Commit 25c7581b authored by David S. Miller's avatar David S. Miller

[SPARC64]: Kill off some more prom_getproperty() remnants.

The remaining ones occur before we have imported the
device tree.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 44bdef5e
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <asm/iommu.h> #include <asm/iommu.h>
#include <asm/upa.h> #include <asm/upa.h>
#include <asm/oplib.h> #include <asm/oplib.h>
#include <asm/prom.h>
#include <asm/timer.h> #include <asm/timer.h>
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/starfire.h> #include <asm/starfire.h>
...@@ -635,23 +636,30 @@ static u64 prom_limit0, prom_limit1; ...@@ -635,23 +636,30 @@ static u64 prom_limit0, prom_limit1;
static void map_prom_timers(void) static void map_prom_timers(void)
{ {
unsigned int addr[3]; struct device_node *dp;
unsigned int *addr;
int tnode, err; int tnode, err;
/* PROM timer node hangs out in the top level of device siblings... */ /* PROM timer node hangs out in the top level of device siblings... */
tnode = prom_finddevice("/counter-timer"); dp = of_find_node_by_path("/");
dp = dp->child;
while (dp) {
if (!strcmp(dp->name, "counter-timer"))
break;
dp = dp->sibling;
}
/* Assume if node is not present, PROM uses different tick mechanism /* Assume if node is not present, PROM uses different tick mechanism
* which we should not care about. * which we should not care about.
*/ */
if (tnode == 0 || tnode == -1) { if (!dp) {
prom_timers = (struct sun5_timer *) 0; prom_timers = (struct sun5_timer *) 0;
return; return;
} }
/* If PROM is really using this, it must be mapped by him. */ /* If PROM is really using this, it must be mapped by him. */
err = prom_getproperty(tnode, "address", (char *)addr, sizeof(addr)); addr = of_get_property(dp, "address", NULL);
if (err == -1) { if (!addr) {
prom_printf("PROM does not have timer mapped, trying to continue.\n"); prom_printf("PROM does not have timer mapped, trying to continue.\n");
prom_timers = (struct sun5_timer *) 0; prom_timers = (struct sun5_timer *) 0;
return; return;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <asm/cache.h> #include <asm/cache.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/prom.h>
#include <asm/starfire.h> #include <asm/starfire.h>
#include "iommu_common.h" #include "iommu_common.h"
...@@ -1098,24 +1099,25 @@ static void __init sysio_register_error_handlers(struct sbus_bus *sbus) ...@@ -1098,24 +1099,25 @@ static void __init sysio_register_error_handlers(struct sbus_bus *sbus)
} }
/* Boot time initialization. */ /* Boot time initialization. */
void __init sbus_iommu_init(int prom_node, struct sbus_bus *sbus) void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
{ {
struct linux_prom64_registers rprop; struct linux_prom64_registers *pr;
struct device_node *dp;
struct sbus_iommu *iommu; struct sbus_iommu *iommu;
unsigned long regs, tsb_base; unsigned long regs, tsb_base;
u64 control; u64 control;
int err, i; int i;
dp = of_find_node_by_phandle(__node);
sbus->portid = prom_getintdefault(sbus->prom_node, sbus->portid = of_getintprop_default(dp, "upa-portid", -1);
"upa-portid", -1);
err = prom_getproperty(prom_node, "reg", pr = of_get_property(dp, "reg", NULL);
(char *)&rprop, sizeof(rprop)); if (!pr) {
if (err < 0) {
prom_printf("sbus_iommu_init: Cannot map SYSIO control registers.\n"); prom_printf("sbus_iommu_init: Cannot map SYSIO control registers.\n");
prom_halt(); prom_halt();
} }
regs = rprop.phys_addr; regs = pr->phys_addr;
iommu = kmalloc(sizeof(*iommu) + SMP_CACHE_BYTES, GFP_ATOMIC); iommu = kmalloc(sizeof(*iommu) + SMP_CACHE_BYTES, GFP_ATOMIC);
if (iommu == NULL) { if (iommu == NULL) {
...@@ -1228,12 +1230,11 @@ void __init sbus_iommu_init(int prom_node, struct sbus_bus *sbus) ...@@ -1228,12 +1230,11 @@ void __init sbus_iommu_init(int prom_node, struct sbus_bus *sbus)
void sbus_fill_device_irq(struct sbus_dev *sdev) void sbus_fill_device_irq(struct sbus_dev *sdev)
{ {
struct linux_prom_irqs irqs[PROMINTR_MAX]; struct device_node *dp = of_find_node_by_phandle(sdev->prom_node);
int len; struct linux_prom_irqs *irqs;
len = prom_getproperty(sdev->prom_node, "interrupts", irqs = of_get_property(dp, "interrupts", NULL);
(char *) irqs, sizeof(irqs)); if (!irqs) {
if (len == -1 || len == 0) {
sdev->irqs[0] = 0; sdev->irqs[0] = 0;
sdev->num_irqs = 0; sdev->num_irqs = 0;
} else { } else {
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <asm/oplib.h> #include <asm/oplib.h>
#include <asm/idprom.h> #include <asm/idprom.h>
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/prom.h>
#include "conv.h" #include "conv.h"
...@@ -194,14 +195,17 @@ static char *machine(void) ...@@ -194,14 +195,17 @@ static char *machine(void)
} }
} }
static char *platform(char *buffer) static char *platform(char *buffer, int sz)
{ {
struct device_node *dp = of_find_node_by_path("/");
int len; int len;
*buffer = 0; *buffer = 0;
len = prom_getproperty(prom_root_node, "name", buffer, 256); len = strlen(dp->name);
if(len > 0) if (len > sz)
buffer[len] = 0; len = sz;
memcpy(buffer, dp->name, len);
buffer[len] = 0;
if (*buffer) { if (*buffer) {
char *p; char *p;
...@@ -213,16 +217,22 @@ static char *platform(char *buffer) ...@@ -213,16 +217,22 @@ static char *platform(char *buffer)
return "sun4u"; return "sun4u";
} }
static char *serial(char *buffer) static char *serial(char *buffer, int sz)
{ {
int node = prom_getchild(prom_root_node); struct device_node *dp = of_find_node_by_path("/options");
int len; int len;
node = prom_searchsiblings(node, "options");
*buffer = 0; *buffer = 0;
len = prom_getproperty(node, "system-board-serial#", buffer, 256); if (dp) {
if(len > 0) char *val = of_get_property(dp, "system-board-serial#", &len);
buffer[len] = 0;
if (val && len > 0) {
if (len > sz)
len = sz;
memcpy(buffer, val, len);
buffer[len] = 0;
}
}
if (!*buffer) if (!*buffer)
return "4512348717234"; return "4512348717234";
else else
...@@ -305,8 +315,8 @@ asmlinkage int solaris_sysinfo(int cmd, u32 buf, s32 count) ...@@ -305,8 +315,8 @@ asmlinkage int solaris_sysinfo(int cmd, u32 buf, s32 count)
case SI_MACHINE: r = machine(); break; case SI_MACHINE: r = machine(); break;
case SI_ARCHITECTURE: r = "sparc"; break; case SI_ARCHITECTURE: r = "sparc"; break;
case SI_HW_PROVIDER: r = "Sun_Microsystems"; break; case SI_HW_PROVIDER: r = "Sun_Microsystems"; break;
case SI_HW_SERIAL: r = serial(buffer); break; case SI_HW_SERIAL: r = serial(buffer, sizeof(buffer)); break;
case SI_PLATFORM: r = platform(buffer); break; case SI_PLATFORM: r = platform(buffer, sizeof(buffer)); break;
case SI_SRPC_DOMAIN: r = ""; break; case SI_SRPC_DOMAIN: r = ""; break;
case SI_VERSION: r = "Generic"; break; case SI_VERSION: r = "Generic"; break;
default: return -EINVAL; default: return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment