Subject: bus_space_write_region_4(9) is broken.
To: None <firstname.lastname@example.org>
From: Jochen Kunz <email@example.com>
Date: 01/17/2005 22:57:40
After fixing an other problem on port-prep I had to notice that
(e)siop(4) doesn't work on port-prep when (e)siop(4) uses the on-board
RAM. (hangs, infinite looping DMA errors) Disabling the on-board RAM in
sys/dev/pci/siop_pci_common.c cures the symptom. Finaly I found some
time to debug this tonight and came to the conclusion that
bus_space_write_region_4(9) is broken. When bus_space_write_region_4(9)
is implemented with a for-loop around bus_space_write_4(9) everything
works as expected.
As port-prep uses the generic powerpc bus_space(9) functions this will
affect all powerpc ports that share this code in -current as well as the
It is easy to see using ddb(4) to hexdump the two memory regions in
question: (e)siop(4) uses bus_space_write_region_4(9) to copy const
u_int32_t esiop_script from src/sys/dev/microcode/siop/esiop.out to
PCI memory. When bus_space_write_region_4(9) is implemented with a
for-loop around bus_space_write_4(9) everything works as expected.
esiop_script is copied with reverse endianes to the PCI memory region.
When bus_space_write_region_4(9) is used the PCI memory region contains
garbage / null bytes.
bus_space_write_region_4(9) is implemented by the assembly function
bswr4rb() in src/sys/arch/powerpc/pio_subr.S Unfortunately I am not
experienced in PPC assembly. So maybe someone who is fluent in PPC
assembly can fix this? This will save me from diging deep into details
I don't want to learn tonight. Thanks. ;-)