From e026de111e220f8a6dbaec79681644fc167be33b Mon Sep 17 00:00:00 2001 From: Bryan Venteicher Date: Mon, 16 Jun 2014 04:16:31 +0000 Subject: [PATCH] Remove kernel specific macro out of the VirtIO PCI header file The eventual goal is to share this file with userland, so remove the macro that is only specific for virtio_pci(4). Instead, add the VIRTIO_PCI_CONFIG_OFF macro from Linux to get the config size whether MSIX is enabled or not. MFC after: 1 week --- sys/dev/virtio/pci/virtio_pci.c | 3 +++ sys/dev/virtio/pci/virtio_pci.h | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/virtio/pci/virtio_pci.c b/sys/dev/virtio/pci/virtio_pci.c index 497abc88363..97fbc0b9382 100644 --- a/sys/dev/virtio/pci/virtio_pci.c +++ b/sys/dev/virtio/pci/virtio_pci.c @@ -170,6 +170,9 @@ static void vtpci_config_intr(void *); #define vtpci_setup_msi_interrupt vtpci_setup_legacy_interrupt +#define VIRTIO_PCI_CONFIG(_sc) \ + VIRTIO_PCI_CONFIG_OFF((((_sc)->vtpci_flags & VTPCI_FLAG_MSIX)) != 0) + /* * I/O port read/write wrappers. */ diff --git a/sys/dev/virtio/pci/virtio_pci.h b/sys/dev/virtio/pci/virtio_pci.h index 485cf4ff5b1..f071ad638d4 100644 --- a/sys/dev/virtio/pci/virtio_pci.h +++ b/sys/dev/virtio/pci/virtio_pci.h @@ -72,8 +72,7 @@ * The remaining space is defined by each driver as the per-driver * configuration space. */ -#define VIRTIO_PCI_CONFIG(sc) \ - (((sc)->vtpci_flags & VTPCI_FLAG_MSIX) ? 24 : 20) +#define VIRTIO_PCI_CONFIG_OFF(msix_enabled) ((msix_enabled) ? 24 : 20) /* * How many bits to shift physical queue address written to QUEUE_PFN.