]> mj.ucw.cz Git - pciutils.git/blobdiff - lib/pci.h
Resurrected the Windows port.
[pciutils.git] / lib / pci.h
index 7fa1de656b309361562d058fd6605f60bd398600..8becd76d9b7ceb843658364854fb8ff7d7e33eec 100644 (file)
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -1,7 +1,7 @@
 /*
  *     The PCI Library
  *
- *     Copyright (c) 1997--2005 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1997--2006 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
@@ -13,7 +13,7 @@
 #include "header.h"
 #include "types.h"
 
-#define PCI_LIB_VERSION 0x020200
+#define PCI_LIB_VERSION 0x020204
 
 /*
  *     PCI Access Structure
@@ -43,7 +43,8 @@ struct pci_access {
   int writeable;                       /* Open in read/write mode */
   int buscentric;                      /* Bus-centric view of the world */
   char *id_file_name;                  /* Name of ID list file */
-  int numeric_ids;                     /* Don't resolve device IDs to names */
+  int free_id_name;                    /* Set if id_file_name is malloced */
+  int numeric_ids;                     /* Enforce PCI_LOOKUP_NUMERIC (>1 => PCI_LOOKUP_MIXED) */
   int debugging;                       /* Turn on debugging messages */
 
   /* Functions you can override: */
@@ -57,6 +58,7 @@ struct pci_access {
   struct pci_methods *methods;
   struct id_entry **id_hash;           /* names.c */
   struct id_bucket *current_id_bucket;
+  int hash_load_failed;
   int fd;                              /* proc: fd */
   int fd_rw;                           /* proc: fd opened read-write */
   struct pci_dev *cached_dev;          /* proc: device the fd is for */
@@ -85,6 +87,7 @@ struct pci_dev {
   /* These fields are set by pci_fill_info() */
   int known_fields;                    /* Set of info fields already known */
   u16 vendor_id, device_id;            /* Identity of the device */
+  u16 device_class;                    /* PCI device class */
   int irq;                             /* IRQ number */
   pciaddr_t base_addr[6];              /* Base addresses */
   pciaddr_t size[6];                   /* Region sizes */
@@ -119,6 +122,7 @@ int pci_fill_info(struct pci_dev *, int flags); /* Fill in device information */
 #define PCI_FILL_BASES         4
 #define PCI_FILL_ROM_BASE      8
 #define PCI_FILL_SIZES         16
+#define PCI_FILL_CLASS         32
 #define PCI_FILL_RESCAN                0x10000
 
 void pci_setup_cache(struct pci_dev *, u8 *cache, int len);
@@ -157,6 +161,7 @@ char *pci_lookup_name(struct pci_access *a, char *buf, int size, int flags, ...)
 
 int pci_load_name_list(struct pci_access *a);  /* Called automatically by pci_lookup_*() when needed; returns success */
 void pci_free_name_list(struct pci_access *a); /* Called automatically by pci_cleanup() */
+void pci_set_name_list_path(struct pci_access *a, char *name, int to_be_freed);
 
 enum pci_lookup_mode {
   PCI_LOOKUP_VENDOR = 1,               /* Vendor name (args: vendorID) */
@@ -165,7 +170,8 @@ enum pci_lookup_mode {
   PCI_LOOKUP_SUBSYSTEM = 8,
   PCI_LOOKUP_PROGIF = 16,              /* Programming interface (args: classID, prog_if) */
   PCI_LOOKUP_NUMERIC = 0x10000,                /* Want only formatted numbers; default if access->numeric_ids is set */
-  PCI_LOOKUP_NO_NUMBERS = 0x20000      /* Return NULL if not found in the database; default is to print numerically */
+  PCI_LOOKUP_NO_NUMBERS = 0x20000,     /* Return NULL if not found in the database; default is to print numerically */
+  PCI_LOOKUP_MIXED = 0x40000,          /* Include both numbers and names */
 };
 
 #endif