hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/parisc/lba_pci.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 **
34 ** PCI Lower Bus Adapter (LBA) manager
....@@ -5,10 +6,6 @@
56 ** (c) Copyright 1999,2000 Grant Grundler
67 ** (c) Copyright 1999,2000 Hewlett-Packard Company
78 **
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.
129 **
1310 **
1411 ** This module primarily provides access to PCI bus (config/IOport
....@@ -48,6 +45,8 @@
4845 #include <asm/hardware.h> /* for register_parisc_driver() stuff */
4946 #include <asm/parisc-device.h>
5047 #include <asm/io.h> /* read/write stuff */
48
+
49
+#include "iommu.h"
5150
5251 #undef DEBUG_LBA /* general stuff */
5352 #undef DEBUG_LBA_PORT /* debug I/O Port access */
....@@ -109,12 +108,10 @@
109108
110109 #define LBA_SKIP_PROBE(d) ((d)->flags & LBA_FLAG_SKIP_PROBE)
111110
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
+}
118115
119116 /*
120117 ** Only allow 8 subsidiary busses per LBA
....@@ -1137,7 +1134,7 @@
11371134 ** Postable I/O port space is per PCI host adapter.
11381135 ** base of 64MB PIOP region
11391136 */
1140
- lba_dev->iop_base = ioremap_nocache(p->start, 64 * 1024 * 1024);
1137
+ lba_dev->iop_base = ioremap(p->start, 64 * 1024 * 1024);
11411138
11421139 sprintf(lba_dev->hba.io_name, "PCI%02x Ports",
11431140 (int)lba_dev->hba.bus_num.start);
....@@ -1275,7 +1272,7 @@
12751272 r->flags = IORESOURCE_MEM;
12761273 /* mmio_mask also clears Enable bit */
12771274 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);
12791276 rsize = ~ READ_REG32(lba_dev->hba.base_addr + LBA_LMMIO_MASK);
12801277
12811278 /*
....@@ -1321,7 +1318,7 @@
13211318 r->flags = IORESOURCE_MEM;
13221319 /* mmio_mask also clears Enable bit */
13231320 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);
13251322 rsize = READ_REG32(lba_dev->hba.base_addr + LBA_ELMMIO_MASK);
13261323 r->end = r->start + ~rsize;
13271324 }
....@@ -1479,8 +1476,12 @@
14791476 u32 func_class;
14801477 void *tmp_obj;
14811478 char *version;
1482
- void __iomem *addr = ioremap_nocache(dev->hpa.start, 4096);
1479
+ void __iomem *addr;
14831480 int max;
1481
+
1482
+ addr = ioremap(dev->hpa.start, 4096);
1483
+ if (addr == NULL)
1484
+ return -ENOMEM;
14841485
14851486 /* Read HW Rev First */
14861487 func_class = READ_REG32(addr + LBA_FCLASS);
....@@ -1562,7 +1563,7 @@
15621563
15631564 /* ------------ Second : initialize common stuff ---------- */
15641565 pci_bios = &lba_bios_ops;
1565
- pcibios_register_hba(HBA_DATA(lba_dev));
1566
+ pcibios_register_hba(&lba_dev->hba);
15661567 spin_lock_init(&lba_dev->lba_lock);
15671568
15681569 if (lba_hw_init(lba_dev))
....@@ -1578,7 +1579,7 @@
15781579 } else {
15791580 if (!astro_iop_base) {
15801581 /* 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);
15821583 pci_port = &lba_astro_port_ops;
15831584 }
15841585
....@@ -1696,7 +1697,7 @@
16961697 */
16971698 void lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask)
16981699 {
1699
- void __iomem * base_addr = ioremap_nocache(lba->hpa.start, 4096);
1700
+ void __iomem * base_addr = ioremap(lba->hpa.start, 4096);
17001701
17011702 imask <<= 2; /* adjust for hints - 2 more bits */
17021703
....@@ -1743,3 +1744,15 @@
17431744 }
17441745 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_AUX,
17451746 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);