Changes in boot/arch/ia64/src/main.c [bbe4828:7e752b2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/ia64/src/main.c
rbbe4828 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 35 #include <halt.h> 38 36 #include <printf.h> … … 53 51 #define DEFAULT_SYS_FREQ 100000000ULL /* 100MHz */ 54 52 55 #define MEMMAP_FREE_MEM 0 56 #define MEMMAP_IO 1 57 #define MEMMAP_IO_PORTS 2 58 59 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 60 56 61 57 static bootinfo_t bootinfo; 62 63 static void read_efi_memmap(void)64 {65 memmap_item_t *memmap = bootinfo.memmap;66 size_t items = 0;67 68 if (!bootpar) {69 /* Fake-up a memory map for simulators. */70 memmap[items].base = DEFAULT_MEMORY_BASE;71 memmap[items].size = DEFAULT_MEMORY_SIZE;72 memmap[items].type = MEMMAP_FREE_MEM;73 items++;74 75 memmap[items].base = DEFAULT_LEGACY_IO_BASE;76 memmap[items].size = DEFAULT_LEGACY_IO_SIZE;77 memmap[items].type = MEMMAP_IO_PORTS;78 items++;79 } else {80 char *cur, *mm_base = (char *) bootpar->efi_memmap;81 size_t mm_size = bootpar->efi_memmap_sz;82 size_t md_size = bootpar->efi_memdesc_sz;83 84 /*85 * Walk the EFI memory map using the V1 memory descriptor86 * format. The actual memory descriptor can use newer format,87 * but it must always be backwards compatible with the V188 * format.89 */90 for (cur = mm_base;91 (cur < mm_base + (mm_size - md_size)) &&92 (items < MEMMAP_ITEMS);93 cur += md_size) {94 efi_v1_memdesc_t *md = (efi_v1_memdesc_t *) cur;95 96 switch ((efi_memory_type_t) md->type) {97 case EFI_CONVENTIONAL_MEMORY:98 memmap[items].type = MEMMAP_FREE_MEM;99 break;100 case EFI_MEMORY_MAPPED_IO:101 memmap[items].type = MEMMAP_IO;102 break;103 case EFI_MEMORY_MAPPED_IO_PORT_SPACE:104 memmap[items].type = MEMMAP_IO_PORTS;105 break;106 default:107 continue;108 }109 110 memmap[items].base = md->phys_start;111 memmap[items].size = md->pages * EFI_PAGE_SIZE;112 items++;113 }114 }115 116 bootinfo.memmap_items = items;117 }118 119 static void read_sal_configuration(void)120 {121 if (!bootpar) {122 /* Configure default values for simulators. */123 bootinfo.freq_scale = DEFAULT_FREQ_SCALE;124 bootinfo.sys_freq = DEFAULT_SYS_FREQ;125 } else {126 /* TODO: read the real values from SAL */127 bootinfo.freq_scale = DEFAULT_FREQ_SCALE;128 bootinfo.sys_freq = DEFAULT_SYS_FREQ;129 }130 }131 58 132 59 void bootstrap(void) … … 186 113 187 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++; 188 129 189 read_efi_memmap(); 190 read_sal_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 191 142 192 143 printf("Booting the kernel ...\n");
Note:
See TracChangeset
for help on using the changeset viewer.