Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/ia64/src/main.c

    rbbe4828 r7e752b2  
    3030
    3131#include <arch/main.h>
    32 #include <arch/types.h>
    3332#include <arch/arch.h>
    3433#include <arch/asm.h>
    3534#include <arch/_components.h>
    36 #include <genarch/efi.h>
    3735#include <halt.h>
    3836#include <printf.h>
     
    5351#define DEFAULT_SYS_FREQ                100000000ULL            /* 100MHz */
    5452
    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
    6056
    6157static 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 descriptor
    86                  * format. The actual memory descriptor can use newer format,
    87                  * but it must always be backwards compatible with the V1
    88                  * 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 }
    13158
    13259void bootstrap(void)
     
    186113       
    187114        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++;
    188129
    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       
    191142       
    192143        printf("Booting the kernel ...\n");
Note: See TracChangeset for help on using the changeset viewer.