xref: /illumos-gate/usr/src/compat/bhyve/dev/pci/pcivar.h (revision d0b3c59b)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2018 Joyent, Inc.
14  */
15 
16 #ifndef _COMPAT_FREEBSD_DEV_PCI_PCIVAR_H
17 #define	_COMPAT_FREEBSD_DEV_PCI_PCIVAR_H
18 
19 #include <sys/types.h>
20 #include <sys/conf.h>
21 #include <sys/ddi.h>
22 #include <sys/sunddi.h>
23 #include <sys/pcie.h>
24 #include <sys/pcie_impl.h>
25 
26 static inline pcie_req_id_t
pci_get_bdf(device_t dev)27 pci_get_bdf(device_t dev)
28 {
29 	pcie_req_id_t bdf;
30 
31 	VERIFY(pcie_get_bdf_from_dip(dev, &bdf) == DDI_SUCCESS);
32 
33 	return (bdf);
34 }
35 
36 #define	pci_get_rid(dev)	(pci_get_bdf(dev))
37 
38 #endif /* _COMPAT_FREEBSD_DEV_PCI_PCIVAR_H */
39