Commit 53f01bba49938f115237fe43a261c31ac13ae5c6

Authored by Matthew Wilcox
Committed by Kyle McMartin
1 parent bdad1f836a

[PARISC] Convert parisc_device to use struct resource for hpa

Convert pa_dev->hpa from an unsigned long to a struct resource.

Signed-off-by: Matthew Wilcox <willy@parisc-linux.org>

Fix up users of ->hpa to use ->hpa.start instead.

Signed-off-by: Matthew Wilcox <willy@parisc-linux.org>

Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>

Showing 23 changed files with 60 additions and 55 deletions Side-by-side Diff

arch/parisc/kernel/perf.c
... ... @@ -746,7 +746,8 @@
746 746 uint64_t *bptr;
747 747 uint32_t dwords;
748 748 uint32_t *intrigue_rdr;
749   - uint64_t *intrigue_bitmask, tmp64, proc_hpa;
  749 + uint64_t *intrigue_bitmask, tmp64;
  750 + void __iomem *runway;
750 751 struct rdr_tbl_ent *tentry;
751 752 int i;
752 753  
753 754  
754 755  
... ... @@ -798,15 +799,16 @@
798 799 return -1;
799 800 }
800 801  
801   - proc_hpa = cpu_device->hpa;
  802 + runway = ioremap(cpu_device->hpa.start, 4096);
802 803  
803 804 /* Merge intrigue bits into Runway STATUS 0 */
804   - tmp64 = __raw_readq(proc_hpa + RUNWAY_STATUS) & 0xffecfffffffffffful;
805   - __raw_writeq(tmp64 | (*memaddr++ & 0x0013000000000000ul), proc_hpa + RUNWAY_STATUS);
  805 + tmp64 = __raw_readq(runway + RUNWAY_STATUS) & 0xffecfffffffffffful;
  806 + __raw_writeq(tmp64 | (*memaddr++ & 0x0013000000000000ul),
  807 + runway + RUNWAY_STATUS);
806 808  
807 809 /* Write RUNWAY DEBUG registers */
808 810 for (i = 0; i < 8; i++) {
809   - __raw_writeq(*memaddr++, proc_hpa + RUNWAY_DEBUG + i);
  811 + __raw_writeq(*memaddr++, runway + RUNWAY_DEBUG);
810 812 }
811 813  
812 814 return 0;
arch/parisc/kernel/processor.c
... ... @@ -92,7 +92,7 @@
92 92 * May get overwritten by PAT code.
93 93 */
94 94 cpuid = boot_cpu_data.cpu_count;
95   - txn_addr = dev->hpa; /* for legacy PDC */
  95 + txn_addr = dev->hpa.start; /* for legacy PDC */
96 96  
97 97 #ifdef __LP64__
98 98 if (is_pdc_pat()) {
... ... @@ -122,7 +122,7 @@
122 122 * boot time (ie shutdown a CPU from an OS perspective).
123 123 */
124 124 /* get the cpu number */
125   - status = pdc_pat_cpu_get_number(&cpu_info, dev->hpa);
  125 + status = pdc_pat_cpu_get_number(&cpu_info, dev->hpa.start);
126 126  
127 127 BUG_ON(PDC_OK != status);
128 128  
... ... @@ -130,7 +130,7 @@
130 130 printk(KERN_WARNING "IGNORING CPU at 0x%x,"
131 131 " cpu_slot_id > NR_CPUS"
132 132 " (%ld > %d)\n",
133   - dev->hpa, cpu_info.cpu_num, NR_CPUS);
  133 + dev->hpa.start, cpu_info.cpu_num, NR_CPUS);
134 134 /* Ignore CPU since it will only crash */
135 135 boot_cpu_data.cpu_count--;
136 136 return 1;
... ... @@ -149,7 +149,7 @@
149 149  
150 150 p->loops_per_jiffy = loops_per_jiffy;
151 151 p->dev = dev; /* Save IODC data in case we need it */
152   - p->hpa = dev->hpa; /* save CPU hpa */
  152 + p->hpa = dev->hpa.start; /* save CPU hpa */
