X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/32b9a6d76790c73d3d2d36d9081a2581cc65d184..28c176b668c841a3b7fb093faccf0efa39257603:/lunaix-os/arch/x86/includes/sys/pci_hba.h diff --git a/lunaix-os/arch/x86/includes/sys/pci_hba.h b/lunaix-os/arch/x86/includes/sys/pci_hba.h new file mode 100644 index 0000000..74d9c03 --- /dev/null +++ b/lunaix-os/arch/x86/includes/sys/pci_hba.h @@ -0,0 +1,37 @@ +#ifndef __LUNAIX_PCI_HBA_H +#define __LUNAIX_PCI_HBA_H + +#include +#include + +#include "port_io.h" + +#define PCI_CONFIG_ADDR 0xcf8 +#define PCI_CONFIG_DATA 0xcfc + +static inline pci_reg_t +pci_read_cspace(ptr_t base, int offset) +{ + port_wrdword(PCI_CONFIG_ADDR, base | (offset & ~0x3)); + return port_rddword(PCI_CONFIG_DATA); +} + +static inline void +pci_write_cspace(ptr_t base, int offset, pci_reg_t data) +{ + port_wrdword(PCI_CONFIG_ADDR, base | (offset & ~0x3)); + port_wrdword(PCI_CONFIG_DATA, data); +} + +static inline u16_t +pci_config_msi_data(int vector) { + return vector; +} + +static inline ptr_t +pci_get_msi_base() { + return 0xFEE00000; +} + + +#endif /* __LUNAIX_PCI_HBA_H */