List PCI devices on boot
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m33s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m33s
This commit is contained in:
60
kernel/device/pci.h
Normal file
60
kernel/device/pci.h
Normal file
@@ -0,0 +1,60 @@
|
||||
#ifndef _KERNEL_DEVICE_PCI_H
|
||||
#define _KERNEL_DEVICE_PCI_H
|
||||
|
||||
#include <libk/std.h>
|
||||
|
||||
#define PCI_CONFIG_ADDR 0xCF8
|
||||
#define PCI_CONFIG_DATA 0xCFC
|
||||
|
||||
#define PCI_VENDOR_ID 0x00
|
||||
#define PCI_DEVICE_ID 0x02
|
||||
#define PCI_COMMAND 0x04
|
||||
#define PCI_STATUS 0x06
|
||||
#define PCI_REVISION_ID 0x08
|
||||
#define PCI_PROG_IF 0x09
|
||||
#define PCI_SUBCLASS 0x0A
|
||||
#define PCI_CLASS 0x0B
|
||||
#define PCI_CACHELINE 0x0C
|
||||
#define PCI_LATENCY 0x0D
|
||||
#define PCI_HEADER_TYPE 0x0E
|
||||
#define PCI_BIST 0x0F
|
||||
#define PCI_BAR0 0x10
|
||||
|
||||
struct pci_dev {
|
||||
uint8_t bus;
|
||||
uint8_t slot;
|
||||
uint8_t func;
|
||||
uint16_t vendor;
|
||||
uint16_t device;
|
||||
uint8_t classcode;
|
||||
uint8_t subclass;
|
||||
};
|
||||
|
||||
struct pci_vendor {
|
||||
uint16_t id;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
struct pci_device_id {
|
||||
uint16_t vendor_id;
|
||||
uint16_t device_id;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
struct pci_class {
|
||||
uint8_t class;
|
||||
uint8_t subclass;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
typedef void (*pci_cb_func_t) (struct pci_dev pci_dev);
|
||||
|
||||
void pci_init (void);
|
||||
|
||||
extern const struct pci_vendor pci_vendors[];
|
||||
|
||||
extern const struct pci_device_id pci_device_names[];
|
||||
|
||||
extern const struct pci_class pci_classes[];
|
||||
|
||||
#endif // _KERNEL_DEVICE_PCI_H
|
||||
Reference in New Issue
Block a user