]> Joshua Wise's Git repositories - netwatch.git/blobdiff - include/pci.h
More ICH2-specific code diked out.
[netwatch.git] / include / pci.h
index 60b665f132f59480d1d99c47e14075ec39788b98..5243bfc6a5a35b79184753911614df81edb99492 100644 (file)
@@ -1,3 +1,14 @@
+/* pci.h
+ * Definitions for PCI access
+ * NetWatch system management mode administration console
+ *
+ * Copyright (c) 2008 Jacob Potter and Joshua Wise.  All rights reserved.
+ * This program is free software; you can redistribute and/or modify it under
+ * the terms found in the file LICENSE in the root of this source tree. 
+ *
+ */
+
+
 #ifndef PCI_H
 #define PCI_H
 
@@ -16,4 +27,45 @@ uint32_t pci_read32(int bus, int slot, int fn, int addr);
 uint16_t pci_read16(int bus, int slot, int fn, int addr);
 uint8_t pci_read8(int bus, int slot, int fn, int addr);
 
+/* Hardware-agnostic functions implemented by pci.c */
+typedef enum {
+       PCI_BAR_NONE = 0,
+       PCI_BAR_MEMORY32,
+       PCI_BAR_MEMORY64,
+       PCI_BAR_IO
+} pci_bar_type_t;
+
+typedef struct pci_bar {
+       pci_bar_type_t type;
+       unsigned char prefetchable;
+       unsigned long addr;
+} pci_bar_t;
+
+typedef struct pci_dev {
+       unsigned short vid, did;
+       int bus, dev, fn;
+       pci_bar_t bars[6];
+} pci_dev_t;
+
+typedef int (*pci_probe_fn_t)(pci_dev_t *, void *data);
+
+void pci_bus_enum();
+int pci_probe(pci_probe_fn_t probe, void *data);
+
+typedef struct pci_id {
+       unsigned short vid, did;
+       const char *name, *friendlyname;
+} pci_id_t;
+
+#define PCI_ROM(a,b,c,d) {(a),(b),(c),(d)}
+
+typedef struct pci_driver {
+       const char *name;
+       pci_probe_fn_t probe;
+       pci_id_t *ids;
+       int id_count;
+} pci_driver_t;
+
+int pci_probe_driver(pci_driver_t *driver);
+
 #endif
This page took 0.023935 seconds and 4 git commands to generate.