* [PATCH 13/16] ps3: get firmware version
@ 2007-01-27 3:08 Geoff Levand
2007-01-27 11:30 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Geoff Levand @ 2007-01-27 3:08 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
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>
---
Changed from a struct to a union and got rid of the output to /proc/cpuinfo.
I'll look into arranging something in /proc/device-tree that userspace utils
can query.
arch/powerpc/platforms/ps3/setup.c | 20 ++++++++++++++++++++
include/asm-powerpc/ps3.h | 12 ++++++++++++
2 files changed, 32 insertions(+)
--- ps3-linux-dev.orig/arch/powerpc/platforms/ps3/setup.c
+++ ps3-linux-dev/arch/powerpc/platforms/ps3/setup.c
@@ -32,6 +32,7 @@
#include <asm/udbg.h>
#include <asm/prom.h>
#include <asm/lv1call.h>
+#include <asm/ps3.h>
#include "platform.h"
@@ -41,6 +42,19 @@
#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();
--- ps3-linux-dev.orig/include/asm-powerpc/ps3.h
+++ ps3-linux-dev/include/asm-powerpc/ps3.h
@@ -27,6 +27,18 @@
#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)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 13/16] ps3: get firmware version
2007-01-27 3:08 [PATCH 13/16] ps3: get firmware version Geoff Levand
@ 2007-01-27 11:30 ` Arnd Bergmann
2007-01-29 19:13 ` Geoff Levand
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2007-01-27 11:30 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Mackerras
On Saturday 27 January 2007 04:08, Geoff Levand wrote:
> 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>
> Changed from a struct to a union and got rid of the output to /proc/cpuinfo.
> I'll look into arranging something in /proc/device-tree that userspace utils
> can query.
What's the current plan for the creating the device tree anyway? I think
this should be part of the boot wrapper for the kernel in the ps3 flash,
which can write the version into the flattened device tree. The second
kernel then gets a copy of that through kboot.
Arnd <><
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 13/16] ps3: get firmware version
2007-01-27 11:30 ` Arnd Bergmann
@ 2007-01-29 19:13 ` Geoff Levand
2007-01-29 21:22 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 4+ messages in thread
From: Geoff Levand @ 2007-01-29 19:13 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linuxppc-dev, Paul Mackerras
Arnd Bergmann wrote:
>> Changed from a struct to a union and got rid of the output to /proc/cpuinfo.
>> I'll look into arranging something in /proc/device-tree that userspace utils
>> can query.
>
> What's the current plan for the creating the device tree anyway? I think
> this should be part of the boot wrapper for the kernel in the ps3 flash,
> which can write the version into the flattened device tree. The second
> kernel then gets a copy of that through kboot.
Yes, that's hopefully ppossible, start with the static tree from ps3.dts then
add some properties in the first stage (romboot) wrapper entry. kboot then
passes that to the second stage wrapper entry, which passes it to the
second stage kernel. I suppose the second stage wrapper could do some
processing on it if needed. Backward compatibility with the 2.6.16 bootloader
will probably need that.
To make it work, I need to arrange to do 64 bit HV calls from the 32 bit
wrapper. I'm not yet entirely sure how to set that up. Any suggestions
would be welcome.
-Geoff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 13/16] ps3: get firmware version
2007-01-29 19:13 ` Geoff Levand
@ 2007-01-29 21:22 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2007-01-29 21:22 UTC (permalink / raw)
To: Geoff Levand; +Cc: linuxppc-dev, Paul Mackerras, Arnd Bergmann
> To make it work, I need to arrange to do 64 bit HV calls from the 32 bit
> wrapper. I'm not yet entirely sure how to set that up. Any suggestions
> would be welcome.
You can use the ld and std instructions in 32 bits mode to load / store
full 64 bits registers. So you can define wrappers for the few HV calls
you need that either put all args in an array of 64 bits entries that
your asm wrapper then loads in registers using "ld" (and stores back the
results using std) or you can define proper wrappers per functions that
"turn" the arguments into the right shape for the 64 bits call (a bit
harder since 32 bits will pass 64 bits values as 2 registers, so you'd
have to write them on the stack and load the combined value with ld...)
Ben.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-01-29 21:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-27 3:08 [PATCH 13/16] ps3: get firmware version Geoff Levand
2007-01-27 11:30 ` Arnd Bergmann
2007-01-29 19:13 ` Geoff Levand
2007-01-29 21:22 ` Benjamin Herrenschmidt
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).