void galileo_machine_restart(char *command) { *(volatile char *) 0xbc000000 = 0x0f; /* * Ouch, we're still alive ... This time we take the silver bullet ... * ... and find that we leave the hardware in a state in which the * kernel in the flush locks up somewhen during of after the PCI * detection stuff. */ set_c0_status(ST0_BEV | ST0_ERL); change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED); flush_cache_all(); write_c0_wired(0); __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000)); }
static void kvm_mips_init_tlbs(struct kvm *kvm) { unsigned long wired; /* * Add a wired entry to the TLB, it is used to map the commpage to * the Guest kernel */ wired = read_c0_wired(); write_c0_wired(wired + 1); mtc0_tlbw_hazard(); kvm->arch.commpage_tlb = wired; kvm_debug("[%d] commpage TLB: %d\n", smp_processor_id(), kvm->arch.commpage_tlb); }
void __cpuinit tlb_init(void) { /* * You should never change this register: * - On R4600 1.7 the tlbp never hits for pages smaller than * the value in the c0_pagemask register. * - The entire mm handling assumes the c0_pagemask register to * be set to fixed-size pages. */ write_c0_pagemask(PM_DEFAULT_MASK); write_c0_wired(0); if (current_cpu_type() == CPU_R10000 || current_cpu_type() == CPU_R12000 || current_cpu_type() == CPU_R14000) write_c0_framemask(0); if (kernel_uses_smartmips_rixi) { /* * Enable the no read, no exec bits, and enable large virtual * address. */ u32 pg = PG_RIE | PG_XIE; #ifdef CONFIG_64BIT pg |= PG_ELPA; #endif write_c0_pagegrain(pg); } //temp_tlb_entry = current_cpu_data.tlbsize - 1; printk("TLB ÊýÁ¿%d.\n", current_cpu_data.tlbsize); /* From this point on the ARC firmware is dead. */ local_flush_tlb_all(); /* Did I tell you that ARC SUCKS? */ // if (ntlb) { // if (ntlb > 1 && ntlb <= current_cpu_data.tlbsize) { // int wired = current_cpu_data.tlbsize - ntlb; // write_c0_wired(wired); // write_c0_index(wired-1); // printk("Restricting TLB to %d entries\n", ntlb); // } else // printk("Ignoring invalid argument ntlb=%d\n", ntlb); // } // build_tlb_refill_handler(); }
static void ipu_add_wired_entry(unsigned long pid, unsigned long entrylo0, unsigned long entrylo1, unsigned long entryhi, unsigned long pagemask) { unsigned long flags; unsigned long wired; unsigned long old_pagemask; unsigned long old_ctx; struct task_struct *g, *p; do_each_thread(g, p) { if (p->pid == pid ) g_asid = p->mm->context[0]; } while_each_thread(g, p); local_irq_save(flags); /* Save old context and create impossible VPN2 value */ old_ctx = read_c0_entryhi() & 0xff; old_pagemask = read_c0_pagemask(); wired = read_c0_wired(); write_c0_wired(wired + 1); write_c0_index(wired); BARRIER; entryhi &= ~0xff; /* new add, 20070906 */ entryhi |= g_asid; /* new add, 20070906 */ // entryhi |= old_ctx; /* new add, 20070906 */ write_c0_pagemask(pagemask); write_c0_entryhi(entryhi); write_c0_entrylo0(entrylo0); write_c0_entrylo1(entrylo1); BARRIER; tlb_write_indexed(); BARRIER; write_c0_entryhi(old_ctx); BARRIER; write_c0_pagemask(old_pagemask); local_flush_tlb_all(); local_irq_restore(flags); #if defined(DEBUG) printk("\nold_ctx=%03d\n", old_ctx); show_tlb(); #endif }
static __init void wire_stupidity_into_tlb(void) { #ifdef CONFIG_32BIT write_c0_wired(0); local_flush_tlb_all(); /* marvell and extra space */ add_wired_entry(ENTRYLO(0xf4000000), ENTRYLO(0xf4010000), 0xf4000000UL, PM_64K); /* fpga, rtc, and uart */ add_wired_entry(ENTRYLO(0xfc000000), ENTRYLO(0xfd000000), 0xfc000000UL, PM_16M); // /* m-sys and internal SRAM */ // add_wired_entry(ENTRYLO(0xfe000000), ENTRYLO(0xff000000), // 0xfe000000UL, PM_16M); marvell_base = 0xf4000000; //mv64340_sram_base = 0xfe000000; /* Currently unused */ #endif }
static inline void software_reset(void) { uint16_t pmucnt2; switch (current_cpu_type()) { case CPU_VR4122: case CPU_VR4131: case CPU_VR4133: pmucnt2 = pmu_read(PMUCNT2REG); pmucnt2 |= SOFTRST; pmu_write(PMUCNT2REG, pmucnt2); break; default: set_c0_status(ST0_BEV | ST0_ERL); change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED); __flush_cache_all(); write_c0_wired(0); __asm__("jr %0"::"r"(0xbfc00000)); break; } }
static int add_wired_tlb_entry(uint32_t entrylo0, uint32_t entrylo1, uint32_t entryhi, uint32_t pgsize) { uint32_t tlbindex; tlbindex = read_c0_wired(); if (tlbindex >= get_tlb_size() || tlbindex >= C0_WIRED_MASK) { printk(BIOS_ERR, "Ran out of TLB entries\n"); return -1; } write_c0_wired(tlbindex + 1); write_c0_index(tlbindex); write_c0_pagemask(((pgsize / MIN_PAGE_SIZE) - 1) << C0_PAGEMASK_SHIFT); write_c0_entryhi(entryhi); write_c0_entrylo0(entrylo0); write_c0_entrylo1(entrylo1); mtc0_tlbw_hazard(); tlb_write_indexed(); tlbw_use_hazard(); return 0; }
void au1000_restart(char *command) { /* Set all integrated peripherals to disabled states */ u32 prid = read_c0_prid(); printk(KERN_NOTICE "\n** Resetting Integrated Peripherals\n"); switch (prid & 0xFF000000) { case 0x00000000: /* Au1000 */ au_writel(0x02, 0xb0000010); /* ac97_enable */ au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */ asm("sync"); au_writel(0x00, 0xb017fffc); /* usbh_enable */ au_writel(0x00, 0xb0200058); /* usbd_enable */ au_writel(0x00, 0xb0300040); /* ir_enable */ au_writel(0x00, 0xb0520000); /* macen0 */ au_writel(0x00, 0xb0520004); /* macen1 */ au_writel(0x00, 0xb1000008); /* i2s_enable */ au_writel(0x00, 0xb1100100); /* uart0_enable */ au_writel(0x00, 0xb1200100); /* uart1_enable */ au_writel(0x00, 0xb1300100); /* uart2_enable */ au_writel(0x00, 0xb1400100); /* uart3_enable */ au_writel(0x02, 0xb1600100); /* ssi0_enable */ au_writel(0x02, 0xb1680100); /* ssi1_enable */ au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */ au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */ au_writel(0x00, 0xb1900028); /* sys_clksrc */ au_writel(0x00, 0xb1900100); /* sys_pininputen */ break; case 0x01000000: /* Au1500 */ au_writel(0x02, 0xb0000010); /* ac97_enable */ au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */ asm("sync"); au_writel(0x00, 0xb017fffc); /* usbh_enable */ au_writel(0x00, 0xb0200058); /* usbd_enable */ au_writel(0x00, 0xb1520000); /* macen0 */ au_writel(0x00, 0xb1520004); /* macen1 */ au_writel(0x00, 0xb1100100); /* uart0_enable */ au_writel(0x00, 0xb1400100); /* uart3_enable */ au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */ au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */ au_writel(0x00, 0xb1900028); /* sys_clksrc */ au_writel(0x00, 0xb1900100); /* sys_pininputen */ break; case 0x02000000: /* Au1100 */ au_writel(0x02, 0xb0000010); /* ac97_enable */ au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */ asm("sync"); au_writel(0x00, 0xb017fffc); /* usbh_enable */ au_writel(0x00, 0xb0200058); /* usbd_enable */ au_writel(0x00, 0xb0300040); /* ir_enable */ au_writel(0x00, 0xb0520000); /* macen0 */ au_writel(0x00, 0xb1000008); /* i2s_enable */ au_writel(0x00, 0xb1100100); /* uart0_enable */ au_writel(0x00, 0xb1200100); /* uart1_enable */ au_writel(0x00, 0xb1400100); /* uart3_enable */ au_writel(0x02, 0xb1600100); /* ssi0_enable */ au_writel(0x02, 0xb1680100); /* ssi1_enable */ au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */ au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */ au_writel(0x00, 0xb1900028); /* sys_clksrc */ au_writel(0x00, 0xb1900100); /* sys_pininputen */ break; default: break; } set_c0_status(ST0_BEV | ST0_ERL); set_c0_config(CONF_CM_UNCACHED); flush_cache_all(); write_c0_wired(0); #if defined(CONFIG_MIPS_PB1500) || defined(CONFIG_MIPS_PB1100) || defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_VEGAS) /* Do a HW reset if the board can do it */ au_writel(0x00000000, 0xAE00001C); #endif __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000)); }
void au1000_restart(char *command) { /* Set all integrated peripherals to disabled states */ extern void board_reset (void); u32 prid = read_c0_prid(); printk(KERN_NOTICE "\n** Resetting Integrated Peripherals\n"); switch (prid & 0xFF000000) { case 0x00000000: /* Au1000 */ au_writel(0x02, 0xb0000010); /* ac97_enable */ au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */ asm("sync"); au_writel(0x00, 0xb017fffc); /* usbh_enable */ au_writel(0x00, 0xb0200058); /* usbd_enable */ au_writel(0x00, 0xb0300040); /* ir_enable */ au_writel(0x00, 0xb4004104); /* mac dma */ au_writel(0x00, 0xb4004114); /* mac dma */ au_writel(0x00, 0xb4004124); /* mac dma */ au_writel(0x00, 0xb4004134); /* mac dma */ au_writel(0x00, 0xb0520000); /* macen0 */ au_writel(0x00, 0xb0520004); /* macen1 */ au_writel(0x00, 0xb1000008); /* i2s_enable */ au_writel(0x00, 0xb1100100); /* uart0_enable */ au_writel(0x00, 0xb1200100); /* uart1_enable */ au_writel(0x00, 0xb1300100); /* uart2_enable */ au_writel(0x00, 0xb1400100); /* uart3_enable */ au_writel(0x02, 0xb1600100); /* ssi0_enable */ au_writel(0x02, 0xb1680100); /* ssi1_enable */ au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */ au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */ au_writel(0x00, 0xb1900028); /* sys_clksrc */ au_writel(0x10, 0xb1900060); /* sys_cpupll */ au_writel(0x00, 0xb1900064); /* sys_auxpll */ au_writel(0x00, 0xb1900100); /* sys_pininputen */ break; case 0x01000000: /* Au1500 */ au_writel(0x02, 0xb0000010); /* ac97_enable */ au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */ asm("sync"); au_writel(0x00, 0xb017fffc); /* usbh_enable */ au_writel(0x00, 0xb0200058); /* usbd_enable */ au_writel(0x00, 0xb4004104); /* mac dma */ au_writel(0x00, 0xb4004114); /* mac dma */ au_writel(0x00, 0xb4004124); /* mac dma */ au_writel(0x00, 0xb4004134); /* mac dma */ au_writel(0x00, 0xb1520000); /* macen0 */ au_writel(0x00, 0xb1520004); /* macen1 */ au_writel(0x00, 0xb1100100); /* uart0_enable */ au_writel(0x00, 0xb1400100); /* uart3_enable */ au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */ au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */ au_writel(0x00, 0xb1900028); /* sys_clksrc */ au_writel(0x10, 0xb1900060); /* sys_cpupll */ au_writel(0x00, 0xb1900064); /* sys_auxpll */ au_writel(0x00, 0xb1900100); /* sys_pininputen */ break; case 0x02000000: /* Au1100 */ au_writel(0x02, 0xb0000010); /* ac97_enable */ au_writel(0x08, 0xb017fffc); /* usbh_enable - early errata */ asm("sync"); au_writel(0x00, 0xb017fffc); /* usbh_enable */ au_writel(0x00, 0xb0200058); /* usbd_enable */ au_writel(0x00, 0xb0300040); /* ir_enable */ au_writel(0x00, 0xb4004104); /* mac dma */ au_writel(0x00, 0xb4004114); /* mac dma */ au_writel(0x00, 0xb4004124); /* mac dma */ au_writel(0x00, 0xb4004134); /* mac dma */ au_writel(0x00, 0xb0520000); /* macen0 */ au_writel(0x00, 0xb1000008); /* i2s_enable */ au_writel(0x00, 0xb1100100); /* uart0_enable */ au_writel(0x00, 0xb1200100); /* uart1_enable */ au_writel(0x00, 0xb1400100); /* uart3_enable */ au_writel(0x02, 0xb1600100); /* ssi0_enable */ au_writel(0x02, 0xb1680100); /* ssi1_enable */ au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */ au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */ au_writel(0x00, 0xb1900028); /* sys_clksrc */ au_writel(0x10, 0xb1900060); /* sys_cpupll */ au_writel(0x00, 0xb1900064); /* sys_auxpll */ au_writel(0x00, 0xb1900100); /* sys_pininputen */ break; case 0x03000000: /* Au1550 */ au_writel(0x00, 0xb1a00004); /* psc 0 */ au_writel(0x00, 0xb1b00004); /* psc 1 */ au_writel(0x00, 0xb0a00004); /* psc 2 */ au_writel(0x00, 0xb0b00004); /* psc 3 */ au_writel(0x00, 0xb017fffc); /* usbh_enable */ au_writel(0x00, 0xb0200058); /* usbd_enable */ au_writel(0x00, 0xb4004104); /* mac dma */ au_writel(0x00, 0xb4004114); /* mac dma */ au_writel(0x00, 0xb4004124); /* mac dma */ au_writel(0x00, 0xb4004134); /* mac dma */ au_writel(0x00, 0xb1520000); /* macen0 */ au_writel(0x00, 0xb1520004); /* macen1 */ au_writel(0x00, 0xb1100100); /* uart0_enable */ au_writel(0x00, 0xb1200100); /* uart1_enable */ au_writel(0x00, 0xb1400100); /* uart3_enable */ au_writel(0x00, 0xb1900020); /* sys_freqctrl0 */ au_writel(0x00, 0xb1900024); /* sys_freqctrl1 */ au_writel(0x00, 0xb1900028); /* sys_clksrc */ au_writel(0x10, 0xb1900060); /* sys_cpupll */ au_writel(0x00, 0xb1900064); /* sys_auxpll */ au_writel(0x00, 0xb1900100); /* sys_pininputen */ break; default: break; } set_c0_status(ST0_BEV | ST0_ERL); change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED); flush_cache_all(); write_c0_wired(0); /* Give board a chance to do a hardware reset */ board_reset(); /* Jump to the beggining in case board_reset() is empty */ __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000)); }