]>
Commit | Line | Data |
---|---|---|
752d4d9a MM |
1 | /* |
2 | * The PCI Library -- ID to Name Translation | |
3 | * | |
ac357d3b | 4 | * Copyright (c) 1997--2014 Martin Mares <mj@ucw.cz> |
752d4d9a MM |
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, | |
ac357d3b | 36 | SRC_HWDB, |
752d4d9a MM |
37 | SRC_LOCAL, |
38 | }; | |
39 | ||
40 | #define BUCKET_SIZE 8192 | |
41 | #define HASH_SIZE 4099 | |
42 | ||
43 | static inline u32 id_pair(unsigned int x, unsigned int y) | |
44 | { | |
45 | return ((x << 16) | y); | |
46 | } | |
47 | ||
48 | static inline unsigned int pair_first(unsigned int x) | |
49 | { | |
50 | return (x >> 16) & 0xffff; | |
51 | } | |
52 | ||
53 | static inline unsigned int pair_second(unsigned int x) | |
54 | { | |
55 | return x & 0xffff; | |
56 | } | |
57 | ||
58 | 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); | |
59 | char *pci_id_lookup(struct pci_access *a, int flags, int cat, int id1, int id2, int id3, int id4); | |
60 | ||
61 | /* names-cache.c */ | |
62 | ||
63 | int pci_id_cache_load(struct pci_access *a, int flags); | |
64 | void pci_id_cache_dirty(struct pci_access *a); | |
65 | void pci_id_cache_flush(struct pci_access *a); | |
c953c309 | 66 | void pci_id_hash_free(struct pci_access *a); |
752d4d9a MM |
67 | |
68 | /* names-dns.c */ | |
69 | ||
70 | char *pci_id_net_lookup(struct pci_access *a, int cat, int id1, int id2, int id3, int id4); | |
ac357d3b MM |
71 | |
72 | /* names-hwdb.c */ | |
73 | ||
74 | char *pci_id_hwdb_lookup(struct pci_access *a, int cat, int id1, int id2, int id3, int id4); | |
75 | void pci_id_hwdb_free(struct pci_access *a); |