diff options
Diffstat (limited to 'arch/sparc64/kernel/prom.c')
-rw-r--r-- | arch/sparc64/kernel/prom.c | 195 |
1 files changed, 67 insertions, 128 deletions
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c index 3c048ac4e638..dbba82f9b142 100644 --- a/arch/sparc64/kernel/prom.c +++ b/arch/sparc64/kernel/prom.c | |||
@@ -38,7 +38,7 @@ struct device_node *of_find_node_by_phandle(phandle handle) | |||
38 | { | 38 | { |
39 | struct device_node *np; | 39 | struct device_node *np; |
40 | 40 | ||
41 | for (np = allnodes; np != 0; np = np->allnext) | 41 | for (np = allnodes; np; np = np->allnext) |
42 | if (np->node == handle) | 42 | if (np->node == handle) |
43 | break; | 43 | break; |
44 | 44 | ||
@@ -59,6 +59,9 @@ int of_getintprop_default(struct device_node *np, const char *name, int def) | |||
59 | } | 59 | } |
60 | EXPORT_SYMBOL(of_getintprop_default); | 60 | EXPORT_SYMBOL(of_getintprop_default); |
61 | 61 | ||
62 | DEFINE_MUTEX(of_set_property_mutex); | ||
63 | EXPORT_SYMBOL(of_set_property_mutex); | ||
64 | |||
62 | int of_set_property(struct device_node *dp, const char *name, void *val, int len) | 65 | int of_set_property(struct device_node *dp, const char *name, void *val, int len) |
63 | { | 66 | { |
64 | struct property **prevp; | 67 | struct property **prevp; |
@@ -82,7 +85,10 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len | |||
82 | void *old_val = prop->value; | 85 | void *old_val = prop->value; |
83 | int ret; | 86 | int ret; |
84 | 87 | ||
88 | mutex_lock(&of_set_property_mutex); | ||
85 | ret = prom_setprop(dp->node, name, val, len); | 89 | ret = prom_setprop(dp->node, name, val, len); |
90 | mutex_unlock(&of_set_property_mutex); | ||
91 | |||
86 | err = -EINVAL; | 92 | err = -EINVAL; |
87 | if (ret >= 0) { | 93 | if (ret >= 0) { |
88 | prop->value = new_val; | 94 | prop->value = new_val; |
@@ -156,55 +162,11 @@ static unsigned long psycho_pcislot_imap_offset(unsigned long ino) | |||
156 | return PSYCHO_IMAP_B_SLOT0 + (slot * 8); | 162 | return PSYCHO_IMAP_B_SLOT0 + (slot * 8); |
157 | } | 163 | } |
158 | 164 | ||
159 | #define PSYCHO_IMAP_SCSI 0x1000UL | 165 | #define PSYCHO_OBIO_IMAP_BASE 0x1000UL |
160 | #define PSYCHO_IMAP_ETH 0x1008UL | 166 | |
161 | #define PSYCHO_IMAP_BPP 0x1010UL | ||
162 | #define PSYCHO_IMAP_AU_REC 0x1018UL | ||
163 | #define PSYCHO_IMAP_AU_PLAY 0x1020UL | ||
164 | #define PSYCHO_IMAP_PFAIL 0x1028UL | ||
165 | #define PSYCHO_IMAP_KMS 0x1030UL | ||
166 | #define PSYCHO_IMAP_FLPY 0x1038UL | ||
167 | #define PSYCHO_IMAP_SHW 0x1040UL | ||
168 | #define PSYCHO_IMAP_KBD 0x1048UL | ||
169 | #define PSYCHO_IMAP_MS 0x1050UL | ||
170 | #define PSYCHO_IMAP_SER 0x1058UL | ||
171 | #define PSYCHO_IMAP_TIM0 0x1060UL | ||
172 | #define PSYCHO_IMAP_TIM1 0x1068UL | ||
173 | #define PSYCHO_IMAP_UE 0x1070UL | ||
174 | #define PSYCHO_IMAP_CE 0x1078UL | ||
175 | #define PSYCHO_IMAP_A_ERR 0x1080UL | ||
176 | #define PSYCHO_IMAP_B_ERR 0x1088UL | ||
177 | #define PSYCHO_IMAP_PMGMT 0x1090UL | ||
178 | #define PSYCHO_IMAP_GFX 0x1098UL | ||
179 | #define PSYCHO_IMAP_EUPA 0x10a0UL | ||
180 | |||
181 | static unsigned long __psycho_onboard_imap_off[] = { | ||
182 | /*0x20*/ PSYCHO_IMAP_SCSI, | ||
183 | /*0x21*/ PSYCHO_IMAP_ETH, | ||
184 | /*0x22*/ PSYCHO_IMAP_BPP, | ||
185 | /*0x23*/ PSYCHO_IMAP_AU_REC, | ||
186 | /*0x24*/ PSYCHO_IMAP_AU_PLAY, | ||
187 | /*0x25*/ PSYCHO_IMAP_PFAIL, | ||
188 | /*0x26*/ PSYCHO_IMAP_KMS, | ||
189 | /*0x27*/ PSYCHO_IMAP_FLPY, | ||
190 | /*0x28*/ PSYCHO_IMAP_SHW, | ||
191 | /*0x29*/ PSYCHO_IMAP_KBD, | ||
192 | /*0x2a*/ PSYCHO_IMAP_MS, | ||
193 | /*0x2b*/ PSYCHO_IMAP_SER, | ||
194 | /*0x2c*/ PSYCHO_IMAP_TIM0, | ||
195 | /*0x2d*/ PSYCHO_IMAP_TIM1, | ||
196 | /*0x2e*/ PSYCHO_IMAP_UE, | ||
197 | /*0x2f*/ PSYCHO_IMAP_CE, | ||
198 | /*0x30*/ PSYCHO_IMAP_A_ERR, | ||
199 | /*0x31*/ PSYCHO_IMAP_B_ERR, | ||
200 | /*0x32*/ PSYCHO_IMAP_PMGMT, | ||
201 | /*0x33*/ PSYCHO_IMAP_GFX, | ||
202 | /*0x34*/ PSYCHO_IMAP_EUPA, | ||
203 | }; | ||
204 | #define PSYCHO_ONBOARD_IRQ_BASE 0x20 | 167 | #define PSYCHO_ONBOARD_IRQ_BASE 0x20 |
205 | #define PSYCHO_ONBOARD_IRQ_LAST 0x34 | ||
206 | #define psycho_onboard_imap_offset(__ino) \ | 168 | #define psycho_onboard_imap_offset(__ino) \ |
207 | __psycho_onboard_imap_off[(__ino) - PSYCHO_ONBOARD_IRQ_BASE] | 169 | (PSYCHO_OBIO_IMAP_BASE + (((__ino) & 0x1f) << 3)) |
208 | 170 | ||
209 | #define PSYCHO_ICLR_A_SLOT0 0x1400UL | 171 | #define PSYCHO_ICLR_A_SLOT0 0x1400UL |
210 | #define PSYCHO_ICLR_SCSI 0x1800UL | 172 | #define PSYCHO_ICLR_SCSI 0x1800UL |
@@ -228,10 +190,6 @@ static unsigned int psycho_irq_build(struct device_node *dp, | |||
228 | imap_off = psycho_pcislot_imap_offset(ino); | 190 | imap_off = psycho_pcislot_imap_offset(ino); |
229 | } else { | 191 | } else { |
230 | /* Onboard device */ | 192 | /* Onboard device */ |
231 | if (ino > PSYCHO_ONBOARD_IRQ_LAST) { | ||
232 | prom_printf("psycho_irq_build: Wacky INO [%x]\n", ino); | ||
233 | prom_halt(); | ||
234 | } | ||
235 | imap_off = psycho_onboard_imap_offset(ino); | 193 | imap_off = psycho_onboard_imap_offset(ino); |
236 | } | 194 | } |
237 | 195 | ||
@@ -318,23 +276,6 @@ static void sabre_wsync_handler(unsigned int ino, void *_arg1, void *_arg2) | |||
318 | 276 | ||
319 | #define SABRE_IMAP_A_SLOT0 0x0c00UL | 277 | #define SABRE_IMAP_A_SLOT0 0x0c00UL |
320 | #define SABRE_IMAP_B_SLOT0 0x0c20UL | 278 | #define SABRE_IMAP_B_SLOT0 0x0c20UL |
321 | #define SABRE_IMAP_SCSI 0x1000UL | ||
322 | #define SABRE_IMAP_ETH 0x1008UL | ||
323 | #define SABRE_IMAP_BPP 0x1010UL | ||
324 | #define SABRE_IMAP_AU_REC 0x1018UL | ||
325 | #define SABRE_IMAP_AU_PLAY 0x1020UL | ||
326 | #define SABRE_IMAP_PFAIL 0x1028UL | ||
327 | #define SABRE_IMAP_KMS 0x1030UL | ||
328 | #define SABRE_IMAP_FLPY 0x1038UL | ||
329 | #define SABRE_IMAP_SHW 0x1040UL | ||
330 | #define SABRE_IMAP_KBD 0x1048UL | ||
331 | #define SABRE_IMAP_MS 0x1050UL | ||
332 | #define SABRE_IMAP_SER 0x1058UL | ||
333 | #define SABRE_IMAP_UE 0x1070UL | ||
334 | #define SABRE_IMAP_CE 0x1078UL | ||
335 | #define SABRE_IMAP_PCIERR 0x1080UL | ||
336 | #define SABRE_IMAP_GFX 0x1098UL | ||
337 | #define SABRE_IMAP_EUPA 0x10a0UL | ||
338 | #define SABRE_ICLR_A_SLOT0 0x1400UL | 279 | #define SABRE_ICLR_A_SLOT0 0x1400UL |
339 | #define SABRE_ICLR_B_SLOT0 0x1480UL | 280 | #define SABRE_ICLR_B_SLOT0 0x1480UL |
340 | #define SABRE_ICLR_SCSI 0x1800UL | 281 | #define SABRE_ICLR_SCSI 0x1800UL |
@@ -364,33 +305,10 @@ static unsigned long sabre_pcislot_imap_offset(unsigned long ino) | |||
364 | return SABRE_IMAP_B_SLOT0 + (slot * 8); | 305 | return SABRE_IMAP_B_SLOT0 + (slot * 8); |
365 | } | 306 | } |
366 | 307 | ||
367 | static unsigned long __sabre_onboard_imap_off[] = { | 308 | #define SABRE_OBIO_IMAP_BASE 0x1000UL |
368 | /*0x20*/ SABRE_IMAP_SCSI, | 309 | #define SABRE_ONBOARD_IRQ_BASE 0x20 |
369 | /*0x21*/ SABRE_IMAP_ETH, | ||
370 | /*0x22*/ SABRE_IMAP_BPP, | ||
371 | /*0x23*/ SABRE_IMAP_AU_REC, | ||
372 | /*0x24*/ SABRE_IMAP_AU_PLAY, | ||
373 | /*0x25*/ SABRE_IMAP_PFAIL, | ||
374 | /*0x26*/ SABRE_IMAP_KMS, | ||
375 | /*0x27*/ SABRE_IMAP_FLPY, | ||
376 | /*0x28*/ SABRE_IMAP_SHW, | ||
377 | /*0x29*/ SABRE_IMAP_KBD, | ||
378 | /*0x2a*/ SABRE_IMAP_MS, | ||
379 | /*0x2b*/ SABRE_IMAP_SER, | ||
380 | /*0x2c*/ 0 /* reserved */, | ||
381 | /*0x2d*/ 0 /* reserved */, | ||
382 | /*0x2e*/ SABRE_IMAP_UE, | ||
383 | /*0x2f*/ SABRE_IMAP_CE, | ||
384 | /*0x30*/ SABRE_IMAP_PCIERR, | ||
385 | /*0x31*/ 0 /* reserved */, | ||
386 | /*0x32*/ 0 /* reserved */, | ||
387 | /*0x33*/ SABRE_IMAP_GFX, | ||
388 | /*0x34*/ SABRE_IMAP_EUPA, | ||
389 | }; | ||
390 | #define SABRE_ONBOARD_IRQ_BASE 0x20 | ||
391 | #define SABRE_ONBOARD_IRQ_LAST 0x30 | ||
392 | #define sabre_onboard_imap_offset(__ino) \ | 310 | #define sabre_onboard_imap_offset(__ino) \ |
393 | __sabre_onboard_imap_off[(__ino) - SABRE_ONBOARD_IRQ_BASE] | 311 | (SABRE_OBIO_IMAP_BASE + (((__ino) & 0x1f) << 3)) |
394 | 312 | ||
395 | #define sabre_iclr_offset(ino) \ | 313 | #define sabre_iclr_offset(ino) \ |
396 | ((ino & 0x20) ? (SABRE_ICLR_SCSI + (((ino) & 0x1f) << 3)) : \ | 314 | ((ino & 0x20) ? (SABRE_ICLR_SCSI + (((ino) & 0x1f) << 3)) : \ |
@@ -453,10 +371,6 @@ static unsigned int sabre_irq_build(struct device_node *dp, | |||
453 | imap_off = sabre_pcislot_imap_offset(ino); | 371 | imap_off = sabre_pcislot_imap_offset(ino); |
454 | } else { | 372 | } else { |
455 | /* onboard device */ | 373 | /* onboard device */ |
456 | if (ino > SABRE_ONBOARD_IRQ_LAST) { | ||
457 | prom_printf("sabre_irq_build: Wacky INO [%x]\n", ino); | ||
458 | prom_halt(); | ||
459 | } | ||
460 | imap_off = sabre_onboard_imap_offset(ino); | 374 | imap_off = sabre_onboard_imap_offset(ino); |
461 | } | 375 | } |
462 | 376 | ||
@@ -1037,22 +951,30 @@ static void __init irq_trans_init(struct device_node *dp) | |||
1037 | for (i = 0; i < ARRAY_SIZE(pci_irq_trans_table); i++) { | 951 | for (i = 0; i < ARRAY_SIZE(pci_irq_trans_table); i++) { |
1038 | struct irq_trans *t = &pci_irq_trans_table[i]; | 952 | struct irq_trans *t = &pci_irq_trans_table[i]; |
1039 | 953 | ||
1040 | if (!strcmp(model, t->name)) | 954 | if (!strcmp(model, t->name)) { |
1041 | return t->init(dp); | 955 | t->init(dp); |
956 | return; | ||
957 | } | ||
1042 | } | 958 | } |
1043 | } | 959 | } |
1044 | #endif | 960 | #endif |
1045 | #ifdef CONFIG_SBUS | 961 | #ifdef CONFIG_SBUS |
1046 | if (!strcmp(dp->name, "sbus") || | 962 | if (!strcmp(dp->name, "sbus") || |
1047 | !strcmp(dp->name, "sbi")) | 963 | !strcmp(dp->name, "sbi")) { |
1048 | return sbus_irq_trans_init(dp); | 964 | sbus_irq_trans_init(dp); |
965 | return; | ||
966 | } | ||
1049 | #endif | 967 | #endif |
1050 | if (!strcmp(dp->name, "fhc") && | 968 | if (!strcmp(dp->name, "fhc") && |
1051 | !strcmp(dp->parent->name, "central")) | 969 | !strcmp(dp->parent->name, "central")) { |
1052 | return central_irq_trans_init(dp); | 970 | central_irq_trans_init(dp); |
971 | return; | ||
972 | } | ||
1053 | if (!strcmp(dp->name, "virtual-devices") || | 973 | if (!strcmp(dp->name, "virtual-devices") || |
1054 | !strcmp(dp->name, "niu")) | 974 | !strcmp(dp->name, "niu")) { |
1055 | return sun4v_vdev_irq_trans_init(dp); | 975 | sun4v_vdev_irq_trans_init(dp); |
976 | return; | ||
977 | } | ||
1056 | } | 978 | } |
1057 | 979 | ||
1058 | static int is_root_node(const struct device_node *dp) | 980 | static int is_root_node(const struct device_node *dp) |
@@ -1323,32 +1245,49 @@ static void __init __build_path_component(struct device_node *dp, char *tmp_buf) | |||
1323 | 1245 | ||
1324 | if (parent != NULL) { | 1246 | if (parent != NULL) { |
1325 | if (!strcmp(parent->type, "pci") || | 1247 | if (!strcmp(parent->type, "pci") || |
1326 | !strcmp(parent->type, "pciex")) | 1248 | !strcmp(parent->type, "pciex")) { |
1327 | return pci_path_component(dp, tmp_buf); | 1249 | pci_path_component(dp, tmp_buf); |
1328 | if (!strcmp(parent->type, "sbus")) | 1250 | return; |
1329 | return sbus_path_component(dp, tmp_buf); | 1251 | } |
1330 | if (!strcmp(parent->type, "upa")) | 1252 | if (!strcmp(parent->type, "sbus")) { |
1331 | return upa_path_component(dp, tmp_buf); | 1253 | sbus_path_component(dp, tmp_buf); |
1332 | if (!strcmp(parent->type, "ebus")) | 1254 | return; |
1333 | return ebus_path_component(dp, tmp_buf); | 1255 | } |
1256 | if (!strcmp(parent->type, "upa")) { | ||
1257 | upa_path_component(dp, tmp_buf); | ||
1258 | return; | ||
1259 | } | ||
1260 | if (!strcmp(parent->type, "ebus")) { | ||
1261 | ebus_path_component(dp, tmp_buf); | ||
1262 | return; | ||
1263 | } | ||
1334 | if (!strcmp(parent->name, "usb") || | 1264 | if (!strcmp(parent->name, "usb") || |
1335 | !strcmp(parent->name, "hub")) | 1265 | !strcmp(parent->name, "hub")) { |
1336 | return usb_path_component(dp, tmp_buf); | 1266 | usb_path_component(dp, tmp_buf); |
1337 | if (!strcmp(parent->type, "i2c")) | 1267 | return; |
1338 | return i2c_path_component(dp, tmp_buf); | 1268 | } |
1339 | if (!strcmp(parent->type, "firewire")) | 1269 | if (!strcmp(parent->type, "i2c")) { |
1340 | return ieee1394_path_component(dp, tmp_buf); | 1270 | i2c_path_component(dp, tmp_buf); |
1341 | if (!strcmp(parent->type, "virtual-devices")) | 1271 | return; |
1342 | return vdev_path_component(dp, tmp_buf); | 1272 | } |
1343 | 1273 | if (!strcmp(parent->type, "firewire")) { | |
1274 | ieee1394_path_component(dp, tmp_buf); | ||
1275 | return; | ||
1276 | } | ||
1277 | if (!strcmp(parent->type, "virtual-devices")) { | ||
1278 | vdev_path_component(dp, tmp_buf); | ||
1279 | return; | ||
1280 | } | ||
1344 | /* "isa" is handled with platform naming */ | 1281 | /* "isa" is handled with platform naming */ |
1345 | } | 1282 | } |
1346 | 1283 | ||
1347 | /* Use platform naming convention. */ | 1284 | /* Use platform naming convention. */ |
1348 | if (tlb_type == hypervisor) | 1285 | if (tlb_type == hypervisor) { |
1349 | return sun4v_path_component(dp, tmp_buf); | 1286 | sun4v_path_component(dp, tmp_buf); |
1350 | else | 1287 | return; |
1351 | return sun4u_path_component(dp, tmp_buf); | 1288 | } else { |
1289 | sun4u_path_component(dp, tmp_buf); | ||
1290 | } | ||
1352 | } | 1291 | } |
1353 | 1292 | ||
1354 | static char * __init build_path_component(struct device_node *dp) | 1293 | static char * __init build_path_component(struct device_node *dp) |