Skip to contentSkip to conversation

PS3: System manager support

PATCH Superseded Geoff Levand 3 participants 8 messages Feb 6, 2007 – Feb 7, 2007

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 PS3: System manager support

Add PS3 system manager support and the ppc_md routines restart() and power_off().

The system manager provides an event notification mechanism for reporting events like thermal alert and button presses. It also provides support to control system shutdown and startup.

---
 arch/powerpc/platforms/ps3/Kconfig |   10 
 arch/powerpc/platforms/ps3/setup.c |   27 +
 drivers/ps3/Makefile               |    1 
 drivers/ps3/sys-manager.c          |  621 +++++++++++++++++++++++++++++++++++++
 include/asm-powerpc/ps3.h          |    5 
 5 files changed, 660 insertions(+), 4 deletions(-)
arch/powerpc/platforms/ps3/Kconfig +10 -0
@@ -61,4 +61,14 @@ config PS3_PS3AV
 	  This support is required for graphics and sound. In
 	  general, all users will say Y or M.
 
+config PS3_SYS_MANAGER
+	tristate "PS3 System Manager driver"
+	select PS3_VUART
+	default y
+	help
+	  Include support for the PS3 System Manager.
+
+	  This support is required for system control.  In
+	  general, all users will say Y or M.
+
 endmenu
arch/powerpc/platforms/ps3/setup.c +23 -4
@@ -42,6 +42,10 @@
 #define DBG(fmt...) do{if(0)printk(fmt);}while(0)
 #endif
 
+#if !defined(CONFIG_SMP)
+static void smp_send_stop(void) {}
+#endif
+
 int ps3_get_firmware_version(union ps3_firmware_version *v)
 {
 	int result = lv1_get_version_info(&v->raw);
@@ -66,22 +70,35 @@ static void ps3_power_save(void)
 	lv1_pause(0);
 }
 
+static void ps3_restart(char *cmd)
+{
+	DBG("%s:%d cmd '%s'\n", __func__, __LINE__, cmd);
+
+	smp_send_stop();
+	ps3_sys_manager_restart(); /* never returns */
+}
+
+static void ps3_power_off(void)
+{
+	DBG("%s:%d\n", __func__, __LINE__);
+
+	smp_send_stop();
+	ps3_sys_manager_power_off(); /* never returns */
+}
+
 static void ps3_panic(char *str)
 {
 	DBG("%s:%d %s\n", __func__, __LINE__, str);
 
-#ifdef CONFIG_SMP
 	smp_send_stop();
-#endif
 	printk("\n");
 	printk("   System does not reboot automatically.\n");
 	printk("   Please press POWER button.\n");
 	printk("\n");
 
-	for (;;) ;
+	while(1);
 }
 
