swissChili | 0d24883 | 2021-04-08 18:16:02 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <kint.h> |
| 4 | |
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 5 | enum |
| 6 | { |
| 7 | PCI_CONFIG_ADDRESS = 0xCF8, |
| 8 | PCI_CONFIG_DATA = 0xCFC, |
| 9 | }; |
| 10 | |
swissChili | 0d24883 | 2021-04-08 18:16:02 -0700 | [diff] [blame] | 11 | struct pci_config_address |
| 12 | { |
| 13 | union |
| 14 | { |
| 15 | struct |
| 16 | { |
| 17 | int enable : 1; |
| 18 | int reserved : 7; |
| 19 | int bus : 8; |
| 20 | int device : 5; |
| 21 | int function : 3; |
| 22 | // Offset into the 256 byte register. Least significant two bits must be zero. |
| 23 | int offset : 8; |
| 24 | }; |
| 25 | |
| 26 | uint packed; |
| 27 | }; |
| 28 | |
| 29 | } __attribute__((packed)); |
| 30 | |
| 31 | ushort pci_config_readw(uchar bus, uchar slot, uchar func, uchar offset); |