Changeset 7dcde32 in mainline


Ignore:
Timestamp:
2006-03-24T18:29:04Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c6143b4
Parents:
f941347
Message:

extend boot info

Location:
arch/ppc32/loader
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • arch/ppc32/loader/main.c

    rf941347 r7dcde32  
    3737#define HEAP_GAP 1024000
    3838
    39 memmap_t memmap;
     39typedef struct {
     40        memmap_t memmap;
     41        screen_t screen;
     42} bootinfo_t;
     43
     44bootinfo_t bootinfo;
    4045
    4146
     
    8388        check_align(&trans, "Translation table");
    8489       
    85         if (!ofw_memmap(&memmap)) {
     90        if (!ofw_memmap(&bootinfo.memmap)) {
    8691                printf("Error: Unable to get memory map\n");
    8792                halt();
    8893        }
    8994       
     95        if (!ofw_screen(&bootinfo.screen)) {
     96                printf("Error: Unable to get screen properties\n");
     97                halt();
     98        }
     99       
     100        printf("\nDevice statistics\n");
     101        printf(" screen at %L, resolution %dx%d, %d bpp (scanline %d bytes)\n", bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline);
     102       
    90103        void *real_mode_pa = ofw_translate(&real_mode);
    91104        void *trans_pa = ofw_translate(&trans);
    92         void *memmap_pa = ofw_translate(&memmap);
     105        void *bootinfo_pa = ofw_translate(&bootinfo);
    93106       
    94         printf("Memory statistics (total %d MB)\n", memmap.total >> 20);
     107        printf("\nMemory statistics (total %d MB)\n", bootinfo.memmap.total >> 20);
    95108        printf(" kernel image         at %L (size %d bytes)\n", KERNEL_START, KERNEL_SIZE);
    96         printf(" memory map           at %L (physical %L)\n", &memmap, memmap_pa);
     109        printf(" boot info            at %L (physical %L)\n", &bootinfo, bootinfo_pa);
    97110        printf(" bootstrap trampoline at %L (physical %L)\n", &real_mode, real_mode_pa);
    98111        printf(" translation table    at %L (physical %L)\n", &trans, trans_pa);
     
    108121        fix_overlap(&real_mode, &real_mode_pa, "Bootstrap trampoline", &top);
    109122        fix_overlap(&trans, &trans_pa, "Translation table", &top);
    110         fix_overlap(&memmap, &memmap_pa, "Memory map", &top);
     123        fix_overlap(&bootinfo, &bootinfo_pa, "Boot info", &top);
    111124       
    112         printf("Booting the kernel...\n");
    113         jump_to_kernel(memmap_pa, trans_pa, KERNEL_SIZE, real_mode_pa);
     125        printf("\nBooting the kernel...\n");
     126        jump_to_kernel(bootinfo_pa, trans_pa, KERNEL_SIZE, real_mode_pa);
    114127}
  • arch/ppc32/loader/ofw.c

    rf941347 r7dcde32  
    3232
    3333#define MAX_OFW_ARGS    10
     34#define STRING_SIZE             1024
    3435
    3536typedef unsigned int ofw_arg_t;
     
    5354
    5455phandle ofw_chosen;
     56phandle ofw_aliases;
    5557ihandle ofw_mmu;
    5658ihandle ofw_stdout;
     
    107109                ofw_stdout = 0;
    108110       
     111        ofw_aliases = ofw_find_device("/aliases");
     112        if (ofw_aliases == -1) {
     113                puts("\nUnable to find /aliases device\n");
     114                halt();
     115        }
     116       
    109117        ofw_mmu = ofw_open("/mmu");
    110118        if (ofw_mmu == -1) {
    111                 puts("Unable to open /mmu node\n");
     119                puts("\nUnable to open /mmu node\n");
    112120                halt();
    113121        }
     
    158166        }
    159167}
     168
     169
     170int ofw_screen(screen_t *screen)
     171{
     172        char device_name[STRING_SIZE];
     173       
     174        if (ofw_get_property(ofw_aliases, "screen", device_name, STRING_SIZE) <= 0)
     175                return false;
     176       
     177        phandle device = ofw_find_device(device_name);
     178        if (device == -1)
     179                return false;
     180       
     181        if (ofw_get_property(device, "address", &screen->addr, sizeof(screen->addr)) <= 0)
     182                return false;
     183       
     184        if (ofw_get_property(device, "width", &screen->width, sizeof(screen->width)) <= 0)
     185                return false;
     186       
     187        if (ofw_get_property(device, "height", &screen->height, sizeof(screen->height)) <= 0)
     188                return false;
     189       
     190        if (ofw_get_property(device, "depth", &screen->bpp, sizeof(screen->bpp)) <= 0)
     191                return false;
     192       
     193        if (ofw_get_property(device, "linebytes", &screen->scanline, sizeof(screen->scanline)) <= 0)
     194                return false;
     195       
     196        return true;
     197}
  • arch/ppc32/loader/ofw.h

    rf941347 r7dcde32  
    5252} memmap_t;
    5353
     54typedef struct {
     55        unsigned int addr;
     56        unsigned int width;
     57        unsigned int height;
     58        unsigned int bpp;
     59        unsigned int scanline;
     60} screen_t;
     61
    5462
    5563extern void init(void);
     
    5967extern int ofw_map(const void *phys, const void *virt, const int size, const int mode);
    6068extern int ofw_memmap(memmap_t *map);
     69extern int ofw_screen(screen_t *screen);
    6170
    6271#endif
Note: See TracChangeset for help on using the changeset viewer.