From: Christian Krafft <krafft@de.ibm.com>
To: Christian Krafft <krafft@linux.ibm.com>
Cc: cbe-oss-dev@ozlabs.org, arnd@arndb.de, linuxppc-dev@ozlabs.org
Subject: Re: [Cbe-oss-dev] [patch 01/02] powerpc/cell: cleanup sysreset_hack for IBM cell blades
Date: Mon, 7 Jul 2008 18:54:28 +0200 [thread overview]
Message-ID: <20080707185428.042a6131@de.ibm.com> (raw)
In-Reply-To: <20080707184756.16e52677@linux.ibm.com>
From: Christian Krafft <krafft@de.ibm.com>
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>
Index: linux.git/arch/powerpc/platforms/cell/pervasive.c
===================================================================
--- linux.git.orig/arch/powerpc/platforms/cell/pervasive.c
+++ linux.git/arch/powerpc/platforms/cell/pervasive.c
@@ -38,8 +38,6 @@
#include "pervasive.h"
-static int sysreset_hack;
-
static void cbe_power_save(void)
{
unsigned long ctrl, thread_switch_control;
@@ -87,9 +85,6 @@ static void cbe_power_save(void)
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);
@@ -98,19 +93,7 @@ static int cbe_system_reset_exception(st
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;
+ return cbe_sysreset_hack();
#ifdef CONFIG_CBE_RAS
case SRR1_WAKESYSERR:
cbe_system_error_exception(regs);
@@ -134,8 +117,6 @@ void __init cbe_pervasive_init(void)
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)
@@ -144,12 +125,6 @@ void __init cbe_pervasive_init(void)
/* 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;
Index: linux.git/arch/powerpc/platforms/cell/Kconfig
===================================================================
--- linux.git.orig/arch/powerpc/platforms/cell/Kconfig
+++ linux.git/arch/powerpc/platforms/cell/Kconfig
@@ -83,6 +83,14 @@ config CBE_RAS
depends on PPC_CELL_NATIVE
default y
+config PPC_IBM_CELL_BLADE_BUTTONS
+ bool "IBM Cell Blade Buttons"
+ depends on CBE_RAS && PPC_IBM_CELL_BLADE
+ default y
+ help
+ Support Buttons on IBM Cell blades. This adds a method to
+ trigger system reset via front panel pinhole button.
+
config CBE_THERM
tristate "CBE thermal support"
default m
Index: linux.git/arch/powerpc/platforms/cell/pervasive.h
===================================================================
--- linux.git.orig/arch/powerpc/platforms/cell/pervasive.h
+++ linux.git/arch/powerpc/platforms/cell/pervasive.h
@@ -30,4 +30,13 @@ extern void cbe_system_error_exception(s
extern void cbe_maintenance_exception(struct pt_regs *regs);
extern void cbe_thermal_exception(struct pt_regs *regs);
+#ifdef CONFIG_PPC_IBM_CELL_BLADE_BUTTONS
+extern int cbe_sysreset_hack(void);
+#else
+static inline int cbe_sysreset_hack(void)
+{
+ return 1;
+}
+#endif /* CONFIG_PPC_IBM_CELL_BLADE_BUTTONS */
+
#endif
Index: linux.git/arch/powerpc/platforms/cell/ras.c
===================================================================
--- linux.git.orig/arch/powerpc/platforms/cell/ras.c
+++ linux.git/arch/powerpc/platforms/cell/ras.c
@@ -230,6 +230,50 @@ static struct notifier_block cbe_ptcal_r
.notifier_call = cbe_ptcal_notify_reboot
};
+#ifdef CONFIG_PPC_IBM_CELL_BLADE_BUTTONS
+static int sysreset_hack;
+
+static int __init cbe_sysreset_init(void)
+{
+ struct cbe_pmd_regs __iomem *regs;
+
+ sysreset_hack = machine_is_compatible("IBM,CBPLUS-1.0");
+ if (!sysreset_hack)
+ return 0;
+
+ /* Enable JTAG system-reset hack */
+ regs = cbe_get_cpu_pmd_regs(0);
+ if (regs)
+ out_be32(®s->fir_mode_reg,
+ in_be32(®s->fir_mode_reg) |
+ CBE_PMD_FIR_MODE_M8);
+
+ return 0;
+}
+device_initcall(cbe_sysreset_init);
+
+int cbe_sysreset_hack(void)
+{
+ struct cbe_pmd_regs __iomem *regs;
+
+ /*
+ * 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 && (smp_processor_id() == 0)) {
+ regs = cbe_get_cpu_pmd_regs(0);
+ if (!regs)
+ return 0;
+ if (in_be64(®s->ras_esc_0) & 0x0000ffff) {
+ out_be64(®s->ras_esc_0, 0);
+ return 0;
+ }
+ }
+ return 1;
+}
+#endif /* CONFIG_PPC_IBM_CELL_BLADE_BUTTONS */
+
int __init cbe_ptcal_init(void)
{
int ret;
--
Mit freundlichen Gruessen,
kind regards,
Christian Krafft
Linux Kernel Development
IBM Systems & Technology Group
Phone: +49-07031-16-2032
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaetsfuehung: Herbert Kircher
Sitz der Gesellschaft: Boelingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
next prev parent reply other threads:[~2008-07-07 16:54 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-04 19:05 [patch 00/11] Cell patches for 2.6.27 arnd
2008-07-04 19:05 ` [patch 01/11] powerpc/cell: add support for power button of future IBM cell blades arnd
2008-07-07 5:12 ` Benjamin Herrenschmidt
2008-07-07 9:23 ` Christian Krafft
[not found] ` <20080707184756.16e52677@linux.ibm.com>
2008-07-07 16:54 ` Christian Krafft [this message]
2008-07-07 16:56 ` [Cbe-oss-dev] [patch 02/02] " Christian Krafft
2008-07-09 3:35 ` Benjamin Herrenschmidt
2008-07-09 13:15 ` Arnd Bergmann
2008-07-09 20:45 ` Benjamin Herrenschmidt
2008-07-10 14:34 ` Arnd Bergmann
2008-07-07 5:24 ` [patch 01/11] " Stephen Rothwell
2008-07-07 8:40 ` [Cbe-oss-dev] " Arnd Bergmann
2008-07-04 19:05 ` [patch 02/11] powerpc/axonram: use only one block device major number arnd
2008-07-04 19:05 ` [patch 03/11] powerpc/axonram: enable partitioning of the Axons DDR2 DIMMs arnd
2008-07-04 19:05 ` [patch 04/11] powerpc/spufs: add atomic busy_spus counter to struct cbe_spu_info arnd
2008-07-07 5:19 ` Benjamin Herrenschmidt
2008-07-07 5:30 ` Stephen Rothwell
2008-07-07 8:50 ` [Cbe-oss-dev] " Arnd Bergmann
2008-07-04 19:05 ` [patch 05/11] powerpc/cell: add spu aware cpufreq governor arnd
2008-07-07 5:21 ` Benjamin Herrenschmidt
2008-07-07 5:32 ` Stephen Rothwell
2008-07-07 9:01 ` [Cbe-oss-dev] " Arnd Bergmann
2008-07-07 6:24 ` Stephen Rothwell
2008-07-07 8:58 ` [Cbe-oss-dev] " Arnd Bergmann
2008-07-07 14:59 ` Arnd Bergmann
2008-07-07 15:35 ` Josh Boyer
2008-07-07 21:15 ` Arnd Bergmann
2008-07-07 21:17 ` Josh Boyer
2008-07-08 2:40 ` Stephen Rothwell
2008-07-07 19:56 ` Geoff Levand
2008-07-04 19:05 ` [patch 06/11] powerpc: Add struct iommu_table argument to iommu_map_sg() arnd
2008-07-04 19:05 ` [patch 07/11] powerpc/dma: implement new dma_*map*_attrs() interfaces arnd
2008-07-07 5:27 ` Benjamin Herrenschmidt
2008-07-07 19:15 ` Geoff Levand
2008-07-04 19:05 ` [patch 08/11] powerpc/dma: use the struct dma_attrs in iommu code arnd
2008-07-04 19:05 ` [patch 09/11] powerpc/cell: cell_dma_dev_setup_iommu() return the iommu table arnd
2008-07-04 19:05 ` [patch 10/11] powerpc: move device_to_mask() to dma-mapping.h arnd
2008-07-04 19:05 ` [patch 11/11] powerpc/cell: Add DMA_ATTR_STRONG_ORDERING dma attribute and use in IOMMU code arnd
2008-07-05 5:43 ` [Cbe-oss-dev] " Michael Ellerman
2008-07-05 6:28 ` Benjamin Herrenschmidt
2008-07-05 21:51 ` Arnd Bergmann
2008-07-05 22:20 ` Benjamin Herrenschmidt
2008-07-06 15:15 ` Arnd Bergmann
2008-07-07 0:00 ` Michael Ellerman
2008-07-07 9:01 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080707185428.042a6131@de.ibm.com \
--to=krafft@de.ibm.com \
--cc=arnd@arndb.de \
--cc=cbe-oss-dev@ozlabs.org \
--cc=krafft@linux.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).