From 7d72fa73a886fa16a462b37690b005297571888a Mon Sep 17 00:00:00 2001 From: meiwenbin Date: Wed, 24 Oct 2012 10:21:12 +0800 Subject: [PATCH] Fix the bug about smbios address problems Original code set the address of smbios at 0x800f0000, it is conflict with the PMON text segment. Now we change the address of smbios to 0x8fffe000, it is OK. The bug as "http://www.loongson.org/dev/bugzilla/show_bug.cgi?id=489" described won't appear any more. It pass test on both ls3a780e and ls3aserver board. Targets: Bonito3a780e Bonito3aserver --- pmon/cmds/bootparam.c | 78 +++++++++++++++++++++---------------- pmon/cmds/bootparam.h | 3 +- pmon/common/smbios/smbios.h | 2 +- 3 files changed, 47 insertions(+), 36 deletions(-) diff --git a/pmon/cmds/bootparam.c b/pmon/cmds/bootparam.c index b9289ffd..2c1cb092 100644 --- a/pmon/cmds/bootparam.c +++ b/pmon/cmds/bootparam.c @@ -1,10 +1,10 @@ #include #include #include "bootparam.h" - +#include "../common/smbios/smbios.h" struct loongson_params g_lp = { 0 }; -struct efi_memory_map_loongson g_map = {1, 0x03, 0x11e1a300, {0, 3, 0x800f001f, 0x01, 0}}; +struct efi_memory_map_loongson g_map = { 0 }; struct efi_cpuinfo_loongson g_cpuinfo_loongson = { 0 }; struct system_loongson g_sysitem = { 0 }; struct irq_source_routing_table g_irq_source = { 0 }; @@ -67,9 +67,9 @@ struct efi_memory_map_loongson * init_memory_map() //map->mem_start_addr = 0x80000000; #if (defined(LOONGSON_3BSERVER)) - emap->nr_map = 8; + emap->nr_map = 10; #else - emap->nr_map = 4; + emap->nr_map = 6; #endif emap->mem_freq = 300000000; //300M @@ -95,72 +95,82 @@ struct efi_memory_map_loongson * init_memory_map() #endif emap->map[1].mem_size = atoi(getenv("highmemsize")); +//support smbios + emap->map[2].node_id = 0; + emap->map[2].mem_type = 10; + emap->map[2].mem_start = SMBIOS_PHYSICAL_ADDRESS; + + emap->map[3].node_id = 0; + emap->map[3].mem_type = 3; + emap->map[3].mem_start = SMBIOS_PHYSICAL_ADDRESS & 0x0fffffff; + emap->map[3].mem_size = SMBIOS_SIZE_LIMIT >> 20; + #if (defined(MULTI_CHIP)) || (defined(LOONGSON_3BSINGLE)) - emap->map[3].mem_size = atoi(getenv("memorysize_high_n1")); - if ( emap->map[3].mem_size != 0 ) + emap->map[5].mem_size = atoi(getenv("memorysize_high_n1")); + if ( emap->map[5].mem_size != 0 ) { - emap->map[2].node_id = 1; + emap->map[4].node_id = 1; //strcpy(emap->map[0].mem_name, "node0_low"); - emap->map[2].mem_type = 1; - emap->map[2].mem_start = 0x01000000; - emap->map[2].mem_size = atoi(getenv("memsize")); + emap->map[4].mem_type = 1; + emap->map[4].mem_start = 0x01000000; + emap->map[4].mem_size = atoi(getenv("memsize")); - emap->map[3].node_id = 1; + emap->map[5].node_id = 1; //strcpy(emap->map[1].mem_name, "node0_high"); - emap->map[3].mem_type = 2; - emap->map[3].mem_start = 0x90000000; + emap->map[5].mem_type = 2; + emap->map[5].mem_start = 0x90000000; } #endif #if (defined(LOONGSON_3BSERVER)) - emap->map[3].mem_size = atoi(getenv("memorysize_high_n1")); - if ( emap->map[3].mem_size != 0 ) - { - emap->map[2].node_id = 1; - //strcpy(emap->map[0].mem_name, "node0_low"); - emap->map[2].mem_type = 1; - emap->map[2].mem_start = 0x01000000; - emap->map[2].mem_size = atoi(getenv("memsize")); - - emap->map[3].node_id = 1; - //strcpy(emap->map[1].mem_name, "node0_high"); - emap->map[3].mem_type = 2; - emap->map[3].mem_start = 0x90000000; - } - - emap->map[5].mem_size = atoi(getenv("memorysize_high_n2")); + emap->map[5].mem_size = atoi(getenv("memorysize_high_n1")); if ( emap->map[5].mem_size != 0 ) { - emap->map[4].node_id = 2; + emap->map[4].node_id = 1; //strcpy(emap->map[0].mem_name, "node0_low"); emap->map[4].mem_type = 1; emap->map[4].mem_start = 0x01000000; emap->map[4].mem_size = atoi(getenv("memsize")); - emap->map[5].node_id = 2; + emap->map[5].node_id = 1; //strcpy(emap->map[1].mem_name, "node0_high"); emap->map[5].mem_type = 2; emap->map[5].mem_start = 0x90000000; } - emap->map[7].mem_size = atoi(getenv("memorysize_high_n3")); + emap->map[7].mem_size = atoi(getenv("memorysize_high_n2")); if ( emap->map[7].mem_size != 0 ) { - emap->map[6].node_id = 3; + emap->map[6].node_id = 2; //strcpy(emap->map[0].mem_name, "node0_low"); emap->map[6].mem_type = 1; emap->map[6].mem_start = 0x01000000; emap->map[6].mem_size = atoi(getenv("memsize")); - emap->map[7].node_id = 3; + emap->map[7].node_id = 2; //strcpy(emap->map[1].mem_name, "node0_high"); emap->map[7].mem_type = 2; emap->map[7].mem_start = 0x90000000; } + emap->map[9].mem_size = atoi(getenv("memorysize_high_n3")); + if ( emap->map[9].mem_size != 0 ) + { + emap->map[8].node_id = 3; + //strcpy(emap->map[0].mem_name, "node0_low"); + emap->map[8].mem_type = 1; + emap->map[8].mem_start = 0x01000000; + emap->map[8].mem_size = atoi(getenv("memsize")); + + emap->map[9].node_id = 3; + //strcpy(emap->map[1].mem_name, "node0_high"); + emap->map[9].mem_type = 2; + emap->map[9].mem_start = 0x90000000; + } + #endif #endif diff --git a/pmon/cmds/bootparam.h b/pmon/cmds/bootparam.h index 6ef6a2e4..f2bfbcc1 100644 --- a/pmon/cmds/bootparam.h +++ b/pmon/cmds/bootparam.h @@ -11,7 +11,8 @@ #define VIDEO_ROM 7 #define DAPTER_ROM 8 #define ACPI_TABLE 9 -#define MAX_MEMORY_TYPE 10 +#define SMBIOS_TABLE 10 +#define MAX_MEMORY_TYPE 11 typedef unsigned long long u64; typedef unsigned int u32; diff --git a/pmon/common/smbios/smbios.h b/pmon/common/smbios/smbios.h index c5016f16..0120c59b 100644 --- a/pmon/common/smbios/smbios.h +++ b/pmon/common/smbios/smbios.h @@ -30,7 +30,7 @@ /* These constants must agree with the memory map as the address and the ROMBIOS pulls * the SMBIOS entry point from in the smbios_init subroutine. */ -#define SMBIOS_PHYSICAL_ADDRESS 0x800f0000 +#define SMBIOS_PHYSICAL_ADDRESS 0x8fffe000 #define SMBIOS_SIZE_LIMIT 0x800 extern void loongson_smbios_init(void);