]> err.no Git - linux-2.6/commitdiff
[POWERPC] PS3: Compare firmware version
authorMasakazu Mokuno <mokuno@sm.sony.co.jp>
Fri, 15 Jun 2007 21:18:48 +0000 (07:18 +1000)
committerPaul Mackerras <paulus@samba.org>
Thu, 28 Jun 2007 09:16:33 +0000 (19:16 +1000)
Add a utility routine ps3_compare_firmware_version() to compare system
firmware versions.  Uses the existing ps3_get_firmware_version() routine.

Signed-off-by: Masakazu Mokuno <mokuno@sm.sony.co.jp>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/ps3/setup.c
include/asm-powerpc/ps3.h

index 9353967666216a33c08520755ce50d1fc65709a9..b79d62b68df594db567c88b186eb429b609d647a 100644 (file)
 static void smp_send_stop(void) {}
 #endif
 
-int ps3_get_firmware_version(union ps3_firmware_version *v)
+static union ps3_firmware_version ps3_firmware_version;
+
+void ps3_get_firmware_version(union ps3_firmware_version *v)
 {
-       int result = lv1_get_version_info(&v->raw);
+       *v = ps3_firmware_version;
+}
+EXPORT_SYMBOL_GPL(ps3_get_firmware_version);
 
-       if (result) {
-               v->raw = 0;
-               return -1;
-       }
+int ps3_compare_firmware_version(u16 major, u16 minor, u16 rev)
+{
+       union ps3_firmware_version x;
+
+       x.pad = 0;
+       x.major = major;
+       x.minor = minor;
+       x.rev = rev;
 
-       return result;
+       return (ps3_firmware_version.raw - x.raw);
 }
-EXPORT_SYMBOL_GPL(ps3_get_firmware_version);
+EXPORT_SYMBOL_GPL(ps3_compare_firmware_version);
 
 static void ps3_power_save(void)
 {
@@ -146,13 +154,13 @@ static int ps3_set_dabr(u64 dabr)
 
 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);
+       lv1_get_version_info(&ps3_firmware_version.raw);
+       printk(KERN_INFO "PS3 firmware version %u.%u.%u\n",
+              ps3_firmware_version.major, ps3_firmware_version.minor,
+              ps3_firmware_version.rev);
 
        ps3_spu_set_platform();
        ps3_map_htab();
index 1e04651eedc4bbc7819b0e17549af58cd6181d49..ac85d729f14fcd7d69425356d9b8ff4f812e036d 100644 (file)
@@ -35,7 +35,8 @@ union ps3_firmware_version {
        };
 };
 
-int ps3_get_firmware_version(union ps3_firmware_version *v);
+void ps3_get_firmware_version(union ps3_firmware_version *v);
+int ps3_compare_firmware_version(u16 major, u16 minor, u16 rev);
 
 /* 'Other OS' area */