153 153 p->cpuid = cpuid; /* save CPU id */
154 154 p->txn_addr = txn_addr; /* save CPU IRQ address */
155 155 #ifdef CONFIG_SMP
drivers/input/keyboard/hilkbd.c
... ... @@ -278,11 +278,11 @@
278 278 hil_init_chip(struct parisc_device *dev)
279 279 {
280 280 if (!dev->irq) {
281   - printk(KERN_WARNING "HIL: IRQ not found for HIL bus at 0x%08lx\n", dev->hpa);
  281 + printk(KERN_WARNING "HIL: IRQ not found for HIL bus at 0x%08lx\n", dev->hpa.start);
282 282 return -ENODEV;
283 283 }
284 284  
285   - hil_base = dev->hpa;
  285 + hil_base = dev->hpa.start;
286 286 hil_irq = dev->irq;
287 287 hil_dev.dev_id = dev;
288 288  
drivers/input/serio/gscps2.c
... ... @@ -331,7 +331,7 @@
331 331 {
332 332 struct gscps2port *ps2port;
333 333 struct serio *serio;
334   - unsigned long hpa = dev->hpa;
  334 + unsigned long hpa = dev->hpa.start;
335 335 int ret;
336 336  
337 337 if (!dev->irq)
drivers/input/serio/hp_sdc.c
... ... @@ -875,9 +875,9 @@
875 875 hp_sdc.dev = d;
876 876 hp_sdc.irq = d->irq;
877 877 hp_sdc.nmi = d->aux_irq;
878   - hp_sdc.base_io = d->hpa;
879   - hp_sdc.data_io = d->hpa + 0x800;
880   - hp_sdc.status_io = d->hpa + 0x801;
  878 + hp_sdc.base_io = d->hpa.start;
  879 + hp_sdc.data_io = d->hpa.start + 0x800;
  880 + hp_sdc.status_io = d->hpa.start + 0x801;
881 881  
882 882 return hp_sdc_init();
883 883 }
drivers/net/lasi_82596.c
... ... @@ -1528,17 +1528,18 @@
1528 1528  
1529 1529 if (!dev->irq) {
1530 1530 printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n",
1531   - __FILE__, dev->hpa);
  1531 + __FILE__, dev->hpa.start);
1532 1532 return -ENODEV;
1533 1533 }
1534 1534  
1535   - printk(KERN_INFO "Found i82596 at 0x%lx, IRQ %d\n", dev->hpa, dev->irq);
  1535 + printk(KERN_INFO "Found i82596 at 0x%lx, IRQ %d\n", dev->hpa.start,
  1536 + dev->irq);
1536 1537  
1537 1538 netdevice = alloc_etherdev(0);
1538 1539 if (!netdevice)
1539 1540 return -ENOMEM;
1540 1541  
1541   - netdevice->base_addr = dev->hpa;
  1542 + netdevice->base_addr = dev->hpa.start;
1542 1543 netdevice->irq = dev->irq;
1543 1544  
1544 1545 retval = i82596_probe(netdevice, &dev->dev);
drivers/parisc/asp.c
... ... @@ -77,12 +77,12 @@
77 77 struct gsc_irq gsc_irq;
78 78 int ret;
79 79  
80   - asp.version = gsc_readb(dev->hpa + ASP_VER_OFFSET) & 0xf;
  80 + asp.version = gsc_readb(dev->hpa.start + ASP_VER_OFFSET) & 0xf;
81 81 asp.name = (asp.version == 1) ? "Asp" : "Cutoff";
82 82 asp.hpa = ASP_INTERRUPT_ADDR;
83 83  
84 84 printk(KERN_INFO "%s version %d at 0x%lx found.\n",
85   - asp.name, asp.version, dev->hpa);
  85 + asp.name, asp.version, dev->hpa.start);
86 86  
87 87 /* the IRQ ASP should use */
88 88 ret = -EBUSY;
drivers/parisc/ccio-dma.c
... ... @@ -1546,7 +1546,7 @@
1546 1546  
1547 1547 ioc->name = dev->id.hversion == U2_IOA_RUNWAY ? "U2" : "UTurn";
1548 1548  
1549   - printk(KERN_INFO "Found %s at 0x%lx\n", ioc->name, dev->hpa);
  1549 + printk(KERN_INFO "Found %s at 0x%lx\n", ioc->name, dev->hpa.start);
