void tlb_unwire_entry(void) { unsigned long status, flags; int urb; local_irq_save(flags); status = __raw_readl(MMUCR); urb = (status & MMUCR_URB) >> MMUCR_URB_SHIFT; status &= ~MMUCR_URB; /* * Make sure we're not trying to unwire a TLB entry when none * have been wired. */ BUG_ON(urb++ == MMUCR_URB_NENTRIES); urb = urb % MMUCR_URB_NENTRIES; status |= (urb << MMUCR_URB_SHIFT); __raw_writel(status, MMUCR); ctrl_barrier(); local_irq_restore(flags); }
/* * Load the entry for 'addr' into the TLB and wire the entry. */ void tlb_wire_entry(struct vm_area_struct *vma, unsigned long addr, pte_t pte) { unsigned long status, flags; int urb; local_irq_save(flags); /* Load the entry into the TLB */ __update_tlb(vma, addr, pte); /* ... and wire it up. */ status = __raw_readl(MMUCR); urb = (status & MMUCR_URB) >> MMUCR_URB_SHIFT; status &= ~MMUCR_URB; /* * Make sure we're not trying to wire the last TLB entry slot. */ BUG_ON(!--urb); urb = urb % MMUCR_URB_NENTRIES; status |= (urb << MMUCR_URB_SHIFT); __raw_writel(status, MMUCR); ctrl_barrier(); local_irq_restore(flags); }
static int __init sh_pm_init(void) { void *onchip_mem = (void *)ILRAM_BASE; /* Copy the assembly snippet to the otherwise ununsed ILRAM */ memcpy(onchip_mem, sh_mobile_standby, sh_mobile_standby_size); wmb(); ctrl_barrier(); suspend_set_ops(&sh_pm_ops); sh_mobile_setup_cpuidle(); return 0; }
void local_flush_tlb_all(void) { unsigned long flags, status; /* * Flush all the TLB. * * Write to the MMU control register's bit: * TF-bit for SH-3, TI-bit for SH-4. * It's same position, bit #2. */ local_irq_save(flags); status = __raw_readl(MMUCR); status |= 0x04; __raw_writel(status, MMUCR); ctrl_barrier(); local_irq_restore(flags); }
void __init pmb_init(void) { /* Synchronize software state */ pmb_synchronize(); /* Attempt to combine compound mappings */ pmb_coalesce(); #ifdef CONFIG_UNCACHED_MAPPING /* Resize initial mappings, if necessary */ pmb_resize(); #endif /* Log them */ pmb_notify(); writel_uncached(0, PMB_IRMCR); /* Flush out the TLB */ __raw_writel(__raw_readl(MMUCR) | MMUCR_TI, MMUCR); ctrl_barrier(); }
static int tlb_seq_show(struct seq_file *file, void *iter) { unsigned int tlb_type = (unsigned int)file->private; unsigned long addr1, addr2, data1, data2; unsigned long flags; unsigned long mmucr; unsigned int nentries, entry; unsigned int urb; mmucr = __raw_readl(MMUCR); if ((mmucr & 0x1) == 0) { seq_printf(file, "address translation disabled\n"); return 0; } if (tlb_type == TLB_TYPE_ITLB) { addr1 = MMU_ITLB_ADDRESS_ARRAY; addr2 = MMU_ITLB_ADDRESS_ARRAY2; data1 = MMU_ITLB_DATA_ARRAY; data2 = MMU_ITLB_DATA_ARRAY2; nentries = 4; } else { addr1 = MMU_UTLB_ADDRESS_ARRAY; addr2 = MMU_UTLB_ADDRESS_ARRAY2; data1 = MMU_UTLB_DATA_ARRAY; data2 = MMU_UTLB_DATA_ARRAY2; nentries = 64; } local_irq_save(flags); jump_to_uncached(); urb = (mmucr & MMUCR_URB) >> MMUCR_URB_SHIFT; /* Make the "entry >= urb" test fail. */ if (urb == 0) urb = MMUCR_URB_NENTRIES + 1; if (tlb_type == TLB_TYPE_ITLB) { addr1 = MMU_ITLB_ADDRESS_ARRAY; addr2 = MMU_ITLB_ADDRESS_ARRAY2; data1 = MMU_ITLB_DATA_ARRAY; data2 = MMU_ITLB_DATA_ARRAY2; nentries = 4; } else { addr1 = MMU_UTLB_ADDRESS_ARRAY; addr2 = MMU_UTLB_ADDRESS_ARRAY2; data1 = MMU_UTLB_DATA_ARRAY; data2 = MMU_UTLB_DATA_ARRAY2; nentries = 64; } seq_printf(file, "entry: vpn ppn asid size valid wired\n"); for (entry = 0; entry < nentries; entry++) { unsigned long vpn, ppn, asid, size; unsigned long valid; unsigned long val; const char *sz = " ?"; int i; val = __raw_readl(addr1 | (entry << MMU_TLB_ENTRY_SHIFT)); ctrl_barrier(); vpn = val & 0xfffffc00; valid = val & 0x100; val = __raw_readl(addr2 | (entry << MMU_TLB_ENTRY_SHIFT)); ctrl_barrier(); asid = val & MMU_CONTEXT_ASID_MASK; val = __raw_readl(data1 | (entry << MMU_TLB_ENTRY_SHIFT)); ctrl_barrier(); ppn = (val & 0x0ffffc00) << 4; val = __raw_readl(data2 | (entry << MMU_TLB_ENTRY_SHIFT)); ctrl_barrier(); size = (val & 0xf0) >> 4; for (i = 0; i < ARRAY_SIZE(tlb_sizes); i++) { if (tlb_sizes[i].bits == size) break; } if (i != ARRAY_SIZE(tlb_sizes)) sz = tlb_sizes[i].size; seq_printf(file, "%2d: 0x%08lx 0x%08lx %5lu %s %s %s\n", entry, vpn, ppn, asid, sz, valid ? "V" : "-", (urb <= entry) ? "W" : "-"); } back_to_cached(); local_irq_restore(flags); return 0; }