aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/include/asm/irq_64.h1
-rw-r--r--arch/sparc/include/asm/pci_32.h8
-rw-r--r--arch/sparc/include/asm/pci_64.h8
-rw-r--r--arch/sparc/include/asm/vga.h1
-rw-r--r--arch/sparc/include/asm/vio.h9
-rw-r--r--arch/sparc/kernel/ds.c5
-rw-r--r--arch/sparc/kernel/leon_pci.c47
-rw-r--r--arch/sparc/kernel/pci.c106
-rw-r--r--arch/sparc/kernel/vio.c8
10 files changed, 53 insertions, 141 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index ca5580e4d81..1666de84d47 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -29,6 +29,7 @@ config SPARC
29 select GENERIC_IRQ_SHOW 29 select GENERIC_IRQ_SHOW
30 select USE_GENERIC_SMP_HELPERS if SMP 30 select USE_GENERIC_SMP_HELPERS if SMP
31 select GENERIC_PCI_IOMAP 31 select GENERIC_PCI_IOMAP
32 select HAVE_NMI_WATCHDOG if SPARC64
32 33
33config SPARC32 34config SPARC32
34 def_bool !64BIT 35 def_bool !64BIT
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h
index 16dcae6d56e..abf6afe82ca 100644
--- a/arch/sparc/include/asm/irq_64.h
+++ b/arch/sparc/include/asm/irq_64.h
@@ -95,7 +95,6 @@ void arch_trigger_all_cpu_backtrace(void);
95extern void *hardirq_stack[NR_CPUS]; 95extern void *hardirq_stack[NR_CPUS];
96extern void *softirq_stack[NR_CPUS]; 96extern void *softirq_stack[NR_CPUS];
97#define __ARCH_HAS_DO_SOFTIRQ 97#define __ARCH_HAS_DO_SOFTIRQ
98#define ARCH_HAS_NMI_WATCHDOG
99 98
100#define NO_IRQ 0xffffffff 99#define NO_IRQ 0xffffffff
101 100
diff --git a/arch/sparc/include/asm/pci_32.h b/arch/sparc/include/asm/pci_32.h
index 6de7f7bf956..dc503297481 100644
--- a/arch/sparc/include/asm/pci_32.h
+++ b/arch/sparc/include/asm/pci_32.h
@@ -52,14 +52,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
52 * 64Kbytes by the Host controller. 52 * 64Kbytes by the Host controller.
53 */ 53 */
54 54
55extern void
56pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
57 struct resource *res);
58
59extern void
60pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
61 struct pci_bus_region *region);
62
63static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 55static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
64{ 56{
65 return PCI_IRQ_NONE; 57 return PCI_IRQ_NONE;
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h
index 755a4bb6bcd..1633b718d3b 100644
--- a/arch/sparc/include/asm/pci_64.h
+++ b/arch/sparc/include/asm/pci_64.h
@@ -73,14 +73,6 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
73 enum pci_mmap_state mmap_state, 73 enum pci_mmap_state mmap_state,
74 int write_combine); 74 int write_combine);
75 75
76extern void
77pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
78 struct resource *res);
79
80extern void
81pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
82 struct pci_bus_region *region);
83
84static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 76static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
85{ 77{
86 return PCI_IRQ_NONE; 78 return PCI_IRQ_NONE;
diff --git a/arch/sparc/include/asm/vga.h b/arch/sparc/include/asm/vga.h
index c69d5b2ba19..ec0e9967d93 100644
--- a/arch/sparc/include/asm/vga.h
+++ b/arch/sparc/include/asm/vga.h
@@ -7,6 +7,7 @@
7#ifndef _LINUX_ASM_VGA_H_ 7#ifndef _LINUX_ASM_VGA_H_
8#define _LINUX_ASM_VGA_H_ 8#define _LINUX_ASM_VGA_H_
9 9
10#include <linux/bug.h>
10#include <asm/types.h> 11#include <asm/types.h>
11 12
12#define VT_BUF_HAVE_RW 13#define VT_BUF_HAVE_RW
diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h
index 9d83d3bcb49..432afa83886 100644
--- a/arch/sparc/include/asm/vio.h
+++ b/arch/sparc/include/asm/vio.h
@@ -284,6 +284,7 @@ struct vio_dev {
284}; 284};
285 285
286struct vio_driver { 286struct vio_driver {
287 const char *name;
287 struct list_head node; 288 struct list_head node;
288 const struct vio_device_id *id_table; 289 const struct vio_device_id *id_table;
289 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id); 290 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
@@ -371,7 +372,13 @@ do { if (vio->debug & VIO_DEBUG_##TYPE) \
371 vio->vdev->channel_id, ## a); \ 372 vio->vdev->channel_id, ## a); \
372} while (0) 373} while (0)
373 374
374extern int vio_register_driver(struct vio_driver *drv); 375extern int __vio_register_driver(struct vio_driver *drv, struct module *owner,
376 const char *mod_name);
377/*
378 * vio_register_driver must be a macro so that KBUILD_MODNAME can be expanded
379 */
380#define vio_register_driver(driver) \
381 __vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
375extern void vio_unregister_driver(struct vio_driver *drv); 382extern void vio_unregister_driver(struct vio_driver *drv);
376 383
377static inline struct vio_driver *to_vio_driver(struct device_driver *drv) 384static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index 381edcd5bc2..fea13c7b1ae 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -1244,10 +1244,7 @@ static struct vio_driver ds_driver = {
1244 .id_table = ds_match, 1244 .id_table = ds_match,
1245 .probe = ds_probe, 1245 .probe = ds_probe,
1246 .remove = ds_remove, 1246 .remove = ds_remove,
1247 .driver = { 1247 .name = "ds",
1248 .name = "ds",
1249 .owner = THIS_MODULE,
1250 }
1251}; 1248};
1252 1249
1253static int __init ds_init(void) 1250static int __init ds_init(void)
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index c7bec25fdb1..aba6b958b2a 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -15,14 +15,19 @@
15 15
16/* The LEON architecture does not rely on a BIOS or bootloader to setup 16/* The LEON architecture does not rely on a BIOS or bootloader to setup
17 * PCI for us. The Linux generic routines are used to setup resources, 17 * PCI for us. The Linux generic routines are used to setup resources,
18 * reset values of confuration-space registers settings ae preseved. 18 * reset values of configuration-space register settings are preserved.
19 *
20 * PCI Memory and Prefetchable Memory is direct-mapped. However I/O Space is
21 * accessed through a Window which is translated to low 64KB in PCI space, the
22 * first 4KB is not used so 60KB is available.
19 */ 23 */
20void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info) 24void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
21{ 25{
22 LIST_HEAD(resources); 26 LIST_HEAD(resources);
23 struct pci_bus *root_bus; 27 struct pci_bus *root_bus;
24 28
25 pci_add_resource(&resources, &info->io_space); 29 pci_add_resource_offset(&resources, &info->io_space,
30 info->io_space.start - 0x1000);
26 pci_add_resource(&resources, &info->mem_space); 31 pci_add_resource(&resources, &info->mem_space);
27 32
28 root_bus = pci_scan_root_bus(&ofdev->dev, 0, info->ops, info, 33 root_bus = pci_scan_root_bus(&ofdev->dev, 0, info->ops, info,
@@ -38,44 +43,6 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
38 } 43 }
39} 44}
40 45
41/* PCI Memory and Prefetchable Memory is direct-mapped. However I/O Space is
42 * accessed through a Window which is translated to low 64KB in PCI space, the
43 * first 4KB is not used so 60KB is available.
44 *
45 * This function is used by generic code to translate resource addresses into
46 * PCI addresses.
47 */
48void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
49 struct resource *res)
50{
51 struct leon_pci_info *info = dev->bus->sysdata;
52
53 region->start = res->start;
54 region->end = res->end;
55
56 if (res->flags & IORESOURCE_IO) {
57 region->start -= (info->io_space.start - 0x1000);
58 region->end -= (info->io_space.start - 0x1000);
59 }
60}
61EXPORT_SYMBOL(pcibios_resource_to_bus);
62
63/* see pcibios_resource_to_bus() comment */
64void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
65 struct pci_bus_region *region)
66{
67 struct leon_pci_info *info = dev->bus->sysdata;
68
69 res->start = region->start;
70 res->end = region->end;
71
72 if (res->flags & IORESOURCE_IO) {
73 res->start += (info->io_space.start - 0x1000);
74 res->end += (info->io_space.start - 0x1000);
75 }
76}
77EXPORT_SYMBOL(pcibios_bus_to_resource);
78
79void __devinit pcibios_fixup_bus(struct pci_bus *pbus) 46void __devinit pcibios_fixup_bus(struct pci_bus *pbus)
80{ 47{
81 struct leon_pci_info *info = pbus->sysdata; 48 struct leon_pci_info *info = pbus->sysdata;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index bb8bc2e519a..fdaf2181167 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -375,13 +375,6 @@ static void __devinit apb_calc_first_last(u8 map, u32 *first_p, u32 *last_p)
375 *last_p = last; 375 *last_p = last;
376} 376}
377 377
378static void pci_resource_adjust(struct resource *res,
379 struct resource *root)
380{
381 res->start += root->start;
382 res->end += root->start;
383}
384
385/* For PCI bus devices which lack a 'ranges' property we interrogate 378/* For PCI bus devices which lack a 'ranges' property we interrogate
386 * the config space values to set the resources, just like the generic 379 * the config space values to set the resources, just like the generic
387 * Linux PCI probing code does. 380 * Linux PCI probing code does.
@@ -390,7 +383,8 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev,
390 struct pci_bus *bus, 383 struct pci_bus *bus,
391 struct pci_pbm_info *pbm) 384 struct pci_pbm_info *pbm)
392{ 385{
393 struct resource *res; 386 struct pci_bus_region region;
387 struct resource *res, res2;
394 u8 io_base_lo, io_limit_lo; 388 u8 io_base_lo, io_limit_lo;
395 u16 mem_base_lo, mem_limit_lo; 389 u16 mem_base_lo, mem_limit_lo;
396 unsigned long base, limit; 390 unsigned long base, limit;
@@ -412,11 +406,14 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev,
412 res = bus->resource[0]; 406 res = bus->resource[0];
413 if (base <= limit) { 407 if (base <= limit) {
414 res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; 408 res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO;
409 res2.flags = res->flags;
410 region.start = base;
411 region.end = limit + 0xfff;
412 pcibios_bus_to_resource(dev, &res2, &region);
415 if (!res->start) 413 if (!res->start)
416 res->start = base; 414 res->start = res2.start;
417 if (!res->end) 415 if (!res->end)
418 res->end = limit + 0xfff; 416 res->end = res2.end;
419 pci_resource_adjust(res, &pbm->io_space);
420 } 417 }
421 418
422 pci_read_config_word(dev, PCI_MEMORY_BASE, &mem_base_lo); 419 pci_read_config_word(dev, PCI_MEMORY_BASE, &mem_base_lo);
@@ -428,9 +425,9 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev,
428 if (base <= limit) { 425 if (base <= limit) {
429 res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | 426 res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) |
430 IORESOURCE_MEM); 427 IORESOURCE_MEM);
431 res->start = base; 428 region.start = base;
432 res->end = limit + 0xfffff; 429 region.end = limit + 0xfffff;
433 pci_resource_adjust(res, &pbm->mem_space); 430 pcibios_bus_to_resource(dev, res, &region);
434 } 431 }
435 432
436 pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); 433 pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo);
@@ -459,9 +456,9 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev,
459 if (base <= limit) { 456 if (base <= limit) {
460 res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | 457 res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) |
461 IORESOURCE_MEM | IORESOURCE_PREFETCH); 458 IORESOURCE_MEM | IORESOURCE_PREFETCH);
462 res->start = base; 459 region.start = base;
463 res->end = limit + 0xfffff; 460 region.end = limit + 0xfffff;
464 pci_resource_adjust(res, &pbm->mem_space); 461 pcibios_bus_to_resource(dev, res, &region);
465 } 462 }
466} 463}
467 464
@@ -472,6 +469,7 @@ static void __devinit apb_fake_ranges(struct pci_dev *dev,
472 struct pci_bus *bus, 469 struct pci_bus *bus,
473 struct pci_pbm_info *pbm) 470 struct pci_pbm_info *pbm)
474{ 471{
472 struct pci_bus_region region;
475 struct resource *res; 473 struct resource *res;
476 u32 first, last; 474 u32 first, last;
477 u8 map; 475 u8 map;
@@ -479,18 +477,18 @@ static void __devinit apb_fake_ranges(struct pci_dev *dev,
479 pci_read_config_byte(dev, APB_IO_ADDRESS_MAP, &map); 477 pci_read_config_byte(dev, APB_IO_ADDRESS_MAP, &map);
480 apb_calc_first_last(map, &first, &last); 478 apb_calc_first_last(map, &first, &last);
481 res = bus->resource[0]; 479 res = bus->resource[0];
482 res->start = (first << 21);
483 res->end = (last << 21) + ((1 << 21) - 1);
484 res->flags = IORESOURCE_IO; 480 res->flags = IORESOURCE_IO;
485 pci_resource_adjust(res, &pbm->io_space); 481 region.start = (first << 21);
482 region.end = (last << 21) + ((1 << 21) - 1);
483 pcibios_bus_to_resource(dev, res, &region);
486 484
487 pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map); 485 pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map);
488 apb_calc_first_last(map, &first, &last); 486 apb_calc_first_last(map, &first, &last);
489 res = bus->resource[1]; 487 res = bus->resource[1];
490 res->start = (first << 21);
491 res->end = (last << 21) + ((1 << 21) - 1);
492 res->flags = IORESOURCE_MEM; 488 res->flags = IORESOURCE_MEM;
493 pci_resource_adjust(res, &pbm->mem_space); 489 region.start = (first << 21);
490 region.end = (last << 21) + ((1 << 21) - 1);
491 pcibios_bus_to_resource(dev, res, &region);
494} 492}
495 493
496static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm, 494static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm,
@@ -506,6 +504,7 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
506 struct pci_bus *bus; 504 struct pci_bus *bus;
507 const u32 *busrange, *ranges; 505 const u32 *busrange, *ranges;
508 int len, i, simba; 506 int len, i, simba;
507 struct pci_bus_region region;
509 struct resource *res; 508 struct resource *res;
510 unsigned int flags; 509 unsigned int flags;
511 u64 size; 510 u64 size;
@@ -556,8 +555,6 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
556 } 555 }
557 i = 1; 556 i = 1;
558 for (; len >= 32; len -= 32, ranges += 8) { 557 for (; len >= 32; len -= 32, ranges += 8) {
559 struct resource *root;
560
561 flags = pci_parse_of_flags(ranges[0]); 558 flags = pci_parse_of_flags(ranges[0]);
562 size = GET_64BIT(ranges, 6); 559 size = GET_64BIT(ranges, 6);
563 if (flags == 0 || size == 0) 560 if (flags == 0 || size == 0)
@@ -569,7 +566,6 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
569 " for bridge %s\n", node->full_name); 566 " for bridge %s\n", node->full_name);
570 continue; 567 continue;
571 } 568 }
572 root = &pbm->io_space;
573 } else { 569 } else {
574 if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) { 570 if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) {
575 printk(KERN_ERR "PCI: too many memory ranges" 571 printk(KERN_ERR "PCI: too many memory ranges"
@@ -578,18 +574,12 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm,
578 } 574 }
579 res = bus->resource[i]; 575 res = bus->resource[i];
580 ++i; 576 ++i;
581 root = &pbm->mem_space;
582 } 577 }
583 578
584 res->start = GET_64BIT(ranges, 1);
585 res->end = res->start + size - 1;
586 res->flags = flags; 579 res->flags = flags;
587 580 region.start = GET_64BIT(ranges, 1);
588 /* Another way to implement this would be to add an of_device 581 region.end = region.start + size - 1;
589 * layer routine that can calculate a resource for a given 582 pcibios_bus_to_resource(dev, res, &region);
590 * range property value in a PCI device.
591 */
592 pci_resource_adjust(res, root);
593 } 583 }
594after_ranges: 584after_ranges:
595 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), 585 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
@@ -691,8 +681,10 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm,
691 681
692 printk("PCI: Scanning PBM %s\n", node->full_name); 682 printk("PCI: Scanning PBM %s\n", node->full_name);
693 683
694 pci_add_resource(&resources, &pbm->io_space); 684 pci_add_resource_offset(&resources, &pbm->io_space,
695 pci_add_resource(&resources, &pbm->mem_space); 685 pbm->io_space.start);
686 pci_add_resource_offset(&resources, &pbm->mem_space,
687 pbm->mem_space.start);
696 bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops, 688 bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
697 pbm, &resources); 689 pbm, &resources);
698 if (!bus) { 690 if (!bus) {
@@ -755,46 +747,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
755 return 0; 747 return 0;
756} 748}
757 749
758void pcibios_resource_to_bus(struct pci_dev *pdev, struct pci_bus_region *region,
759 struct resource *res)
760{
761 struct pci_pbm_info *pbm = pdev->bus->sysdata;
762 struct resource zero_res, *root;
763
764 zero_res.start = 0;
765 zero_res.end = 0;
766 zero_res.flags = res->flags;
767
768 if (res->flags & IORESOURCE_IO)
769 root = &pbm->io_space;
770 else
771 root = &pbm->mem_space;
772
773 pci_resource_adjust(&zero_res, root);
774
775 region->start = res->start - zero_res.start;
776 region->end = res->end - zero_res.start;
777}
778EXPORT_SYMBOL(pcibios_resource_to_bus);
779
780void pcibios_bus_to_resource(struct pci_dev *pdev, struct resource *res,
781 struct pci_bus_region *region)
782{
783 struct pci_pbm_info *pbm = pdev->bus->sysdata;
784 struct resource *root;
785
786 res->start = region->start;
787 res->end = region->end;
788
789 if (res->flags & IORESOURCE_IO)
790 root = &pbm->io_space;
791 else
792 root = &pbm->mem_space;
793
794 pci_resource_adjust(res, root);
795}
796EXPORT_SYMBOL(pcibios_bus_to_resource);
797
798char * __devinit pcibios_setup(char *str) 750char * __devinit pcibios_setup(char *str)
799{ 751{
800 return str; 752 return str;
diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index f67e28ef598..5cffdc55f07 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -119,13 +119,17 @@ static struct bus_type vio_bus_type = {
119 .remove = vio_device_remove, 119 .remove = vio_device_remove,
120}; 120};
121 121
122int vio_register_driver(struct vio_driver *viodrv) 122int __vio_register_driver(struct vio_driver *viodrv, struct module *owner,
123 const char *mod_name)
123{ 124{
124 viodrv->driver.bus = &vio_bus_type; 125 viodrv->driver.bus = &vio_bus_type;
126 viodrv->driver.name = viodrv->name;
127 viodrv->driver.owner = owner;
128 viodrv->driver.mod_name = mod_name;
125 129
126 return driver_register(&viodrv->driver); 130 return driver_register(&viodrv->driver);
127} 131}
128EXPORT_SYMBOL(vio_register_driver); 132EXPORT_SYMBOL(__vio_register_driver);
129 133
130void vio_unregister_driver(struct vio_driver *viodrv) 134void vio_unregister_driver(struct vio_driver *viodrv)
131{ 135{