void cbe_read_trace_buffer(u32 cpu, u64 *buf) { struct cbe_pmd_regs __iomem *pmd_regs = cbe_get_cpu_pmd_regs(cpu); *buf++ = in_be64(&pmd_regs->trace_buffer_0_63); *buf++ = in_be64(&pmd_regs->trace_buffer_64_127); }
void __init cbe_pervasive_init(void) { int cpu; if (!cpu_has_feature(CPU_FTR_PAUSE_ZERO)) return; sysreset_hack = machine_is_compatible("IBM,CBPLUS-1.0"); for_each_possible_cpu(cpu) { struct cbe_pmd_regs __iomem *regs = cbe_get_cpu_pmd_regs(cpu); if (!regs) continue; /* Enable Pause(0) control bit */ out_be64(®s->pmcr, in_be64(®s->pmcr) | CBE_PMD_PAUSE_ZERO_CONTROL); /* Enable JTAG system-reset hack */ if (sysreset_hack) out_be32(®s->fir_mode_reg, in_be32(®s->fir_mode_reg) | CBE_PMD_FIR_MODE_M8); } ppc_md.power_save = cbe_power_save; ppc_md.system_reset_exception = cbe_system_reset_exception; }
int cbe_cpufreq_get_pmode(int cpu) { int ret; struct cbe_pmd_regs __iomem *pmd_regs; pmd_regs = cbe_get_cpu_pmd_regs(cpu); ret = in_be64(&pmd_regs->pmsr) & 0x07; return ret; }
int cbe_cpufreq_set_pmode(int cpu, unsigned int pmode) { struct cbe_pmd_regs __iomem *pmd_regs; struct cbe_mic_tm_regs __iomem *mic_tm_regs; u64 flags; u64 value; #ifdef DEBUG long time; #endif local_irq_save(flags); mic_tm_regs = cbe_get_cpu_mic_tm_regs(cpu); pmd_regs = cbe_get_cpu_pmd_regs(cpu); #ifdef DEBUG time = jiffies; #endif out_be64(&mic_tm_regs->slow_fast_timer_0, MIC_Slow_Fast_Timer_table[pmode]); out_be64(&mic_tm_regs->slow_fast_timer_1, MIC_Slow_Fast_Timer_table[pmode]); out_be64(&mic_tm_regs->slow_next_timer_0, MIC_Slow_Next_Timer_table[pmode]); out_be64(&mic_tm_regs->slow_next_timer_1, MIC_Slow_Next_Timer_table[pmode]); value = in_be64(&pmd_regs->pmcr); /* set bits to zero */ value &= 0xFFFFFFFFFFFFFFF8ull; /* set bits to next pmode */ value |= pmode; out_be64(&pmd_regs->pmcr, value); #ifdef DEBUG /* wait until new pmode appears in status register */ value = in_be64(&pmd_regs->pmsr) & 0x07; while(value != pmode) { cpu_relax(); value = in_be64(&pmd_regs->pmsr) & 0x07; } time = jiffies - time; time = jiffies_to_msecs(time); pr_debug("had to wait %lu ms for a transition using " \ "pervasive unit\n", time); #endif local_irq_restore(flags); return 0; }
void __init cbe_pervasive_init(void) { int cpu; if (!cpu_has_feature(CPU_FTR_PAUSE_ZERO)) return; for_each_possible_cpu(cpu) { struct cbe_pmd_regs __iomem *regs = cbe_get_cpu_pmd_regs(cpu); if (!regs) continue; /* Enable Pause(0) control bit */ out_be64(®s->pmcr, in_be64(®s->pmcr) | CBE_PMD_PAUSE_ZERO_CONTROL); } ppc_md.power_save = cbe_power_save; ppc_md.system_reset_exception = cbe_system_reset_exception; }
static int cbe_system_reset_exception(struct pt_regs *regs) { int cpu; struct cbe_pmd_regs __iomem *pmd; switch (regs->msr & SRR1_WAKEMASK) { case SRR1_WAKEEE: do_IRQ(regs); break; case SRR1_WAKEDEC: timer_interrupt(regs); break; case SRR1_WAKEMT: /* * The BMC can inject user triggered system reset exceptions, * but cannot set the system reset reason in srr1, * so check an extra register here. */ if (sysreset_hack && (cpu = smp_processor_id()) == 0) { pmd = cbe_get_cpu_pmd_regs(cpu); if (in_be64(&pmd->ras_esc_0) & 0xffff) { out_be64(&pmd->ras_esc_0, 0); return 0; } } break; #ifdef CONFIG_CBE_RAS case SRR1_WAKESYSERR: cbe_system_error_exception(regs); break; case SRR1_WAKETHERM: cbe_thermal_exception(regs); break; #endif /* CONFIG_CBE_RAS */ default: /* do system reset */ return 0; } /* everything handled */ return 1; }
static void __init cbe_enable_pause_zero(void) { unsigned long thread_switch_control; unsigned long temp_register; struct cbe_pmd_regs __iomem *pregs; spin_lock_irq(&cbe_pervasive_lock); pregs = cbe_get_cpu_pmd_regs(smp_processor_id()); if (pregs == NULL) goto out; pr_debug("Power Management: CPU %d\n", smp_processor_id()); /* Enable Pause(0) control bit */ temp_register = in_be64(&pregs->pm_control); out_be64(&pregs->pm_control, temp_register | CBE_PMD_PAUSE_ZERO_CONTROL); /* Enable DEC and EE interrupt request */ thread_switch_control = mfspr(SPRN_TSC_CELL); thread_switch_control |= TSC_CELL_EE_ENABLE | TSC_CELL_EE_BOOST; switch ((mfspr(SPRN_CTRLF) & CTRL_CT)) { case CTRL_CT0: thread_switch_control |= TSC_CELL_DEC_ENABLE_0; break; case CTRL_CT1: thread_switch_control |= TSC_CELL_DEC_ENABLE_1; break; default: printk(KERN_WARNING "%s: unknown configuration\n", __FUNCTION__); break; } mtspr(SPRN_TSC_CELL, thread_switch_control); out: spin_unlock_irq(&cbe_pervasive_lock); }
static void dump_fir(int cpu) { struct cbe_pmd_regs __iomem *pregs = cbe_get_cpu_pmd_regs(cpu); struct cbe_iic_regs __iomem *iregs = cbe_get_cpu_iic_regs(cpu); if (pregs == NULL) return; /* Todo: do some nicer parsing of bits and based on them go down * to other sub-units FIRs and not only IIC */ printk(KERN_ERR "Global Checkstop FIR : 0x%016lx\n", in_be64(&pregs->checkstop_fir)); printk(KERN_ERR "Global Recoverable FIR : 0x%016lx\n", in_be64(&pregs->checkstop_fir)); printk(KERN_ERR "Global MachineCheck FIR : 0x%016lx\n", in_be64(&pregs->spec_att_mchk_fir)); if (iregs == NULL) return; printk(KERN_ERR "IOC FIR : 0x%016lx\n", in_be64(&iregs->ioc_fir)); }