Unifying External Interrupt System (#51)
[lunaix-os.git] / lunaix-os / arch / x86 / hal / pci.c
1 #include <hal/pci.h>
2 #include <asm/x86_pmio.h>
3
4 #ifdef CONFIG_PCI_PMIO
5 #define PCI_CONFIG_ADDR 0xcf8
6 #define PCI_CONFIG_DATA 0xcfc
7
8 pci_reg_t
9 pci_read_cspace(ptr_t base, int offset)
10 {
11     port_wrdword(PCI_CONFIG_ADDR, base | (offset & ~0x3));
12     return port_rddword(PCI_CONFIG_DATA);
13 }
14
15 void
16 pci_write_cspace(ptr_t base, int offset, pci_reg_t data)
17 {
18     port_wrdword(PCI_CONFIG_ADDR, base | (offset & ~0x3));
19     port_wrdword(PCI_CONFIG_DATA, data);
20 }
21
22 #endif