aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--arch/sparc64/kernel/irq.c18
-rw-r--r--arch/sparc64/kernel/sbus.c29
-rw-r--r--arch/sparc64/solaris/misc.c34
3 files changed, 50 insertions, 31 deletions
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index a8c9dc8d1958..2d00ccffc55b 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -34,6 +34,7 @@
34#include <asm/iommu.h> 34#include <asm/iommu.h>
35#include <asm/upa.h> 35#include <asm/upa.h>
36#include <asm/oplib.h> 36#include <asm/oplib.h>
37#include <asm/prom.h>
37#include <asm/timer.h> 38#include <asm/timer.h>
38#include <asm/smp.h> 39#include <asm/smp.h>
39#include <asm/starfire.h> 40#include <asm/starfire.h>
@@ -635,23 +636,30 @@ static u64 prom_limit0, prom_limit1;
635 636
636static void map_prom_timers(void) 637static void map_prom_timers(void)
637{ 638{
638 unsigned int addr[3]; 639 struct device_node *dp;
640 unsigned int *addr;
639 int tnode, err; 641 int tnode, err;
640 642
641 /* PROM timer node hangs out in the top level of device siblings... */ 643 /* PROM timer node hangs out in the top level of device siblings... */
642 tnode = prom_finddevice("/counter-timer"); 644 dp = of_find_node_by_path("/");
645 dp = dp->child;
646 while (dp) {
647 if (!strcmp(dp->name, "counter-timer"))
648 break;
649 dp = dp->sibling;
650 }
643 651
644 /* Assume if node is not present, PROM uses different tick mechanism 652 /* Assume if node is not present, PROM uses different tick mechanism
645 * which we should not care about. 653 * which we should not care about.
646 */ 654 */
647 if (tnode == 0 || tnode == -1) { 655 if (!dp) {
648 prom_timers = (struct sun5_timer *) 0; 656 prom_timers = (struct sun5_timer *) 0;
649 return; 657 return;
650 } 658 }
651 659
652 /* If PROM is really using this, it must be mapped by him. */ 660 /* If PROM is really using this, it must be mapped by him. */
653 err = prom_getproperty(tnode, "address", (char *)addr, sizeof(addr)); 661 addr = of_get_property(dp, "address", NULL);
654 if (err == -1) { 662 if (!addr) {
655 prom_printf("PROM does not have timer mapped, trying to continue.\n"); 663 prom_printf("PROM does not have timer mapped, trying to continue.\n");
656 prom_timers = (struct sun5_timer *) 0; 664 prom_timers = (struct sun5_timer *) 0;
657 return; 665 return;
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c
index 8f7877ac858f..a72bba398809 100644
--- a/arch/sparc64/kernel/sbus.c
+++ b/arch/sparc64/kernel/sbus.c
@@ -19,6 +19,7 @@
19#include <asm/cache.h> 19#include <asm/cache.h>
20#include <asm/dma.h> 20#include <asm/dma.h>
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/prom.h>
22#include <asm/starfire.h> 23#include <asm/starfire.h>
23 24
24#include "iommu_common.h" 25#include "iommu_common.h"
@@ -1098,24 +1099,25 @@ static void __init sysio_register_error_handlers(struct sbus_bus *sbus)
1098} 1099}
1099 1100
1100/* Boot time initialization. */ 1101/* Boot time initialization. */
1101void __init sbus_iommu_init(int prom_node, struct sbus_bus *sbus) 1102void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
1102{ 1103{
1103 struct linux_prom64_registers rprop; 1104 struct linux_prom64_registers *pr;
1105 struct device_node *dp;
1104 struct sbus_iommu *iommu; 1106 struct sbus_iommu *iommu;
1105 unsigned long regs, tsb_base; 1107 unsigned long regs, tsb_base;
1106 u64 control; 1108 u64 control;
1107 int err, i; 1109 int i;
1110
1111 dp = of_find_node_by_phandle(__node);
1108 1112
1109 sbus->portid = prom_getintdefault(sbus->prom_node, 1113 sbus->portid = of_getintprop_default(dp, "upa-portid", -1);
1110 "upa-portid", -1);
1111 1114
1112 err = prom_getproperty(prom_node, "reg", 1115 pr = of_get_property(dp, "reg", NULL);
1113 (char *)&rprop, sizeof(rprop)); 1116 if (!pr) {
1114 if (err < 0) {
1115 prom_printf("sbus_iommu_init: Cannot map SYSIO control registers.\n"); 1117 prom_printf("sbus_iommu_init: Cannot map SYSIO control registers.\n");
1116 prom_halt(); 1118 prom_halt();
1117 } 1119 }
1118 regs = rprop.phys_addr; 1120 regs = pr->phys_addr;
1119 1121
1120 iommu = kmalloc(sizeof(*iommu) + SMP_CACHE_BYTES, GFP_ATOMIC); 1122 iommu = kmalloc(sizeof(*iommu) + SMP_CACHE_BYTES, GFP_ATOMIC);
1121 if (iommu == NULL) { 1123 if (iommu == NULL) {
@@ -1228,12 +1230,11 @@ void __init sbus_iommu_init(int prom_node, struct sbus_bus *sbus)
1228 1230
1229void sbus_fill_device_irq(struct sbus_dev *sdev) 1231void sbus_fill_device_irq(struct sbus_dev *sdev)
1230{ 1232{
1231 struct linux_prom_irqs irqs[PROMINTR_MAX]; 1233 struct device_node *dp = of_find_node_by_phandle(sdev->prom_node);
1232 int len; 1234 struct linux_prom_irqs *irqs;
1233 1235
1234 len = prom_getproperty(sdev->prom_node, "interrupts", 1236 irqs = of_get_property(dp, "interrupts", NULL);
1235 (char *) irqs, sizeof(irqs)); 1237 if (!irqs) {
1236 if (len == -1 || len == 0) {
1237 sdev->irqs[0] = 0; 1238 sdev->irqs[0] = 0;
1238 sdev->num_irqs = 0; 1239 sdev->num_irqs = 0;
1239 } else { 1240 } else {
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;