Skip to content

Commit 08bcdd2

Browse files
Jon DerrickLorenzo Pieralisi
authored andcommitted
PCI: vmd: Add bus 224-255 restriction decode
VMD bus restrictions are required when IO fabric is multiplexed such that VMD cannot use the entire bus range. This patch adds another bus restriction decode bit that can be set by firmware to restrict the VMD bus range to between 224-255. Signed-off-by: Jon Derrick <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]>
1 parent 54ecb8f commit 08bcdd2

File tree

1 file changed

+22
-8
lines changed
  • drivers/pci/controller

1 file changed

+22
-8
lines changed

drivers/pci/controller/vmd.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -602,16 +602,30 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
602602

603603
/*
604604
* Certain VMD devices may have a root port configuration option which
605-
* limits the bus range to between 0-127 or 128-255
605+
* limits the bus range to between 0-127, 128-255, or 224-255
606606
*/
607607
if (features & VMD_FEAT_HAS_BUS_RESTRICTIONS) {
608-
u32 vmcap, vmconfig;
609-
610-
pci_read_config_dword(vmd->dev, PCI_REG_VMCAP, &vmcap);
611-
pci_read_config_dword(vmd->dev, PCI_REG_VMCONFIG, &vmconfig);
612-
if (BUS_RESTRICT_CAP(vmcap) &&
613-
(BUS_RESTRICT_CFG(vmconfig) == 0x1))
614-
vmd->busn_start = 128;
608+
u16 reg16;
609+
610+
pci_read_config_word(vmd->dev, PCI_REG_VMCAP, &reg16);
611+
if (BUS_RESTRICT_CAP(reg16)) {
612+
pci_read_config_word(vmd->dev, PCI_REG_VMCONFIG,
613+
&reg16);
614+
615+
switch (BUS_RESTRICT_CFG(reg16)) {
616+
case 1:
617+
vmd->busn_start = 128;
618+
break;
619+
case 2:
620+
vmd->busn_start = 224;
621+
break;
622+
case 3:
623+
pci_err(vmd->dev, "Unknown Bus Offset Setting\n");
624+
return -ENODEV;
625+
default:
626+
break;
627+
}
628+
}
615629
}
616630

617631
res = &vmd->dev->resource[VMD_CFGBAR];

0 commit comments

Comments
 (0)