1 #ifndef __LUNAIX_PCI_HBA_H
2 #define __LUNAIX_PCI_HBA_H
5 #include <lunaix/types.h>
9 #define PCI_CONFIG_ADDR 0xcf8
10 #define PCI_CONFIG_DATA 0xcfc
12 static inline pci_reg_t
13 pci_read_cspace(ptr_t base, int offset)
15 port_wrdword(PCI_CONFIG_ADDR, base | (offset & ~0x3));
16 return port_rddword(PCI_CONFIG_DATA);
20 pci_write_cspace(ptr_t base, int offset, pci_reg_t data)
22 port_wrdword(PCI_CONFIG_ADDR, base | (offset & ~0x3));
23 port_wrdword(PCI_CONFIG_DATA, data);
27 * @brief 配置并启用设备MSI支持。
28 * 参阅:PCI LB Spec. (Rev 3) Section 6.8 & 6.8.1
29 * 以及:Intel Manual, Vol 3, Section 10.11
31 * @param device PCI device
32 * @param vector interrupt vector.
35 pci_setup_msi(struct pci_device* device, int vector);
37 #endif /* __LUNAIX_PCI_HBA_H */