Changeset 8b863a62 in mainline for kernel/arch/arm32
- Timestamp:
- 2014-04-16T17:14:06Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f857e8b
- Parents:
- dba3e2c (diff), 70b570c (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:
- kernel/arch/arm32
- Files:
-
- 2 added
- 19 edited
-
Makefile.inc (modified) (2 diffs)
-
_link.ld.in (modified) (1 diff)
-
include/arch/asm.h (modified) (3 diffs)
-
include/arch/cp15.h (modified) (6 diffs)
-
include/arch/mach/integratorcp/integratorcp.h (modified) (1 diff)
-
include/arch/mach/raspberrypi/raspberrypi.h (added)
-
include/arch/mm/frame.h (modified) (2 diffs)
-
include/arch/mm/page.h (modified) (5 diffs)
-
include/arch/mm/page_armv4.h (modified) (4 diffs)
-
include/arch/mm/page_armv6.h (modified) (8 diffs)
-
src/cpu/cpu.c (modified) (8 diffs)
-
src/mach/beagleboardxm/beagleboardxm.c (modified) (7 diffs)
-
src/mach/beaglebone/beaglebone.c (modified) (6 diffs)
-
src/mach/gta02/gta02.c (modified) (3 diffs)
-
src/mach/integratorcp/integratorcp.c (modified) (6 diffs)
-
src/mach/raspberrypi/raspberrypi.c (added)
-
src/machine_func.c (modified) (2 diffs)
-
src/mm/frame.c (modified) (1 diff)
-
src/mm/page.c (modified) (1 diff)
-
src/mm/tlb.c (modified) (5 diffs)
-
src/ras.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/Makefile.inc
rdba3e2c r8b863a62 36 36 37 37 ifeq ($(CONFIG_FPU),y) 38 # This is necessary to allow vmsr insn and fpexc manipulation39 # Use vfp32 to allow context save/restore of d16-d31 regs.40 AFLAGS += -mfloat-abi=hard -mfpu=vfp338 # This is necessary to allow vmsr insn and fpexc manipulation 39 # Use vfp32 to allow context save/restore of d16-d31 regs. 40 AFLAGS += -mfloat-abi=hard -mfpu=vfp3 41 41 endif 42 42 … … 86 86 87 87 ifeq ($(MACHINE),beaglebone) 88 ARCH_SOURCES += arch/$(KARCH)/src/mach/beaglebone/beaglebone.c 88 ARCH_SOURCES += arch/$(KARCH)/src/mach/beaglebone/beaglebone.c 89 endif 90 91 ifeq ($(MACHINE),raspberrypi) 92 ARCH_SOURCES += arch/$(KARCH)/src/mach/raspberrypi/raspberrypi.c 89 93 endif 90 94 -
kernel/arch/arm32/_link.ld.in
rdba3e2c r8b863a62 13 13 #elif defined MACHINE_beaglebone 14 14 #define KERNEL_LOAD_ADDRESS 0x80a00000 15 #elif defined MACHINE_raspberrypi 16 #define KERNEL_LOAD_ADDRESS 0x80a08000 15 17 #else 16 18 #define KERNEL_LOAD_ADDRESS 0x80a00000 -
kernel/arch/arm32/include/arch/asm.h
rdba3e2c r8b863a62 38 38 39 39 #include <typedefs.h> 40 #include <arch/cp15.h> 40 41 #include <arch/stack.h> 41 42 #include <config.h> … … 51 52 * chapter 2.3.8 p.2-22 (52 in the PDF) 52 53 * 53 * @note Although mcr p15, 0, R0, c7, c0, 4 is defined in ARM Architecture54 * reference manual for armv4/5 CP15 implementation is mandatory only for55 * armv6+.54 * @note Although CP15WFI (mcr p15, 0, R0, c7, c0, 4) is defined in ARM 55 * Architecture reference manual for armv4/5, CP15 implementation is mandatory 56 * only for armv6+. 56 57 */ 57 58 NO_TRACE static inline void cpu_sleep(void) … … 60 61 asm volatile ( "wfe" ); 61 62 #elif defined(PROCESSOR_ARCH_armv6) | defined(PROCESSOR_arm926ej_s) | defined(PROCESSOR_arm920t) 62 asm volatile ( "mcr p15, 0, R0, c7, c0, 4");63 WFI_write(0); 63 64 #endif 64 65 } -
kernel/arch/arm32/include/arch/cp15.h
rdba3e2c r8b863a62 171 171 CCSIDR_LINESIZE_MASK = 0x7, 172 172 CCSIDR_LINESIZE_SHIFT = 0, 173 #define CCSIDR_SETS(val) \ 174 (((val >> CCSIDR_NUMSETS_SHIFT) & CCSIDR_NUMSETS_MASK) + 1) 175 #define CCSIDR_WAYS(val) \ 176 (((val >> CCSIDR_ASSOC_SHIFT) & CCSIDR_ASSOC_MASK) + 1) 177 /* The register value is log(linesize_in_words) - 2 */ 178 #define CCSIDR_LINESIZE_LOG(val) \ 179 (((val >> CCSIDR_LINESIZE_SHIFT) & CCSIDR_LINESIZE_MASK) + 2 + 2) 173 180 }; 174 181 CONTROL_REG_GEN_READ(CCSIDR, c0, 1, c0, 0); … … 187 194 CLIDR_UNI_CACHE = 0x4, 188 195 CLIDR_CACHE_MASK = 0x7, 189 #define CLIDR_CACHE(level, val) ((val >> (level - 1) * 3) & CLIDR_CACHE_MASK) 196 /** levels counted from 0 */ 197 #define CLIDR_CACHE(level, val) ((val >> (level * 3)) & CLIDR_CACHE_MASK) 190 198 }; 191 199 CONTROL_REG_GEN_READ(CLIDR, c0, 1, c0, 1); … … 223 231 SCTLR_FAST_IRQ_EN_FLAG = 1 << 21, /* Disable impl. specific feat*/ 224 232 SCTLR_UNALIGNED_EN_FLAG = 1 << 22, /* Must be 1 on armv7 */ 233 SCTLR_EXTENDED_PT_EN_FLAG = 1 << 23, 225 234 SCTLR_IRQ_VECTORS_EN_FLAG = 1 << 24, 226 235 SCTLR_BIG_ENDIAN_EXC_FLAG = 1 << 25, … … 293 302 294 303 /* Memory protection and control registers */ 304 enum { 305 TTBR_ADDR_MASK = 0xffffff80, 306 TTBR_NOS_FLAG = 1 << 5, 307 TTBR_RGN_MASK = 0x3 << 3, 308 TTBR_RGN_NO_CACHE = 0x0 << 3, 309 TTBR_RGN_WBWA_CACHE = 0x1 << 3, 310 TTBR_RGN_WT_CACHE = 0x2 << 3, 311 TTBR_RGN_WB_CACHE = 0x3 << 3, 312 TTBR_S_FLAG = 1 << 1, 313 TTBR_C_FLAG = 1 << 0, 314 }; 295 315 CONTROL_REG_GEN_READ(TTBR0, c2, 0, c0, 0); 296 316 CONTROL_REG_GEN_WRITE(TTBR0, c2, 0, c0, 0); … … 363 383 364 384 CONTROL_REG_GEN_WRITE(DCIMVAC, c7, 0, c6, 1); 365 CONTROL_REG_GEN_WRITE(DCI MSW, c7, 0, c6, 2);385 CONTROL_REG_GEN_WRITE(DCISW, c7, 0, c6, 2); 366 386 367 387 CONTROL_REG_GEN_WRITE(ATS1CPR, c7, 0, c8, 0); … … 369 389 CONTROL_REG_GEN_WRITE(ATS1CUR, c7, 0, c8, 2); 370 390 CONTROL_REG_GEN_WRITE(ATS1CUW, c7, 0, c8, 3); 371 CONTROL_REG_GEN_WRITE(ATS1 NSOPR, c7, 0, c8, 4);372 CONTROL_REG_GEN_WRITE(ATS1 NSOPW, c7, 0, c8, 5);373 CONTROL_REG_GEN_WRITE(ATS1 NSOUR, c7, 0, c8, 6);374 CONTROL_REG_GEN_WRITE(ATS1 NSOUW, c7, 0, c8, 7);391 CONTROL_REG_GEN_WRITE(ATS12NSOPR, c7, 0, c8, 4); 392 CONTROL_REG_GEN_WRITE(ATS12NSOPW, c7, 0, c8, 5); 393 CONTROL_REG_GEN_WRITE(ATS12NSOUR, c7, 0, c8, 6); 394 CONTROL_REG_GEN_WRITE(ATS12NSOUW, c7, 0, c8, 7); 375 395 376 396 -
kernel/arch/arm32/include/arch/mach/integratorcp/integratorcp.h
rdba3e2c r8b863a62 46 46 #define ICP_IRQC_MAX_IRQ 8 47 47 #define ICP_KBD_IRQ 3 48 #define ICP_TIMER_IRQ 6 48 #define ICP_TIMER_IRQ 6 49 #define ICP_UART0_IRQ 1 49 50 50 51 /** Timer frequency */ -
kernel/arch/arm32/include/arch/mm/frame.h
rdba3e2c r8b863a62 40 40 #define FRAME_SIZE (1 << FRAME_WIDTH) 41 41 42 #define FRAME_LOWPRIO 0 43 42 44 #ifndef __ASM__ 43 45 … … 60 62 #define PHYSMEM_START_ADDR 0x80000000 61 63 #define BOOT_PAGE_TABLE_ADDRESS 0x80008000 64 65 #elif defined MACHINE_raspberrypi 66 67 #define PHYSMEM_START_ADDR 0x00000000 68 #define BOOT_PAGE_TABLE_ADDRESS 0x00010000 62 69 63 70 #else -
kernel/arch/arm32/include/arch/mm/page.h
rdba3e2c r8b863a62 41 41 #include <arch/exception.h> 42 42 #include <arch/barrier.h> 43 #include <arch/cp15.h> 43 44 #include <trace.h> 44 45 … … 72 73 73 74 /* Page table sizes for each level. */ 74 #define PTL0_ SIZE_ARCH FOUR_FRAMES75 #define PTL1_ SIZE_ARCH 076 #define PTL2_ SIZE_ARCH 077 #define PTL3_ SIZE_ARCH ONE_FRAME75 #define PTL0_FRAMES_ARCH 4 76 #define PTL1_FRAMES_ARCH 1 77 #define PTL2_FRAMES_ARCH 1 78 #define PTL3_FRAMES_ARCH 1 78 79 79 80 /* Macros calculating indices into page tables for each level. */ … … 95 96 /* Set PTE address accessors for each level. */ 96 97 #define SET_PTL0_ADDRESS_ARCH(ptl0) \ 97 (set_ptl0_addr((pte_t *) (ptl0)))98 set_ptl0_addr((pte_t *) (ptl0)) 98 99 #define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) \ 99 (((pte_t *) (ptl0))[(i)].l0.coarse_table_addr = (a) >> 10)100 set_ptl1_addr((pte_t*) (ptl0), i, a) 100 101 #define SET_PTL2_ADDRESS_ARCH(ptl1, i, a) 101 102 #define SET_PTL3_ADDRESS_ARCH(ptl2, i, a) 102 103 #define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \ 103 (((pte_t *) (ptl3))[(i)].l1.frame_base_addr = (a) >> 12)104 set_ptl3_addr((pte_t*) (ptl3), i, a) 104 105 105 106 /* Get PTE flags accessors for each level. */ … … 129 130 set_pt_level1_present((pte_t *) (ptl3), (size_t) (i)) 130 131 132 133 #define pt_coherence(page) pt_coherence_m(page, 1) 134 131 135 #if defined(PROCESSOR_ARCH_armv6) | defined(PROCESSOR_ARCH_armv7_a) 132 136 #include "page_armv6.h" … … 137 141 #endif 138 142 143 /** Sets the address of level 0 page table. 144 * 145 * @param pt Pointer to the page table to set. 146 * 147 * Page tables are always in cacheable memory. 148 * Make sure the memory type is correct, and in sync with: 149 * init_boot_pt (boot/arch/arm32/src/mm.c) 150 * init_ptl0_section (boot/arch/arm32/src/mm.c) 151 * set_pt_level1_flags (kernel/arch/arm32/include/arch/mm/page_armv6.h) 152 */ 153 NO_TRACE static inline void set_ptl0_addr(pte_t *pt) 154 { 155 uint32_t val = (uint32_t)pt & TTBR_ADDR_MASK; 156 val |= TTBR_RGN_WBWA_CACHE | TTBR_C_FLAG; 157 TTBR0_write(val); 158 } 159 160 NO_TRACE static inline void set_ptl1_addr(pte_t *pt, size_t i, uintptr_t address) 161 { 162 pt[i].l0.coarse_table_addr = address >> 10; 163 pt_coherence(&pt[i].l0); 164 } 165 166 NO_TRACE static inline void set_ptl3_addr(pte_t *pt, size_t i, uintptr_t address) 167 { 168 pt[i].l1.frame_base_addr = address >> 12; 169 pt_coherence(&pt[i].l1); 170 } 171 139 172 #endif 140 173 -
kernel/arch/arm32/include/arch/mm/page_armv4.h
rdba3e2c r8b863a62 48 48 (((pte_t *) (pte))->l0.descriptor_type != 0) 49 49 #define PTE_GET_FRAME_ARCH(pte) \ 50 ((( pte_t *) (pte))->l1.frame_base_addr<< FRAME_WIDTH)50 (((uintptr_t) ((pte_t *) (pte))->l1.frame_base_addr) << FRAME_WIDTH) 51 51 #define PTE_WRITABLE_ARCH(pte) \ 52 52 (((pte_t *) (pte))->l1.access_permission_0 == PTE_AP_USER_RW_KERNEL_RW) … … 120 120 #define PTE_DESCRIPTOR_SMALL_PAGE 2 121 121 122 123 /** Sets the address of level 0 page table. 124 * 125 * @param pt Pointer to the page table to set. 126 * 127 */ 128 NO_TRACE static inline void set_ptl0_addr(pte_t *pt) 129 { 130 asm volatile ( 131 "mcr p15, 0, %[pt], c2, c0, 0\n" 132 :: [pt] "r" (pt) 133 ); 134 } 135 122 #define pt_coherence_m(pt, count) \ 123 do { \ 124 for (unsigned i = 0; i < count; ++i) \ 125 DCCMVAU_write((uintptr_t)(pt + i)); \ 126 read_barrier(); \ 127 } while (0) 136 128 137 129 /** Returns level 0 page table entry flags. … … 223 215 224 216 /* default access permission */ 225 p->access_permission_0 = p->access_permission_1 = 217 p->access_permission_0 = p->access_permission_1 = 226 218 p->access_permission_2 = p->access_permission_3 = 227 219 PTE_AP_USER_NO_KERNEL_RW; … … 229 221 if (flags & PAGE_USER) { 230 222 if (flags & PAGE_READ) { 231 p->access_permission_0 = p->access_permission_1 = 232 p->access_permission_2 = p->access_permission_3 = 223 p->access_permission_0 = p->access_permission_1 = 224 p->access_permission_2 = p->access_permission_3 = 233 225 PTE_AP_USER_RO_KERNEL_RW; 234 226 } 235 227 if (flags & PAGE_WRITE) { 236 p->access_permission_0 = p->access_permission_1 = 237 p->access_permission_2 = p->access_permission_3 = 238 PTE_AP_USER_RW_KERNEL_RW; 228 p->access_permission_0 = p->access_permission_1 = 229 p->access_permission_2 = p->access_permission_3 = 230 PTE_AP_USER_RW_KERNEL_RW; 239 231 } 240 232 } -
kernel/arch/arm32/include/arch/mm/page_armv6.h
rdba3e2c r8b863a62 41 41 #endif 42 42 43 43 44 /* Macros for querying the last-level PTE entries. */ 44 45 #define PTE_VALID_ARCH(pte) \ … … 47 48 (((pte_t *) (pte))->l0.descriptor_type != 0) 48 49 #define PTE_GET_FRAME_ARCH(pte) \ 49 ((( pte_t *) (pte))->l1.frame_base_addr<< FRAME_WIDTH)50 (((uintptr_t) ((pte_t *) (pte))->l1.frame_base_addr) << FRAME_WIDTH) 50 51 #define PTE_WRITABLE_ARCH(pte) \ 51 52 (((pte_t *) (pte))->l1.access_permission_1 != PTE_AP1_RO) … … 125 126 #define PTE_DESCRIPTOR_SMALL_PAGE_NX 3 126 127 127 /** Sets the address of level 0 page table. 128 * 129 * @param pt Pointer to the page table to set. 130 * 131 */ 132 NO_TRACE static inline void set_ptl0_addr(pte_t *pt) 133 { 134 asm volatile ( 135 "mcr p15, 0, %[pt], c2, c0, 0\n" 136 :: [pt] "r" (pt) 137 ); 138 } 128 129 /** 130 * For an ARMv7 implementation that does not include the Large Physical Address Extension, 131 * and in implementations of architecture versions before ARMv7, if the translation tables 132 * are held in Write-Back Cacheable memory, the caches must be cleaned to the point of 133 * unification after writing to the translation tables and before the DSB instruction. This 134 * ensures that the updated translation table are visible to a hardware translation table walk. 135 * 136 * Therefore, an example instruction sequence for writing a translation table entry, 137 * covering changes to the instruction 138 * or data mappings in a uniprocessor system is: 139 * STR rx, [Translation table entry] 140 * ; write new entry to the translation table 141 * Clean cache line [Translation table entry] : This operation is not required with the 142 * ; Multiprocessing Extensions. 143 * DSB 144 * ; ensures visibility of the data cleaned from the D Cache 145 * Invalidate TLB entry by MVA (and ASID if non-global) [page address] 146 * Invalidate BTC 147 * DSB 148 * ; ensure completion of the Invalidate TLB operation 149 * ISB 150 * ; ensure table changes visible to instruction fetch 151 * 152 * ARM Architecture reference chp. B3.10.1 p. B3-1375 153 * @note: see TTRB0/1 for pt memory type 154 */ 155 #define pt_coherence_m(pt, count) \ 156 do { \ 157 for (unsigned i = 0; i < count; ++i) \ 158 DCCMVAU_write((uintptr_t)(pt + i)); \ 159 read_barrier(); \ 160 } while (0) 139 161 140 162 … … 206 228 p->ns = 0; 207 229 } 230 pt_coherence(p); 208 231 } 209 232 … … 232 255 p->descriptor_type = PTE_DESCRIPTOR_SMALL_PAGE_NX; 233 256 } 234 235 /* tex=0 buf=1 and cache=1 => normal memory 236 * tex=0 buf=1 and cache=0 => shareable device mmio 237 */ 238 p->cacheable = (flags & PAGE_CACHEABLE); 239 p->bufferable = 1; 240 p->tex = 0; 241 257 258 if (flags & PAGE_CACHEABLE) { 259 /* 260 * Write-through, no write-allocate memory, see ch. B3.8.2 261 * (p. B3-1358) of ARM Architecture reference manual. 262 * Make sure the memory type is correct, and in sync with: 263 * init_boot_pt (boot/arch/arm32/src/mm.c) 264 * init_ptl0_section (boot/arch/arm32/src/mm.c) 265 * set_ptl0_addr (kernel/arch/arm32/include/arch/mm/page.h) 266 */ 267 p->tex = 5; 268 p->cacheable = 0; 269 p->bufferable = 1; 270 } else { 271 /* 272 * Shareable device memory, see ch. B3.8.2 (p. B3-1358) of 273 * ARM Architecture reference manual. 274 */ 275 p->tex = 0; 276 p->cacheable = 0; 277 p->bufferable = 1; 278 } 279 280 #if defined(PROCESSOR_ARCH_armv6) 281 /* FIXME: this disables caches */ 282 p->shareable = 1; 283 #else 242 284 /* Shareable is ignored for devices (non-cacheable), 243 * turn it on for normal memory. */ 244 p->shareable = 1; 285 * turn it off for normal memory. */ 286 p->shareable = 0; 287 #endif 245 288 246 289 p->non_global = !(flags & PAGE_GLOBAL); … … 256 299 p->access_permission_1 = PTE_AP1_RO; 257 300 } 301 pt_coherence(p); 258 302 } 259 303 … … 264 308 p->should_be_zero_0 = 0; 265 309 p->should_be_zero_1 = 0; 266 write_barrier();267 310 p->descriptor_type = PTE_DESCRIPTOR_COARSE_TABLE; 311 pt_coherence(p); 268 312 } 269 313 … … 273 317 274 318 p->descriptor_type = PTE_DESCRIPTOR_SMALL_PAGE; 319 pt_coherence(p); 275 320 } 276 321 -
kernel/arch/arm32/src/cpu/cpu.c
rdba3e2c r8b863a62 157 157 #endif 158 158 #ifdef PROCESSOR_ARCH_armv7_a 159 /* ICache coherency is elaborate on in barrier.h.159 /* ICache coherency is elaborated on in barrier.h. 160 160 * VIPT and PIPT caches need maintenance only on code modify, 161 161 * so it should be safe for general use. … … 166 166 control_reg |= 167 167 SCTLR_INST_CACHE_EN_FLAG | SCTLR_BRANCH_PREDICT_EN_FLAG; 168 } else { 169 control_reg &= 170 ~(SCTLR_INST_CACHE_EN_FLAG | SCTLR_BRANCH_PREDICT_EN_FLAG); 168 171 } 169 172 #endif … … 204 207 #ifdef PROCESSOR_ARCH_armv7_a 205 208 CSSELR_write((level & CCSELR_LEVEL_MASK) << CCSELR_LEVEL_SHIFT); 206 const unsigned ls_log = 2 + 207 ((CCSIDR_read() >> CCSIDR_LINESIZE_SHIFT) & CCSIDR_LINESIZE_MASK); 208 return ls_log + 2; //return log2(bytes) 209 const uint32_t ccsidr = CCSIDR_read(); 210 return CCSIDR_LINESIZE_LOG(ccsidr); 209 211 #endif 210 212 return 0; … … 217 219 #ifdef PROCESSOR_ARCH_armv7_a 218 220 CSSELR_write((level & CCSELR_LEVEL_MASK) << CCSELR_LEVEL_SHIFT); 219 const unsigned ways = 1 + 220 ((CCSIDR_read() >> CCSIDR_ASSOC_SHIFT) & CCSIDR_ASSOC_MASK); 221 return ways; 221 const uint32_t ccsidr = CCSIDR_read(); 222 return CCSIDR_WAYS(ccsidr); 222 223 #endif 223 224 return 0; … … 229 230 #ifdef PROCESSOR_ARCH_armv7_a 230 231 CSSELR_write((level & CCSELR_LEVEL_MASK) << CCSELR_LEVEL_SHIFT); 231 const unsigned sets = 1 + 232 ((CCSIDR_read() >> CCSIDR_NUMSETS_SHIFT) & CCSIDR_NUMSETS_MASK); 233 return sets; 232 const uint32_t ccsidr = CCSIDR_read(); 233 return CCSIDR_SETS(ccsidr); 234 234 #endif 235 235 return 0; … … 241 241 #ifdef PROCESSOR_ARCH_armv7_a 242 242 const uint32_t val = CLIDR_read(); 243 for (unsigned i = 1; i <= 7; ++i) {243 for (unsigned i = 0; i < 8; ++i) { 244 244 const unsigned ctype = CLIDR_CACHE(i, val); 245 245 switch (ctype) { … … 280 280 const unsigned ways = dcache_ways(i); 281 281 const unsigned sets = dcache_sets(i); 282 const unsigned way_shift = 31- log2(ways);282 const unsigned way_shift = 32 - log2(ways); 283 283 const unsigned set_shift = dcache_linesize_log(i); 284 284 dcache_clean_manual(i, false, ways, sets, way_shift, set_shift); … … 293 293 const unsigned ways = dcache_ways(i); 294 294 const unsigned sets = dcache_sets(i); 295 const unsigned way_shift = 31- log2(ways);295 const unsigned way_shift = 32 - log2(ways); 296 296 const unsigned set_shift = dcache_linesize_log(i); 297 297 dcache_clean_manual(i, true, ways, sets, way_shift, set_shift); -
kernel/arch/arm32/src/mach/beagleboardxm/beagleboardxm.c
rdba3e2c r8b863a62 60 60 61 61 static struct beagleboard { 62 amdm37x_irc_regs_t *irc_addr;62 omap_irc_regs_t *irc_addr; 63 63 omap_uart_t uart; 64 64 amdm37x_gpt_t timer; … … 85 85 static void bb_timer_irq_handler(irq_t *irq) 86 86 { 87 amdm37x_gpt_irq_ack(&beagleboard.timer); 88 87 89 /* 88 90 * We are holding a lock which prevents preemption. 89 91 * Release the lock, call clock() and reacquire the lock again. 90 92 */ 91 amdm37x_gpt_irq_ack(&beagleboard.timer);92 93 spinlock_unlock(&irq->lock); 93 94 clock(); … … 102 103 PAGE_NOT_CACHEABLE); 103 104 ASSERT(beagleboard.irc_addr); 104 amdm37x_irc_init(beagleboard.irc_addr);105 omap_irc_init(beagleboard.irc_addr); 105 106 106 107 /* Initialize timer. Use timer1, because it is in WKUP power domain … … 122 123 123 124 /* Enable timer interrupt */ 124 amdm37x_irc_enable(beagleboard.irc_addr, AMDM37x_GPT1_IRQ);125 omap_irc_enable(beagleboard.irc_addr, AMDM37x_GPT1_IRQ); 125 126 126 127 /* Start timer here */ … … 146 147 static void bbxm_irq_exception(unsigned int exc_no, istate_t *istate) 147 148 { 148 const unsigned inum = amdm37x_irc_inum_get(beagleboard.irc_addr); 149 amdm37x_irc_irq_ack(beagleboard.irc_addr); 149 const unsigned inum = omap_irc_inum_get(beagleboard.irc_addr); 150 150 151 151 irq_t *irq = irq_dispatch_and_lock(inum); … … 159 159 CPU->id, inum); 160 160 } 161 /** amdm37x manual ch. 12.5.2 (p. 2428) places irc ack at the end 162 * of ISR. DO this to avoid strange behavior. */ 163 omap_irc_irq_ack(beagleboard.irc_addr); 161 164 } 162 165 … … 185 188 indev_t *srln = srln_wire(srln_instance, sink); 186 189 omap_uart_input_wire(&beagleboard.uart, srln); 187 amdm37x_irc_enable(beagleboard.irc_addr, AMDM37x_UART3_IRQ);190 omap_irc_enable(beagleboard.irc_addr, AMDM37x_UART3_IRQ); 188 191 } 189 192 #endif -
kernel/arch/arm32/src/mach/beaglebone/beaglebone.c
rdba3e2c r8b863a62 63 63 64 64 static struct beaglebone { 65 am335x_irc_regs_t *irc_addr;65 omap_irc_regs_t *irc_addr; 66 66 am335x_cm_per_regs_t *cm_per_addr; 67 67 am335x_cm_dpll_regs_t *cm_dpll_addr; … … 104 104 105 105 /* Initialize the interrupt controller */ 106 am335x_irc_init(bbone.irc_addr);106 omap_irc_init(bbone.irc_addr); 107 107 } 108 108 … … 153 153 } 154 154 /* Enable the interrupt */ 155 am335x_irc_enable(bbone.irc_addr, AM335x_DMTIMER2_IRQ);155 omap_irc_enable(bbone.irc_addr, AM335x_DMTIMER2_IRQ); 156 156 /* Start the timer */ 157 157 am335x_timer_start(&bbone.timer); … … 176 176 static void bbone_irq_exception(unsigned int exc_no, istate_t *istate) 177 177 { 178 const unsigned inum = am335x_irc_inum_get(bbone.irc_addr); 179 am335x_irc_irq_ack(bbone.irc_addr); 178 const unsigned inum = omap_irc_inum_get(bbone.irc_addr); 180 179 181 180 irq_t *irq = irq_dispatch_and_lock(inum); … … 187 186 printf("Spurious interrupt\n"); 188 187 } 188 189 omap_irc_irq_ack(bbone.irc_addr); 189 190 } 190 191 … … 213 214 indev_t *srln = srln_wire(srln_instance, sink); 214 215 omap_uart_input_wire(&bbone.uart, srln); 215 am335x_irc_enable(bbone.irc_addr, AM335x_UART0_IRQ);216 omap_irc_enable(bbone.irc_addr, AM335x_UART0_IRQ); 216 217 } 217 218 #endif -
kernel/arch/arm32/src/mach/gta02/gta02.c
rdba3e2c r8b863a62 41 41 #include <genarch/fb/fb.h> 42 42 #include <abi/fb/visuals.h> 43 #include <genarch/drivers/s3c24xx _uart/s3c24xx_uart.h>44 #include <genarch/drivers/s3c24xx _irqc/s3c24xx_irqc.h>45 #include <genarch/drivers/s3c24xx _timer/s3c24xx_timer.h>43 #include <genarch/drivers/s3c24xx/uart.h> 44 #include <genarch/drivers/s3c24xx/irqc.h> 45 #include <genarch/drivers/s3c24xx/timer.h> 46 46 #include <genarch/srln/srln.h> 47 47 #include <sysinfo/sysinfo.h> … … 49 49 #include <ddi/ddi.h> 50 50 #include <ddi/device.h> 51 #include <log.h> 51 52 52 53 #define GTA02_MEMORY_START 0x30000000 /* physical */ … … 149 150 } else { 150 151 /* Spurious interrupt.*/ 151 printf("cpu%d: spurious interrupt (inum=%d)\n",152 log(LF_ARCH, LVL_DEBUG, "cpu%d: spurious interrupt (inum=%d)", 152 153 CPU->id, inum); 153 154 } -
kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
rdba3e2c r8b863a62 37 37 #include <ipc/irq.h> 38 38 #include <console/chardev.h> 39 #include <genarch/drivers/pl011/pl011.h> 39 40 #include <genarch/drivers/pl050/pl050.h> 40 #include <genarch/drivers/arm926_uart/arm926_uart.h>41 41 #include <genarch/kbrd/kbrd.h> 42 42 #include <genarch/srln/srln.h> 43 43 #include <console/console.h> 44 44 #include <sysinfo/sysinfo.h> 45 #include <print.h>46 45 #include <ddi/device.h> 47 46 #include <mm/page.h> … … 53 52 #include <abi/fb/visuals.h> 54 53 #include <ddi/ddi.h> 55 #include <print.h> 54 #include <log.h> 55 56 56 57 57 … … 61 61 icp_hw_map_t hw_map; 62 62 irq_t timer_irq; 63 arm926_uart_t uart;63 pl011_uart_t uart; 64 64 } icp; 65 65 … … 275 275 } else { 276 276 /* Spurious interrupt.*/ 277 printf("cpu%d: spurious interrupt (inum=%d)\n", 277 log(LF_ARCH, LVL_DEBUG, 278 "cpu%d: spurious interrupt (inum=%d)", 278 279 CPU->id, i); 279 280 } … … 314 315 stdout_wire(fbdev); 315 316 #endif 316 #ifdef CONFIG_ARM926_UART 317 if (arm926_uart_init(&icp.uart, ARM926_UART0_IRQ, 318 ARM926_UART0_BASE_ADDRESS, sizeof(arm926_uart_regs_t))) 317 #ifdef CONFIG_PL011_UART 318 if (pl011_uart_init(&icp.uart, ICP_UART0_IRQ, ICP_UART)) 319 319 stdout_wire(&icp.uart.outdev); 320 320 #endif … … 350 350 ICP_KBD); 351 351 352 #ifdef CONFIG_ ARM926_UART352 #ifdef CONFIG_PL011_UART 353 353 srln_instance_t *srln_instance = srln_init(); 354 354 if (srln_instance) { 355 355 indev_t *sink = stdin_wire(); 356 356 indev_t *srln = srln_wire(srln_instance, sink); 357 arm926_uart_input_wire(&icp.uart, srln);358 icp_irqc_unmask(ARM926_UART0_IRQ);357 pl011_uart_input_wire(&icp.uart, srln); 358 icp_irqc_unmask(ICP_UART0_IRQ); 359 359 } 360 360 #endif -
kernel/arch/arm32/src/machine_func.c
rdba3e2c r8b863a62 43 43 #include <arch/mach/beagleboardxm/beagleboardxm.h> 44 44 #include <arch/mach/beaglebone/beaglebone.h> 45 #include <arch/mach/raspberrypi/raspberrypi.h> 45 46 46 47 /** Pointer to machine_ops structure being used. */ … … 58 59 #elif defined(MACHINE_beaglebone) 59 60 machine_ops = &bbone_machine_ops; 61 #elif defined(MACHINE_raspberrypi) 62 machine_ops = &raspberrypi_machine_ops; 60 63 #else 61 64 #error Machine type not defined. -
kernel/arch/arm32/src/mm/frame.c
rdba3e2c r8b863a62 88 88 void boot_page_table_free(void) 89 89 { 90 unsigned int i; 91 for (i = 0; i < BOOT_PAGE_TABLE_SIZE_IN_FRAMES; i++) 92 frame_free(i * FRAME_SIZE + BOOT_PAGE_TABLE_ADDRESS); 90 frame_free(BOOT_PAGE_TABLE_ADDRESS, 91 BOOT_PAGE_TABLE_SIZE_IN_FRAMES); 93 92 } 94 93 -
kernel/arch/arm32/src/mm/page.c
rdba3e2c r8b863a62 69 69 #ifdef HIGH_EXCEPTION_VECTORS 70 70 /* Create mapping for exception table at high offset */ 71 uintptr_t ev_frame = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_NONE);71 uintptr_t ev_frame = frame_alloc(1, FRAME_NONE, 0); 72 72 page_mapping_insert(AS_KERNEL, EXC_BASE_ADDRESS, ev_frame, flags); 73 73 #else -
kernel/arch/arm32/src/mm/tlb.c
rdba3e2c r8b863a62 37 37 #include <arch/mm/asid.h> 38 38 #include <arch/asm.h> 39 #include <arch/cp15.h> 39 40 #include <typedefs.h> 40 41 #include <arch/mm/page.h> 42 #include <arch/cache.h> 41 43 42 44 /** Invalidate all entries in TLB. … … 46 48 void tlb_invalidate_all(void) 47 49 { 48 asm volatile ( 49 "eor r1, r1\n" 50 "mcr p15, 0, r1, c8, c7, 0\n" 51 ::: "r1" 52 ); 50 TLBIALL_write(0); 51 /* 52 * "A TLB maintenance operation is only guaranteed to be complete after 53 * the execution of a DSB instruction." 54 * "An ISB instruction, or a return from an exception, causes the 55 * effect of all completed TLB maintenance operations that appear in 56 * program order before the ISB or return from exception to be visible 57 * to all subsequent instructions, including the instruction fetches 58 * for those instructions." 59 * ARM Architecture reference Manual ch. B3.10.1 p. B3-1374 B3-1375 60 */ 61 read_barrier(); 62 inst_barrier(); 53 63 } 54 64 … … 60 70 { 61 71 tlb_invalidate_all(); 72 // TODO: why not TLBIASID_write(asid) ? 62 73 } 63 74 … … 65 76 * 66 77 * @param page Virtual adress of the page 67 */ 78 */ 68 79 static inline void invalidate_page(uintptr_t page) 69 80 { 70 asm volatile ( 71 "mcr p15, 0, %[page], c8, c7, 1\n" 72 :: [page] "r" (page) 73 ); 81 //TODO: What about TLBIMVAA? 82 TLBIMVA_write(page); 83 /* 84 * "A TLB maintenance operation is only guaranteed to be complete after 85 * the execution of a DSB instruction." 86 * "An ISB instruction, or a return from an exception, causes the 87 * effect of all completed TLB maintenance operations that appear in 88 * program order before the ISB or return from exception to be visible 89 * to all subsequent instructions, including the instruction fetches 90 * for those instructions." 91 * ARM Architecture reference Manual ch. B3.10.1 p. B3-1374 B3-1375 92 */ 93 read_barrier(); 94 inst_barrier(); 74 95 } 75 96 … … 83 104 void tlb_invalidate_pages(asid_t asid __attribute__((unused)), uintptr_t page, size_t cnt) 84 105 { 85 unsigned int i; 86 87 for (i = 0; i < cnt; i++) 106 for (unsigned i = 0; i < cnt; i++) 88 107 invalidate_page(page + i * PAGE_SIZE); 89 108 } -
kernel/arch/arm32/src/ras.c
rdba3e2c r8b863a62 51 51 void ras_init(void) 52 52 { 53 uintptr_t frame; 54 55 frame = (uintptr_t) frame_alloc(ONE_FRAME, 56 FRAME_ATOMIC | FRAME_HIGHMEM); 53 uintptr_t frame = 54 frame_alloc(1, FRAME_ATOMIC | FRAME_HIGHMEM, 0); 57 55 if (!frame) 58 frame = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_LOWMEM); 56 frame = frame_alloc(1, FRAME_LOWMEM, 0); 57 59 58 ras_page = (uintptr_t *) km_map(frame, 60 59 PAGE_SIZE, PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_CACHEABLE); 61 60 62 61 memsetb(ras_page, PAGE_SIZE, 0); 63 62 ras_page[RAS_START] = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
