17 #define PCI_CONFIG_ADDR 0x0cf8 18 #define PCI_CONFIG_DATA 0x0cfc 20 static inline uint32_t
21 read(uint32_t bus, uint32_t device, uint32_t func, uint32_t offset)
23 uint32_t addr = (1u << 31) |
33 static inline uint32_t
36 uint32_t value =
read(bus, device, func, 0x0c);
37 return (value >> 16) & 0xff;
40 static inline uint32_t
43 uint32_t value =
read(bus, device, func, 0x00);
44 return (value >> 16) & 0xffff;
47 static inline uint32_t
50 uint32_t value =
read(bus, device, func, 0x00);
51 return value & 0xffff;
54 static inline uint32_t
57 uint32_t value =
read(bus, device, func, 0x08);
61 static inline uint32_t
64 uint32_t value =
read(bus, device, func, 0x08);
65 return (value >> 16) & 0xff;
68 static inline uint32_t
71 uint32_t value =
read(bus, device, func, 0x18);
72 return (value >> 8) & 0xff;
86 uint32_t
class =
read_class(bus, device, func);
91 if (
class == 6 && subclass == 4) {
101 "[pci] %u/%u/%u vendor=0x%04x devid=0x%04x " 102 "class=%02x subclass=%02x\n",
103 bus, device, func, vendor, devid,
class, subclass);
119 if (hdrtype & 0x80) {
120 for (uint32_t func = 1; func < 8; ++func)
129 for (uint32_t device = 0; device < 32; ++device)
141 if (hdrtype & 0x80) {
142 for (uint32_t bus = 1; bus < 8; ++bus) {
144 if (vendor != 0xffff)
static uint32_t read(uint32_t bus, uint32_t device, uint32_t func, uint32_t offset)
__forceinline void io_outd(uint16_t port, uint32_t value)
static void probe_bus(uint32_t bus)
static uint32_t read_hdrtype(uint32_t bus, uint32_t device, uint32_t func)
static uint32_t read_subclass(uint32_t bus, uint32_t device, uint32_t func)
static uint32_t read_secondary_bus(uint32_t bus, uint32_t device, uint32_t func)
static bool probe_function(uint32_t bus, uint32_t device, uint32_t func)
x86 CPU-specific function implementations.
__forceinline uint32_t io_ind(uint16_t port)
int tty_printf(int id, const char *format,...)
Output a printf-formatted string to the virtual console using the console's current text color and sc...
Teletype (console) screen text manipulation routines.
static void probe_device(uint32_t bus, uint32_t device)
static uint32_t read_vendor(uint32_t bus, uint32_t device, uint32_t func)
static uint32_t read_deviceid(uint32_t bus, uint32_t device, uint32_t func)
static uint32_t read_class(uint32_t bus, uint32_t device, uint32_t func)