6 #define __pci_inX(w, off_mask) \
7 uint##w##_t pci_in##w(int bus, int device, int function, int offset) \
10 out32(0xcf8, 0x80000000 | ((bus & 0xff) << 16) | ((device & 0x1f) << 11) | ((function & 0x07) << 8) | (offset & 0xfc)); \
11 ret = in##w(0xcfc + (offset & off_mask)); \
20 #define __pci_outX(w, off_mask) \
21 void pci_out##w(int bus, int device, int function, int offset, uint##w##_t value) \
23 out32(0xcf8, 0x80000000 | ((bus & 0xff) << 16) | ((device & 0x1f) << 11) | ((function & 0x07) << 8) | (offset & 0xfc)); \
24 out##w(0xcfc + (offset & off_mask), value); \
32 void cdi_pci_alloc_ioports(struct cdi_pci_device
*device
)
37 void cdi_pci_free_ioports(struct cdi_pci_device
*device
)
42 uint16_t cdi_pci_config_readw(struct cdi_pci_device
*device
, uint8_t offset
)
44 return pci_in16(device
->bus
, device
->dev
, device
->function
, offset
);
47 void cdi_pci_config_writew(struct cdi_pci_device
*device
, uint8_t offset
, uint16_t val
)
49 pci_out16(device
->bus
, device
->dev
, device
->function
, offset
, val
);