On 21.05.2010, at 10:00, Mark Cave-Ayland wrote:
Andreas Färber wrote:
I've dug some more and noticed that the data parsed from /chosen/mmu/translations seems wrong: 0: map: 0x00000000, length 16384 -> physical: 0x00000000, mode 132972544 1: map: 0x00030000, length 0 -> physical: 0x07f00000, mode 1048576 2: map: 0x00000002, length -2147483648 -> physical: 0x000eb000, mode 106 Note the weird mode and subsequent values. It looks as if Haiku expects (and gets on real OpenFirmware): void *virtual_address int length void *physical_address int mode whereas OpenBIOS writes in libopenbios/ofmem_common.c:ofmem_update_mmu_translations: props[ncells++] = t->virt props[ncells++] = t->size props[ncells++] = t->mode Should this be changed as follows, or is this platform-dependent?
Hmmm that's interesting. According to the OpenSolaris kernel source the translations property is mapped to the following struct:
http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/sun4v/sys/...
struct translation { uint32_t virt_hi; /* upper 32 bits of vaddr */ uint32_t virt_lo; /* lower 32 bits of vaddr */ uint32_t size_hi; /* upper 32 bits of size in bytes */ uint32_t size_lo; /* lower 32 bits of size in bytes */ uint32_t tte_hi; /* higher 32 bites of tte */ uint32_t tte_lo; /* lower 32 bits of tte */ };
And in Haiku:
http://dev.haiku-os.org/browser/haiku/trunk/src/system/boot/platform/openfir...
struct translation_map { void *virtual_address; int length; void *physical_address; int mode; } translations[64];
So in short, it does indeed look as if there are some platform differences here. I guess this extra field is based upon the Mac OF implementation so it would be good for someone to verify this on a real Mac before we go and hack the source for PPC-only hosts. Note that I can't see any references to the translations property in the OF spec so I guess it must be an extension.
Let's see - I went through several machines and tried to find that node. Since they're all inside of Linux, I couldn't easily resolve /chosen/mmu, which btw didn't always exist either.
PowerMac G5:
agraf@mac:/proc/device-tree> find . -name translations ./cpus/PowerPC,970@0/translations agraf@mac:/proc/device-tree> od -t x4 ./cpus/PowerPC,970@0/translations 0000000 00000000 00003000 00000000 00000000 0000020 00000010 00040000 0002d000 00000000 0000040 00040000 00000002 00400000 00700000 0000060 00000000 00400000 00000010 00b00000 0000100 00180000 00000000 00b00000 00000010 0000120 00d00000 00e00000 00000000 00d00000 0000140 00000010 01b00000 00625000 00000000 0000160 01b00000 00000010 02130000 00100000 0000200 00000000 02130000 00000010 1fbfc000 0000220 00004000 00000000 1fbfc000 00000010 0000240 80000000 00080000 00000000 80000000 0000260 00000028 80080000 00001000 00000000 0000300 80080000 00000028 80081000 00001000 0000320 00000000 80081000 00000028 80101000 0000340 00001000 00000000 80101000 00000028 0000360 80102000 00001000 00000000 80102000 0000400 00000028 80200000 00001000 00000000 0000420 80200000 00000028 80400000 00200000 0000440 00000000 80400000 00000028 80600000 0000460 00002000 00000000 80600000 00000028 0000500 90000000 00020000 00000000 90000000 0000520 00000028 91000000 01000000 00000000 0000540 91000000 00000028 98000000 08000000 0000560 00000000 98000000 00000028 f0000000 0000600 00010000 00000000 f0000000 00000028 0000620 f0800000 00001000 00000000 f0800000 0000640 00000028 f0c00000 00001000 00000000 0000660 f0c00000 00000028 f2000000 02800000 0000700 00000000 f2000000 00000028 f4000000 0000720 00400000 00000000 f4000000 00000028 0000740 f8000000 01000000 00000000 f8000000 0000760 00000028 f8070000 00001000 00000000 0001000 f8070000 00000028 ff800000 00400000 0001020 00000000 1fc00000 00000010 fff04000 0001040 00002000 00000000 fff04000 00000028 0001060 fff06000 00002000 00000000 fff06000 0001100 00000028
YDL PowerStation (970MP)
agraf@lychee:/proc/device-tree> find . -name translations ./mmu/translations agraf@lychee:/proc/device-tree> od -t x4 mmu/translations 0000000
IBM POWER5 System
agraf@cherry:/proc/device-tree> find . -name translations ./cpus/PowerPC,POWER5@0/translations agraf@cherry:/proc/device-tree> od -t x4 ./cpus/PowerPC,POWER5@0/translations 0000000
Apparently all our PPC32 machines are offline, so I can't easily check things there. If you like, I can boot up my iBook and see what I can find.
Alex