Changeset e731b0d in mainline for boot/arch/ppc32


Ignore:
Timestamp:
2009-08-20T16:58:55Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b9c7425
Parents:
a11099f
Message:

make ppc32 OFW usage on par with sparc64, make appropriate modifications elsewhere

  • introduce ofw_tree_walk_by_device_type() to gather all OFW devices of a given type
  • ppc32 uses canonized OFW tree, mac-io and display devices are detected in kernel (not by the boot loader) by means of device type
  • various busses (PCI, EBUS, etc.) stay sparc64 specific for now
  • boot memcpy() is defined in a common way
  • BALLOC_MAX_SIZE is platform-dependent
  • ppc32 and sparc64 boot loaders cleanup (removal of obsolete stuff, data is not passed by global variables if not necessary, etc.)
  • balloc and OFW tree canonizer have now a provision to support different mapping of the data during boot time and kernel run-time
  • OFW tree canonizer uses balloc_rebase() to store pointers suitable for access during kernel run-time (with potentially different memory mapping than during boot time)
Location:
boot/arch/ppc32/loader
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/ppc32/loader/Makefile

    ra11099f re731b0d  
    6262SOURCES = \
    6363        main.c \
    64         ofwarch.c \
    6564        _components.c \
    66         ../../../genarch/ofw.c \
    6765        ../../../generic/printf.c \
    6866        ../../../generic/string.c \
     67        ../../../genarch/balloc.c \
     68        ../../../genarch/ofw.c \
     69        ../../../genarch/ofw_tree.c \
     70        ofwarch.c \
    6971        asm.S \
    7072        boot.S
     
    7375        $(KERNELDIR)/kernel.bin \
    7476        $(USPACEDIR)/srv/ns/ns \
     77        $(USPACEDIR)/app/init/init \
    7578        $(USPACEDIR)/srv/loader/loader \
    76         $(USPACEDIR)/app/init/init \
    7779        $(USPACEDIR)/srv/devmap/devmap \
    7880        $(USPACEDIR)/srv/bd/rd/rd \
     
    99101        $(USPACEDIR)/app/tester/tester \
    100102        $(USPACEDIR)/app/trace/trace \
    101         $(USPACEDIR)/app/klog/klog \
    102         $(USPACEDIR)/app/bdsh/bdsh
     103        $(USPACEDIR)/app/bdsh/bdsh \
     104        $(USPACEDIR)/app/klog/klog
    103105
    104106OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
  • boot/arch/ppc32/loader/_link.ld.in

    ra11099f re731b0d  
    1919[[COMPONENTS]]
    2020        }
     21       
     22        /DISCARD/ : {
     23                *(.comment);
     24                *(.note*);
     25        }
    2126}
  • boot/arch/ppc32/loader/asm.S

    ra11099f re731b0d  
    2929#include "asm.h"
    3030#include "regname.h"
     31#include "ofwarch.h"
    3132
    3233.macro SMC_COHERENCY addr
     
    4546
    4647.macro TLB_FLUSH reg
    47         tlbie \reg
    48         addi \reg, \reg, 0x1000
     48        li \reg, 0
     49        sync
     50       
     51        .rept 64
     52                tlbie \reg
     53                addi \reg, \reg, 0x1000
     54        .endr
     55       
     56        eieio
     57        tlbsync
     58        sync
    4959.endm
    5060
     
    5464.global memcpy
    5565.global jump_to_kernel
     66.global balloc_base
    5667
    5768halt:
     
    6273        addi r6, r3, -4
    6374        addi r4, r4, -4
    64         beq     2f
     75        beq 2f
    6576       
    6677        andi. r0, r6, 3
     
    6980       
    7081        1:
    71        
    72         lwz r7, 4(r4)
    73         lwzu r8, 8(r4)
    74         stw r7, 4(r6)
    75         stwu r8, 8(r6)
    76         bdnz 1b
    77        
    78         andi. r5, r5, 7
     82                lwz r7, 4(r4)
     83                lwzu r8, 8(r4)
     84                stw r7, 4(r6)
     85                stwu r8, 8(r6)
     86                bdnz 1b
     87               
     88                andi. r5, r5, 7
    7989       
    8090        2:
    81        
    82         cmplwi 0, r5, 4
    83         blt 3f
    84        
    85         lwzu r0, 4(r4)
    86         addi r5, r5, -4
    87         stwu r0, 4(r6)
     91                cmplwi 0, r5, 4
     92                blt 3f
     93               
     94                lwzu r0, 4(r4)
     95                addi r5, r5, -4
     96                stwu r0, 4(r6)
    8897       
    8998        3:
    90        
    91         cmpwi 0, r5, 0
    92         beqlr
    93         mtctr r5
    94         addi r4, r4, 3
    95         addi r6, r6, 3
     99                cmpwi 0, r5, 0
     100                beqlr
     101                mtctr r5
     102                addi r4, r4, 3
     103                addi r6, r6, 3
    96104       
    97105        4:
    98        
    99         lbzu r0, 1(r4)
    100         stbu r0, 1(r6)
    101         bdnz 4b
    102         blr
     106                lbzu r0, 1(r4)
     107                stbu r0, 1(r6)
     108                bdnz 4b
     109                blr
    103110       
    104111        5:
    105        
    106         subfic r0, r0, 4
    107         mtctr r0
     112                subfic r0, r0, 4
     113                mtctr r0
    108114       
    109115        6:
    110        
    111         lbz r7, 4(r4)
    112         addi r4, r4, 1
    113         stb r7, 4(r6)
    114         addi r6, r6, 1
    115         bdnz 6b
    116         subf r5, r0, r5
    117         rlwinm. r7, r5, 32-3, 3, 31
    118         beq 2b
    119         mtctr r7
    120         b 1b
    121 
     116                lbz r7, 4(r4)
     117                addi r4, r4, 1
     118                stb r7, 4(r6)
     119                addi r6, r6, 1
     120                bdnz 6b
     121                subf r5, r0, r5
     122                rlwinm. r7, r5, 32-3, 3, 31
     123                beq 2b
     124                mtctr r7
     125                b 1b
    122126
    123127jump_to_kernel:
     
    128132        # r6 = bytes to copy
    129133        # r7 = real_mode (pa)
    130         # r8 = framebuffer (pa)
    131         # r9 = scanline
    132134       
    133135        # disable interrupts
     
    153155        rfi
    154156
     157.align PAGE_WIDTH
     158balloc_base:
     159        .fill BALLOC_MAX_SIZE
     160
    155161.section REALMODE, "ax"
     162
    156163.align PAGE_WIDTH
    157164.global real_mode
    158 
    159165real_mode:
    160166       
    161167        # copy kernel to proper location
    162168        #
     169        # r3 = bootinfo (pa)
     170        # r4 = bootinfo_size
    163171        # r5 = trans (pa)
    164172        # r6 = bytes to copy
    165         # r8 = framebuffer (pa)
    166         # r9 = scanline
    167173       
    168174        li r31, PAGE_SIZE >> 2
     
    343349        # flush TLB
    344350       
    345         li r31, 0
    346         sync
    347        
    348351        TLB_FLUSH r31
    349         TLB_FLUSH r31
    350         TLB_FLUSH r31
    351         TLB_FLUSH r31
    352         TLB_FLUSH r31
    353         TLB_FLUSH r31
    354         TLB_FLUSH r31
    355         TLB_FLUSH r31
    356        
    357         TLB_FLUSH r31
    358         TLB_FLUSH r31
    359         TLB_FLUSH r31
    360         TLB_FLUSH r31
    361         TLB_FLUSH r31
    362         TLB_FLUSH r31
    363         TLB_FLUSH r31
    364         TLB_FLUSH r31
    365        
    366         TLB_FLUSH r31
    367         TLB_FLUSH r31
    368         TLB_FLUSH r31
    369         TLB_FLUSH r31
    370         TLB_FLUSH r31
    371         TLB_FLUSH r31
    372         TLB_FLUSH r31
    373         TLB_FLUSH r31
    374        
    375         TLB_FLUSH r31
    376         TLB_FLUSH r31
    377         TLB_FLUSH r31
    378         TLB_FLUSH r31
    379         TLB_FLUSH r31
    380         TLB_FLUSH r31
    381         TLB_FLUSH r31
    382         TLB_FLUSH r31
    383        
    384         TLB_FLUSH r31
    385         TLB_FLUSH r31
    386         TLB_FLUSH r31
    387         TLB_FLUSH r31
    388         TLB_FLUSH r31
    389         TLB_FLUSH r31
    390         TLB_FLUSH r31
    391         TLB_FLUSH r31
    392        
    393         TLB_FLUSH r31
    394         TLB_FLUSH r31
    395         TLB_FLUSH r31
    396         TLB_FLUSH r31
    397         TLB_FLUSH r31
    398         TLB_FLUSH r31
    399         TLB_FLUSH r31
    400         TLB_FLUSH r31
    401        
    402         TLB_FLUSH r31
    403         TLB_FLUSH r31
    404         TLB_FLUSH r31
    405         TLB_FLUSH r31
    406         TLB_FLUSH r31
    407         TLB_FLUSH r31
    408         TLB_FLUSH r31
    409         TLB_FLUSH r31
    410        
    411         TLB_FLUSH r31
    412         TLB_FLUSH r31
    413         TLB_FLUSH r31
    414         TLB_FLUSH r31
    415         TLB_FLUSH r31
    416         TLB_FLUSH r31
    417         TLB_FLUSH r31
    418         TLB_FLUSH r31
    419        
    420         eieio
    421         tlbsync
    422         sync
    423352       
    424353        # start the kernel
    425354        #
    426         # pc = KERNEL_START_ADDR
     355        # pc = PA2KA(BOOT_OFFSET)
    427356        # r3 = bootinfo (pa)
    428         # sprg0 = KA2PA(KERNEL_START_ADDR)
     357        # sprg0 = BOOT_OFFSET
    429358        # sprg3 = physical memory size
    430359        # sp = 0 (pa)
    431360       
    432         lis r31, KERNEL_START_ADDR@ha
    433         addi r31, r31, KERNEL_START_ADDR@l
    434        
     361        lis r31, PA2KA(BOOT_OFFSET)@ha
     362        addi r31, r31, PA2KA(BOOT_OFFSET)@l
    435363        mtspr srr0, r31
    436364       
    437         subis r31, r31, 0x8000
     365        lis r31, BOOT_OFFSET@ha
     366        addi r31, r31, BOOT_OFFSET@l
    438367        mtsprg0 r31
    439368       
     
    454383.global trans
    455384trans:
    456         .space (TRANS_SIZE * TRANS_ITEM_SIZE)
     385        .rept TRANS_SIZE
     386        .int 0
     387        .endr
  • boot/arch/ppc32/loader/asm.h

    ra11099f re731b0d  
    3030#define BOOT_ppc32_ASM_H_
    3131
    32 #define PAGE_SIZE 4096
    33 #define PAGE_WIDTH 12
     32#define PAGE_WIDTH  12
     33#define PAGE_SIZE   (1 << PAGE_WIDTH)
    3434
    35 #define TRANS_SIZE 1024
    36 #define TRANS_ITEM_SIZE 4
     35#define TRANS_SIZE   1024
     36#define BOOT_OFFSET  0x8000
    3737
    38 #define KERNEL_START_ADDR 0x80008000
     38#define BALLOC_MAX_SIZE  (128 * 1024)
    3939
    4040#ifndef __ASM__
    4141
    42 #define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
     42#include "types.h"
     43#include "main.h"
     44#include "ofwarch.h"
    4345
    44 extern void *trans[TRANS_SIZE];
     46#define PA2KA(x)  (((uintptr_t) (x)) + 0x80000000)
     47
     48extern uint8_t balloc_base[BALLOC_MAX_SIZE];
     49extern uintptr_t trans[TRANS_SIZE];
    4550
    4651extern void halt();
    47 extern void jump_to_kernel(void *bootinfo, unsigned int bootinfo_size, void *trans, unsigned int kernel_size, void *real_mode, void *fb, unsigned int scanline) __attribute__((noreturn));
     52extern void jump_to_kernel(void *bootinfo, unsigned int bootinfo_size,
     53    uintptr_t trans[], unsigned int kernel_size, void *real_mode) __attribute__((noreturn));
    4854extern void real_mode();
     55
     56#else
     57
     58#define PA2KA(x)  ((x) + 0x80000000)
    4959
    5060#endif
  • boot/arch/ppc32/loader/main.c

    ra11099f re731b0d  
    2727 */
    2828
    29 #include "main.h"
    3029#include <printf.h>
    31 #include "asm.h"
    32 #include "_components.h"
    3330#include <ofw.h>
    3431#include <align.h>
    3532#include <macros.h>
    3633#include <string.h>
     34#include "main.h"
     35#include "asm.h"
     36#include "_components.h"
    3737
    38 #define HEAP_GAP 1024000
     38static bootinfo_t bootinfo;
     39static component_t components[COMPONENTS];
     40static char *release = STRING(RELEASE);
    3941
    40 bootinfo_t bootinfo;
     42#ifdef REVISION
     43        static char *revision = ", revision " STRING(REVISION);
     44#else
     45        static char *revision = "";
     46#endif
    4147
     48#ifdef TIMESTAMP
     49        static char *timestamp = "\nBuilt on " STRING(TIMESTAMP);
     50#else
     51        static char *timestamp = "";
     52#endif
     53
     54/** Print version information. */
     55static void version_print(void)
     56{
     57        printf("HelenOS PPC32 Bootloader\nRelease %s%s%s\n"
     58            "Copyright (c) 2006 HelenOS project\n\n",
     59            release, revision, timestamp);
     60}
    4261
    4362static void check_align(const void *addr, const char *desc)
    4463{
    45         if ((unsigned int) addr % PAGE_SIZE != 0) {
     64        if ((uintptr_t) addr % PAGE_SIZE != 0) {
    4665                printf("Error: %s not on page boundary, halting.\n", desc);
    4766                halt();
     
    4968}
    5069
    51 
    52 static void fix_overlap(void *va, void **pa, const char *desc, unsigned int *top)
     70static void check_overlap(const void *pa, const char *desc, const uintptr_t top)
    5371{
    54         if ((unsigned int) *pa + PAGE_SIZE < *top) {
    55                 printf("Warning: %s overlaps kernel physical area\n", desc);
    56                
    57                 void *new_va = (void *) (ALIGN_UP((unsigned int) KERNEL_END + HEAP_GAP, PAGE_SIZE) + *top);
    58                 void *new_pa = (void *) (HEAP_GAP + *top);
    59                 *top += PAGE_SIZE;
    60                
    61                 if (ofw_map(new_pa, new_va, PAGE_SIZE, 0) != 0) {
    62                         printf("Error: Unable to map page aligned memory at %L (physical %L), halting.\n", new_va, new_pa);
    63                         halt();
    64                 }
    65                
    66                 if ((unsigned int) new_pa + PAGE_SIZE < KERNEL_SIZE) {
    67                         printf("Error: %s cannot be relocated, halting.\n", desc);
    68                         halt();
    69                 }
    70                
    71                 printf("Relocating %L -> %L (physical %L -> %L)\n", va, new_va, *pa, new_pa);
    72                 *pa = new_pa;
    73                 memcpy(new_va, va, PAGE_SIZE);
     72        if ((uintptr_t) pa + PAGE_SIZE < top) {
     73                printf("Error: %s overlaps destination physical area\n", desc);
     74                halt();
    7475        }
    75 }
    76 
    77 char *release = STRING(RELEASE);
    78 
    79 #ifdef REVISION
    80         char *revision = ", revision " STRING(REVISION);
    81 #else
    82         char *revision = "";
    83 #endif
    84 
    85 #ifdef TIMESTAMP
    86         char *timestamp = "\nBuilt on " STRING(TIMESTAMP);
    87 #else
    88         char *timestamp = "";
    89 #endif
    90 
    91 /** Print version information. */
    92 static void version_print(void)
    93 {
    94         printf("HelenOS PPC32 Bootloader\nRelease %s%s%s\nCopyright (c) 2006 HelenOS project\n\n", release, revision, timestamp);
    9576}
    9677
     
    9879{
    9980        version_print();
    100        
    101         component_t components[COMPONENTS];
    10281        init_components(components);
    103                
    104         unsigned int i;
    105         for (i = 0; i < COMPONENTS; i++)
    106                 check_align(components[i].start, components[i].name);
    107        
    108         check_align(&real_mode, "bootstrap trampoline");
    109         check_align(&trans, "translation table");
    11082       
    11183        if (!ofw_memmap(&bootinfo.memmap)) {
     
    11991        }
    12092       
    121         if (!ofw_screen(&bootinfo.screen))
    122                 printf("Warning: Unable to get screen properties.\n");
     93        check_align(&real_mode, "bootstrap trampoline");
     94        check_align(trans, "translation table");
     95        check_align(balloc_base, "boot allocations");
    12396       
    124         if (!ofw_macio(&bootinfo.macio))
    125                 printf("Warning: Unable to get macio properties.\n");
     97        unsigned int i;
     98        for (i = 0; i < COMPONENTS; i++)
     99                check_align(components[i].start, components[i].name);
    126100       
    127         printf("Device statistics\n");
     101        void *bootinfo_pa = ofw_translate(&bootinfo);
     102        void *real_mode_pa = ofw_translate(&real_mode);
     103        void *trans_pa = ofw_translate(trans);
     104        void *balloc_base_pa = ofw_translate(balloc_base);
    128105       
    129         if (bootinfo.screen.addr)
    130                 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);
    131        
    132         if (bootinfo.macio.addr)
    133                 printf(" macio at %L (size %d bytes)\n", bootinfo.macio.addr, bootinfo.macio.size);
    134        
    135         void *real_mode_pa = ofw_translate(&real_mode);
    136         void *trans_pa = ofw_translate(&trans);
    137         void *bootinfo_pa = ofw_translate(&bootinfo);
    138        
    139         printf("\nMemory statistics (total %d MB)\n", bootinfo.memmap.total >> 20);
     106        printf("Memory statistics (total %d MB)\n", bootinfo.memmap.total >> 20);
    140107        printf(" %L: boot info structure (physical %L)\n", &bootinfo, bootinfo_pa);
    141108        printf(" %L: bootstrap trampoline (physical %L)\n", &real_mode, real_mode_pa);
    142         printf(" %L: translation table (physical %L)\n", &trans, trans_pa);
     109        printf(" %L: translation table (physical %L)\n", trans, trans_pa);
     110        printf(" %L: boot allocations (physical %L)\n", balloc_base, balloc_base_pa);
    143111        for (i = 0; i < COMPONENTS; i++)
    144112                printf(" %L: %s image (size %d bytes)\n", components[i].start, components[i].name, components[i].size);
    145113       
    146         unsigned int top = 0;
     114        uintptr_t top = 0;
    147115        for (i = 0; i < COMPONENTS; i++)
    148116                top += ALIGN_UP(components[i].size, PAGE_SIZE);
     117        top += ALIGN_UP(BALLOC_MAX_SIZE, PAGE_SIZE);
     118       
     119        if (top >= TRANS_SIZE * PAGE_SIZE) {
     120                printf("Error: boot image is too large\n");
     121                halt();
     122        }
     123       
     124        check_overlap(bootinfo_pa, "boot info", top);
     125        check_overlap(real_mode_pa, "bootstrap trampoline", top);
     126        check_overlap(trans_pa, "translation table", top);
    149127       
    150128        unsigned int pages = ALIGN_UP(KERNEL_SIZE, PAGE_SIZE) >> PAGE_WIDTH;
     
    152130        for (i = 0; i < pages; i++) {
    153131                void *pa = ofw_translate(KERNEL_START + (i << PAGE_WIDTH));
    154                 fix_overlap(KERNEL_START + (i << PAGE_WIDTH), &pa, "kernel", &top);
    155                 trans[i] = pa;
     132                check_overlap(pa, "kernel", top);
     133                trans[i] = (uintptr_t) pa;
    156134        }
    157135       
    158136        bootinfo.taskmap.count = 0;
    159137        for (i = 1; i < COMPONENTS; i++) {
     138                if (bootinfo.taskmap.count == TASKMAP_MAX_RECORDS) {
     139                        printf("\nSkipping superfluous components.\n");
     140                        break;
     141                }
     142               
    160143                unsigned int component_pages = ALIGN_UP(components[i].size, PAGE_SIZE) >> PAGE_WIDTH;
    161144                unsigned int j;
     
    163146                for (j = 0; j < component_pages; j++) {
    164147                        void *pa = ofw_translate(components[i].start + (j << PAGE_WIDTH));
    165                         fix_overlap(components[i].start + (j << PAGE_WIDTH), &pa, components[i].name, &top);
    166                         trans[pages + j] = pa;
     148                        check_overlap(pa, components[i].name, top);
     149                        trans[pages + j] = (uintptr_t) pa;
    167150                        if (j == 0) {
    168                                 bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr = (void *) (pages << PAGE_WIDTH);
     151                               
     152                                bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr = (void *) PA2KA(pages << PAGE_WIDTH);
    169153                                bootinfo.taskmap.tasks[bootinfo.taskmap.count].size = components[i].size;
    170154                                strncpy(bootinfo.taskmap.tasks[bootinfo.taskmap.count].name,
    171155                                    components[i].name, BOOTINFO_TASK_NAME_BUFLEN);
    172 
     156                               
    173157                                bootinfo.taskmap.count++;
    174158                        }
     
    178162        }
    179163       
    180         fix_overlap(&real_mode, &real_mode_pa, "bootstrap trampoline", &top);
    181         fix_overlap(&trans, &trans_pa, "translation table", &top);
    182         fix_overlap(&bootinfo, &bootinfo_pa, "boot info", &top);
     164        uintptr_t balloc_kernel_base = PA2KA(pages << PAGE_WIDTH);
     165        unsigned int balloc_pages = ALIGN_UP(BALLOC_MAX_SIZE, PAGE_SIZE) >> PAGE_WIDTH;
     166        for (i = 0; i < balloc_pages; i++) {
     167                void *pa = ofw_translate(balloc_base + (i << PAGE_WIDTH));
     168                check_overlap(pa, "boot allocations", top);
     169                trans[pages + i] = (uintptr_t) pa;
     170        }
     171       
     172        pages += balloc_pages;
     173       
     174        balloc_init(&bootinfo.ballocs, (uintptr_t) balloc_base, balloc_kernel_base);
     175        printf("\nCanonizing OpenFirmware device tree...");
     176        bootinfo.ofw_root = ofw_tree_build();
     177        printf("done.\n");
    183178       
    184179        ofw_setup_palette();
    185180       
    186181        printf("\nBooting the kernel...\n");
    187         jump_to_kernel(bootinfo_pa, sizeof(bootinfo), trans_pa, pages << PAGE_WIDTH, real_mode_pa, (void *) bootinfo.screen.addr, bootinfo.screen.scanline);
     182        jump_to_kernel(bootinfo_pa, sizeof(bootinfo), trans_pa, pages << PAGE_WIDTH, real_mode_pa);
    188183}
  • boot/arch/ppc32/loader/main.h

    ra11099f re731b0d  
    3030#define BOOT_ppc32_MAIN_H_
    3131
    32 #include "ofw.h"
     32#include <ofw.h>
     33#include <ofw_tree.h>
     34#include <balloc.h>
     35#include <types.h>
    3336
    34 #define TASKMAP_MAX_RECORDS 32
     37#define TASKMAP_MAX_RECORDS  32
    3538
    3639/** Size of buffer for storing task name in task_t. */
    37 #define BOOTINFO_TASK_NAME_BUFLEN 32
     40#define BOOTINFO_TASK_NAME_BUFLEN  32
    3841
    39 /** Struct holding information about single loaded task. */
    4042typedef struct {
    41         /** Address where the task was placed. */
    4243        void *addr;
    43         /** Size of the task's binary. */
    44         unsigned int size;
    45         /** Task name. */
     44        uint32_t size;
    4645        char name[BOOTINFO_TASK_NAME_BUFLEN];
    4746} task_t;
    4847
    4948typedef struct {
    50         unsigned int count;
     49        uint32_t count;
    5150        task_t tasks[TASKMAP_MAX_RECORDS];
    5251} taskmap_t;
     
    5554        memmap_t memmap;
    5655        taskmap_t taskmap;
    57         screen_t screen;
    58         macio_t macio;
     56        ballocs_t ballocs;
     57        ofw_tree_node_t *ofw_root;
    5958} bootinfo_t;
    6059
     
    6261extern void bootstrap(void);
    6362
    64 extern memmap_t memmap;
    65 
    6663#endif
  • boot/arch/ppc32/loader/ofwarch.c

    ra11099f re731b0d  
    3131#include <printf.h>
    3232
    33 typedef int (* ofw_entry_t)(ofw_args_t *args);
     33typedef int (*ofw_entry_t)(ofw_args_t *args);
    3434
    3535int ofw(ofw_args_t *args)
     
    4949}
    5050
    51 int ofw_macio(macio_t *macio)
    52 {
    53         char device_name[BUF_SIZE];
    54        
    55         if ((ofw_get_property(ofw_aliases, "macio", device_name, sizeof(device_name)) <= 0)
    56             && (ofw_get_property(ofw_aliases, "mac-io", device_name, sizeof(device_name)) <= 0))
    57                 return false;
    58        
    59         phandle device = ofw_find_device(device_name);
    60         if (device == -1)
    61                 return false;
    62        
    63         pci_reg_t pci_reg;
    64         if (ofw_get_property(device, "assigned-addresses", &pci_reg, sizeof(pci_reg)) <= 0)
    65                 return false;
    66        
    67         macio->addr = (void *) pci_reg.addr.addr_lo;
    68         macio->size = pci_reg.size_lo;
    69 
    70         return true;
    71 }
    72 
    7351int ofw_translate_failed(ofw_arg_t flag)
    7452{
     53        /* PearPC returns buggy flag */
    7554        return 0;
    7655}
  • boot/arch/ppc32/loader/ofwarch.h

    ra11099f re731b0d  
    3030#define BOOT_ppc32_OFWARCH_H_
    3131
    32 #define OFW_ADDRESS_CELLS       1
    33 #define OFW_SIZE_CELLS          1
     32#define OFW_ADDRESS_CELLS  1
     33#define OFW_SIZE_CELLS     1
    3434
    3535#endif
Note: See TracChangeset for help on using the changeset viewer.