d871790b4fcb4359ed160f4ecd97d2261606b23f
[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
23
24 u16_t
25 pci_config_msi_data(int vector) {
26     return vector;
27 }
28
29 ptr_t
30 pci_get_msi_base() {
31     return 0xFEE00000;
32 }
33