This ensures that the physical and virtual addresses for OpenBIOS itself are marked as in use, and also appear in the translations property so they can be maintained by client programs.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/arch/sparc32/ofmem_sparc32.c | 6 ++++-- openbios-devel/include/arch/sparc32/ofmem_sparc32.h | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/openbios-devel/arch/sparc32/ofmem_sparc32.c b/openbios-devel/arch/sparc32/ofmem_sparc32.c index e2f4159..a6557df 100644 --- a/openbios-devel/arch/sparc32/ofmem_sparc32.c +++ b/openbios-devel/arch/sparc32/ofmem_sparc32.c @@ -241,6 +241,8 @@ void ofmem_init( void ) /* Claim reserved physical addresses at top of RAM */ ofmem_claim_phys(ofmem_arch_get_phys_top(), s_ofmem_data.ofmem.ramsize - ofmem_arch_get_phys_top(), 0); - /* Claim OpenBIOS reserved space */ - ofmem_claim_virt(0xffd00000, 0x300000, 0); + /* Map OpenBIOS ROM in RAM copy */ + ofmem_claim_phys(va2pa(OF_CODE_START), s_ofmem_data.ofmem.ramsize - va2pa(OF_CODE_START), 0); + ofmem_claim_virt(OF_CODE_START, (ucell)-1, 0); + ofmem_map_page_range(va2pa(OF_CODE_START), OF_CODE_START, s_ofmem_data.ofmem.ramsize - va2pa(OF_CODE_START), ofmem_arch_default_translation_mode(OF_CODE_START)); } diff --git a/openbios-devel/include/arch/sparc32/ofmem_sparc32.h b/openbios-devel/include/arch/sparc32/ofmem_sparc32.h index 7a35b44..6ffa172 100644 --- a/openbios-devel/include/arch/sparc32/ofmem_sparc32.h +++ b/openbios-devel/include/arch/sparc32/ofmem_sparc32.h @@ -16,6 +16,8 @@
#include "libopenbios/ofmem.h"
+#define OF_CODE_START 0xffd00000 + struct mem; extern struct mem cdvmem;
@@ -25,4 +27,4 @@ extern unsigned long find_pte(unsigned long va, int alloc); void mem_init(struct mem *t, char *begin, char *limit); void *mem_alloc(struct mem *t, int size, int align);
-#endif /* _H_OFMEM_SPARC32 */ \ No newline at end of file +#endif /* _H_OFMEM_SPARC32 */
In preparation for changing the virtual memory allocator range so it is lower in memory, keep the Forth dictionary in high memory. Even with the previous commit now correctly setting the memory properties, Linux seems to crash on boot if we don't maintain the Forth dictionary location in high memory.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/arch/sparc32/openbios.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/openbios-devel/arch/sparc32/openbios.c b/openbios-devel/arch/sparc32/openbios.c index 53c6760..ce1a1cc 100644 --- a/openbios-devel/arch/sparc32/openbios.c +++ b/openbios-devel/arch/sparc32/openbios.c @@ -25,7 +25,7 @@ #include "packages/video.h" #define NO_QEMU_PROTOS #include "arch/common/fw_cfg.h" -#include "libopenbios/ofmem.h" +#include "arch/sparc32/ofmem_sparc32.h"
#define MEMORY_SIZE (512*1024) /* 512K ram for hosted system */ #define UUID_FMT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" @@ -812,8 +812,8 @@ static void init_memory(void) phys = ofmem_claim_phys(-1, MEMORY_SIZE, PAGE_SIZE); if (!phys) printk("panic: not enough physical memory on host system.\n"); - - virt = ofmem_claim_virt(-1, MEMORY_SIZE, PAGE_SIZE); + + virt = ofmem_claim_virt(OF_CODE_START - MEMORY_SIZE, MEMORY_SIZE, 0); if (!virt) printk("panic: not enough virtual memory on host system.\n");
As reported by Artyom Tarasenko, kadb on some versions of Solaris seems to assume that it can freely make use of memory below the ROM image.
Hence move the dynamic virtual memory allocation range lower in memory (beneath the ROM image and DVMA area) so that kadb can run.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/arch/sparc32/ofmem_sparc32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/openbios-devel/arch/sparc32/ofmem_sparc32.c b/openbios-devel/arch/sparc32/ofmem_sparc32.c index a6557df..8a81829 100644 --- a/openbios-devel/arch/sparc32/ofmem_sparc32.c +++ b/openbios-devel/arch/sparc32/ofmem_sparc32.c @@ -61,7 +61,8 @@ ucell ofmem_arch_get_heap_top(void)
ucell ofmem_arch_get_virt_top(void) { - return (ucell)TOP_OF_RAM; + /* Return the highest address beneath the ROM image and DVMA area */ + return (ucell)0xfe000000; }
phys_addr_t ofmem_arch_get_phys_top(void)