[POWERPC] ps3: get firmware version
authorGeoff Levand <geoffrey.levand@am.sony.com>
Sat, 27 Jan 2007 03:08:21 +0000 (19:08 -0800)
committerPaul Mackerras <paulus@samba.org>
Wed, 7 Feb 2007 03:03:18 +0000 (14:03 +1100)
Add a new routine ps3_get_firmware_version() and use it to output the firmware
version to dmesg.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/ps3/setup.c
include/asm-powerpc/ps3.h

index 8b0569853fcd95257ea2f96853c3341fab2e679a..cb91a81352bfbdaae4003e30113a4ec7e0bcd6cf 100644 (file)
@@ -32,6 +32,7 @@
 #include <asm/udbg.h>
 #include <asm/prom.h>
 #include <asm/lv1call.h>
+#include <asm/ps3.h>
 
 #include "platform.h"
 
 #define DBG(fmt...) do{if(0)printk(fmt);}while(0)
 #endif
 
+int ps3_get_firmware_version(union ps3_firmware_version *v)
+{
+       int result = lv1_get_version_info(&v->raw);
+
+       if (result) {
+               v->raw = 0;
+               return -1;
+       }
+
+       return result;
+}
+EXPORT_SYMBOL_GPL(ps3_get_firmware_version);
+
 static void ps3_power_save(void)
 {
        /*
@@ -69,8 +83,14 @@ static void ps3_panic(char *str)
 
 static void __init ps3_setup_arch(void)
 {
+       union ps3_firmware_version v;
+
        DBG(" -> %s:%d\n", __func__, __LINE__);
 
+       ps3_get_firmware_version(&v);
+       printk(KERN_INFO "PS3 firmware version %u.%u.%u\n", v.major, v.minor,
+               v.rev);
+
        ps3_spu_set_platform();
        ps3_map_htab();
 
index 00a4c7d3c6d1e2767dec2eecdd289e266ca16b2e..d1ae87df7776bd4133511a00cbd117c6fe5902d7 100644 (file)
 #include <linux/device.h>
 #include <scsi/scsi.h>
 
+union ps3_firmware_version {
+       u64 raw;
+       struct {
+               u16 pad;
+               u16 major;
+               u16 minor;
+               u16 rev;
+       };
+};
+
+int ps3_get_firmware_version(union ps3_firmware_version *v);
+
 /**
  * struct ps3_device_id - HV bus device identifier from the system repository
  * @bus_id: HV bus id, {1..} (zero invalid)