Changeset 03362fbd in mainline for boot/arch


Ignore:
Timestamp:
2013-02-09T23:14:45Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
22dfd38
Parents:
b5d2e57 (diff), 005b765 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Conflict resulting from bool.h → stdbool.h move and ddf structs turning opaque.
Fails to boot to shell console.

Location:
boot/arch
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/amd64/Makefile.inc

    rb5d2e57 r03362fbd  
    4747RD_DRVS_NON_ESSENTIAL += \
    4848        char/ns8250 \
     49        time/cmos-rtc \
    4950        bus/usb/ehci\
    5051        bus/usb/ohci \
  • boot/arch/arm32/Makefile.inc

    rb5d2e57 r03362fbd  
    3030        BOOT_OUTPUT = image.boot
    3131        POST_OUTPUT = $(ROOT_PATH)/uImage.bin
     32        LADDR = 0x30008000
     33        SADDR = 0x30008000
     34        POSTBUILD = Makefile.uboot
     35endif
     36
     37ifeq ($(MACHINE), beagleboardxm)
     38        BOOT_OUTPUT = image.boot
     39        POST_OUTPUT = $(ROOT_PATH)/uImage.bin
     40        LADDR = 0x80000000
     41        SADDR = 0x80000000
    3242        POSTBUILD = Makefile.uboot
    3343endif
     
    3949BITS = 32
    4050ENDIANESS = LE
    41 EXTRA_CFLAGS = -march=armv4
     51EXTRA_CFLAGS = -march=$(subst _,-,$(PROCESSOR_ARCH)) -mno-unaligned-access
    4252
     53ifeq ($(MACHINE), gta02)
    4354RD_SRVS_ESSENTIAL += \
    4455        $(USPACE_PATH)/srv/hid/s3c24xx_ts/s3c24xx_ts \
    45         $(USPACE_PATH)/srv/hw/char/s3c24xx_uart/s3c24xx_uart
     56        $(USPACE_PATH)/srv/hw/char/s3c24xx_uart/s3c24ser
     57endif
    4658
    47 RD_SRVS_NON_ESSENTIAL += \
    48         $(USPACE_PATH)/srv/bd/gxe_bd/gxe_bd
     59RD_DRVS += \
     60        infrastructure/rootamdm37x \
     61        fb/amdm37x_dispc \
     62        bus/usb/ehci \
     63        bus/usb/ohci \
     64        bus/usb/usbflbk \
     65        bus/usb/usbhub \
     66        bus/usb/usbhid \
     67        bus/usb/usbmast \
     68        bus/usb/usbmid
    4969
    5070SOURCES = \
  • boot/arch/arm32/_link.ld.in

    rb5d2e57 r03362fbd  
    1111        . = BOOT_BASE + 0x8000;
    1212        .data : {
     13                bdata_start = .;
    1314                *(BOOTPT);      /* bootstrap page table */
    1415                *(BOOTSTACK);   /* bootstrap stack */
     
    2425[[COMPONENTS]]
    2526        }
    26        
     27        bdata_end = .;
     28
    2729        /DISCARD/ : {
    2830                *(.gnu.*);
  • boot/arch/arm32/include/arch.h

    rb5d2e57 r03362fbd  
    4242#ifdef MACHINE_gta02
    4343#define BOOT_BASE       0x30008000
     44#elif defined MACHINE_beagleboardxm
     45#define BOOT_BASE       0x80000000
    4446#else
    4547#define BOOT_BASE       0x00000000
     
    4850#define BOOT_OFFSET     (BOOT_BASE + 0xa00000)
    4951
     52#ifdef MACHINE_beagleboardxm
     53        #define PA_OFFSET 0
     54#else
     55        #define PA_OFFSET 0x80000000
     56#endif
     57
    5058#ifndef __ASM__
    51         #define PA2KA(addr)  (((uintptr_t) (addr)) + 0x80000000)
     59        #define PA2KA(addr)  (((uintptr_t) (addr)) + PA_OFFSET)
    5260#else
    53         #define PA2KA(addr)  ((addr) + 0x80000000)
     61        #define PA2KA(addr)  ((addr) + PA_OFFSET)
    5462#endif
     63
    5564
    5665#endif
  • boot/arch/arm32/include/main.h

    rb5d2e57 r03362fbd  
    4040/** Address where characters to be printed are expected. */
    4141
     42
     43/** BeagleBoard-xM UART register address
     44 *
     45 * This is UART3 of AM/DM37x CPU
     46 */
     47#define BBXM_SCONS_THR          0x49020000
     48#define BBXM_SCONS_SSR          0x49020044
     49
     50/* Check this bit before writing (tx fifo full) */
     51#define BBXM_THR_FULL           0x00000001
     52
     53
    4254/** GTA02 serial console UART register addresses.
    4355 *
     
    5163
    5264
    53 /** GXemul testarm serial console output register */
    54 #define TESTARM_SCONS_ADDR      0x10000000
    55 
    5665/** IntegratorCP serial console output register */
    57 #define ICP_SCONS_ADDR          0x16000000
     66#define ICP_SCONS_ADDR          0x16000000
    5867
    5968extern void bootstrap(void);
  • boot/arch/arm32/include/mm.h

    rb5d2e57 r03362fbd  
    4747/** Describe "section" page table entry (one-level paging with 1 MB sized pages). */
    4848#define PTE_DESCRIPTOR_SECTION  0x02
     49/** Shift of memory address in section descriptor */
     50#define PTE_SECTION_SHIFT  20
    4951
    5052/** Page table access rights: user - no access, kernel - read/write. */
    5153#define PTE_AP_USER_NO_KERNEL_RW  0x01
     54
     55/** Start of memory mapped I/O area for GTA02 */
     56#define GTA02_IOMEM_START  0x48000000
     57/** End of memory mapped I/O area for GTA02 */
     58#define GTA02_IOMEM_END  0x60000000
     59
     60/** Start of ram memory on BBxM */
     61#define BBXM_RAM_START   0x80000000
     62/** Start of ram memory on BBxM */
     63#define BBXM_RAM_END   0xc0000000
     64
    5265
    5366/* Page table level 0 entry - "section" format is used
     
    5871        unsigned int bufferable : 1;
    5972        unsigned int cacheable : 1;
    60         unsigned int impl_specific : 1;
     73        unsigned int xn : 1;
    6174        unsigned int domain : 4;
    6275        unsigned int should_be_zero_1 : 1;
    63         unsigned int access_permission : 2;
    64         unsigned int should_be_zero_2 : 8;
     76        unsigned int access_permission_0 : 2;
     77        unsigned int tex : 3;
     78        unsigned int access_permission_1 : 2;
     79        unsigned int non_global : 1;
     80        unsigned int should_be_zero_2 : 1;
     81        unsigned int non_secure : 1;
    6582        unsigned int section_base_addr : 12;
    6683} __attribute__((packed)) pte_level0_section_t;
  • boot/arch/arm32/src/asm.S

    rb5d2e57 r03362fbd  
    6060        # before passing control to the copied code.
    6161        #
     62
     63        #
     64        # r0 is kernel entry point
     65        # r1 is pointer to the bootinfo structure
     66
     67#define CP15_C1_IC              12
     68#define CP15_C1_BP              11
     69#define CP15_C1_DC              2
     70        # Disable I-cache and D-cache before the kernel is started.
     71        mrc     p15, 0, r4, c1, c0, 0
     72        bic     r4, r4, #(1 << CP15_C1_DC)
     73        bic     r4, r4, #(1 << CP15_C1_IC)
     74        bic     r4, r4, #(1 << CP15_C1_BP)
     75        mcr     p15, 0, r4, c1, c0, 0
     76
     77       
     78        #Wait for the operations to complete
     79#ifdef PROCESSOR_ARCH_armv7_a
     80        dsb
     81#else
     82        #cp15 dsb, r4 is ignored (should be zero)
     83        mcr p15, 0, r4, c7, c10, 4
     84#endif
     85       
     86        # Clean ICache and BPredictors, r4 ignored (SBZ)
     87        mcr p15, 0, r4, c7, c5, 0
     88        nop
     89
     90        #Wait for the operations to complete
     91#ifdef PROCESSOR_ARCH_armv7_a
     92        isb
     93        nop
     94#else
     95        # cp15 isb
     96        mcr p15, 0, r4, c7, c5, 4
     97        nop
     98#endif
    6299        mov pc, r0
  • boot/arch/arm32/src/main.c

    rb5d2e57 r03362fbd  
    5050#define TOP2ADDR(top)  (((void *) PA2KA(BOOT_OFFSET)) + (top))
    5151
     52extern void *bdata_start;
     53extern void *bdata_end;
     54
     55
     56static inline void invalidate_icache(void)
     57{
     58        /* ICIALLU Invalidate entire ICache */
     59        asm volatile ("mov r0, #0\n" "mcr p15, 0, r0, c7, c5, 0\n" ::: "r0" );
     60}
     61
     62static inline void invalidate_dcache(void *address, size_t size)
     63{
     64        const uintptr_t addr = (uintptr_t)address;
     65        /* DCIMVAC - invalidate by address to the point of coherence */
     66        for (uintptr_t a = addr; a < addr + size; a += 4) {
     67                asm volatile ("mcr p15, 0, %[a], c7, c6, 1\n" :: [a]"r"(a) : );
     68        }
     69}
     70
     71static inline void clean_dcache_poc(void *address, size_t size)
     72{
     73        const uintptr_t addr = (uintptr_t)address;
     74        /* DCCMVAC - clean by address to the point of coherence */
     75        for (uintptr_t a = addr; a < addr + size; a += 4) {
     76                asm volatile ("mcr p15, 0, %[a], c7, c10, 1\n" :: [a]"r"(a) : );
     77        }
     78}
     79
    5280static bootinfo_t bootinfo;
    5381
    5482void bootstrap(void)
    5583{
     84        /* Make sure  we run in memory code when caches are enabled,
     85         * make sure we read memory data too. This part is ARMv7 specific as
     86         * ARMv7 no longer invalidates caches on restart.
     87         * See chapter B2.2.2 of ARM Architecture Reference Manual p. B2-1263*/
     88        invalidate_icache();
     89        invalidate_dcache(&bdata_start, &bdata_end - &bdata_start);
     90
     91        /* Enable MMU and caches */
    5692        mmu_start();
    5793        version_print();
    5894       
     95        printf("Boot data: %p -> %p\n", &bdata_start, &bdata_end);
    5996        printf("\nMemory statistics\n");
    6097        printf(" %p|%p: bootstrap stack\n", &boot_stack, &boot_stack);
     
    64101            (void *) PA2KA(BOOT_OFFSET), (void *) BOOT_OFFSET);
    65102       
    66         size_t i;
    67         for (i = 0; i < COMPONENTS; i++)
     103        for (size_t i = 0; i < COMPONENTS; i++) {
    68104                printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].start,
    69105                    components[i].start, components[i].name, components[i].inflated,
    70106                    components[i].size);
     107                invalidate_dcache(components[i].start, components[i].size);
     108        }
    71109       
    72110        void *dest[COMPONENTS];
     
    74112        size_t cnt = 0;
    75113        bootinfo.cnt = 0;
    76         for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
     114        for (size_t i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {
    77115                top = ALIGN_UP(top, PAGE_SIZE);
    78116               
     
    94132        printf("\nInflating components ... ");
    95133       
    96         for (i = cnt; i > 0; i--) {
     134        for (size_t i = cnt; i > 0; i--) {
    97135                void *tail = components[i - 1].start + components[i - 1].size;
    98136                if (tail >= dest[i - 1]) {
     
    106144                int err = inflate(components[i - 1].start, components[i - 1].size,
    107145                    dest[i - 1], components[i - 1].inflated);
    108                
    109146                if (err != EOK) {
    110147                        printf("\n%s: Inflating error %d\n", components[i - 1].name, err);
    111148                        halt();
    112149                }
     150                clean_dcache_poc(dest[i - 1], components[i - 1].inflated);
    113151        }
    114152       
    115153        printf(".\n");
    116154       
    117         printf("Booting the kernel... \n");
     155        printf("Booting the kernel...\n");
    118156        jump_to_kernel((void *) PA2KA(BOOT_OFFSET), &bootinfo);
    119157}
  • boot/arch/arm32/src/mm.c

    rb5d2e57 r03362fbd  
    3838#include <arch/mm.h>
    3939
     40/** Check if caching can be enabled for a given memory section.
     41 *
     42 * Memory areas used for I/O are excluded from caching.
     43 * At the moment caching is enabled only on GTA02.
     44 *
     45 * @param section       The section number.
     46 *
     47 * @return      1 if the given section can be mapped as cacheable, 0 otherwise.
     48*/
     49static inline int section_cacheable(pfn_t section)
     50{
     51#ifdef MACHINE_gta02
     52        unsigned long address = section << PTE_SECTION_SHIFT;
     53
     54        if (address >= GTA02_IOMEM_START && address < GTA02_IOMEM_END)
     55                return 0;
     56        else
     57                return 1;
     58#elif defined MACHINE_beagleboardxm
     59        const unsigned long address = section << PTE_SECTION_SHIFT;
     60        if (address >= BBXM_RAM_START && address < BBXM_RAM_END)
     61                return 1;
     62#endif
     63        return 0;
     64}
     65
    4066/** Initialize "section" page table entry.
    4167 *
     
    5480{
    5581        pte->descriptor_type = PTE_DESCRIPTOR_SECTION;
    56         pte->bufferable = 0;
    57         pte->cacheable = 0;
    58         pte->impl_specific = 0;
     82        pte->bufferable = 1;
     83        pte->cacheable = section_cacheable(frame);
     84        pte->xn = 0;
    5985        pte->domain = 0;
    6086        pte->should_be_zero_1 = 0;
    61         pte->access_permission = PTE_AP_USER_NO_KERNEL_RW;
     87        pte->access_permission_0 = PTE_AP_USER_NO_KERNEL_RW;
     88        pte->tex = 0;
     89        pte->access_permission_1 = 0;
     90        pte->non_global = 0;
    6291        pte->should_be_zero_2 = 0;
     92        pte->non_secure = 0;
    6393        pte->section_base_addr = frame;
    6494}
     
    6797static void init_boot_pt(void)
    6898{
    69         pfn_t split_page = 0x800;
    70        
     99        const pfn_t split_page = PTL0_ENTRIES;
    71100        /* Create 1:1 virtual-physical mapping (in lower 2 GB). */
    72101        pfn_t page;
     
    78107         * (upper 2 GB), physical addresses start from 0.
    79108         */
     109        /* BeagleBoard-xM (DM37x) memory starts at 2GB border,
     110         * thus mapping only lower 2GB is not not enough.
     111         * Map entire AS 1:1 instead and hope it works. */
    80112        for (page = split_page; page < PTL0_ENTRIES; page++)
     113#ifndef MACHINE_beagleboardxm
    81114                init_ptl0_section(&boot_pt[page], page - split_page);
     115#else
     116                init_ptl0_section(&boot_pt[page], page);
     117#endif
    82118       
    83119        asm volatile (
     
    95131                /* Behave as a client of domains */
    96132                "ldr r0, =0x55555555\n"
    97                 "mcr p15, 0, r0, c3, c0, 0\n" 
     133                "mcr p15, 0, r0, c3, c0, 0\n"
    98134               
    99135                /* Current settings */
    100136                "mrc p15, 0, r0, c1, c0, 0\n"
    101137               
    102                 /* Mask to enable paging */
    103                 "ldr r1, =0x00000001\n"
     138                /* Enable ICache, DCache, BPredictors and MMU,
     139                 * we disable caches before jumping to kernel
     140                 * so this is safe for all archs.
     141                 */
     142                "ldr r1, =0x00001805\n"
     143               
    104144                "orr r0, r0, r1\n"
    105145               
  • boot/arch/arm32/src/putchar.c

    rb5d2e57 r03362fbd  
    4141#include <str.h>
    4242
     43#ifdef MACHINE_beagleboardxm
     44
     45/** Send a byte to the amdm37x serial console.
     46 *
     47 * @param byte          Byte to send.
     48 */
     49static void scons_sendb_bbxm(uint8_t byte)
     50{
     51        volatile uint32_t *thr =
     52            (volatile uint32_t *)BBXM_SCONS_THR;
     53        volatile uint32_t *ssr =
     54            (volatile uint32_t *)BBXM_SCONS_SSR;
     55
     56        /* Wait until transmitter is empty. */
     57        while ((*ssr & BBXM_THR_FULL) == 1) ;
     58
     59        /* Transmit byte. */
     60        *thr = (uint32_t) byte;
     61}
     62
     63#endif
     64
    4365#ifdef MACHINE_gta02
    4466
     
    6587#endif
    6688
    67 #ifdef MACHINE_testarm
    68 
    69 /** Send a byte to the GXemul testarm serial console.
    70  *
    71  * @param byte          Byte to send.
    72  */
    73 static void scons_sendb_testarm(uint8_t byte)
    74 {
    75         *((volatile uint8_t *) TESTARM_SCONS_ADDR) = byte;
    76 }
    77 
    78 #endif
    79 
    8089#ifdef MACHINE_integratorcp
    8190
     
    97106static void scons_sendb(uint8_t byte)
    98107{
     108#ifdef MACHINE_beagleboardxm
     109        scons_sendb_bbxm(byte);
     110#endif
    99111#ifdef MACHINE_gta02
    100112        scons_sendb_gta02(byte);
    101 #endif
    102 #ifdef MACHINE_testarm
    103         scons_sendb_testarm(byte);
    104113#endif
    105114#ifdef MACHINE_integratorcp
  • boot/arch/ia64/Makefile.inc

    rb5d2e57 r03362fbd  
    3131BFD_ARCH = ia64
    3232
     33#
     34# FIXME:
     35#
     36# The -fno-selective-scheduling and -fno-selective-scheduling2 options
     37# should be removed as soon as a bug in GCC concerning unchecked
     38# speculative loads is fixed.
     39#
     40# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53975 for reference.
     41#
     42
    3343BITS = 64
    3444ENDIANESS = LE
    35 EXTRA_CFLAGS = -fno-unwind-tables -mfixed-range=f32-f127 -mno-pic -mno-sdata
     45EXTRA_CFLAGS = -fno-unwind-tables -mfixed-range=f32-f127 -mno-pic -mno-sdata -fno-selective-scheduling -fno-selective-scheduling2
    3646
    3747RD_SRVS_NON_ESSENTIAL +=
  • boot/arch/ia64/src/main.c

    rb5d2e57 r03362fbd  
    4848
    4949#define DEFAULT_MEMORY_BASE             0x4000000ULL
    50 #define DEFAULT_MEMORY_SIZE             0x4000000ULL
     50#define DEFAULT_MEMORY_SIZE             (256 * 1024 * 1024)
    5151#define DEFAULT_LEGACY_IO_BASE          0x00000FFFFC000000ULL
    5252#define DEFAULT_LEGACY_IO_SIZE          0x4000000ULL
  • boot/arch/mips32/Makefile.inc

    rb5d2e57 r03362fbd  
    2929BFD_ARCH = mips
    3030BITS = 32
    31 EXTRA_CFLAGS = -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3 -mabi=32
     31EXTRA_CFLAGS = -msoft-float -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3 -mabi=32
    3232
    3333RD_SRVS_NON_ESSENTIAL += \
     
    4848        BFD_OUTPUT = binary
    4949        ENDIANESS = LE
    50         EXTRA_GCC_CFLAGS = -mhard-float
    5150endif
    5251
  • boot/arch/mips64/Makefile.inc

    rb5d2e57 r03362fbd  
    2929BFD_ARCH = mips:4000
    3030BITS = 64
    31 EXTRA_CFLAGS = -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3 -mabi=64
     31EXTRA_CFLAGS = -msoft-float -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3 -mabi=64
    3232
    3333ifeq ($(MACHINE),msim)
     
    3535        BFD_OUTPUT = binary
    3636        ENDIANESS = LE
    37         EXTRA_GCC_CFLAGS = -mhard-float
    3837endif
    3938
  • boot/arch/ppc32/Makefile.inc

    rb5d2e57 r03362fbd  
    4242        $(USPACE_PATH)/srv/hw/bus/cuda_adb/cuda_adb
    4343
    44 RD_DRVS_NON_ESSENTIAL += \
    45         infrastructure/rootmac
     44RD_DRVS += \
     45        infrastructure/rootmac \
     46        bus/pci/pciintel \
     47        bus/usb/ohci \
     48        bus/usb/usbflbk \
     49        bus/usb/usbhub \
     50        bus/usb/usbhid \
     51        bus/usb/usbmast \
     52        bus/usb/usbmid \
     53        bus/usb/vhc
    4654
    4755SOURCES = \
  • boot/arch/ppc32/_link.ld.in

    rb5d2e57 r03362fbd  
    22
    33SECTIONS {
    4         . = 0x01000000;
     4        . = 0x02000000;
    55        .text : {
    66                *(BOOTSTRAP);
  • boot/arch/ppc32/include/arch.h

    rb5d2e57 r03362fbd  
    3535#define BOOT_OFFSET  0x8000
    3636
    37 #define LOADER_ADDRESS  0x01000000
     37#define LOADER_ADDRESS  0x02000000
    3838
    3939#ifndef __ASM__
  • boot/arch/ppc32/src/main.c

    rb5d2e57 r03362fbd  
    103103        }
    104104       
     105        if (top >= (size_t) loader_address_pa) {
     106                printf("Inflated components overlap loader area.\n");
     107                printf("The boot image is too large. Halting.\n");
     108                halt();
     109        }
     110       
    105111        void *balloc_base;
    106112        void *balloc_base_pa;
Note: See TracChangeset for help on using the changeset viewer.