]> git.ipfire.org Git - thirdparty/pciutils.git/blame - lspci.h
Sylixos port
[thirdparty/pciutils.git] / lspci.h
CommitLineData
c7a34993
MM
1/*
2 * The PCI Utilities -- List All PCI Devices
3 *
8f39f69e 4 * Copyright (c) 1997--2010 Martin Mares <mj@ucw.cz>
c7a34993
MM
5 *
6 * Can be freely distributed and used under the terms of the GNU GPL.
7 */
8
9#define PCIUTILS_LSPCI
10#include "pciutils.h"
11
12/*
13 * If we aren't being compiled by GCC, use xmalloc() instead of alloca().
14 * This increases our memory footprint, but only slightly since we don't
15 * use alloca() much.
16 */
5c5ce192 17#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__DragonFly__) || defined (__DJGPP__)
c7a34993
MM
18/* alloca() is defined in stdlib.h */
19#elif defined(__GNUC__) && !defined(PCI_OS_WINDOWS)
20#include <alloca.h>
21#else
22#undef alloca
23#define alloca xmalloc
24#endif
25
26/*** Options ***/
27
28extern int verbose;
29extern struct pci_filter filter;
30extern char *opt_pcimap;
31
32/*** PCI devices and access to their config space ***/
33
34struct device {
35 struct device *next;
36 struct pci_dev *dev;
37 unsigned int config_cached, config_bufsize;
38 byte *config; /* Cached configuration space data */
39 byte *present; /* Maps which configuration bytes are present */
40};
41
42extern struct device *first_dev;
43extern struct pci_access *pacc;
44
45struct device *scan_device(struct pci_dev *p);
46void show_device(struct device *d);
47
48int config_fetch(struct device *d, unsigned int pos, unsigned int len);
49u32 get_conf_long(struct device *d, unsigned int pos);
50word get_conf_word(struct device *d, unsigned int pos);
51byte get_conf_byte(struct device *d, unsigned int pos);
52
53void get_subid(struct device *d, word *subvp, word *subdp);
54
769ff0a8
MM
55/* Useful macros for decoding of bits and bit fields */
56
c7a34993 57#define FLAG(x,y) ((x & y) ? '+' : '-')
769ff0a8
MM
58#define BITS(x,at,width) (((x) >> (at)) & ((1 << (width)) - 1))
59#define TABLE(tab,x,buf) ((x) < sizeof(tab)/sizeof((tab)[0]) ? (tab)[x] : (sprintf((buf), "??%d", (x)), (buf)))
c7a34993
MM
60
61/* ls-vpd.c */
62
63void cap_vpd(struct device *d);
64
65/* ls-caps.c */
66
21510591 67void show_caps(struct device *d, int where);
c7a34993
MM
68
69/* ls-ecaps.c */
70
a1492b88 71void show_ext_caps(struct device *d, int type);
c7a34993 72
7ff8a323
GH
73/* ls-caps-vendor.c */
74
75void show_vendor_caps(struct device *d, int where, int cap);
76
c7a34993
MM
77/* ls-kernel.c */
78
79void show_kernel_machine(struct device *d UNUSED);
80void show_kernel(struct device *d UNUSED);
17ec7e70 81void show_kernel_cleanup(void);
c7a34993
MM
82
83/* ls-tree.c */
84
85void show_forest(void);
86
87/* ls-map.c */
88
89void map_the_bus(void);