On 2016-06-15 14:21, David Kiarie wrote: > Introduce PCI macros from linux headers for use by AMD IOMMU > > Signed-off-by: David Kiarie <davidkiar...@gmail.com> > --- > include/hw/pci/pci.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h > index 4420f47..ac376c5 100644 > --- a/include/hw/pci/pci.h > +++ b/include/hw/pci/pci.h > @@ -12,6 +12,8 @@ > > /* PCI bus */ > > +#define PCI_BUS_NUM(x) (((x) >> 8) & 0xff)
Minor: should probably come after PCI_DEVFN and before PCI_SLOT to have some logical grouping. > +#define PCI_DEVID(bus, devfn) ((((uint16_t)(bus)) << 8) | (devfn)) That's often called "BDF" (bus-device-function). At least for me clearer than "device ID". > #define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) > #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) > #define PCI_FUNC(devfn) ((devfn) & 0x07) > Jan
signature.asc
Description: OpenPGP digital signature