1550 1550  
1551 1551 for (i = 0; i < ioc_count; i++) {
1552 1552 ioc_p = &(*ioc_p)->next;
... ... @@ -1554,7 +1554,7 @@
1554 1554 *ioc_p = ioc;
1555 1555  
1556 1556 ioc->hw_path = dev->hw_path;
1557   - ioc->ioc_hpa = (struct ioa_registers *)dev->hpa;
  1557 + ioc->ioc_regs = ioremap(dev->hpa.start, 4096);
1558 1558 ccio_ioc_init(ioc);
1559 1559 ccio_init_resources(ioc);
1560 1560 hppa_dma_ops = &ccio_ops;
drivers/parisc/ccio-rm-dma.c
... ... @@ -167,7 +167,7 @@
167 167 {
168 168 printk(KERN_INFO "%s found %s at 0x%lx\n", MODULE_NAME,
169 169 dev->id.hversion == U2_BC_GSC ? "U2" : "UTurn",
170   - dev->hpa);
  170 + dev->hpa.start);
171 171  
172 172 /*
173 173 ** FIXME - should check U2 registers to verify it's really running
drivers/parisc/dino.c
... ... @@ -902,15 +902,15 @@
902 902 ** If so, initialize the chip appropriately (card-mode vs bridge mode).
903 903 ** Much of the initialization is common though.
904 904 */
905   -static int __init
906   -dino_driver_callback(struct parisc_device *dev)
  905 +static int __init dino_probe(struct parisc_device *dev)
907 906 {
908 907 struct dino_device *dino_dev; // Dino specific control struct
909 908 const char *version = "unknown";
910 909 char *name;
911 910 int is_cujo = 0;
912 911 struct pci_bus *bus;
913   -
  912 + unsigned long hpa = dev->hpa.start;
  913 +
914 914 name = "Dino";
915 915 if (is_card_dino(&dev->id)) {
916 916 version = "3.x (card mode)";
drivers/parisc/eisa.c
... ... @@ -315,7 +315,7 @@
315 315 char *name = is_mongoose(dev) ? "Mongoose" : "Wax";
316 316  
317 317 printk(KERN_INFO "%s EISA Adapter found at 0x%08lx\n",
318   - name, dev->hpa);
  318 + name, dev->hpa.start);
319 319  
320 320 eisa_dev.hba.dev = dev;
321 321 eisa_dev.hba.iommu = ccio_get_iommu(dev);
drivers/parisc/hppb.c
... ... @@ -68,14 +68,14 @@
68 68 memset(card->next, '\0', sizeof(struct hppb_card));
69 69 card = card->next;
70 70 }
71   - printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa);
  71 + printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa.start);
72 72  
73   - card->hpa = dev->hpa;
  73 + card->hpa = dev->hpa.start;
74 74 card->mmio_region.name = "HP-PB Bus";
75 75 card->mmio_region.flags = IORESOURCE_MEM;
76 76  
77   - card->mmio_region.start = __raw_readl(dev->hpa + IO_IO_LOW);
78   - card->mmio_region.end = __raw_readl(dev->hpa + IO_IO_HIGH) - 1;
  77 + card->mmio_region.start = gsc_readl(dev->hpa.start + IO_IO_LOW);
  78 + card->mmio_region.end = gsc_readl(dev->hpa.start + IO_IO_HIGH) - 1;
79 79  
80 80 status = ccio_request_resource(dev, &card->mmio_region);
81 81 if(status < 0) {
drivers/parisc/lasi.c
... ... @@ -175,7 +175,7 @@
175 175 return -ENOMEM;
176 176  
177 177 lasi->name = "Lasi";
178   - lasi->hpa = dev->hpa;
  178 + lasi->hpa = dev->hpa.start;
179 179  
180 180 /* Check the 4-bit (yes, only 4) version register */
181 181 lasi->version = gsc_readl(lasi->hpa + LASI_VER) & 0xf;
drivers/parisc/lba_pci.c
... ... @@ -1288,7 +1288,7 @@
1288 1288 ** Adjust "window" for this rope.
1289 1289 */
1290 1290 rsize /= ROPES_PER_IOC;
1291   - r->start += (rsize + 1) * LBA_NUM(pa_dev->hpa);
  1291 + r->start += (rsize + 1) * LBA_NUM(pa_dev->hpa.start);
1292 1292 r->end = r->start + rsize;
1293 1293 } else {
1294 1294 r->end = r->start = 0; /* Not enabled. */
... ... @@ -1458,7 +1458,7 @@
1458 1458 u32 func_class;
1459 1459 void *tmp_obj;
1460 1460 char *version;
1461   - void __iomem *addr = ioremap(dev->hpa, 4096);
  1461 + void __iomem *addr = ioremap(dev->hpa.start, 4096);
1462 1462  
1463 1463 /* Read HW Rev First */
1464 1464 func_class = READ_REG32(addr + LBA_FCLASS);
... ... @@ -1476,7 +1476,7 @@
1476 1476 }
1477 1477  
1478 1478 printk(KERN_INFO "%s version %s (0x%x) found at 0x%lx\n",
1479   - MODULE_NAME, version, func_class & 0xf, dev->hpa);
  1479 + MODULE_NAME, version, func_class & 0xf, dev->hpa.start);
