Changeset f6f22cdb in mainline for boot/arch/sparc32/src/main.c


Ignore:
Timestamp:
2013-12-27T18:45:56Z (11 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
32e8cd1
Parents:
e47ed05
Message:

code revision
coding style changes

File:
1 edited

Legend:

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

    re47ed05 rf6f22cdb  
    5252
    5353#define TOP2ADDR(top)  (((void *) PA2KA(BOOT_OFFSET)) + (top))
     54
    5455static bootinfo_t bootinfo;
    5556
     
    5859        /* Initialize AMBA P&P device list */
    5960        ambapp_scan();
    60 
    61         /* Look up for UART */
     61       
     62        /* Look for UART */
    6263        amba_device_t *uart = ambapp_lookup_first(GAISLER, GAISLER_APBUART);
    6364        amba_uart_base = uart->bars[0].start;
    6465        bootinfo.uart_base = amba_uart_base;
    6566        bootinfo.uart_irq = uart->irq;
    66 
    67         /* Look up for IRQMP */
     67       
     68        /* Look for IRQMP */
    6869        amba_device_t *irqmp = ambapp_lookup_first(GAISLER, GAISLER_IRQMP);
    6970        bootinfo.intc_base = irqmp->bars[0].start;
    70 
    71         /* Look up for timer */
     71       
     72        /* Look for timer */
    7273        amba_device_t *timer = ambapp_lookup_first(GAISLER, GAISLER_GPTIMER);
    7374        bootinfo.timer_base = timer->bars[0].start;
    7475        bootinfo.timer_irq = timer->irq;
    7576       
    76         /* Lookp up for memory controller and obtain memory size */
    77         if (ambapp_fake()) {
    78                 bootinfo.memsize = 64 * 1024 * 1024; // 64MB
    79         } else {
     77        /* Look for memory controller and obtain memory size */
     78        if (!ambapp_fake()) {
    8079                amba_device_t *mctrl = ambapp_lookup_first(ESA, ESA_MCTRL);
    81                 volatile mctrl_mcfg2_t *mcfg2 = (volatile mctrl_mcfg2_t *)(mctrl->bars[0].start + 0x4);
     80                volatile mctrl_mcfg2_t *mcfg2 = (volatile mctrl_mcfg2_t *)
     81                    (mctrl->bars[0].start + 0x4);
    8282                bootinfo.memsize = (1 << (13 + mcfg2->bank_size));
    83         }
     83        } else
     84                bootinfo.memsize = 64 * 1024 * 1024;
    8485       
    8586        /* Standard output is now initialized */
    8687        version_print();
    87 
     88       
    8889        for (size_t i = 0; i < COMPONENTS; i++) {
    8990                printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].start,
     
    9192                    components[i].size);
    9293        }
    93 
     94       
    9495        ambapp_print_devices();
    95 
    96         printf("Memory size: %dMB\n", bootinfo.memsize >> 20);
    97 
     96       
     97        printf("Memory size: %u MB\n", bootinfo.memsize >> 20);
     98       
    9899        mmu_init();
    99 
     100       
    100101        void *dest[COMPONENTS];
    101102        size_t top = 0;
     
    116117               
    117118                dest[i] = TOP2ADDR(top);
    118 
     119               
    119120                top += components[i].inflated;
    120121                cnt++;
     
    128129                        printf("\n%s: Image too large to fit (%p >= %p), halting.\n",
    129130                            components[i].name, tail, dest[i - 1]);
    130                         for (;;);
     131                        halt();
    131132                }
    132133               
     
    137138                if (err != EOK) {
    138139                        printf("\n%s: Inflating error %d\n", components[i - 1].name, err);
    139                         for (;;);
     140                        halt();
    140141                }
    141142        }
    142 
     143       
    143144        printf("Booting the kernel ... \n");
    144145        jump_to_kernel((void *) PA2KA(BOOT_OFFSET), &bootinfo);
Note: See TracChangeset for help on using the changeset viewer.