Author: mcayland Date: Tue Feb 8 23:06:54 2011 New Revision: 1022 URL: http://tracker.coreboot.org/trac/openbios/changeset/1022
Log: Fix up /virtual-memory reg property on SPARC32.
Make it similar to the OBP output with 2 entries consisting of half the virtual address space.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@siriusit.co.uk
Modified: trunk/openbios-devel/arch/sparc32/lib.c trunk/openbios-devel/drivers/iommu.c
Modified: trunk/openbios-devel/arch/sparc32/lib.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/lib.c Tue Feb 8 23:06:51 2011 (r1021) +++ trunk/openbios-devel/arch/sparc32/lib.c Tue Feb 8 23:06:54 2011 (r1022) @@ -373,7 +373,10 @@ void ob_init_mmu(void) { - ucell *reg; + ucell *memreg; + ucell *virtreg; + phys_addr_t virtregsize; + ofmem_t *ofmem = ofmem_arch_get_private();
init_romvec_mem();
@@ -391,18 +394,35 @@ ofmem_register(s_phandle_memory, s_phandle_mmu);
/* Setup /memory:reg (totphys) property */ - reg = malloc(3 * sizeof(ucell)); - ofmem_arch_encode_physaddr(reg, 0); /* physical base */ - reg[2] = (ucell)ofmem_arch_get_phys_top(); /* size */ + memreg = malloc(3 * sizeof(ucell)); + ofmem_arch_encode_physaddr(memreg, 0); /* physical base */ + memreg[2] = (ucell)ofmem->ramsize; /* size */
push_str("/memory"); fword("find-device"); - PUSH(pointer2cell(reg)); + PUSH(pointer2cell(memreg)); PUSH(3 * sizeof(ucell)); push_str("reg"); PUSH_ph(s_phandle_memory); fword("encode-property");
+ /* Setup /virtual-memory:reg property */ + virtregsize = ((phys_addr_t)((ucell)-1) + 1) / 2; + + virtreg = malloc(6 * sizeof(ucell)); + ofmem_arch_encode_physaddr(virtreg, 0); + virtreg[2] = virtregsize; + ofmem_arch_encode_physaddr(&virtreg[3], virtregsize); + virtreg[5] = virtregsize; + + push_str("/virtual-memory"); + fword("find-device"); + PUSH(pointer2cell(virtreg)); + PUSH(6 * sizeof(ucell)); + push_str("reg"); + PUSH_ph(s_phandle_mmu); + fword("encode-property"); + PUSH(0); fword("active-package!"); bind_func("pgmap@", pgmap_fetch);
Modified: trunk/openbios-devel/drivers/iommu.c ============================================================================== --- trunk/openbios-devel/drivers/iommu.c Tue Feb 8 23:06:51 2011 (r1021) +++ trunk/openbios-devel/drivers/iommu.c Tue Feb 8 23:06:54 2011 (r1022) @@ -155,20 +155,6 @@
regs = iommu_init(&ciommu, base);
- push_str("/virtual-memory"); - fword("find-device"); - - PUSH(base >> 32); - fword("encode-int"); - PUSH(base & 0xffffffff); - fword("encode-int"); - fword("encode+"); - PUSH(IOMMU_REGS); - fword("encode-int"); - fword("encode+"); - push_str("reg"); - fword("property"); - push_str("/iommu"); fword("find-device"); PUSH((unsigned long)regs);