]> git.ipfire.org Git - thirdparty/pciutils.git/blame - lib/names.h
lspci: add VirtIO SharedMemory capability support
[thirdparty/pciutils.git] / lib / names.h
CommitLineData
752d4d9a
MM
1/*
2 * The PCI Library -- ID to Name Translation
3 *
ac357d3b 4 * Copyright (c) 1997--2014 Martin Mares <mj@ucw.cz>
752d4d9a 5 *
61829219
MM
6 * Can be freely distributed and used under the terms of the GNU GPL v2+
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
752d4d9a
MM
9 */
10
11#define MAX_LINE 1024
12
13/* names-hash.c */
14
15struct id_entry {
16 struct id_entry *next;
17 u32 id12, id34;
18 byte cat;
19 byte src;
20 char name[1];
21};
22
23enum id_entry_type {
24 ID_UNKNOWN,
25 ID_VENDOR,
26 ID_DEVICE,
27 ID_SUBSYSTEM,
28 ID_GEN_SUBSYSTEM,
29 ID_CLASS,
30 ID_SUBCLASS,
31 ID_PROGIF
32};
33
34enum id_entry_src {
35 SRC_UNKNOWN,
36 SRC_CACHE,
37 SRC_NET,
ac357d3b 38 SRC_HWDB,
752d4d9a
MM
39 SRC_LOCAL,
40};
41
42#define BUCKET_SIZE 8192
43#define HASH_SIZE 4099
44
45static inline u32 id_pair(unsigned int x, unsigned int y)
46{
47 return ((x << 16) | y);
48}
49
50static inline unsigned int pair_first(unsigned int x)
51{
52 return (x >> 16) & 0xffff;
53}
54
55static inline unsigned int pair_second(unsigned int x)
56{
57 return x & 0xffff;
58}
59
60int pci_id_insert(struct pci_access *a, int cat, int id1, int id2, int id3, int id4, char *text, enum id_entry_src src);
61char *pci_id_lookup(struct pci_access *a, int flags, int cat, int id1, int id2, int id3, int id4);
62
63/* names-cache.c */
64
65int pci_id_cache_load(struct pci_access *a, int flags);
66void pci_id_cache_dirty(struct pci_access *a);
67void pci_id_cache_flush(struct pci_access *a);
c953c309 68void pci_id_hash_free(struct pci_access *a);
752d4d9a
MM
69
70/* names-dns.c */
71
72char *pci_id_net_lookup(struct pci_access *a, int cat, int id1, int id2, int id3, int id4);
ac357d3b
MM
73
74/* names-hwdb.c */
75
76char *pci_id_hwdb_lookup(struct pci_access *a, int cat, int id1, int id2, int id3, int id4);
77void pci_id_hwdb_free(struct pci_access *a);