1: /*
2: * The PCI Library -- ID to Name Translation
3: *
4: * Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz>
5: *
6: * Can be freely distributed and used under the terms of the GNU GPL.
7: */
8:
9: #define MAX_LINE 1024
10:
11: /* names-hash.c */
12:
13: struct id_entry {
14: struct id_entry *next;
15: u32 id12, id34;
16: byte cat;
17: byte src;
18: char name[1];
19: };
20:
21: enum id_entry_type {
22: ID_UNKNOWN,
23: ID_VENDOR,
24: ID_DEVICE,
25: ID_SUBSYSTEM,
26: ID_GEN_SUBSYSTEM,
27: ID_CLASS,
28: ID_SUBCLASS,
29: ID_PROGIF
30: };
31:
32: enum id_entry_src {
33: SRC_UNKNOWN,
34: SRC_CACHE,
35: SRC_NET,
36: SRC_LOCAL,
37: };
38:
39: #define BUCKET_SIZE 8192
40: #define HASH_SIZE 4099
41:
42: static inline u32 id_pair(unsigned int x, unsigned int y)
43: {
44: return ((x << 16) | y);
45: }
46:
47: static inline unsigned int pair_first(unsigned int x)
48: {
49: return (x >> 16) & 0xffff;
50: }
51:
52: static inline unsigned int pair_second(unsigned int x)
53: {
54: return x & 0xffff;
55: }
56:
57: int pci_id_insert(struct pci_access *a, int cat, int id1, int id2, int id3, int id4, char *text, enum id_entry_src src);
58: char *pci_id_lookup(struct pci_access *a, int flags, int cat, int id1, int id2, int id3, int id4);
59:
60: /* names-cache.c */
61:
62: int pci_id_cache_load(struct pci_access *a, int flags);
63: void pci_id_cache_dirty(struct pci_access *a);
64: void pci_id_cache_flush(struct pci_access *a);
65: void pci_id_hash_free(struct pci_access *a);
66:
67: /* names-dns.c */
68:
69: char *pci_id_net_lookup(struct pci_access *a, int cat, int id1, int id2, int id3, int id4);
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>