From: Igor V. Kovalenko igor.v.kovalenko@gmail.com
At the moment qemu maps i/o and pci memory spaces into low physical addresses, making first megabytes of RAM space unavalable.
Instead of changing qemu we map first 64M of physical address space at 0x1ff.00000000 and map low virtual addresses after that hole. i/o space is accessed via bypass ASI therefore no changes to drivers using i/o are required.
Issue with framebuffer mapping is solved by separate patch to find where framebuffer got mapped by startup code.
- map low 64M of physical address space at 0x1ff00000000 by startup code
- map low 64M of virtual address space after 64M of physical address space by startup code
Signed-off-by: Igor V. Kovalenko igor.v.kovalenko@gmail.com --- arch/sparc64/entry.S | 68 +++++++++++++++++++++++--------------------------- 1 files changed, 31 insertions(+), 37 deletions(-)
diff --git a/arch/sparc64/entry.S b/arch/sparc64/entry.S index d3075d8..c865a5d 100644 --- a/arch/sparc64/entry.S +++ b/arch/sparc64/entry.S @@ -18,6 +18,11 @@ #define PROM_ADDR 0x1fff0000000 #define CFG_ADDR 0x1fe02000510
+! where do we remap low 64M as a workaround +#define REMAP_VADDR 0x1ff00000000 +! where usable RAM starts after 64M hole +#define REMAP_PADDR 0x4000000 + .globl entry, _entry
.section ".text", "ax" @@ -180,39 +185,47 @@ entry: bne 1b add %l2, %g5, %l2
- ! setup VGA buffer - setx 0x1ff004a0000, %g7, %g4 - mov 2, %g6 + ! remap low 64m including VGA buffer to high memory + setx 0, %l1, %l3 ! physical address + setx REMAP_VADDR, %l1, %l4 ! virtual address + + ! 16x4M mapped + mov 16, %g6 set 48, %g7 - set 0x10000, %g5 -1: stxa %g4, [%g7] ASI_DMMU ! vaddr = 0x1ff004a0000, ctx=0 - set 0xa0000000, %g3 + set 0x400000, %g5 +1: mov %l4, %g4 + stxa %g4, [%g7] ASI_DMMU ! vaddr = 0x1ff00000000, ctx=0 + set 0xe0000000, %g3 sllx %g3, 32, %g3 - or %g3, 0x76, %g3 + or %g3, 0x76, %g3 ! valid, 4M, locked, cacheable(I/E/C), priv, writable + mov %l3, %g4 or %g4, %g3, %g3 - ! valid, 64k, locked, cacheable(I/E/C), priv, writable - ! paddr = 0x1ff004a0000 stxa %g3, [%g0] ASI_DTLB_DATA_IN - add %g4, %g5, %g4 + add %l3, %g5, %l3 + add %l4, %g5, %l4 deccc %g6 bne 1b nop
#if 1 - ! setup 0-16M - mov %g0, %g4 - mov 4, %g6 + ! setup 0-64M of virtual space after 64M of physical space + setx REMAP_PADDR, %l1, %l3 ! physical address + setx 0, %l1, %l4 ! virtual address + + ! 16x4M mapped + mov 16, %g6 set 48, %g7 set 0x400000, %g5 -1: stxa %g4, [%g7] ASI_DMMU ! vaddr = 0, ctx=0 +1: mov %l4, %g4 + stxa %g4, [%g7] ASI_DMMU ! vaddr = 0x1ff00000000, ctx=0 set 0xe0000000, %g3 sllx %g3, 32, %g3 - or %g3, 0x36, %g3 + or %g3, 0x36, %g3 ! valid, 4M, cacheable(I/E/C), priv, writable + mov %l3, %g4 or %g4, %g3, %g3 - ! valid, 4M, cacheable(I/E/C), priv, writable - ! paddr = 0 stxa %g3, [%g0] ASI_DTLB_DATA_IN - add %g4, %g5, %g4 + add %l3, %g5, %l3 + add %l4, %g5, %l4 deccc %g6 bne 1b nop @@ -242,25 +255,6 @@ entry: bne 1b add %l2, %g5, %l2
-#if 1 - ! setup 0-16M - mov %g0, %g4 - mov 4, %g6 - set 0x400000, %g5 -1: stxa %g4, [%g7] ASI_IMMU ! vaddr = 0, ctx=0 - set 0xe0000000, %g3 - sllx %g3, 32, %g3 - or %g3, 0x34, %g3 - or %g4, %g3, %g3 - ! valid, 4M, cacheable(I/E/C), priv - ! paddr = 0 - stxa %g3, [%g0] ASI_ITLB_DATA_IN - add %g4, %g5, %g4 - deccc %g6 - bne 1b - nop -#endif - flush %g4
mov %g1, %g3