pci: macros to make it easier to read from config space

This commit is contained in:
Matheus
2023-12-31 15:48:18 -03:00
parent d49ca437ed
commit 4f6c825d48
+9
View File
@@ -30,6 +30,7 @@
#define PCI_HEADERTYPE_STANDARD 0
#define PCI_CONFIG_CAP 0x34
#define PCI_CAP_MSI 0x5
#define PCI_CAP_VENDORSPECIFIC 0x9
#define PCI_CAP_MSIX 0x11
typedef struct {
@@ -88,4 +89,12 @@ void pci_msixsetmask(pcienum_t *e, int v);
void pci_msixadd(pcienum_t *e, int msixvec, int vec, int edgetrigger, int deassert);
void pci_init();
#define PCI_READ32(e, offset) pci_read32(e->bus, e->device, e->function, offset)
#define PCI_READ16(e, offset) pci_read16(e->bus, e->device, e->function, offset)
#define PCI_READ8(e, offset) pci_read8(e->bus, e->device, e->function, offset)
#define PCI_WRITE32(e, offset, value) pci_write32(e->bus, e->device, e->function, offset, value)
#define PCI_WRITE16(e, offset, value) pci_write16(e->bus, e->device, e->function, offset, value)
#define PCI_WRITE8(e, offset, value) pci_write8(e->bus, e->device, e->function, offset, value)
#endif