Changes in boot/arch/ia64/src/main.c [699f3bc:7e752b2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/ia64/src/main.c
r699f3bc r7e752b2 30 30 31 31 #include <arch/main.h> 32 #include <arch/types.h>33 32 #include <arch/arch.h> 34 33 #include <arch/asm.h> 35 34 #include <arch/_components.h> 36 #include <genarch/efi.h>37 #include <arch/sal.h>38 #include <arch/pal.h>39 35 #include <halt.h> 40 36 #include <printf.h> … … 55 51 #define DEFAULT_SYS_FREQ 100000000ULL /* 100MHz */ 56 52 57 #define MEMMAP_FREE_MEM 0 58 #define MEMMAP_IO 1 59 #define MEMMAP_IO_PORTS 2 60 61 extern boot_param_t *bootpar; 53 #define EFI_MEMMAP_FREE_MEM 0 54 #define EFI_MEMMAP_IO 1 55 #define EFI_MEMMAP_IO_PORTS 2 62 56 63 57 static bootinfo_t bootinfo; 64 65 static void read_efi_memmap(void)66 {67 memmap_item_t *memmap = bootinfo.memmap;68 size_t items = 0;69 70 if (!bootpar) {71 /* Fake-up a memory map for simulators. */72 memmap[items].base = DEFAULT_MEMORY_BASE;73 memmap[items].size = DEFAULT_MEMORY_SIZE;74 memmap[items].type = MEMMAP_FREE_MEM;75 items++;76 77 memmap[items].base = DEFAULT_LEGACY_IO_BASE;78 memmap[items].size = DEFAULT_LEGACY_IO_SIZE;79 memmap[items].type = MEMMAP_IO_PORTS;80 items++;81 } else {82 char *cur, *mm_base = (char *) bootpar->efi_memmap;83 size_t mm_size = bootpar->efi_memmap_sz;84 size_t md_size = bootpar->efi_memdesc_sz;85 86 /*87 * Walk the EFI memory map using the V1 memory descriptor88 * format. The actual memory descriptor can use newer format,89 * but it must always be backwards compatible with the V190 * format.91 */92 for (cur = mm_base;93 (cur < mm_base + (mm_size - md_size)) &&94 (items < MEMMAP_ITEMS);95 cur += md_size) {96 efi_v1_memdesc_t *md = (efi_v1_memdesc_t *) cur;97 98 switch ((efi_memory_type_t) md->type) {99 case EFI_CONVENTIONAL_MEMORY:100 memmap[items].type = MEMMAP_FREE_MEM;101 break;102 case EFI_MEMORY_MAPPED_IO:103 memmap[items].type = MEMMAP_IO;104 break;105 case EFI_MEMORY_MAPPED_IO_PORT_SPACE:106 memmap[items].type = MEMMAP_IO_PORTS;107 break;108 default:109 continue;110 }111 112 memmap[items].base = md->phys_start;113 memmap[items].size = md->pages * EFI_PAGE_SIZE;114 items++;115 }116 }117 118 bootinfo.memmap_items = items;119 }120 121 static void read_pal_configuration(void)122 {123 if (bootpar) {124 bootinfo.freq_scale = pal_proc_freq_ratio();125 } else {126 /* Configure default values for simulators. */127 bootinfo.freq_scale = DEFAULT_FREQ_SCALE;128 }129 }130 131 static void read_sal_configuration(void)132 {133 if (bootpar && bootpar->efi_system_table) {134 efi_guid_t sal_guid = SAL_SYSTEM_TABLE_GUID;135 sal_system_table_header_t *sal_st;136 137 sal_st = efi_vendor_table_find(138 (efi_system_table_t *) bootpar->efi_system_table, sal_guid);139 140 sal_system_table_parse(sal_st);141 142 bootinfo.sys_freq = sal_base_clock_frequency();143 } else {144 /* Configure default values for simulators. */145 bootinfo.sys_freq = DEFAULT_SYS_FREQ;146 }147 }148 58 149 59 void bootstrap(void) … … 203 113 204 114 printf(".\n"); 115 116 if (!bootinfo.hello_configured) { /* XXX */ 117 /* 118 * Load configuration defaults for simulators. 119 */ 120 bootinfo.memmap_items = 0; 121 122 bootinfo.memmap[bootinfo.memmap_items].base = 123 DEFAULT_MEMORY_BASE; 124 bootinfo.memmap[bootinfo.memmap_items].size = 125 DEFAULT_MEMORY_SIZE; 126 bootinfo.memmap[bootinfo.memmap_items].type = 127 EFI_MEMMAP_FREE_MEM; 128 bootinfo.memmap_items++; 205 129 206 read_efi_memmap(); 207 read_sal_configuration(); 208 read_pal_configuration(); 130 bootinfo.memmap[bootinfo.memmap_items].base = 131 DEFAULT_LEGACY_IO_BASE; 132 bootinfo.memmap[bootinfo.memmap_items].size = 133 DEFAULT_LEGACY_IO_SIZE; 134 bootinfo.memmap[bootinfo.memmap_items].type = 135 EFI_MEMMAP_IO_PORTS; 136 bootinfo.memmap_items++; 137 138 bootinfo.freq_scale = DEFAULT_FREQ_SCALE; 139 bootinfo.sys_freq = DEFAULT_SYS_FREQ; 140 } 141 209 142 210 143 printf("Booting the kernel ...\n");
Note:
See TracChangeset
for help on using the changeset viewer.