.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | ** |
---|
3 | 4 | ** PCI Lower Bus Adapter (LBA) manager |
---|
.. | .. |
---|
5 | 6 | ** (c) Copyright 1999,2000 Grant Grundler |
---|
6 | 7 | ** (c) Copyright 1999,2000 Hewlett-Packard Company |
---|
7 | 8 | ** |
---|
8 | | -** This program is free software; you can redistribute it and/or modify |
---|
9 | | -** it under the terms of the GNU General Public License as published by |
---|
10 | | -** the Free Software Foundation; either version 2 of the License, or |
---|
11 | | -** (at your option) any later version. |
---|
12 | 9 | ** |
---|
13 | 10 | ** |
---|
14 | 11 | ** This module primarily provides access to PCI bus (config/IOport |
---|
.. | .. |
---|
48 | 45 | #include <asm/hardware.h> /* for register_parisc_driver() stuff */ |
---|
49 | 46 | #include <asm/parisc-device.h> |
---|
50 | 47 | #include <asm/io.h> /* read/write stuff */ |
---|
| 48 | + |
---|
| 49 | +#include "iommu.h" |
---|
51 | 50 | |
---|
52 | 51 | #undef DEBUG_LBA /* general stuff */ |
---|
53 | 52 | #undef DEBUG_LBA_PORT /* debug I/O Port access */ |
---|
.. | .. |
---|
109 | 108 | |
---|
110 | 109 | #define LBA_SKIP_PROBE(d) ((d)->flags & LBA_FLAG_SKIP_PROBE) |
---|
111 | 110 | |
---|
112 | | - |
---|
113 | | -/* Looks nice and keeps the compiler happy */ |
---|
114 | | -#define LBA_DEV(d) ({ \ |
---|
115 | | - void *__pdata = d; \ |
---|
116 | | - BUG_ON(!__pdata); \ |
---|
117 | | - (struct lba_device *)__pdata; }) |
---|
| 111 | +static inline struct lba_device *LBA_DEV(struct pci_hba_data *hba) |
---|
| 112 | +{ |
---|
| 113 | + return container_of(hba, struct lba_device, hba); |
---|
| 114 | +} |
---|
118 | 115 | |
---|
119 | 116 | /* |
---|
120 | 117 | ** Only allow 8 subsidiary busses per LBA |
---|
.. | .. |
---|
1137 | 1134 | ** Postable I/O port space is per PCI host adapter. |
---|
1138 | 1135 | ** base of 64MB PIOP region |
---|
1139 | 1136 | */ |
---|
1140 | | - lba_dev->iop_base = ioremap_nocache(p->start, 64 * 1024 * 1024); |
---|
| 1137 | + lba_dev->iop_base = ioremap(p->start, 64 * 1024 * 1024); |
---|
1141 | 1138 | |
---|
1142 | 1139 | sprintf(lba_dev->hba.io_name, "PCI%02x Ports", |
---|
1143 | 1140 | (int)lba_dev->hba.bus_num.start); |
---|
.. | .. |
---|
1275 | 1272 | r->flags = IORESOURCE_MEM; |
---|
1276 | 1273 | /* mmio_mask also clears Enable bit */ |
---|
1277 | 1274 | r->start &= mmio_mask; |
---|
1278 | | - r->start = PCI_HOST_ADDR(HBA_DATA(lba_dev), r->start); |
---|
| 1275 | + r->start = PCI_HOST_ADDR(&lba_dev->hba, r->start); |
---|
1279 | 1276 | rsize = ~ READ_REG32(lba_dev->hba.base_addr + LBA_LMMIO_MASK); |
---|
1280 | 1277 | |
---|
1281 | 1278 | /* |
---|
.. | .. |
---|
1321 | 1318 | r->flags = IORESOURCE_MEM; |
---|
1322 | 1319 | /* mmio_mask also clears Enable bit */ |
---|
1323 | 1320 | r->start &= mmio_mask; |
---|
1324 | | - r->start = PCI_HOST_ADDR(HBA_DATA(lba_dev), r->start); |
---|
| 1321 | + r->start = PCI_HOST_ADDR(&lba_dev->hba, r->start); |
---|
1325 | 1322 | rsize = READ_REG32(lba_dev->hba.base_addr + LBA_ELMMIO_MASK); |
---|
1326 | 1323 | r->end = r->start + ~rsize; |
---|
1327 | 1324 | } |
---|
.. | .. |
---|
1479 | 1476 | u32 func_class; |
---|
1480 | 1477 | void *tmp_obj; |
---|
1481 | 1478 | char *version; |
---|
1482 | | - void __iomem *addr = ioremap_nocache(dev->hpa.start, 4096); |
---|
| 1479 | + void __iomem *addr; |
---|
1483 | 1480 | int max; |
---|
| 1481 | + |
---|
| 1482 | + addr = ioremap(dev->hpa.start, 4096); |
---|
| 1483 | + if (addr == NULL) |
---|
| 1484 | + return -ENOMEM; |
---|
1484 | 1485 | |
---|
1485 | 1486 | /* Read HW Rev First */ |
---|
1486 | 1487 | func_class = READ_REG32(addr + LBA_FCLASS); |
---|
.. | .. |
---|
1562 | 1563 | |
---|
1563 | 1564 | /* ------------ Second : initialize common stuff ---------- */ |
---|
1564 | 1565 | pci_bios = &lba_bios_ops; |
---|
1565 | | - pcibios_register_hba(HBA_DATA(lba_dev)); |
---|
| 1566 | + pcibios_register_hba(&lba_dev->hba); |
---|
1566 | 1567 | spin_lock_init(&lba_dev->lba_lock); |
---|
1567 | 1568 | |
---|
1568 | 1569 | if (lba_hw_init(lba_dev)) |
---|
.. | .. |
---|
1578 | 1579 | } else { |
---|
1579 | 1580 | if (!astro_iop_base) { |
---|
1580 | 1581 | /* Sprockets PDC uses NPIOP region */ |
---|
1581 | | - astro_iop_base = ioremap_nocache(LBA_PORT_BASE, 64 * 1024); |
---|
| 1582 | + astro_iop_base = ioremap(LBA_PORT_BASE, 64 * 1024); |
---|
1582 | 1583 | pci_port = &lba_astro_port_ops; |
---|
1583 | 1584 | } |
---|
1584 | 1585 | |
---|
.. | .. |
---|
1696 | 1697 | */ |
---|
1697 | 1698 | void lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask) |
---|
1698 | 1699 | { |
---|
1699 | | - void __iomem * base_addr = ioremap_nocache(lba->hpa.start, 4096); |
---|
| 1700 | + void __iomem * base_addr = ioremap(lba->hpa.start, 4096); |
---|
1700 | 1701 | |
---|
1701 | 1702 | imask <<= 2; /* adjust for hints - 2 more bits */ |
---|
1702 | 1703 | |
---|
.. | .. |
---|
1743 | 1744 | } |
---|
1744 | 1745 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_AUX, |
---|
1745 | 1746 | quirk_diva_aux_disable); |
---|
| 1747 | + |
---|
| 1748 | +static void quirk_tosca_aux_disable(struct pci_dev *dev) |
---|
| 1749 | +{ |
---|
| 1750 | + if (dev->subsystem_vendor != PCI_VENDOR_ID_HP || |
---|
| 1751 | + dev->subsystem_device != 0x104a) |
---|
| 1752 | + return; |
---|
| 1753 | + |
---|
| 1754 | + dev_info(&dev->dev, "Hiding Tosca secondary built-in AUX serial device"); |
---|
| 1755 | + dev->device = 0; |
---|
| 1756 | +} |
---|
| 1757 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA, |
---|
| 1758 | + quirk_tosca_aux_disable); |
---|