Write 2- and 4-byte aligned values as single writes in ddb(4)

On the mpc85xx SoC family, writes to any part of a word in the CCSR affect the
full word.  This prevents single-byte writes from taking the desired effect.

Code copied directly from ARM.
This commit is contained in:
Justin Hibbits 2015-11-06 04:56:52 +00:00
parent cf1eeb33be
commit fdf068bc5e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290434

View file

@ -67,8 +67,14 @@ db_write_bytes(vm_offset_t addr, size_t size, char *data)
dst = (char *)addr;
cnt = size;
while (cnt-- > 0)
*dst++ = *data++;
if (size == 4 && (addr & 3) == 0 && ((uintptr_t)data & 3) == 0)
*((int*)dst) = *((int*)data);
else
if (size == 2 && (addr & 1) == 0 && ((uintptr_t)data & 1) == 0)
*((short*)dst) = *((short*)data);
else
while (cnt-- > 0)
*dst++ = *data++;
kdb_cpu_sync_icache((void *)addr, size);
}
(void)kdb_jmpbuf(prev_jb);