summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/pcib_support.c
diff options
context:
space:
mode:
authorandrew <andrew@FreeBSD.org>2016-05-11 17:07:29 +0000
committerandrew <andrew@FreeBSD.org>2016-05-11 17:07:29 +0000
commit5685cc375d21d790be35070ebd5b39d6fc119767 (patch)
treeafff2f04742ffb12b2ce76615e50923c5cff12c5 /sys/dev/pci/pcib_support.c
parent3109740c43a0c3799249f3fc316212a523d1c643 (diff)
downloadFreeBSD-src-5685cc375d21d790be35070ebd5b39d6fc119767.zip
FreeBSD-src-5685cc375d21d790be35070ebd5b39d6fc119767.tar.gz
Add a new get_id interface to pci and pcib. This will allow us to both
detect failures, and get different PCI IDs. For the former the interface returns an int to signal an error. The ID is returned at a uintptr_t * argument. For the latter there is a type argument that allows selecting the ID type. This only specifies a single type, however a MSI type will be added to handle the need to find the ID the hardware passes to the ARM GICv3 interrupt controller. A follow up commit will be made to remove pci_get_rid. Reviewed by: jhb, rstone Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6239
Diffstat (limited to 'sys/dev/pci/pcib_support.c')
-rw-r--r--sys/dev/pci/pcib_support.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/dev/pci/pcib_support.c b/sys/dev/pci/pcib_support.c
index ef88a60..fdd3a45 100644
--- a/sys/dev/pci/pcib_support.c
+++ b/sys/dev/pci/pcib_support.c
@@ -54,16 +54,20 @@ pcib_maxfuncs(device_t dev)
return (PCI_FUNCMAX);
}
-uint16_t
-pcib_get_rid(device_t pcib, device_t dev)
+int
+pcib_get_id(device_t pcib, device_t dev, enum pci_id_type type, uintptr_t *id)
{
uint8_t bus, slot, func;
+ if (type != PCI_ID_RID)
+ return (ENXIO);
+
bus = pci_get_bus(dev);
slot = pci_get_slot(dev);
func = pci_get_function(dev);
- return (PCI_RID(bus, slot, func));
+ *id = (PCI_RID(bus, slot, func));
+ return (0);
}
void
OpenPOWER on IntegriCloud