-
 static void prealloc(struct ps3_prealloc *p)
 {
 	if (!p->size)
@@ -219,6 +236,8 @@ define_machine(ps3) {
 	.get_rtc_time			= ps3_get_rtc_time,
 	.calibrate_decr			= ps3_calibrate_decr,
 	.progress			= ps3_progress,
+	.restart			= ps3_restart,
+	.power_off			= ps3_power_off,
 #if defined(CONFIG_KEXEC)
 	.kexec_cpu_down			= ps3_kexec_cpu_down,
 	.machine_kexec			= ps3_machine_kexec,
drivers/ps3/Makefile +1 -0
@@ -1,2 +1,3 @@
 obj-$(CONFIG_PS3_VUART) += vuart.o
 obj-$(CONFIG_PS3_PS3AV) += ps3av.o ps3av_cmd.o
+obj-$(CONFIG_PS3_SYS_MANAGER) += sys-manager.o
drivers/ps3/sys-manager.c new file +621 -0

621 lines not on this page · raw message

include/asm-powerpc/ps3.h +5 -0
@@ -370,6 +370,11 @@ struct ps3_vuart_port_device {
 
 int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev);
 
+/* system manager */
+
+void ps3_sys_manager_restart(void);
+void ps3_sys_manager_power_off(void);
+
 struct ps3_prealloc {
     const char *name;
     void *address;
#1 lore raw
Quoted 56 lines · Geoff Levand

Add PS3 system manager support and the ppc_md routines restart() and power_off().

The system manager provides an event notification mechanism for reporting events like thermal alert and button presses. It also provides support to control system shutdown and startup.

---
 arch/powerpc/platforms/ps3/Kconfig |   10 
 arch/powerpc/platforms/ps3/setup.c |   27 +
 drivers/ps3/Makefile               |    1 
 drivers/ps3/sys-manager.c          |  621 +++++++++++++++++++++++++++++++++++++
 include/asm-powerpc/ps3.h          |    5 
 5 files changed, 660 insertions(+), 4 deletions(-)
arch/powerpc/platforms/ps3/Kconfig +10 -0
@@ -61,4 +61,14 @@ config PS3_PS3AV
 	  This support is required for graphics and sound. In
 	  general, all users will say Y or M.
 
+config PS3_SYS_MANAGER
+	tristate "PS3 System Manager driver"
+	select PS3_VUART
+	default y
+	help
+	  Include support for the PS3 System Manager.
+
+	  This support is required for system control.  In
+	  general, all users will say Y or M.
+
 endmenu
arch/powerpc/platforms/ps3/setup.c +9 -0
@@ -42,6 +42,10 @@
 #define DBG(fmt...) do{if(0)printk(fmt);}while(0)
 #endif
 
+#if !defined(CONFIG_SMP)
+static void smp_send_stop(void) {}
+#endif
+
 int ps3_get_firmware_version(union ps3_firmware_version *v)
 {
 	int result = lv1_get_version_info(&v->raw);
@@ -66,22 +70,35 @@ static void ps3_power_save(void)
 	lv1_pause(0);
 }
 
+static void ps3_restart(char *cmd)
+{
+	DBG("%s:%d cmd '%s'\n", __func__, __LINE__, cmd);
+
+	smp_send_stop();

arch/powerpc/platforms/ps3/setup.c static void ps3_power_save(void) · line 87

Quoted 10 lines
arch/powerpc/platforms/ps3/setup.c +10 -0
+	ps3_sys_manager_restart(); /* never returns */
+}
+
+static void ps3_power_off(void)
+{
+	DBG("%s:%d\n", __func__, __LINE__);
+
+	smp_send_stop();
+	ps3_sys_manager_power_off(); /* never returns */
+}

What happens here when the sys manager stuff is built as a module ?

cheers

Signature · 8 lines
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
#2 lore raw
Quoted 61 lines · Michael Ellerman
Quoted 60 lines · Geoff Levand

Add PS3 system manager support and the ppc_md routines restart() and power_off().

The system manager provides an event notification mechanism for reporting events like thermal alert and button presses. It also provides support to control system shutdown and startup.

---
 arch/powerpc/platforms/ps3/Kconfig |   10 
 arch/powerpc/platforms/ps3/setup.c |   27 +
 drivers/ps3/Makefile               |    1 
 drivers/ps3/sys-manager.c          |  621 +++++++++++++++++++++++++++++++++++++
 include/asm-powerpc/ps3.h          |    5 
 5 files changed, 660 insertions(+), 4 deletions(-)
arch/powerpc/platforms/ps3/Kconfig +10 -0
@@ -61,4 +61,14 @@ config PS3_PS3AV
 	  This support is required for graphics and sound. In
 	  general, all users will say Y or M.
 
+config PS3_SYS_MANAGER
+	tristate "PS3 System Manager driver"
+	select PS3_VUART
+	default y
+	help
+	  Include support for the PS3 System Manager.
+
+	  This support is required for system control.  In
+	  general, all users will say Y or M.
+
 endmenu
arch/powerpc/platforms/ps3/setup.c +13 -0
@@ -42,6 +42,10 @@
 #define DBG(fmt...) do{if(0)printk(fmt);}while(0)
 #endif
 
+#if !defined(CONFIG_SMP)
+static void smp_send_stop(void) {}
+#endif
+
 int ps3_get_firmware_version(union ps3_firmware_version *v)
 {
 	int result = lv1_get_version_info(&v->raw);
@@ -66,22 +70,35 @@ static void ps3_power_save(void)
 	lv1_pause(0);
 }
 
+static void ps3_restart(char *cmd)
+{
+	DBG("%s:%d cmd '%s'\n", __func__, __LINE__, cmd);
+
+	smp_send_stop();
+	ps3_sys_manager_restart(); /* never returns */
+}
+
+static void ps3_power_off(void)
Quoted 8 lines

arch/powerpc/platforms/ps3/setup.c static void ps3_power_save(void) · line 87

Quoted 6 lines
arch/powerpc/platforms/ps3/setup.c +6 -0
+{
+	DBG("%s:%d\n", __func__, __LINE__);
+
+	smp_send_stop();
+	ps3_sys_manager_power_off(); /* never returns */
+}

What happens here when the sys manager stuff is built as a module ?

I don't support it as a module yet. I'll change the Kconfig.

-Geoff

#3 lore raw
Quoted 71 lines · Geoff Levand
Quoted 61 lines · Michael Ellerman
Quoted 60 lines · Geoff Levand

Add PS3 system manager support and the ppc_md routines restart() and power_off().

The system manager provides an event notification mechanism for reporting events like thermal alert and button presses. It also provides support to control system shutdown and startup.

---
 arch/powerpc/platforms/ps3/Kconfig |   10 
 arch/powerpc/platforms/ps3/setup.c |   27 +
 drivers/ps3/Makefile               |    1 
 drivers/ps3/sys-manager.c          |  621 +++++++++++++++++++++++++++++++++++++
 include/asm-powerpc/ps3.h          |    5 
 5 files changed, 660 insertions(+), 4 deletions(-)
arch/powerpc/platforms/ps3/Kconfig +10 -0
@@ -61,4 +61,14 @@ config PS3_PS3AV
 	  This support is required for graphics and sound. In
 	  general, all users will say Y or M.
 
+config PS3_SYS_MANAGER
+	tristate "PS3 System Manager driver"
+	select PS3_VUART
+	default y
+	help
+	  Include support for the PS3 System Manager.
+
+	  This support is required for system control.  In
+	  general, all users will say Y or M.
+
 endmenu
arch/powerpc/platforms/ps3/setup.c +13 -0
@@ -42,6 +42,10 @@
 #define DBG(fmt...) do{if(0)printk(fmt);}while(0)
 #endif
 
+#if !defined(CONFIG_SMP)
+static void smp_send_stop(void) {}
+#endif
+
 int ps3_get_firmware_version(union ps3_firmware_version *v)
 {
 	int result = lv1_get_version_info(&v->raw);
@@ -66,22 +70,35 @@ static void ps3_power_save(void)
 	lv1_pause(0);
 }
 
+static void ps3_restart(char *cmd)
+{
+	DBG("%s:%d cmd '%s'\n", __func__, __LINE__, cmd);
+
+	smp_send_stop();
+	ps3_sys_manager_restart(); /* never returns */
+}
+
+static void ps3_power_off(void)
Quoted 8 lines

arch/powerpc/platforms/ps3/setup.c static void ps3_power_save(void) · line 87

Quoted 6 lines
arch/powerpc/platforms/ps3/setup.c +6 -0
+{
+	DBG("%s:%d\n", __func__, __LINE__);
+
+	smp_send_stop();
+	ps3_sys_manager_power_off(); /* never returns */
+}

What happens here when the sys manager stuff is built as a module ?

Quoted 1 line

I don't support it as a module yet. I'll change the Kconfig.

Yeah OK.

I don't think it really makes sense for it to be a module.

cheers

Signature · 8 lines
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
#4 lore raw
Quoted 18 lines · Michael Ellerman
Quoted 18 lines
Quoted 17 lines
Quoted 5 lines
arch/powerpc/platforms/ps3/setup.c +5 -0
+static void ps3_restart(char *cmd)
+{
+	DBG("%s:%d cmd '%s'\n", __func__, __LINE__, cmd);
+
+	smp_send_stop();

arch/powerpc/platforms/ps3/setup.c static void ps3_power_save(void) · line 87

Quoted 10 lines
arch/powerpc/platforms/ps3/setup.c +10 -0
+	ps3_sys_manager_restart(); /* never returns */
+}
+
+static void ps3_power_off(void)
+{
+	DBG("%s:%d\n", __func__, __LINE__);
+
+	smp_send_stop();
+	ps3_sys_manager_power_off(); /* never returns */
+}

What happens here when the sys manager stuff is built as a module ?

Quoted 5 lines
Quoted 1 line

I don't support it as a module yet. I'll change the Kconfig.

Yeah OK.

I don't think it really makes sense for it to be a module.

Well, I was thinking that for multi-platform binaries it would only be loaded when running on ps3. I don't need to support unloading though, since it is needed for proper shutdown. Anyway, for now I'll just make it a static module.

-Geoff

#5 lore raw
In reply to Geoff Levand

arch/powerpc/platforms/ps3/setup.c line 47

Quoted 9 lines · Geoff Levand
arch/powerpc/platforms/ps3/setup.c +3 -0
@@ -42,6 +42,10 @@
 #define DBG(fmt...) do{if(0)printk(fmt);}while(0)
 #endif
 
+#if !defined(CONFIG_SMP)
+static void smp_send_stop(void) {}
+#endif

Shouldn't this be added to include/linux/smp.h instead? That header file already contains some dummy definitions for the non-SMP case.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- Sony Network and Software Technology Center Europe (NSCE) [email protected] ------- The Corporate Village, Da Vincilaan 7-D1 Voice +32-2-7008453 Fax +32-2-7008622 ---------------- B-1935 Zaventem, Belgium

#6 lore raw
Quoted 7 lines · Geert Uytterhoeven
Quoted 6 lines · Geoff Levand
arch/powerpc/platforms/ps3/setup.c +0 -0
@@ -42,6 +42,10 @@
 #define DBG(fmt...) do{if(0)printk(fmt);}while(0)
 #endif
 
Quoted 6 lines

arch/powerpc/platforms/ps3/setup.c line 47

Quoted 3 lines
arch/powerpc/platforms/ps3/setup.c +3 -0
+#if !defined(CONFIG_SMP)
+static void smp_send_stop(void) {}
+#endif

Shouldn't this be added to include/linux/smp.h instead? That header file already contains some dummy definitions for the non-SMP case.

Sounds like a good idea. I'll prepare a seperate patch that does it.

-Geoff

#7 lore raw

PATCH v2 3/3 PS3: System manager support

In reply to Geoff Levand

Add PS3 system manager support and the ppc_md routines restart() and power_off().

The system manager provides an event notification mechanism for reporting events like thermal alert and button presses. It also provides support to control system shutdown and startup.

---
Version 2.

I removed the half-cooked loadable module support as pointed out by Michael. As suggested by Geert, I'll make a seperate patch sometime to move the non-smp smp_send_stop() to include/linx/smp.h.

This patch set of three should be ready for inclusion in 2.6.21.

-Geoff

 arch/powerpc/platforms/ps3/Kconfig |   10 
 arch/powerpc/platforms/ps3/setup.c |   27 +
 drivers/ps3/Makefile               |    1 
 drivers/ps3/sys-manager.c          |  604 +++++++++++++++++++++++++++++++++++++
 include/asm-powerpc/ps3.h          |    5 
 5 files changed, 643 insertions(+), 4 deletions(-)
arch/powerpc/platforms/ps3/Kconfig +10 -0
@@ -61,4 +61,14 @@ config PS3_PS3AV
 	  This support is required for graphics and sound. In
 	  general, all users will say Y or M.
 
+config PS3_SYS_MANAGER
+	bool "PS3 System Manager driver"
+	select PS3_VUART
+	default y
+	help
+	  Include support for the PS3 System Manager.
+
+	  This support is required for system control.  In
+	  general, all users will say Y.
+
 endmenu
arch/powerpc/platforms/ps3/setup.c +23 -4
@@ -42,6 +42,10 @@
 #define DBG(fmt...) do{if(0)printk(fmt);}while(0)
 #endif
 
+#if !defined(CONFIG_SMP)
+static void smp_send_stop(void) {}
+#endif
+
 int ps3_get_firmware_version(union ps3_firmware_version *v)
 {
 	int result = lv1_get_version_info(&v->raw);
@@ -66,22 +70,35 @@ static void ps3_power_save(void)
 	lv1_pause(0);
 }
 
+static void ps3_restart(char *cmd)
+{
+	DBG("%s:%d cmd '%s'\n", __func__, __LINE__, cmd);
+
+	smp_send_stop();
+	ps3_sys_manager_restart(); /* never returns */
+}
+
+static void ps3_power_off(void)
+{
+	DBG("%s:%d\n", __func__, __LINE__);
+
+	smp_send_stop();
+	ps3_sys_manager_power_off(); /* never returns */
+}
+
 static void ps3_panic(char *str)
 {
 	DBG("%s:%d %s\n", __func__, __LINE__, str);
 
-#ifdef CONFIG_SMP
 	smp_send_stop();
-#endif
 	printk("\n");
 	printk("   System does not reboot automatically.\n");
 	printk("   Please press POWER button.\n");
 	printk("\n");
 
-	for (;;) ;
+	while(1);
 }
 
-
 static void prealloc(struct ps3_prealloc *p)
 {
 	if (!p->size)
@@ -219,6 +236,8 @@ define_machine(ps3) {
 	.get_rtc_time			= ps3_get_rtc_time,
 	.calibrate_decr			= ps3_calibrate_decr,
 	.progress			= ps3_progress,
+	.restart			= ps3_restart,
+	.power_off			= ps3_power_off,
 #if defined(CONFIG_KEXEC)
 	.kexec_cpu_down			= ps3_kexec_cpu_down,
 	.machine_kexec			= ps3_machine_kexec,
drivers/ps3/Makefile +1 -0
@@ -1,2 +1,3 @@
 obj-$(CONFIG_PS3_VUART) += vuart.o
 obj-$(CONFIG_PS3_PS3AV) += ps3av.o ps3av_cmd.o
+obj-$(CONFIG_PS3_SYS_MANAGER) += sys-manager.o
drivers/ps3/sys-manager.c new file +604 -0

604 lines not on this page · raw message

include/asm-powerpc/ps3.h +5 -0
@@ -370,6 +370,11 @@ struct ps3_vuart_port_device {
 
 int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev);
 
+/* system manager */
+
+void ps3_sys_manager_restart(void);
+void ps3_sys_manager_power_off(void);
+
 struct ps3_prealloc {
     const char *name;
     void *address;