Changes in / [a940f1d:f3386d7] in mainline
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/arm32/src/asm.S
ra940f1d rf3386d7 71 71 mrc p15, 0, r4, c1, c0, 0 72 72 bic r4, r4, #(1 << CP15_C1_DC) 73 #ifndef PROCESSOR_ARCH_armv7_a 73 74 bic r4, r4, #(1 << CP15_C1_IC) 74 75 bic r4, r4, #(1 << CP15_C1_BP) 76 #endif 75 77 mcr p15, 0, r4, c1, c0, 0 76 78 -
boot/arch/arm32/src/main.c
ra940f1d rf3386d7 63 63 { 64 64 const uintptr_t addr = (uintptr_t)address; 65 /* DCIMVAC - invalidate by address to the point of coherence */66 65 for (uintptr_t a = addr; a < addr + size; a += 4) { 66 /* DCIMVAC - invalidate by address to the point of coherence */ 67 67 asm volatile ("mcr p15, 0, %[a], c7, c6, 1\n" :: [a]"r"(a) : ); 68 68 } … … 72 72 { 73 73 const uintptr_t addr = (uintptr_t)address; 74 /* DCCMVAC - clean by address to the point of coherence */75 74 for (uintptr_t a = addr; a < addr + size; a += 4) { 75 /* DCCMVAC - clean by address to the point of coherence */ 76 76 asm volatile ("mcr p15, 0, %[a], c7, c10, 1\n" :: [a]"r"(a) : ); 77 77 } … … 82 82 void bootstrap(void) 83 83 { 84 /* Make sure 84 /* Make sure we run in memory code when caches are enabled, 85 85 * make sure we read memory data too. This part is ARMv7 specific as 86 86 * ARMv7 no longer invalidates caches on restart. … … 105 105 components[i].start, components[i].name, components[i].inflated, 106 106 components[i].size); 107 /* Make sure there is no cache garbage in read locations */ 107 108 invalidate_dcache(components[i].start, components[i].size); 108 109 } … … 148 149 halt(); 149 150 } 151 /* Make sure data are in the memory, ICache will need them */ 150 152 clean_dcache_poc(dest[i - 1], components[i - 1].inflated); 151 153 } -
kernel/arch/arm32/include/arch/asm.h
ra940f1d rf3386d7 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/mm/page_armv4.h
ra940f1d rf3386d7 41 41 #error "Do not include arch specific page.h directly use generic page.h instead" 42 42 #endif 43 44 #include <arch/cp15.h> 43 45 44 46 /* Macros for querying the last-level PTE entries. */ … … 128 130 NO_TRACE static inline void set_ptl0_addr(pte_t *pt) 129 131 { 130 asm volatile ( 131 "mcr p15, 0, %[pt], c2, c0, 0\n" 132 :: [pt] "r" (pt) 133 ); 132 TTBR0_write((uint32_t)pt); 134 133 } 135 134 … … 223 222 224 223 /* default access permission */ 225 p->access_permission_0 = p->access_permission_1 = 224 p->access_permission_0 = p->access_permission_1 = 226 225 p->access_permission_2 = p->access_permission_3 = 227 226 PTE_AP_USER_NO_KERNEL_RW; … … 229 228 if (flags & PAGE_USER) { 230 229 if (flags & PAGE_READ) { 231 p->access_permission_0 = p->access_permission_1 = 232 p->access_permission_2 = p->access_permission_3 = 230 p->access_permission_0 = p->access_permission_1 = 231 p->access_permission_2 = p->access_permission_3 = 233 232 PTE_AP_USER_RO_KERNEL_RW; 234 233 } 235 234 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; 235 p->access_permission_0 = p->access_permission_1 = 236 p->access_permission_2 = p->access_permission_3 = 237 PTE_AP_USER_RW_KERNEL_RW; 239 238 } 240 239 } -
kernel/arch/arm32/include/arch/mm/page_armv6.h
ra940f1d rf3386d7 40 40 #error "Do not include arch specific page.h directly use generic page.h instead" 41 41 #endif 42 43 #include <arch/cp15.h> 42 44 43 45 /* Macros for querying the last-level PTE entries. */ … … 132 134 NO_TRACE static inline void set_ptl0_addr(pte_t *pt) 133 135 { 134 asm volatile ( 135 "mcr p15, 0, %[pt], c2, c0, 0\n" 136 :: [pt] "r" (pt) 137 ); 136 TTBR0_write((uint32_t)pt); 138 137 } 139 138 -
kernel/arch/arm32/src/mach/beagleboardxm/beagleboardxm.c
ra940f1d rf3386d7 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(); … … 147 148 { 148 149 const unsigned inum = amdm37x_irc_inum_get(beagleboard.irc_addr); 149 amdm37x_irc_irq_ack(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 amdm37x_irc_irq_ack(beagleboard.irc_addr); 161 164 } 162 165 -
kernel/arch/arm32/src/mm/tlb.c
ra940f1d rf3386d7 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> … … 46 47 void tlb_invalidate_all(void) 47 48 { 48 asm volatile ( 49 "eor r1, r1\n" 50 "mcr p15, 0, r1, c8, c7, 0\n" 51 ::: "r1" 52 ); 49 TLBIALL_write(0); 53 50 } 54 51 … … 60 57 { 61 58 tlb_invalidate_all(); 59 // TODO: why not TLBIASID_write(asid) ? 62 60 } 63 61 … … 65 63 * 66 64 * @param page Virtual adress of the page 67 */ 65 */ 68 66 static inline void invalidate_page(uintptr_t page) 69 67 { 70 asm volatile ( 71 "mcr p15, 0, %[page], c8, c7, 1\n" 72 :: [page] "r" (page) 73 ); 68 TLBIMVA_write(page); 69 //TODO: What about TLBIMVAA? 74 70 } 75 71 -
kernel/genarch/include/genarch/drivers/amdm37x/gpt.h
ra940f1d rf3386d7 39 39 #include <typedefs.h> 40 40 #include <mm/km.h> 41 #include <time/clock.h> 41 42 42 43 /* AMDM37x TRM p. 2740 */ … … 128 129 #define AMDM37x_GPT_TCLR_CE_FLAG (1 << 6) 129 130 #define AMDM37x_GPT_TCLR_SCPWM (1 << 7) 130 #define AMDM37x_GPT_TCLR_TCM_MASK (0x3) 131 #define AMDM37x_GPT_TCLR_TCM_SHIFT (8) 132 #define AMDM37x_GPT_TCLR_TRG_MASK (0x3) 133 #define AMDM37x_GPT_TCLR_TRG_SHIFT (10) 131 #define AMDM37x_GPT_TCLR_TCM_MASK (0x3 << 8) 132 #define AMDM37x_GPT_TCLR_TCM_NO_CAPTURE (0x0 << 8) 133 #define AMDM37x_GPT_TCLR_TCM_RAISE_CAPTURE (0x1 << 8) 134 #define AMDM37x_GPT_TCLR_TCM_FALL_CAPTURE (0x2 << 8) 135 #define AMDM37x_GPT_TCLR_TCM_BOTH_CAPTURE (0x3 << 8) 136 #define AMDM37x_GPT_TCLR_TRG_MASK (0x3 << 10) 137 #define AMDM37x_GPT_TCLR_TRG_NO (0x0 << 10) 138 #define AMDM37x_GPT_TCLR_TRG_OVERFLOW (0x1 << 10) 139 #define AMDM37x_GPT_TCLR_TRG_OVERMATCH (0x2 << 10) 134 140 #define AMDM37x_GPT_TCLR_PT_FLAG (1 << 12) 135 141 #define AMDM37x_GPT_TCLR_CAPT_MODE_FLAG (1 << 13) … … 209 215 timer->regs = (void*) km_map(ioregs, iosize, PAGE_NOT_CACHEABLE); 210 216 217 /* Reset the timer */ 218 timer->regs->tiocp_cfg |= AMDM37x_GPT_TIOCP_CFG_SOFTRESET_FLAG; 219 220 while (timer->regs->tistat & AMDM37x_GPT_TISTAT_RESET_DONE_FLAG); 221 211 222 /* Set autoreload */ 212 timer->regs->tclr = AMDM37x_GPT_TCLR_AR_FLAG;223 timer->regs->tclr |= AMDM37x_GPT_TCLR_AR_FLAG; 213 224 214 225 timer->special_available = ( … … 216 227 (ioregs == AMDM37x_GPT2_BASE_ADDRESS) || 217 228 (ioregs == AMDM37x_GPT10_BASE_ADDRESS)); 229 /* Select reload value */ 218 230 timer->regs->tldr = 0xffffffff - (32768 / hz) + 1; 231 /* Set current counter value */ 219 232 timer->regs->tccr = 0xffffffff - (32768 / hz) + 1; 233 220 234 if (timer->special_available) { 221 /* Set values foraccording to formula (manual p. 2733) */235 /* Set values according to formula (manual p. 2733) */ 222 236 /* Use temporary variables for easier debugging */ 223 237 const uint32_t tpir = 224 238 ((32768 / hz + 1) * 1000000) - (32768000L * (1000 / hz)); 225 239 const uint32_t tnir = 226 ((32768 / hz) * 1000000) - (32768000 * (1000 / hz));240 ((32768 / hz) * 1000000) - (32768000L * (1000 / hz)); 227 241 timer->regs->tpir = tpir; 228 242 timer->regs->tnir = tnir; … … 241 255 } 242 256 243 static inline voidamdm37x_gpt_irq_ack(amdm37x_gpt_t* timer)257 static inline bool amdm37x_gpt_irq_ack(amdm37x_gpt_t* timer) 244 258 { 245 259 ASSERT(timer); 246 260 ASSERT(timer->regs); 247 261 /* Clear all pending interrupts */ 248 timer->regs->tisr = timer->regs->tisr; 262 const uint32_t tisr = timer->regs->tisr; 263 timer->regs->tisr = tisr; 264 return tisr != 0; 249 265 } 250 266
Note:
See TracChangeset
for help on using the changeset viewer.