1480 1480  
1481 1481 if (func_class < 2) {
1482 1482 printk(KERN_WARNING "Can't support LBA older than "
1483 1483  
1484 1484  
... ... @@ -1503,17 +1503,17 @@
1503 1503 * but for the mask for func_class.
1504 1504 */
1505 1505 printk(KERN_INFO "%s version %s (0x%x) found at 0x%lx\n",
1506   - MODULE_NAME, version, func_class & 0xff, dev->hpa);
  1506 + MODULE_NAME, version, func_class & 0xff, dev->hpa.start);
1507 1507 cfg_ops = &mercury_cfg_ops;
1508 1508 } else {
1509   - printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa);
  1509 + printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa.start);
1510 1510 return -ENODEV;
1511 1511 }
1512 1512  
1513 1513 /*
1514 1514 ** Tell I/O SAPIC driver we have a IRQ handler/region.
1515 1515 */
1516   - tmp_obj = iosapic_register(dev->hpa + LBA_IOSAPIC_BASE);
  1516 + tmp_obj = iosapic_register(dev->hpa.start + LBA_IOSAPIC_BASE);
1517 1517  
1518 1518 /* NOTE: PCI devices (e.g. 103c:1005 graphics card) which don't
1519 1519 ** have an IRT entry will get NULL back from iosapic code.
... ... @@ -1635,7 +1635,7 @@
1635 1635 */
1636 1636 void lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask)
1637 1637 {
1638   - void __iomem * base_addr = ioremap(lba->hpa, 4096);
  1638 + void __iomem * base_addr = ioremap(lba->hpa.start, 4096);
1639 1639  
1640 1640 imask <<= 2; /* adjust for hints - 2 more bits */
1641 1641  
drivers/parisc/sba_iommu.c
... ... @@ -1600,7 +1600,7 @@
1600 1600  
1601 1601 static void __iomem *ioc_remap(struct sba_device *sba_dev, int offset)
1602 1602 {
1603   - return ioremap(sba_dev->dev->hpa + offset, SBA_FUNC_SIZE);
  1603 + return ioremap(sba_dev->dev->hpa.start + offset, SBA_FUNC_SIZE);
1604 1604 }
1605 1605  
1606 1606 static void sba_hw_init(struct sba_device *sba_dev)
... ... @@ -1978,7 +1978,7 @@
1978 1978 u32 func_class;
1979 1979 int i;
1980 1980 char *version;
1981   - void __iomem *sba_addr = ioremap(dev->hpa, SBA_FUNC_SIZE);
  1981 + void __iomem *sba_addr = ioremap(dev->hpa.start, SBA_FUNC_SIZE);
1982 1982  
1983 1983 sba_dump_ranges(sba_addr);
1984 1984  
... ... @@ -2020,7 +2020,7 @@
2020 2020 }
2021 2021  
2022 2022 printk(KERN_INFO "%s found %s at 0x%lx\n",
2023   - MODULE_NAME, version, dev->hpa);
  2023 + MODULE_NAME, version, dev->hpa.start);
