diff options
Diffstat (limited to 'sys/include/dev/pci/pci.h')
-rw-r--r-- | sys/include/dev/pci/pci.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/include/dev/pci/pci.h b/sys/include/dev/pci/pci.h index 66ecb91..ad3f7ac 100644 --- a/sys/include/dev/pci/pci.h +++ b/sys/include/dev/pci/pci.h @@ -34,6 +34,7 @@ #include <sys/queue.h> #include <sys/cdefs.h> #include <dev/pci/pciregs.h> +#include <vm/vm.h> /* Lookup bits */ #define PCI_DEVICE_ID __BIT(0) @@ -41,6 +42,14 @@ #define PCI_CLASS __BIT(2) #define PCI_SUBCLASS __BIT(3) +/* Base address masks for BARs */ +#define PCI_BAR_MEMMASK ~7 +#define PCI_BAR_IOMASK ~3 + +/* Macros to fetch base address from BAR */ +#define PCI_BAR_MEMBASE(BAR) PHYS_TO_VIRT(BAR & PCI_BAR_MEMMASK) +#define PCI_BAR_IOBASE(BAR) PHYS_TO_VIRT(BAR & PCI_BAR_IOMASK) + /* For PCI lookups */ struct pci_lookup { uint16_t device_id; |