- Timestamp:
- 2013-06-05T19:41:12Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 74dcc07
- Parents:
- f288d85 (diff), 6db5d4b (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. - Location:
- boot/arch
- Files:
-
- 13 edited
-
arm32/Makefile.inc (modified) (2 diffs)
-
arm32/include/arch.h (modified) (2 diffs)
-
arm32/include/main.h (modified) (1 diff)
-
arm32/include/mm.h (modified) (2 diffs)
-
arm32/src/mm.c (modified) (7 diffs)
-
arm32/src/putchar.c (modified) (2 diffs)
-
mips32/Makefile.inc (modified) (1 diff)
-
mips32/_link.ld.in (modified) (1 diff)
-
mips32/include/arch.h (modified) (2 diffs)
-
mips32/include/types.h (modified) (1 diff)
-
mips32/src/asm.S (modified) (1 diff)
-
mips32/src/main.c (modified) (3 diffs)
-
mips32/src/putchar.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/arm32/Makefile.inc
rf288d85 rdff90fa7 35 35 endif 36 36 37 ifeq ($(MACHINE), beagleboardxm)37 ifeq ($(MACHINE), $(filter $(MACHINE),beagleboardxm beaglebone)) 38 38 BOOT_OUTPUT = image.boot 39 39 POST_OUTPUT = $(ROOT_PATH)/uImage.bin … … 54 54 RD_SRVS_ESSENTIAL += \ 55 55 $(USPACE_PATH)/srv/hid/s3c24xx_ts/s3c24xx_ts \ 56 $(USPACE_PATH)/srv/hw/char/s3c24xx_uart/s3c24 xx_uart56 $(USPACE_PATH)/srv/hw/char/s3c24xx_uart/s3c24ser 57 57 endif 58 58 -
boot/arch/arm32/include/arch.h
rf288d85 rdff90fa7 44 44 #elif defined MACHINE_beagleboardxm 45 45 #define BOOT_BASE 0x80000000 46 #elif defined MACHINE_beaglebone 47 #define BOOT_BASE 0x80000000 46 48 #else 47 49 #define BOOT_BASE 0x00000000 … … 51 53 52 54 #ifdef MACHINE_beagleboardxm 55 #define PA_OFFSET 0 56 #elif defined MACHINE_beaglebone 53 57 #define PA_OFFSET 0 54 58 #else -
boot/arch/arm32/include/main.h
rf288d85 rdff90fa7 51 51 #define BBXM_THR_FULL 0x00000001 52 52 53 /** Beaglebone UART register addresses 54 * 55 * This is UART0 of AM335x CPU 56 */ 57 #define BBONE_SCONS_THR 0x44E09000 58 #define BBONE_SCONS_SSR 0x44E09044 59 60 /** Check this bit before writing (tx fifo full) */ 61 #define BBONE_TXFIFO_FULL 0x00000001 53 62 54 63 /** GTA02 serial console UART register addresses. -
boot/arch/arm32/include/mm.h
rf288d85 rdff90fa7 63 63 #define BBXM_RAM_END 0xc0000000 64 64 65 /** Start of ram memory on AM335x */ 66 #define AM335x_RAM_START 0x80000000 67 /** End of ram memory on AM335x */ 68 #define AM335x_RAM_END 0xC0000000 69 65 70 66 71 /* Page table level 0 entry - "section" format is used … … 76 81 unsigned int access_permission_0 : 2; 77 82 unsigned int tex : 3; 78 unsigned int access_permission_1 : 2; 83 unsigned int access_permission_1 : 1; 84 unsigned int shareable : 1; 79 85 unsigned int non_global : 1; 80 86 unsigned int should_be_zero_2 : 1; -
boot/arch/arm32/src/mm.c
rf288d85 rdff90fa7 38 38 #include <arch/mm.h> 39 39 40 /** Disable the MMU */ 41 static void disable_paging(void) 42 { 43 asm volatile ( 44 "mrc p15, 0, r0, c1, c0, 0\n" 45 "bic r0, r0, #1\n" 46 "mcr p15, 0, r0, c1, c0, 0\n" 47 ::: "r0" 48 ); 49 } 50 40 51 /** Check if caching can be enabled for a given memory section. 41 52 * … … 59 70 const unsigned long address = section << PTE_SECTION_SHIFT; 60 71 if (address >= BBXM_RAM_START && address < BBXM_RAM_END) 72 return 1; 73 #elif defined MACHINE_beaglebone 74 const unsigned long address = section << PTE_SECTION_SHIFT; 75 if (address >= AM335x_RAM_START && address < AM335x_RAM_END) 61 76 return 1; 62 77 #endif … … 88 103 pte->tex = 0; 89 104 pte->access_permission_1 = 0; 105 pte->shareable = 0; 90 106 pte->non_global = 0; 91 107 pte->should_be_zero_2 = 0; … … 102 118 for (page = 0; page < split_page; page++) 103 119 init_ptl0_section(&boot_pt[page], page); 104 105 /*106 * Create 1:1 virtual-physical mapping in kernel space107 * (upper 2 GB), physical addresses start from 0.108 */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. */112 for (page = split_page; page < PTL0_ENTRIES; page++)113 #ifndef MACHINE_beagleboardxm114 init_ptl0_section(&boot_pt[page], page - split_page);115 #else116 init_ptl0_section(&boot_pt[page], page);117 #endif118 120 119 121 asm volatile ( … … 132 134 "ldr r0, =0x55555555\n" 133 135 "mcr p15, 0, r0, c3, c0, 0\n" 134 136 135 137 /* Current settings */ 136 138 "mrc p15, 0, r0, c1, c0, 0\n" … … 143 145 144 146 "orr r0, r0, r1\n" 147 148 /* Invalidate the TLB content before turning on the MMU. 149 * ARMv7-A Reference manual, B3.10.3 150 */ 151 "mcr p15, 0, r0, c8, c7, 0\n" 145 152 146 /* Store settings */153 /* Store settings, enable the MMU */ 147 154 "mcr p15, 0, r0, c1, c0, 0\n" 148 155 ::: "r0", "r1" … … 152 159 /** Start the MMU - initialize page table and enable paging. */ 153 160 void mmu_start() { 161 disable_paging(); 154 162 init_boot_pt(); 155 163 enable_paging(); -
boot/arch/arm32/src/putchar.c
rf288d85 rdff90fa7 40 40 #include <putchar.h> 41 41 #include <str.h> 42 43 #ifdef MACHINE_beaglebone 44 45 /** Send a byte to the am335x serial console. 46 * 47 * @param byte Byte to send. 48 */ 49 static void scons_sendb_bbone(uint8_t byte) 50 { 51 volatile uint32_t *thr = 52 (volatile uint32_t *) BBONE_SCONS_THR; 53 volatile uint32_t *ssr = 54 (volatile uint32_t *) BBONE_SCONS_SSR; 55 56 /* Wait until transmitter is empty */ 57 while (*ssr & BBONE_TXFIFO_FULL); 58 59 /* Transmit byte */ 60 *thr = (uint32_t) byte; 61 } 62 63 #endif 42 64 43 65 #ifdef MACHINE_beagleboardxm … … 106 128 static void scons_sendb(uint8_t byte) 107 129 { 130 #ifdef MACHINE_beaglebone 131 scons_sendb_bbone(byte); 132 #endif 108 133 #ifdef MACHINE_beagleboardxm 109 134 scons_sendb_bbxm(byte); -
boot/arch/mips32/Makefile.inc
rf288d85 rdff90fa7 29 29 BFD_ARCH = mips 30 30 BITS = 32 31 EXTRA_CFLAGS = -msoft-float -mno-abicalls -G 0 -fno-zero-initialized-in-bss -m ips3 -mabi=3231 EXTRA_CFLAGS = -msoft-float -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mabi=32 32 32 33 RD_SRVS_NON_ESSENTIAL += \34 $(USPACE_PATH)/srv/bd/gxe_bd/gxe_bd35 36 ifeq ($(MACHINE),lgxemul)37 BFD_NAME = elf32-tradlittlemips38 BFD_OUTPUT = ecoff-littlemips39 ENDIANESS = LE40 endif41 ifeq ($(MACHINE),bgxemul)42 BFD_NAME = elf32-tradbigmips43 BFD_OUTPUT = ecoff-bigmips44 ENDIANESS = BE45 endif46 33 ifeq ($(MACHINE),msim) 47 34 BFD_NAME = elf32-tradlittlemips 48 35 BFD_OUTPUT = binary 49 36 ENDIANESS = LE 37 EXTRA_CFLAGS += -march=r4000 50 38 endif 39 ifeq ($(MACHINE),lmalta) 40 BFD_NAME = elf32-tradlittlemips 41 BFD_OUTPUT = elf32-tradlittlemips 42 ENDIANESS = LE 43 EXTRA_CFLAGS += -march=4kc 44 endif 45 ifeq ($(MACHINE),bmalta) 46 BFD_NAME = elf32-tradbigmips 47 BFD_OUTPUT = elf32-tradbigmips 48 ENDIANESS = BE 49 EXTRA_CFLAGS += -march=4kc 50 endif 51 51 52 52 53 SOURCES = \ -
boot/arch/mips32/_link.ld.in
rf288d85 rdff90fa7 2 2 3 3 SECTIONS { 4 #if defined(MACHINE_msim) 4 5 . = 0xbfc00000; 6 #elif defined(MACHINE_lmalta) || defined(MACHINE_bmalta) 7 . = 0x80103000; 8 #endif 5 9 .text : { 6 10 *(BOOTSTRAP); -
boot/arch/mips32/include/arch.h
rf288d85 rdff90fa7 33 33 #define PAGE_SIZE (1 << PAGE_WIDTH) 34 34 35 #if defined(MACHINE_msim) 35 36 #define CPUMAP_OFFSET 0x00001000 36 37 #define STACK_OFFSET 0x00002000 … … 41 42 #define MSIM_VIDEORAM_ADDRESS 0xb0000000 42 43 #define MSIM_DORDER_ADDRESS 0xb0000100 44 #endif 45 46 #if defined(MACHINE_lmalta) || defined(MACHINE_bmalta) 47 #define CPUMAP_OFFSET 0x00100000 48 #define STACK_OFFSET 0x00101000 49 #define BOOTINFO_OFFSET 0x00102000 50 #define BOOT_OFFSET 0x00200000 51 #define LOADER_OFFSET 0x00103000 52 53 #define YAMON_SUBR_BASE PA2KA(0x1fc00500) 54 #define YAMON_SUBR_PRINT_COUNT (YAMON_SUBR_BASE + 0x4) 55 #endif 43 56 44 57 #ifndef __ASM__ 45 58 #define PA2KA(addr) (((uintptr_t) (addr)) + 0x80000000) 59 #define PA2KSEG(addr) (((uintptr_t) (addr)) + 0xa0000000) 60 #define KA2PA(addr) (((uintptr_t) (addr)) - 0x80000000) 46 61 #define KSEG2PA(addr) (((uintptr_t) (addr)) - 0xa0000000) 47 62 #else -
boot/arch/mips32/include/types.h
rf288d85 rdff90fa7 47 47 48 48 typedef struct { 49 #if defined(MACHINE_lmalta) || defined(MACHINE_bmalta) 50 uint32_t sdram_size; 51 #endif 49 52 uint32_t cpumap; 50 53 size_t cnt; -
boot/arch/mips32/src/asm.S
rf288d85 rdff90fa7 51 51 and $a0, $a1, $a0 52 52 mtc0 $a0, $status 53 54 #if defined(MACHINE_lmalta) || defined(MACHINE_bmalta) 55 /* 56 * Remember the size of the SDRAM in bootinfo. 57 */ 58 la $a0, PA2KA(BOOTINFO_OFFSET) 59 sw $a3, 0($a0) 60 #endif 53 61 54 62 /* -
boot/arch/mips32/src/main.c
rf288d85 rdff90fa7 65 65 for (i = 0; i < COMPONENTS; i++) 66 66 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].start, 67 (void *) KSEG2PA(components[i].start), components[i].name, 68 components[i].inflated, components[i].size); 67 (uintptr_t) components[i].start >= PA2KSEG(0) ? 68 (void *) KSEG2PA(components[i].start) : 69 (void *) KA2PA(components[i].start), 70 components[i].name, components[i].inflated, 71 components[i].size); 69 72 70 73 void *dest[COMPONENTS]; … … 93 96 94 97 for (i = cnt; i > 0; i--) { 98 #ifdef MACHINE_msim 95 99 void *tail = dest[i - 1] + components[i].inflated; 96 100 if (tail >= ((void *) PA2KA(LOADER_OFFSET))) { … … 99 103 halt(); 100 104 } 105 #endif 101 106 102 107 printf("%s ", components[i - 1].name); -
boot/arch/mips32/src/putchar.c
rf288d85 rdff90fa7 32 32 #include <str.h> 33 33 34 #ifdef PUTCHAR_ADDRESS 35 #undef PUTCHAR_ADDRESS 36 #endif 37 38 #if defined(MACHINE_msim) 39 #define _putchar(ch) msim_putchar((ch)) 40 static void msim_putchar(const wchar_t ch) 41 { 42 *((char *) MSIM_VIDEORAM_ADDRESS) = ch; 43 } 44 #endif 45 46 #if defined(MACHINE_lmalta) || defined(MACHINE_bmalta) 47 #define _putchar(ch) yamon_putchar((ch)) 48 typedef void (**yamon_print_count_ptr_t)(uint32_t, const char *, uint32_t); 49 yamon_print_count_ptr_t yamon_print_count = 50 (yamon_print_count_ptr_t) YAMON_SUBR_PRINT_COUNT; 51 52 static void yamon_putchar(const wchar_t wch) 53 { 54 const char ch = (char) wch; 55 56 (*yamon_print_count)(0, &ch, 1); 57 } 58 #endif 59 34 60 void putchar(const wchar_t ch) 35 61 { 36 62 if (ascii_check(ch)) 37 *((char *) MSIM_VIDEORAM_ADDRESS) = ch;63 _putchar(ch); 38 64 else 39 *((char *) MSIM_VIDEORAM_ADDRESS) = U_SPECIAL;65 _putchar(U_SPECIAL); 40 66 } 67
Note:
See TracChangeset
for help on using the changeset viewer.
