]> git.ipfire.org Git - thirdparty/pciutils.git/blame - lib/names.h
lspci: Display CardBus bridge capabilities
[thirdparty/pciutils.git] / lib / names.h
CommitLineData
752d4d9a
MM
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
13struct id_entry {
14 struct id_entry *next;
15 u32 id12, id34;
16 byte cat;
17 byte src;
18 char name[1];
19};
20
21enum 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
32enum 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
42static inline u32 id_pair(unsigned int x, unsigned int y)
43{
44 return ((x << 16) | y);
45}
46
47static inline unsigned int pair_first(unsigned int x)
48{
49 return (x >> 16) & 0xffff;
50}
51
52static inline unsigned int pair_second(unsigned int x)
53{
54 return x & 0xffff;
55}
56
57int pci_id_insert(struct pci_access *a, int cat, int id1, int id2, int id3, int id4, char *text, enum id_entry_src src);
58char *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
62int pci_id_cache_load(struct pci_access *a, int flags);
63void pci_id_cache_dirty(struct pci_access *a);
64void pci_id_cache_flush(struct pci_access *a);
c953c309 65void pci_id_hash_free(struct pci_access *a);
752d4d9a
MM
66
67/* names-dns.c */
68
69char *pci_id_net_lookup(struct pci_access *a, int cat, int id1, int id2, int id3, int id4);