]> mj.ucw.cz Git - pciutils.git/blobdiff - lib/pci.h
Arguments now correspond to the format string
[pciutils.git] / lib / pci.h
index 782d6bcdbaf5fdc65066c751580eaa0630a16673..188f2e545c16c899c0913e565c2c6f5da8b7cce9 100644 (file)
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -1,7 +1,7 @@
 /*
  *     The PCI Library
  *
- *     Copyright (c) 1997--2003 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1997--2004 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
 
 #include <sys/types.h>
 
+#ifdef OS_WINDOWS
+typedef unsigned char byte;
+typedef char u8;
+typedef unsigned short word;
+typedef short u16;
+typedef unsigned long u32;
+#else
 typedef u_int8_t byte;
 typedef u_int8_t u8;
 typedef u_int16_t word;
 typedef u_int16_t u16;
 typedef u_int32_t u32;
+#endif
 
 #ifdef HAVE_64BIT_ADDRESS
 #include <limits.h>
@@ -32,8 +40,8 @@ typedef unsigned long u64;
 #define PCIADDR_PORT_FMT "%04lx"
 #else
 typedef unsigned long long u64;
-#define PCIADDR_T_FMT "%016Lx"
-#define PCIADDR_PORT_FMT "%04Lx"
+#define PCIADDR_T_FMT "%016llx"
+#define PCIADDR_PORT_FMT "%04llx"
 #endif
 typedef u64 pciaddr_t;
 #else
@@ -61,6 +69,7 @@ struct nl_entry;
 enum pci_access_type {
   /* Known access methods, remember to update access.c as well */
   PCI_ACCESS_AUTO,                     /* Autodetection (params: none) */
+  PCI_ACCESS_SYS_BUS_PCI,              /* Linux /sys/bus/pci (params: path) */
   PCI_ACCESS_PROC_BUS_PCI,             /* Linux /proc/bus/pci (params: path) */
   PCI_ACCESS_I386_TYPE1,               /* i386 ports, type 1 (params: none) */
   PCI_ACCESS_I386_TYPE2,               /* i386 ports, type 2 (params: none) */
@@ -105,7 +114,7 @@ void pci_cleanup(struct pci_access *);
 
 /* Scanning of devices */
 void pci_scan_bus(struct pci_access *acc);
-struct pci_dev *pci_get_dev(struct pci_access *acc, int bus, int dev, int func); /* Raw access to specified device */
+struct pci_dev *pci_get_dev(struct pci_access *acc, int domain, int bus, int dev, int func); /* Raw access to specified device */
 void pci_free_dev(struct pci_dev *);
 
 /*
@@ -114,8 +123,8 @@ void pci_free_dev(struct pci_dev *);
 
 struct pci_dev {
   struct pci_dev *next;                        /* Next device in the chain */
-  word bus;                            /* Higher byte can select host bridges */
-  byte dev, func;                      /* Device and function */
+  u16 domain;                          /* PCI domain (host bridge) */
+  byte bus, dev, func;                 /* Bus inside domain, device and function */
 
   /* These fields are set by pci_fill_info() */
   int known_fields;                    /* Set of info fields already known */
@@ -129,9 +138,9 @@ struct pci_dev {
   /* Fields used internally: */
   struct pci_access *access;
   struct pci_methods *methods;
-  byte *cache;                         /* Cached information */
+  byte *cache;                         /* Cached config registers */
   int cache_len;
-  int hdrtype;                         /* Direct methods: header type */
+  int hdrtype;                         /* Cached header type, -1 if unknown */
   void *aux;                           /* Auxillary data */
 };
 
@@ -163,7 +172,7 @@ void pci_setup_cache(struct pci_dev *, byte *cache, int len);
  */
 
 struct pci_filter {
-  int bus, slot, func;                 /* -1 = ANY */
+  int domain, bus, slot, func;                 /* -1 = ANY */
   int vendor, device;
 };