aboutsummaryrefslogtreecommitdiff
path: root/sys/include/dev/pci
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-07-09 01:46:04 -0400
committerIan Moffett <ian@osmora.org>2024-07-09 01:46:04 -0400
commit54c9c5246e28a8a3d586a5f7346e38648ef2b3f9 (patch)
treef7663e42ac340c660da2845546e101a05258ac54 /sys/include/dev/pci
parentf031ad404e544c9332498a11d9956b27a4acc72b (diff)
kernel: pci: Add PCI device lookups
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include/dev/pci')
-rw-r--r--sys/include/dev/pci/pci.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/include/dev/pci/pci.h b/sys/include/dev/pci/pci.h
index 4e2ceec..3d37b05 100644
--- a/sys/include/dev/pci/pci.h
+++ b/sys/include/dev/pci/pci.h
@@ -33,8 +33,22 @@
#include <sys/types.h>
#include <sys/queue.h>
+/* Lookup bits */
+#define PCI_DEVICE_ID BIT(0)
+#define PCI_VENDOR_ID BIT(1)
+#define PCI_CLASS BIT(2)
+#define PCI_SUBCLASS BIT(3)
+
typedef uint32_t pcireg_t;
+/* For PCI lookups */
+struct pci_lookup {
+ uint16_t device_id;
+ uint16_t vendor_id;
+ uint8_t pci_class;
+ uint8_t pci_subclass;
+};
+
struct pci_device {
uint8_t bus;
uint8_t slot;
@@ -51,6 +65,8 @@ struct pci_device {
};
pcireg_t pci_readl(struct pci_device *dev, uint32_t offset);
+struct pci_device *pci_get_device(struct pci_lookup lookup, uint16_t lookup_type);
+
void pci_writel(struct pci_device *dev, uint32_t offset, pcireg_t val);
int pci_init(void);