Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/cell: Cleanup sysreset_hack for IBM cell blades

This patch adds a config option for the sysreset_hack used for
IBM Cell blades. The code is moves from pervasive.c into ras.c and
gets it's own init method.

Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Christian Krafft and committed by
Benjamin Herrenschmidt
70694a8b 880e7105

+64 -26
+8
arch/powerpc/platforms/cell/Kconfig
··· 83 83 depends on PPC_CELL_NATIVE 84 84 default y 85 85 86 + config PPC_IBM_CELL_RESETBUTTON 87 + bool "IBM Cell Blade Pinhole reset button" 88 + depends on CBE_RAS && PPC_IBM_CELL_BLADE 89 + default y 90 + help 91 + Support Pinhole Resetbutton on IBM Cell blades. 92 + This adds a method to trigger system reset via front panel pinhole button. 93 + 86 94 config CBE_THERM 87 95 tristate "CBE thermal support" 88 96 default m
+1 -26
arch/powerpc/platforms/cell/pervasive.c
··· 38 38 39 39 #include "pervasive.h" 40 40 41 - static int sysreset_hack; 42 - 43 41 static void cbe_power_save(void) 44 42 { 45 43 unsigned long ctrl, thread_switch_control; ··· 85 87 86 88 static int cbe_system_reset_exception(struct pt_regs *regs) 87 89 { 88 - int cpu; 89 - struct cbe_pmd_regs __iomem *pmd; 90 - 91 90 switch (regs->msr & SRR1_WAKEMASK) { 92 91 case SRR1_WAKEEE: 93 92 do_IRQ(regs); ··· 93 98 timer_interrupt(regs); 94 99 break; 95 100 case SRR1_WAKEMT: 96 - /* 97 - * The BMC can inject user triggered system reset exceptions, 98 - * but cannot set the system reset reason in srr1, 99 - * so check an extra register here. 100 - */ 101 - if (sysreset_hack && (cpu = smp_processor_id()) == 0) { 102 - pmd = cbe_get_cpu_pmd_regs(cpu); 103 - if (in_be64(&pmd->ras_esc_0) & 0xffff) { 104 - out_be64(&pmd->ras_esc_0, 0); 105 - return 0; 106 - } 107 - } 108 - break; 101 + return cbe_sysreset_hack(); 109 102 #ifdef CONFIG_CBE_RAS 110 103 case SRR1_WAKESYSERR: 111 104 cbe_system_error_exception(regs); ··· 117 134 if (!cpu_has_feature(CPU_FTR_PAUSE_ZERO)) 118 135 return; 119 136 120 - sysreset_hack = machine_is_compatible("IBM,CBPLUS-1.0"); 121 - 122 137 for_each_possible_cpu(cpu) { 123 138 struct cbe_pmd_regs __iomem *regs = cbe_get_cpu_pmd_regs(cpu); 124 139 if (!regs) ··· 125 144 /* Enable Pause(0) control bit */ 126 145 out_be64(&regs->pmcr, in_be64(&regs->pmcr) | 127 146 CBE_PMD_PAUSE_ZERO_CONTROL); 128 - 129 - /* Enable JTAG system-reset hack */ 130 - if (sysreset_hack) 131 - out_be32(&regs->fir_mode_reg, 132 - in_be32(&regs->fir_mode_reg) | 133 - CBE_PMD_FIR_MODE_M8); 134 147 } 135 148 136 149 ppc_md.power_save = cbe_power_save;
+9
arch/powerpc/platforms/cell/pervasive.h
··· 30 30 extern void cbe_maintenance_exception(struct pt_regs *regs); 31 31 extern void cbe_thermal_exception(struct pt_regs *regs); 32 32 33 + #ifdef CONFIG_PPC_IBM_CELL_RESETBUTTON 34 + extern int cbe_sysreset_hack(void); 35 + #else 36 + static inline int cbe_sysreset_hack(void) 37 + { 38 + return 1; 39 + } 40 + #endif /* CONFIG_PPC_IBM_CELL_RESETBUTTON */ 41 + 33 42 #endif
+46
arch/powerpc/platforms/cell/ras.c
··· 236 236 .notifier_call = cbe_ptcal_notify_reboot 237 237 }; 238 238 239 + #ifdef CONFIG_PPC_IBM_CELL_RESETBUTTON 240 + static int sysreset_hack; 241 + 242 + static int __init cbe_sysreset_init(void) 243 + { 244 + struct cbe_pmd_regs __iomem *regs; 245 + 246 + sysreset_hack = machine_is_compatible("IBM,CBPLUS-1.0"); 247 + if (!sysreset_hack) 248 + return 0; 249 + 250 + regs = cbe_get_cpu_pmd_regs(0); 251 + if (!regs) 252 + return 0; 253 + 254 + /* Enable JTAG system-reset hack */ 255 + out_be32(&regs->fir_mode_reg, 256 + in_be32(&regs->fir_mode_reg) | 257 + CBE_PMD_FIR_MODE_M8); 258 + 259 + return 0; 260 + } 261 + device_initcall(cbe_sysreset_init); 262 + 263 + int cbe_sysreset_hack(void) 264 + { 265 + struct cbe_pmd_regs __iomem *regs; 266 + 267 + /* 268 + * The BMC can inject user triggered system reset exceptions, 269 + * but cannot set the system reset reason in srr1, 270 + * so check an extra register here. 271 + */ 272 + if (sysreset_hack && (smp_processor_id() == 0)) { 273 + regs = cbe_get_cpu_pmd_regs(0); 274 + if (!regs) 275 + return 0; 276 + if (in_be64(&regs->ras_esc_0) & 0x0000ffff) { 277 + out_be64(&regs->ras_esc_0, 0); 278 + return 0; 279 + } 280 + } 281 + return 1; 282 + } 283 + #endif /* CONFIG_PPC_IBM_CELL_RESETBUTTON */ 284 + 239 285 int __init cbe_ptcal_init(void) 240 286 { 241 287 int ret;