summaryrefslogtreecommitdiff
path: root/kernel/include
diff options
context:
space:
mode:
authorAleksa Vuckovic <aleksa@vuckovic.cc>2023-03-09 01:22:07 +0100
committerAleksa Vuckovic <aleksa@vuckovic.cc>2023-03-09 01:22:07 +0100
commiteb3b263b11e90902841dc21c5a55c45e59128542 (patch)
treeaa06c0e5f04907c4f92ec51b3b94f07e98ebd4ee /kernel/include
parent48a4f607403c074252d3e77b2e0b3c1a8f3b86c7 (diff)
pcie device enumeration
Diffstat (limited to 'kernel/include')
-rw-r--r--kernel/include/mcfg.h4
-rw-r--r--kernel/include/pci.h49
2 files changed, 51 insertions, 2 deletions
diff --git a/kernel/include/mcfg.h b/kernel/include/mcfg.h
index 9f062c0..2e238cf 100644
--- a/kernel/include/mcfg.h
+++ b/kernel/include/mcfg.h
@@ -6,8 +6,8 @@
struct config_space_mcfgt {
uint64_t base_addr;
uint16_t pci_seg_group;
- uint8_t start_pci_bus;
- uint8_t end_pci_bus;
+ uint8_t start_bus;
+ uint8_t end_bus;
uint32_t reserved;
} __attribute__((packed));
typedef struct config_space_mcfgt config_space_mcfgt;
diff --git a/kernel/include/pci.h b/kernel/include/pci.h
new file mode 100644
index 0000000..01d97fc
--- /dev/null
+++ b/kernel/include/pci.h
@@ -0,0 +1,49 @@
+#ifndef PCI_H
+#define PCI_H
+
+#include <types.h>
+
+struct pci_dev {
+ uint16_t vendor_id;
+ uint16_t device_id;
+ uint16_t command;
+ uint16_t status;
+ uint8_t revision_id;
+ uint8_t progif;
+ uint8_t subclass;
+ uint8_t class_;
+ uint8_t cache_line_size;
+ uint8_t latency_timer;
+ uint8_t header_type;
+ uint8_t bist;
+};
+typedef struct pci_dev pci_dev;
+
+const char *class_string[] = {
+ "Unclassified",
+ "Mass Storage Controller",
+ "Network Controller",
+ "Display Controller",
+ "Multimedia Controller",
+ "Memory Controller",
+ "Bridge",
+ "Simple Communication Controller",
+ "Base System Peripheral",
+ "Input Device Controller",
+ "Docking Station",
+ "Processor",
+ "Serial Bus Controller",
+ "Wireless Controller",
+ "Intelligent Controller",
+ "Satellite Communication Controller",
+ "Encryption Controller",
+ "Signal Processing Controller",
+ "Processing Accelerator",
+ "Non-Essential Instrumentation",
+};
+
+const char *subclass_string[] = {
+
+};
+
+#endif