diff options
Diffstat (limited to 'arch/sparc64/kernel/sbus.c')
-rw-r--r-- | arch/sparc64/kernel/sbus.c | 166 |
1 files changed, 77 insertions, 89 deletions
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c index e33a8a660e9..2ead310066d 100644 --- a/arch/sparc64/kernel/sbus.c +++ b/arch/sparc64/kernel/sbus.c | |||
@@ -11,15 +11,17 @@ | |||
11 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/of.h> | ||
15 | #include <linux/of_device.h> | ||
14 | 16 | ||
15 | #include <asm/page.h> | 17 | #include <asm/page.h> |
16 | #include <asm/sbus.h> | ||
17 | #include <asm/io.h> | 18 | #include <asm/io.h> |
18 | #include <asm/upa.h> | 19 | #include <asm/upa.h> |
19 | #include <asm/cache.h> | 20 | #include <asm/cache.h> |
20 | #include <asm/dma.h> | 21 | #include <asm/dma.h> |
21 | #include <asm/irq.h> | 22 | #include <asm/irq.h> |
22 | #include <asm/prom.h> | 23 | #include <asm/prom.h> |
24 | #include <asm/oplib.h> | ||
23 | #include <asm/starfire.h> | 25 | #include <asm/starfire.h> |
24 | 26 | ||
25 | #include "iommu_common.h" | 27 | #include "iommu_common.h" |
@@ -52,13 +54,23 @@ | |||
52 | #define STRBUF_TAG_VALID 0x02UL | 54 | #define STRBUF_TAG_VALID 0x02UL |
53 | 55 | ||
54 | /* Enable 64-bit DVMA mode for the given device. */ | 56 | /* Enable 64-bit DVMA mode for the given device. */ |
55 | void sbus_set_sbus64(struct sbus_dev *sdev, int bursts) | 57 | void sbus_set_sbus64(struct device *dev, int bursts) |
56 | { | 58 | { |
57 | struct iommu *iommu = sdev->ofdev.dev.archdata.iommu; | 59 | struct iommu *iommu = dev->archdata.iommu; |
58 | int slot = sdev->slot; | 60 | struct of_device *op = to_of_device(dev); |
61 | const struct linux_prom_registers *regs; | ||
59 | unsigned long cfg_reg; | 62 | unsigned long cfg_reg; |
63 | int slot; | ||
60 | u64 val; | 64 | u64 val; |
61 | 65 | ||
66 | regs = of_get_property(op->node, "reg", NULL); | ||
67 | if (!regs) { | ||
68 | printk(KERN_ERR "sbus_set_sbus64: Cannot find regs for %s\n", | ||
69 | op->node->full_name); | ||
70 | return; | ||
71 | } | ||
72 | slot = regs->which_io; | ||
73 | |||
62 | cfg_reg = iommu->write_complete_reg; | 74 | cfg_reg = iommu->write_complete_reg; |
63 | switch (slot) { | 75 | switch (slot) { |
64 | case 0: | 76 | case 0: |
@@ -191,10 +203,9 @@ static unsigned long sysio_imap_to_iclr(unsigned long imap) | |||
191 | return imap + diff; | 203 | return imap + diff; |
192 | } | 204 | } |
193 | 205 | ||
194 | unsigned int sbus_build_irq(void *buscookie, unsigned int ino) | 206 | static unsigned int sbus_build_irq(struct of_device *op, unsigned int ino) |
195 | { | 207 | { |
196 | struct sbus_bus *sbus = (struct sbus_bus *)buscookie; | 208 | struct iommu *iommu = op->dev.archdata.iommu; |
197 | struct iommu *iommu = sbus->ofdev.dev.archdata.iommu; | ||
198 | unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; | 209 | unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; |
199 | unsigned long imap, iclr; | 210 | unsigned long imap, iclr; |
200 | int sbus_level = 0; | 211 | int sbus_level = 0; |
@@ -255,12 +266,12 @@ unsigned int sbus_build_irq(void *buscookie, unsigned int ino) | |||
255 | #define SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ | 266 | #define SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ |
256 | static irqreturn_t sysio_ue_handler(int irq, void *dev_id) | 267 | static irqreturn_t sysio_ue_handler(int irq, void *dev_id) |
257 | { | 268 | { |
258 | struct sbus_bus *sbus = dev_id; | 269 | struct of_device *op = dev_id; |
259 | struct iommu *iommu = sbus->ofdev.dev.archdata.iommu; | 270 | struct iommu *iommu = op->dev.archdata.iommu; |
260 | unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; | 271 | unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; |
261 | unsigned long afsr_reg, afar_reg; | 272 | unsigned long afsr_reg, afar_reg; |
262 | unsigned long afsr, afar, error_bits; | 273 | unsigned long afsr, afar, error_bits; |
263 | int reported; | 274 | int reported, portid; |
264 | 275 | ||
265 | afsr_reg = reg_base + SYSIO_UE_AFSR; | 276 | afsr_reg = reg_base + SYSIO_UE_AFSR; |
266 | afar_reg = reg_base + SYSIO_UE_AFAR; | 277 | afar_reg = reg_base + SYSIO_UE_AFAR; |
@@ -275,9 +286,11 @@ static irqreturn_t sysio_ue_handler(int irq, void *dev_id) | |||
275 | SYSIO_UEAFSR_SPIO | SYSIO_UEAFSR_SDRD | SYSIO_UEAFSR_SDWR); | 286 | SYSIO_UEAFSR_SPIO | SYSIO_UEAFSR_SDRD | SYSIO_UEAFSR_SDWR); |
276 | upa_writeq(error_bits, afsr_reg); | 287 | upa_writeq(error_bits, afsr_reg); |
277 | 288 | ||
289 | portid = of_getintprop_default(op->node, "portid", -1); | ||
290 | |||
278 | /* Log the error. */ | 291 | /* Log the error. */ |
279 | printk("SYSIO[%x]: Uncorrectable ECC Error, primary error type[%s]\n", | 292 | printk("SYSIO[%x]: Uncorrectable ECC Error, primary error type[%s]\n", |
280 | sbus->portid, | 293 | portid, |
281 | (((error_bits & SYSIO_UEAFSR_PPIO) ? | 294 | (((error_bits & SYSIO_UEAFSR_PPIO) ? |
282 | "PIO" : | 295 | "PIO" : |
283 | ((error_bits & SYSIO_UEAFSR_PDRD) ? | 296 | ((error_bits & SYSIO_UEAFSR_PDRD) ? |
@@ -285,12 +298,12 @@ static irqreturn_t sysio_ue_handler(int irq, void *dev_id) | |||
285 | ((error_bits & SYSIO_UEAFSR_PDWR) ? | 298 | ((error_bits & SYSIO_UEAFSR_PDWR) ? |
286 | "DVMA Write" : "???"))))); | 299 | "DVMA Write" : "???"))))); |
287 | printk("SYSIO[%x]: DOFF[%lx] SIZE[%lx] MID[%lx]\n", | 300 | printk("SYSIO[%x]: DOFF[%lx] SIZE[%lx] MID[%lx]\n", |
288 | sbus->portid, | 301 | portid, |
289 | (afsr & SYSIO_UEAFSR_DOFF) >> 45UL, | 302 | (afsr & SYSIO_UEAFSR_DOFF) >> 45UL, |
290 | (afsr & SYSIO_UEAFSR_SIZE) >> 42UL, | 303 | (afsr & SYSIO_UEAFSR_SIZE) >> 42UL, |
291 | (afsr & SYSIO_UEAFSR_MID) >> 37UL); | 304 | (afsr & SYSIO_UEAFSR_MID) >> 37UL); |
292 | printk("SYSIO[%x]: AFAR[%016lx]\n", sbus->portid, afar); | 305 | printk("SYSIO[%x]: AFAR[%016lx]\n", portid, afar); |
293 | printk("SYSIO[%x]: Secondary UE errors [", sbus->portid); | 306 | printk("SYSIO[%x]: Secondary UE errors [", portid); |
294 | reported = 0; | 307 | reported = 0; |
295 | if (afsr & SYSIO_UEAFSR_SPIO) { | 308 | if (afsr & SYSIO_UEAFSR_SPIO) { |
296 | reported++; | 309 | reported++; |
@@ -327,12 +340,12 @@ static irqreturn_t sysio_ue_handler(int irq, void *dev_id) | |||
327 | #define SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ | 340 | #define SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ |
328 | static irqreturn_t sysio_ce_handler(int irq, void *dev_id) | 341 | static irqreturn_t sysio_ce_handler(int irq, void *dev_id) |
329 | { | 342 | { |
330 | struct sbus_bus *sbus = dev_id; | 343 | struct of_device *op = dev_id; |
331 | struct iommu *iommu = sbus->ofdev.dev.archdata.iommu; | 344 | struct iommu *iommu = op->dev.archdata.iommu; |
332 | unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; | 345 | unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; |
333 | unsigned long afsr_reg, afar_reg; | 346 | unsigned long afsr_reg, afar_reg; |
334 | unsigned long afsr, afar, error_bits; | 347 | unsigned long afsr, afar, error_bits; |
335 | int reported; | 348 | int reported, portid; |
336 | 349 | ||
337 | afsr_reg = reg_base + SYSIO_CE_AFSR; | 350 | afsr_reg = reg_base + SYSIO_CE_AFSR; |
338 | afar_reg = reg_base + SYSIO_CE_AFAR; | 351 | afar_reg = reg_base + SYSIO_CE_AFAR; |
@@ -347,8 +360,10 @@ static irqreturn_t sysio_ce_handler(int irq, void *dev_id) | |||
347 | SYSIO_CEAFSR_SPIO | SYSIO_CEAFSR_SDRD | SYSIO_CEAFSR_SDWR); | 360 | SYSIO_CEAFSR_SPIO | SYSIO_CEAFSR_SDRD | SYSIO_CEAFSR_SDWR); |
348 | upa_writeq(error_bits, afsr_reg); | 361 | upa_writeq(error_bits, afsr_reg); |
349 | 362 | ||
363 | portid = of_getintprop_default(op->node, "portid", -1); | ||
364 | |||
350 | printk("SYSIO[%x]: Correctable ECC Error, primary error type[%s]\n", | 365 | printk("SYSIO[%x]: Correctable ECC Error, primary error type[%s]\n", |
351 | sbus->portid, | 366 | portid, |
352 | (((error_bits & SYSIO_CEAFSR_PPIO) ? | 367 | (((error_bits & SYSIO_CEAFSR_PPIO) ? |
353 | "PIO" : | 368 | "PIO" : |
354 | ((error_bits & SYSIO_CEAFSR_PDRD) ? | 369 | ((error_bits & SYSIO_CEAFSR_PDRD) ? |
@@ -360,14 +375,14 @@ static irqreturn_t sysio_ce_handler(int irq, void *dev_id) | |||
360 | * XXX UDB CE trap handler does... -DaveM | 375 | * XXX UDB CE trap handler does... -DaveM |
361 | */ | 376 | */ |
362 | printk("SYSIO[%x]: DOFF[%lx] ECC Syndrome[%lx] Size[%lx] MID[%lx]\n", | 377 | printk("SYSIO[%x]: DOFF[%lx] ECC Syndrome[%lx] Size[%lx] MID[%lx]\n", |
363 | sbus->portid, | 378 | portid, |
364 | (afsr & SYSIO_CEAFSR_DOFF) >> 45UL, | 379 | (afsr & SYSIO_CEAFSR_DOFF) >> 45UL, |
365 | (afsr & SYSIO_CEAFSR_ESYND) >> 48UL, | 380 | (afsr & SYSIO_CEAFSR_ESYND) >> 48UL, |
366 | (afsr & SYSIO_CEAFSR_SIZE) >> 42UL, | 381 | (afsr & SYSIO_CEAFSR_SIZE) >> 42UL, |
367 | (afsr & SYSIO_CEAFSR_MID) >> 37UL); | 382 | (afsr & SYSIO_CEAFSR_MID) >> 37UL); |
368 | printk("SYSIO[%x]: AFAR[%016lx]\n", sbus->portid, afar); | 383 | printk("SYSIO[%x]: AFAR[%016lx]\n", portid, afar); |
369 | 384 | ||
370 | printk("SYSIO[%x]: Secondary CE errors [", sbus->portid); | 385 | printk("SYSIO[%x]: Secondary CE errors [", portid); |
371 | reported = 0; | 386 | reported = 0; |
372 | if (afsr & SYSIO_CEAFSR_SPIO) { | 387 | if (afsr & SYSIO_CEAFSR_SPIO) { |
373 | reported++; | 388 | reported++; |
@@ -404,11 +419,11 @@ static irqreturn_t sysio_ce_handler(int irq, void *dev_id) | |||
404 | #define SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved */ | 419 | #define SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved */ |
405 | static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id) | 420 | static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id) |
406 | { | 421 | { |
407 | struct sbus_bus *sbus = dev_id; | 422 | struct of_device *op = dev_id; |
408 | struct iommu *iommu = sbus->ofdev.dev.archdata.iommu; | 423 | struct iommu *iommu = op->dev.archdata.iommu; |
409 | unsigned long afsr_reg, afar_reg, reg_base; | 424 | unsigned long afsr_reg, afar_reg, reg_base; |
410 | unsigned long afsr, afar, error_bits; | 425 | unsigned long afsr, afar, error_bits; |
411 | int reported; | 426 | int reported, portid; |
412 | 427 | ||
413 | reg_base = iommu->write_complete_reg - 0x2000UL; | 428 | reg_base = iommu->write_complete_reg - 0x2000UL; |
414 | afsr_reg = reg_base + SYSIO_SBUS_AFSR; | 429 | afsr_reg = reg_base + SYSIO_SBUS_AFSR; |
@@ -423,9 +438,11 @@ static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id) | |||
423 | SYSIO_SBAFSR_SLE | SYSIO_SBAFSR_STO | SYSIO_SBAFSR_SBERR); | 438 | SYSIO_SBAFSR_SLE | SYSIO_SBAFSR_STO | SYSIO_SBAFSR_SBERR); |
424 | upa_writeq(error_bits, afsr_reg); | 439 | upa_writeq(error_bits, afsr_reg); |
425 | 440 | ||
441 | portid = of_getintprop_default(op->node, "portid", -1); | ||
442 | |||
426 | /* Log the error. */ | 443 | /* Log the error. */ |
427 | printk("SYSIO[%x]: SBUS Error, primary error type[%s] read(%d)\n", | 444 | printk("SYSIO[%x]: SBUS Error, primary error type[%s] read(%d)\n", |
428 | sbus->portid, | 445 | portid, |
429 | (((error_bits & SYSIO_SBAFSR_PLE) ? | 446 | (((error_bits & SYSIO_SBAFSR_PLE) ? |
430 | "Late PIO Error" : | 447 | "Late PIO Error" : |
431 | ((error_bits & SYSIO_SBAFSR_PTO) ? | 448 | ((error_bits & SYSIO_SBAFSR_PTO) ? |
@@ -434,11 +451,11 @@ static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id) | |||
434 | "Error Ack" : "???")))), | 451 | "Error Ack" : "???")))), |
435 | (afsr & SYSIO_SBAFSR_RD) ? 1 : 0); | 452 | (afsr & SYSIO_SBAFSR_RD) ? 1 : 0); |
436 | printk("SYSIO[%x]: size[%lx] MID[%lx]\n", | 453 | printk("SYSIO[%x]: size[%lx] MID[%lx]\n", |
437 | sbus->portid, | 454 | portid, |
438 | (afsr & SYSIO_SBAFSR_SIZE) >> 42UL, | 455 | (afsr & SYSIO_SBAFSR_SIZE) >> 42UL, |
439 | (afsr & SYSIO_SBAFSR_MID) >> 37UL); | 456 | (afsr & SYSIO_SBAFSR_MID) >> 37UL); |
440 | printk("SYSIO[%x]: AFAR[%016lx]\n", sbus->portid, afar); | 457 | printk("SYSIO[%x]: AFAR[%016lx]\n", portid, afar); |
441 | printk("SYSIO[%x]: Secondary SBUS errors [", sbus->portid); | 458 | printk("SYSIO[%x]: Secondary SBUS errors [", portid); |
442 | reported = 0; | 459 | reported = 0; |
443 | if (afsr & SYSIO_SBAFSR_SLE) { | 460 | if (afsr & SYSIO_SBAFSR_SLE) { |
444 | reported++; | 461 | reported++; |
@@ -470,34 +487,37 @@ static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id) | |||
470 | #define SYSIO_CE_INO 0x35 | 487 | #define SYSIO_CE_INO 0x35 |
471 | #define SYSIO_SBUSERR_INO 0x36 | 488 | #define SYSIO_SBUSERR_INO 0x36 |
472 | 489 | ||
473 | static void __init sysio_register_error_handlers(struct sbus_bus *sbus) | 490 | static void __init sysio_register_error_handlers(struct of_device *op) |
474 | { | 491 | { |
475 | struct iommu *iommu = sbus->ofdev.dev.archdata.iommu; | 492 | struct iommu *iommu = op->dev.archdata.iommu; |
476 | unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; | 493 | unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; |
477 | unsigned int irq; | 494 | unsigned int irq; |
478 | u64 control; | 495 | u64 control; |
496 | int portid; | ||
497 | |||
498 | portid = of_getintprop_default(op->node, "portid", -1); | ||
479 | 499 | ||
480 | irq = sbus_build_irq(sbus, SYSIO_UE_INO); | 500 | irq = sbus_build_irq(op, SYSIO_UE_INO); |
481 | if (request_irq(irq, sysio_ue_handler, 0, | 501 | if (request_irq(irq, sysio_ue_handler, 0, |
482 | "SYSIO_UE", sbus) < 0) { | 502 | "SYSIO_UE", op) < 0) { |
483 | prom_printf("SYSIO[%x]: Cannot register UE interrupt.\n", | 503 | prom_printf("SYSIO[%x]: Cannot register UE interrupt.\n", |
484 | sbus->portid); | 504 | portid); |
485 | prom_halt(); | 505 | prom_halt(); |
486 | } | 506 | } |
487 | 507 | ||
488 | irq = sbus_build_irq(sbus, SYSIO_CE_INO); | 508 | irq = sbus_build_irq(op, SYSIO_CE_INO); |
489 | if (request_irq(irq, sysio_ce_handler, 0, | 509 | if (request_irq(irq, sysio_ce_handler, 0, |
490 | "SYSIO_CE", sbus) < 0) { | 510 | "SYSIO_CE", op) < 0) { |
491 | prom_printf("SYSIO[%x]: Cannot register CE interrupt.\n", | 511 | prom_printf("SYSIO[%x]: Cannot register CE interrupt.\n", |
492 | sbus->portid); | 512 | portid); |
493 | prom_halt(); | 513 | prom_halt(); |
494 | } | 514 | } |
495 | 515 | ||
496 | irq = sbus_build_irq(sbus, SYSIO_SBUSERR_INO); | 516 | irq = sbus_build_irq(op, SYSIO_SBUSERR_INO); |
497 | if (request_irq(irq, sysio_sbus_error_handler, 0, | 517 | if (request_irq(irq, sysio_sbus_error_handler, 0, |
498 | "SYSIO_SBERR", sbus) < 0) { | 518 | "SYSIO_SBERR", op) < 0) { |
499 | prom_printf("SYSIO[%x]: Cannot register SBUS Error interrupt.\n", | 519 | prom_printf("SYSIO[%x]: Cannot register SBUS Error interrupt.\n", |
500 | sbus->portid); | 520 | portid); |
501 | prom_halt(); | 521 | prom_halt(); |
502 | } | 522 | } |
503 | 523 | ||
@@ -513,19 +533,15 @@ static void __init sysio_register_error_handlers(struct sbus_bus *sbus) | |||
513 | } | 533 | } |
514 | 534 | ||
515 | /* Boot time initialization. */ | 535 | /* Boot time initialization. */ |
516 | static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus) | 536 | static void __init sbus_iommu_init(struct of_device *op) |
517 | { | 537 | { |
518 | const struct linux_prom64_registers *pr; | 538 | const struct linux_prom64_registers *pr; |
519 | struct device_node *dp; | 539 | struct device_node *dp = op->node; |
520 | struct iommu *iommu; | 540 | struct iommu *iommu; |
521 | struct strbuf *strbuf; | 541 | struct strbuf *strbuf; |
522 | unsigned long regs, reg_base; | 542 | unsigned long regs, reg_base; |
543 | int i, portid; | ||
523 | u64 control; | 544 | u64 control; |
524 | int i; | ||
525 | |||
526 | dp = of_find_node_by_phandle(__node); | ||
527 | |||
528 | sbus->portid = of_getintprop_default(dp, "upa-portid", -1); | ||
529 | 545 | ||
530 | pr = of_get_property(dp, "reg", NULL); | 546 | pr = of_get_property(dp, "reg", NULL); |
531 | if (!pr) { | 547 | if (!pr) { |
@@ -542,9 +558,9 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus) | |||
542 | if (!strbuf) | 558 | if (!strbuf) |
543 | goto fatal_memory_error; | 559 | goto fatal_memory_error; |
544 | 560 | ||
545 | sbus->ofdev.dev.archdata.iommu = iommu; | 561 | op->dev.archdata.iommu = iommu; |
546 | sbus->ofdev.dev.archdata.stc = strbuf; | 562 | op->dev.archdata.stc = strbuf; |
547 | sbus->ofdev.dev.archdata.numa_node = -1; | 563 | op->dev.archdata.numa_node = -1; |
548 | 564 | ||
549 | reg_base = regs + SYSIO_IOMMUREG_BASE; | 565 | reg_base = regs + SYSIO_IOMMUREG_BASE; |
550 | iommu->iommu_control = reg_base + IOMMU_CONTROL; | 566 | iommu->iommu_control = reg_base + IOMMU_CONTROL; |
@@ -572,8 +588,9 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus) | |||
572 | */ | 588 | */ |
573 | iommu->write_complete_reg = regs + 0x2000UL; | 589 | iommu->write_complete_reg = regs + 0x2000UL; |
574 | 590 | ||
575 | printk("SYSIO: UPA portID %x, at %016lx\n", | 591 | portid = of_getintprop_default(op->node, "portid", -1); |
576 | sbus->portid, regs); | 592 | printk(KERN_INFO "SYSIO: UPA portID %x, at %016lx\n", |
593 | portid, regs); | ||
577 | 594 | ||
578 | /* Setup for TSB_SIZE=7, TBW_SIZE=0, MMU_DE=1, MMU_EN=1 */ | 595 | /* Setup for TSB_SIZE=7, TBW_SIZE=0, MMU_DE=1, MMU_EN=1 */ |
579 | if (iommu_table_init(iommu, IO_TSB_SIZE, MAP_BASE, 0xffffffff, -1)) | 596 | if (iommu_table_init(iommu, IO_TSB_SIZE, MAP_BASE, 0xffffffff, -1)) |
@@ -631,56 +648,27 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus) | |||
631 | 648 | ||
632 | /* Now some Xfire specific grot... */ | 649 | /* Now some Xfire specific grot... */ |
633 | if (this_is_starfire) | 650 | if (this_is_starfire) |
634 | starfire_hookup(sbus->portid); | 651 | starfire_hookup(portid); |
635 | 652 | ||
636 | sysio_register_error_handlers(sbus); | 653 | sysio_register_error_handlers(op); |
637 | return; | 654 | return; |
638 | 655 | ||
639 | fatal_memory_error: | 656 | fatal_memory_error: |
640 | prom_printf("sbus_iommu_init: Fatal memory allocation error.\n"); | 657 | prom_printf("sbus_iommu_init: Fatal memory allocation error.\n"); |
641 | } | 658 | } |
642 | 659 | ||
643 | void sbus_fill_device_irq(struct sbus_dev *sdev) | 660 | static int __init sbus_init(void) |
644 | { | 661 | { |
645 | struct device_node *dp = of_find_node_by_phandle(sdev->prom_node); | 662 | struct device_node *dp; |
646 | const struct linux_prom_irqs *irqs; | ||
647 | |||
648 | irqs = of_get_property(dp, "interrupts", NULL); | ||
649 | if (!irqs) { | ||
650 | sdev->irqs[0] = 0; | ||
651 | sdev->num_irqs = 0; | ||
652 | } else { | ||
653 | unsigned int pri = irqs[0].pri; | ||
654 | 663 | ||
655 | sdev->num_irqs = 1; | 664 | for_each_node_by_name(dp, "sbus") { |
656 | if (pri < 0x20) | 665 | struct of_device *op = of_find_device_by_node(dp); |
657 | pri += sdev->slot * 8; | ||
658 | 666 | ||
659 | sdev->irqs[0] = sbus_build_irq(sdev->bus, pri); | 667 | sbus_iommu_init(op); |
668 | of_propagate_archdata(op); | ||
660 | } | 669 | } |
661 | } | ||
662 | 670 | ||
663 | void __init sbus_arch_bus_ranges_init(struct device_node *pn, struct sbus_bus *sbus) | ||
664 | { | ||
665 | } | ||
666 | |||
667 | void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp) | ||
668 | { | ||
669 | sbus_iommu_init(dp->node, sbus); | ||
670 | } | ||
671 | |||
672 | void __init sbus_setup_arch_props(struct sbus_bus *sbus, struct device_node *dp) | ||
673 | { | ||
674 | } | ||
675 | |||
676 | int __init sbus_arch_preinit(void) | ||
677 | { | ||
678 | return 0; | 671 | return 0; |
679 | } | 672 | } |
680 | 673 | ||
681 | void __init sbus_arch_postinit(void) | 674 | subsys_initcall(sbus_init); |
682 | { | ||
683 | extern void firetruck_init(void); | ||
684 | |||
685 | firetruck_init(); | ||
686 | } | ||