Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: Add defines for normal and subtractive PCI bridges

Add these PCI class codes to pci_ids.h:

PCI_CLASS_BRIDGE_PCI_NORMAL
PCI_CLASS_BRIDGE_PCI_SUBTRACTIVE

Use these defines in all kernel code for describing PCI class codes for
normal and subtractive PCI bridges.

[bhelgaas: similar change in pci-mvebu.c]
Link: https://lore.kernel.org/r/20220214114109.26809-1-pali@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

authored by

Pali Rohár and committed by
Bjorn Helgaas
904b10fb e783362e

+38 -37
-2
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
··· 1380 1380 1381 1381 #define PCIE_IDVAL3_REG 0x43c 1382 1382 #define IDVAL3_CLASS_CODE_MASK 0xffffff 1383 - #define IDVAL3_SUBCLASS_SHIFT 8 1384 - #define IDVAL3_CLASS_SHIFT 16 1385 1383 1386 1384 #define PCIE_DLSTATUS_REG 0x1048 1387 1385 #define DLSTATUS_PHYLINKUP (1 << 13)
+1 -1
arch/mips/pci/fixup-sb1250.c
··· 75 75 */ 76 76 static void quirk_sb1250_ht(struct pci_dev *dev) 77 77 { 78 - dev->class = PCI_CLASS_BRIDGE_PCI << 8; 78 + dev->class = PCI_CLASS_BRIDGE_PCI_NORMAL; 79 79 } 80 80 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SIBYTE, PCI_DEVICE_ID_BCM1250_HT, 81 81 quirk_sb1250_ht);
+1 -1
arch/mips/pci/pci-bcm63xx.c
··· 186 186 /* setup class code as bridge */ 187 187 val = bcm_pcie_readl(PCIE_IDVAL3_REG); 188 188 val &= ~IDVAL3_CLASS_CODE_MASK; 189 - val |= (PCI_CLASS_BRIDGE_PCI << IDVAL3_SUBCLASS_SHIFT); 189 + val |= PCI_CLASS_BRIDGE_PCI_NORMAL; 190 190 bcm_pcie_writel(val, PCIE_IDVAL3_REG); 191 191 192 192 /* disable bar1 size */
+1 -1
arch/powerpc/platforms/powernv/pci.c
··· 815 815 /* Fixup wrong class code in p7ioc and p8 root complex */ 816 816 static void pnv_p7ioc_rc_quirk(struct pci_dev *dev) 817 817 { 818 - dev->class = PCI_CLASS_BRIDGE_PCI << 8; 818 + dev->class = PCI_CLASS_BRIDGE_PCI_NORMAL; 819 819 } 820 820 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_IBM, 0x3b9, pnv_p7ioc_rc_quirk); 821 821
+1 -1
arch/powerpc/sysdev/fsl_pci.c
··· 55 55 if ((hdr_type & 0x7f) != PCI_HEADER_TYPE_BRIDGE) 56 56 return; 57 57 58 - dev->class = PCI_CLASS_BRIDGE_PCI << 8; 58 + dev->class = PCI_CLASS_BRIDGE_PCI_NORMAL; 59 59 fsl_pcie_bus_fixup = 1; 60 60 return; 61 61 }
+1 -1
arch/sh/drivers/pci/pcie-sh7786.c
··· 314 314 * class to match. Hardware takes care of propagating the IDSETR 315 315 * settings, so there is no need to bother with a quirk. 316 316 */ 317 - pci_write_reg(chan, PCI_CLASS_BRIDGE_PCI << 16, SH4A_PCIEIDSETR1); 317 + pci_write_reg(chan, PCI_CLASS_BRIDGE_PCI_NORMAL << 8, SH4A_PCIEIDSETR1); 318 318 319 319 /* Initialize default capabilities. */ 320 320 data = pci_read_reg(chan, SH4A_PCIEEXPCAP0);
+4 -4
drivers/pci/controller/dwc/pci-keystone.c
··· 531 531 struct pci_dev *bridge; 532 532 static const struct pci_device_id rc_pci_devids[] = { 533 533 { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2HK), 534 - .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, 534 + .class = PCI_CLASS_BRIDGE_PCI_NORMAL, .class_mask = ~0, }, 535 535 { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2E), 536 - .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, 536 + .class = PCI_CLASS_BRIDGE_PCI_NORMAL, .class_mask = ~0, }, 537 537 { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2L), 538 - .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, 538 + .class = PCI_CLASS_BRIDGE_PCI_NORMAL, .class_mask = ~0, }, 539 539 { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2G), 540 - .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, 540 + .class = PCI_CLASS_BRIDGE_PCI_NORMAL, .class_mask = ~0, }, 541 541 { 0, }, 542 542 }; 543 543
+8 -8
drivers/pci/controller/dwc/pci-meson.c
··· 313 313 * cannot program the PCI_CLASS_DEVICE register, so we must fabricate 314 314 * the return value in the config accessors. 315 315 */ 316 - if (where == PCI_CLASS_REVISION && size == 4) 317 - *val = (PCI_CLASS_BRIDGE_PCI << 16) | (*val & 0xffff); 318 - else if (where == PCI_CLASS_DEVICE && size == 2) 319 - *val = PCI_CLASS_BRIDGE_PCI; 320 - else if (where == PCI_CLASS_DEVICE && size == 1) 321 - *val = PCI_CLASS_BRIDGE_PCI & 0xff; 322 - else if (where == PCI_CLASS_DEVICE + 1 && size == 1) 323 - *val = (PCI_CLASS_BRIDGE_PCI >> 8) & 0xff; 316 + if ((where & ~3) == PCI_CLASS_REVISION) { 317 + if (size <= 2) 318 + *val = (*val & ((1 << (size * 8)) - 1)) << (8 * (where & 3)); 319 + *val &= ~0xffffff00; 320 + *val |= PCI_CLASS_BRIDGE_PCI_NORMAL << 8; 321 + if (size <= 2) 322 + *val = (*val >> (8 * (where & 3))) & ((1 << (size * 8)) - 1); 323 + } 324 324 325 325 return PCIBIOS_SUCCESSFUL; 326 326 }
+1 -1
drivers/pci/controller/dwc/pcie-qcom.c
··· 1634 1634 1635 1635 static void qcom_fixup_class(struct pci_dev *dev) 1636 1636 { 1637 - dev->class = PCI_CLASS_BRIDGE_PCI << 8; 1637 + dev->class = PCI_CLASS_BRIDGE_PCI_NORMAL; 1638 1638 } 1639 1639 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x0101, qcom_fixup_class); 1640 1640 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x0104, qcom_fixup_class);
+1 -1
drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
··· 295 295 /* fixup for PCIe class register */ 296 296 value = mobiveil_csr_readl(pcie, PAB_INTP_AXI_PIO_CLASS); 297 297 value &= 0xff; 298 - value |= (PCI_CLASS_BRIDGE_PCI << 16); 298 + value |= PCI_CLASS_BRIDGE_PCI_NORMAL << 8; 299 299 mobiveil_csr_writel(pcie, value, PAB_INTP_AXI_PIO_CLASS); 300 300 301 301 return 0;
+1 -1
drivers/pci/controller/pci-aardvark.c
··· 529 529 */ 530 530 reg = advk_readl(pcie, PCIE_CORE_DEV_REV_REG); 531 531 reg &= ~0xffffff00; 532 - reg |= (PCI_CLASS_BRIDGE_PCI << 8) << 8; 532 + reg |= PCI_CLASS_BRIDGE_PCI_NORMAL << 8; 533 533 advk_writel(pcie, reg, PCIE_CORE_DEV_REV_REG); 534 534 535 535 /* Disable Root Bridge I/O space, memory space and bus mastering */
+1 -1
drivers/pci/controller/pci-loongson.c
··· 35 35 /* Fixup wrong class code in PCIe bridges */ 36 36 static void bridge_class_quirk(struct pci_dev *dev) 37 37 { 38 - dev->class = PCI_CLASS_BRIDGE_PCI << 8; 38 + dev->class = PCI_CLASS_BRIDGE_PCI_NORMAL; 39 39 } 40 40 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, 41 41 DEV_PCIE_PORT_0, bridge_class_quirk);
+1 -1
drivers/pci/controller/pci-mvebu.c
··· 268 268 */ 269 269 dev_rev = mvebu_readl(port, PCIE_DEV_REV_OFF); 270 270 dev_rev &= ~0xffffff00; 271 - dev_rev |= (PCI_CLASS_BRIDGE_PCI << 8) << 8; 271 + dev_rev |= PCI_CLASS_BRIDGE_PCI_NORMAL << 8; 272 272 mvebu_writel(port, dev_rev, PCIE_DEV_REV_OFF); 273 273 274 274 /* Point PCIe unit MBUS decode windows to DRAM space. */
+1 -1
drivers/pci/controller/pci-tegra.c
··· 726 726 /* Tegra PCIE root complex wrongly reports device class */ 727 727 static void tegra_pcie_fixup_class(struct pci_dev *dev) 728 728 { 729 - dev->class = PCI_CLASS_BRIDGE_PCI << 8; 729 + dev->class = PCI_CLASS_BRIDGE_PCI_NORMAL; 730 730 } 731 731 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0bf0, tegra_pcie_fixup_class); 732 732 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0bf1, tegra_pcie_fixup_class);
+1 -1
drivers/pci/controller/pcie-iproc-bcma.c
··· 18 18 /* NS: CLASS field is R/O, and set to wrong 0x200 value */ 19 19 static void bcma_pcie2_fixup_class(struct pci_dev *dev) 20 20 { 21 - dev->class = PCI_CLASS_BRIDGE_PCI << 8; 21 + dev->class = PCI_CLASS_BRIDGE_PCI_NORMAL; 22 22 } 23 23 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x8011, bcma_pcie2_fixup_class); 24 24 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x8012, bcma_pcie2_fixup_class);
+1 -1
drivers/pci/controller/pcie-iproc.c
··· 1581 1581 * code that the bridge is not an Ethernet device. 1582 1582 */ 1583 1583 if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE) 1584 - pdev->class = PCI_CLASS_BRIDGE_PCI << 8; 1584 + pdev->class = PCI_CLASS_BRIDGE_PCI_NORMAL; 1585 1585 1586 1586 /* 1587 1587 * MPSS is not being set properly (as it is currently 0). This is
+1 -1
drivers/pci/controller/pcie-mediatek-gen3.c
··· 292 292 /* Set class code */ 293 293 val = readl_relaxed(pcie->base + PCIE_PCI_IDS_1); 294 294 val &= ~GENMASK(31, 8); 295 - val |= PCI_CLASS(PCI_CLASS_BRIDGE_PCI << 8); 295 + val |= PCI_CLASS(PCI_CLASS_BRIDGE_PCI_NORMAL); 296 296 writel_relaxed(val, pcie->base + PCIE_PCI_IDS_1); 297 297 298 298 /* Mask all INTx interrupts */
+1 -1
drivers/pci/controller/pcie-rcar-host.c
··· 370 370 * class to match. Hardware takes care of propagating the IDSETR 371 371 * settings, so there is no need to bother with a quirk. 372 372 */ 373 - rcar_pci_write_reg(pcie, PCI_CLASS_BRIDGE_PCI << 16, IDSETR1); 373 + rcar_pci_write_reg(pcie, PCI_CLASS_BRIDGE_PCI_NORMAL << 8, IDSETR1); 374 374 375 375 /* 376 376 * Setup Secondary Bus Number & Subordinate Bus Number, even though
+1 -1
drivers/pci/controller/pcie-rockchip-host.c
··· 370 370 rockchip_pcie_write(rockchip, ROCKCHIP_VENDOR_ID, 371 371 PCIE_CORE_CONFIG_VENDOR); 372 372 rockchip_pcie_write(rockchip, 373 - PCI_CLASS_BRIDGE_PCI << PCIE_RC_CONFIG_SCC_SHIFT, 373 + PCI_CLASS_BRIDGE_PCI_NORMAL << 8, 374 374 PCIE_RC_CONFIG_RID_CCR); 375 375 376 376 /* Clear THP cap's next cap pointer to remove L1 substate cap */
-1
drivers/pci/controller/pcie-rockchip.h
··· 134 134 #define PCIE_RC_CONFIG_NORMAL_BASE 0x800000 135 135 #define PCIE_RC_CONFIG_BASE 0xa00000 136 136 #define PCIE_RC_CONFIG_RID_CCR (PCIE_RC_CONFIG_BASE + 0x08) 137 - #define PCIE_RC_CONFIG_SCC_SHIFT 16 138 137 #define PCIE_RC_CONFIG_DCR (PCIE_RC_CONFIG_BASE + 0xc4) 139 138 #define PCIE_RC_CONFIG_DCR_CSPL_SHIFT 18 140 139 #define PCIE_RC_CONFIG_DCR_CSPL_LIMIT 0xff
+1 -1
drivers/pci/hotplug/shpchp_core.c
··· 312 312 } 313 313 314 314 static const struct pci_device_id shpcd_pci_tbl[] = { 315 - {PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0)}, 315 + {PCI_DEVICE_CLASS(PCI_CLASS_BRIDGE_PCI_NORMAL, ~0)}, 316 316 { /* end: all zeroes */ } 317 317 }; 318 318 MODULE_DEVICE_TABLE(pci, shpcd_pci_tbl);
+5 -3
drivers/pci/pci-bridge-emul.c
··· 328 328 BUILD_BUG_ON(sizeof(bridge->conf) != PCI_BRIDGE_CONF_END); 329 329 330 330 /* 331 - * class_revision: Class is high 24 bits and revision is low 8 bit of this member, 332 - * while class for PCI Bridge Normal Decode has the 24-bit value: PCI_CLASS_BRIDGE_PCI << 8 331 + * class_revision: Class is high 24 bits and revision is low 8 bit 332 + * of this member, while class for PCI Bridge Normal Decode has the 333 + * 24-bit value: PCI_CLASS_BRIDGE_PCI_NORMAL 333 334 */ 334 - bridge->conf.class_revision |= cpu_to_le32((PCI_CLASS_BRIDGE_PCI << 8) << 8); 335 + bridge->conf.class_revision |= 336 + cpu_to_le32(PCI_CLASS_BRIDGE_PCI_NORMAL << 8); 335 337 bridge->conf.header_type = PCI_HEADER_TYPE_BRIDGE; 336 338 bridge->conf.cache_line_size = 0x10; 337 339 bridge->conf.status = cpu_to_le16(PCI_STATUS_CAP_LIST);
+2 -2
drivers/pci/pcie/portdrv_pci.c
··· 178 178 */ 179 179 static const struct pci_device_id port_pci_ids[] = { 180 180 /* handle any PCI-Express port */ 181 - { PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0) }, 181 + { PCI_DEVICE_CLASS(PCI_CLASS_BRIDGE_PCI_NORMAL, ~0) }, 182 182 /* subtractive decode PCI-to-PCI bridge, class type is 060401h */ 183 - { PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x01), ~0) }, 183 + { PCI_DEVICE_CLASS(PCI_CLASS_BRIDGE_PCI_SUBTRACTIVE, ~0) }, 184 184 /* handle any Root Complex Event Collector */ 185 185 { PCI_DEVICE_CLASS(((PCI_CLASS_SYSTEM_RCEC << 8) | 0x00), ~0) }, 186 186 { },
+2
include/linux/pci_ids.h
··· 60 60 #define PCI_CLASS_BRIDGE_EISA 0x0602 61 61 #define PCI_CLASS_BRIDGE_MC 0x0603 62 62 #define PCI_CLASS_BRIDGE_PCI 0x0604 63 + #define PCI_CLASS_BRIDGE_PCI_NORMAL 0x060400 64 + #define PCI_CLASS_BRIDGE_PCI_SUBTRACTIVE 0x060401 63 65 #define PCI_CLASS_BRIDGE_PCMCIA 0x0605 64 66 #define PCI_CLASS_BRIDGE_NUBUS 0x0606 65 67 #define PCI_CLASS_BRIDGE_CARDBUS 0x0607