2024 2024  
2025 2025 sba_dev = kmalloc(sizeof(struct sba_device), GFP_KERNEL);
2026 2026 if (!sba_dev) {
drivers/parisc/wax.c
... ... @@ -81,7 +81,7 @@
81 81 return -ENOMEM;
82 82  
83 83 wax->name = "wax";
84   - wax->hpa = dev->hpa;
  84 + wax->hpa = dev->hpa.start;
85 85  
86 86 wax->version = 0; /* gsc_readb(wax->hpa+WAX_VER); */
87 87 printk(KERN_INFO "%s at 0x%lx found.\n", wax->name, wax->hpa);
drivers/parport/parport_gsc.c
... ... @@ -359,11 +359,12 @@
359 359 unsigned long port;
360 360  
361 361 if (!dev->irq) {
362   - printk("IRQ not found for parallel device at 0x%lx\n", dev->hpa);
  362 + printk(KERN_WARNING "IRQ not found for parallel device at 0x%lx\n",
  363 + dev->hpa.start);
363 364 return -ENODEV;
364 365 }
365 366  
366   - port = dev->hpa + PARPORT_GSC_OFFSET;
  367 + port = dev->hpa.start + PARPORT_GSC_OFFSET;
367 368  
368 369 /* some older machines with ASP-chip don't support
369 370 * the enhanced parport modes.
drivers/scsi/lasi700.c
... ... @@ -98,7 +98,7 @@
98 98 static int __init
99 99 lasi700_probe(struct parisc_device *dev)
100 100 {
101   - unsigned long base = dev->hpa + LASI_SCSI_CORE_OFFSET;
  101 + unsigned long base = dev->hpa.start + LASI_SCSI_CORE_OFFSET;
102 102 struct NCR_700_Host_Parameters *hostdata;
103 103 struct Scsi_Host *host;
104 104  
drivers/scsi/zalon.c
... ... @@ -88,7 +88,7 @@
88 88 struct gsc_irq gsc_irq;
89 89 u32 zalon_vers;
90 90 int error = -ENODEV;
91   - void __iomem *zalon = ioremap(dev->hpa, 4096);
  91 + void __iomem *zalon = ioremap(dev->hpa.start, 4096);
92 92 void __iomem *io_port = zalon + GSC_SCSI_ZALON_OFFSET;
93 93 static int unit = 0;
94 94 struct Scsi_Host *host;
... ... @@ -127,7 +127,7 @@
127 127 device.chip = zalon720_chip;
128 128 device.host_id = 7;
129 129 device.dev = &dev->dev;
130   - device.slot.base = dev->hpa + GSC_SCSI_ZALON_OFFSET;
  130 + device.slot.base = dev->hpa.start + GSC_SCSI_ZALON_OFFSET;
131 131 device.slot.base_v = io_port;
132 132 device.slot.irq = dev->irq;
133 133 device.differential = 2;
drivers/serial/8250_gsc.c
... ... @@ -42,12 +42,13 @@
42 42 */
43 43 if (parisc_parent(dev)->id.hw_type != HPHW_IOA) {
44 44 printk(KERN_INFO "Serial: device 0x%lx not configured.\n"
45   - "Enable support for Wax, Lasi, Asp or Dino.\n", dev->hpa);
  45 + "Enable support for Wax, Lasi, Asp or Dino.\n",
  46 + dev->hpa.start);
46 47 }
47 48 return -ENODEV;
48 49 }
49 50  
50   - address = dev->hpa;
  51 + address = dev->hpa.start;
51 52 if (dev->id.sversion != 0x8d) {
52 53 address += 0x800;
53 54 }
drivers/serial/mux.c
... ... @@ -444,7 +444,7 @@
444 444 unsigned long bytecnt;
445 445 struct uart_port *port;
446 446  
447   - status = pdc_iodc_read(&bytecnt, dev->hpa, 0, iodc_data, 32);
  447 + status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32);
448 448 if(status != PDC_OK) {
449 449 printk(KERN_ERR "Serial mux: Unable to read IODC.\n");
450 450 return 1;
include/asm-parisc/parisc-device.h
1 1 #include <linux/device.h>
2 2  
3 3 struct parisc_device {
4   - unsigned long hpa; /* Hard Physical Address */
  4 + struct resource hpa; /* Hard Physical Address */
5 5 struct parisc_device_id id;
6 6 struct parisc_driver *driver; /* Driver for this device */
7 7 char name[80]; /* The hardware description */
sound/parisc/harmony.c
... ... @@ -852,14 +852,14 @@
852 852 memset(&h->pbuf, 0, sizeof(h->pbuf));
853 853 memset(&h->cbuf, 0, sizeof(h->cbuf));
854 854  
855   - h->hpa = padev->hpa;
  855 + h->hpa = padev->hpa.start;
856 856 h->card = card;
857 857 h->dev = padev;
858 858 h->irq = padev->irq;
859   - h->iobase = ioremap_nocache(padev->hpa, HARMONY_SIZE);
  859 + h->iobase = ioremap_nocache(padev->hpa.start, HARMONY_SIZE);
860 860 if (h->iobase == NULL) {
861 861 printk(KERN_ERR PFX "unable to remap hpa 0x%lx\n",
862   - padev->hpa);
  862 + padev->hpa.start);
863 863 err = -EBUSY;
864 864 goto free_and_ret;
865 865 }