aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/solaris/misc.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-06-22 23:21:22 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-24 02:15:36 -0400
commit25c7581bcdd11cf9b82a8ef062a10bea310cc9e9 (patch)
treec88f4ee5e91fa7921ff13627f373e1bfbcec8b81 /arch/sparc64/solaris/misc.c
parent44bdef5e8f2e64ba5974b587989a829d57126bad (diff)
[SPARC64]: Kill off some more prom_getproperty() remnants.
The remaining ones occur before we have imported the device tree. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/solaris/misc.c')
-rw-r--r--arch/sparc64/solaris/misc.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c
index 5284996780a7..719c90905a1e 100644
--- a/arch/sparc64/solaris/misc.c
+++ b/arch/sparc64/solaris/misc.c
@@ -23,6 +23,7 @@
23#include <asm/oplib.h> 23#include <asm/oplib.h>
24#include <asm/idprom.h> 24#include <asm/idprom.h>
25#include <asm/smp.h> 25#include <asm/smp.h>
26#include <asm/prom.h>
26 27
27#include "conv.h" 28#include "conv.h"
28 29
@@ -194,14 +195,17 @@ static char *machine(void)
194 } 195 }
195} 196}
196 197
197static char *platform(char *buffer) 198static char *platform(char *buffer, int sz)
198{ 199{
200 struct device_node *dp = of_find_node_by_path("/");
199 int len; 201 int len;
200 202
201 *buffer = 0; 203 *buffer = 0;
202 len = prom_getproperty(prom_root_node, "name", buffer, 256); 204 len = strlen(dp->name);
203 if(len > 0) 205 if (len > sz)
204 buffer[len] = 0; 206 len = sz;
207 memcpy(buffer, dp->name, len);
208 buffer[len] = 0;
205 if (*buffer) { 209 if (*buffer) {
206 char *p; 210 char *p;
207 211
@@ -213,16 +217,22 @@ static char *platform(char *buffer)
213 return "sun4u"; 217 return "sun4u";
214} 218}
215 219
216static char *serial(char *buffer) 220static char *serial(char *buffer, int sz)
217{ 221{
218 int node = prom_getchild(prom_root_node); 222 struct device_node *dp = of_find_node_by_path("/options");
219 int len; 223 int len;
220 224
221 node = prom_searchsiblings(node, "options");
222 *buffer = 0; 225 *buffer = 0;
223 len = prom_getproperty(node, "system-board-serial#", buffer, 256); 226 if (dp) {
224 if(len > 0) 227 char *val = of_get_property(dp, "system-board-serial#", &len);
225 buffer[len] = 0; 228
229 if (val && len > 0) {
230 if (len > sz)
231 len = sz;
232 memcpy(buffer, val, len);
233 buffer[len] = 0;
234 }
235 }
226 if (!*buffer) 236 if (!*buffer)
227 return "4512348717234"; 237 return "4512348717234";
228 else 238 else
@@ -305,8 +315,8 @@ asmlinkage int solaris_sysinfo(int cmd, u32 buf, s32 count)
305 case SI_MACHINE: r = machine(); break; 315 case SI_MACHINE: r = machine(); break;
306 case SI_ARCHITECTURE: r = "sparc"; break; 316 case SI_ARCHITECTURE: r = "sparc"; break;
307 case SI_HW_PROVIDER: r = "Sun_Microsystems"; break; 317 case SI_HW_PROVIDER: r = "Sun_Microsystems"; break;
308 case SI_HW_SERIAL: r = serial(buffer); break; 318 case SI_HW_SERIAL: r = serial(buffer, sizeof(buffer)); break;
309 case SI_PLATFORM: r = platform(buffer); break; 319 case SI_PLATFORM: r = platform(buffer, sizeof(buffer)); break;
310 case SI_SRPC_DOMAIN: r = ""; break; 320 case SI_SRPC_DOMAIN: r = ""; break;
311 case SI_VERSION: r = "Generic"; break; 321 case SI_VERSION: r = "Generic"; break;
312 default: return -EINVAL; 322 default: return -EINVAL;