]> mj.ucw.cz Git - pciutils.git/blob - lib/types.h
Added PCI/PCI-X to PCI-Express Bridge type.
[pciutils.git] / lib / types.h
1 /*
2  *      The PCI Library -- Types and Format Strings
3  *
4  *      Copyright (c) 1997--2007 Martin Mares <mj@ucw.cz>
5  *
6  *      Can be freely distributed and used under the terms of the GNU GPL.
7  */
8
9 #include <sys/types.h>
10
11 #ifndef PCI_HAVE_Uxx_TYPES
12
13 #ifdef PCI_OS_WINDOWS
14 typedef unsigned __int8 u8;
15 typedef unsigned __int16 u16;
16 typedef unsigned __int32 u32;
17 #elif defined(PCI_HAVE_STDINT_H)
18 #include <stdint.h>
19 typedef uint8_t u8;
20 typedef uint16_t u16;
21 typedef uint32_t u32;
22 #else
23 typedef u_int8_t u8;
24 typedef u_int16_t u16;
25 typedef u_int32_t u32;
26 #endif
27
28 #ifdef PCI_HAVE_64BIT_ADDRESS
29 #include <limits.h>
30 #if ULONG_MAX > 0xffffffff
31 typedef unsigned long u64;
32 #define PCI_U64_FMT "l"
33 #else
34 typedef unsigned long long u64;
35 #define PCI_U64_FMT "ll"
36 #endif
37 #endif
38
39 #endif  /* PCI_HAVE_Uxx_TYPES */
40
41 #ifdef PCI_HAVE_64BIT_ADDRESS
42 typedef u64 pciaddr_t;
43 #define PCIADDR_T_FMT "%08" PCI_U64_FMT "x"
44 #define PCIADDR_PORT_FMT "%04" PCI_U64_FMT "x"
45 #else
46 typedef u32 pciaddr_t;
47 #define PCIADDR_T_FMT "%08x"
48 #define PCIADDR_PORT_FMT "%04x"
49 #endif
50
51 #ifdef PCI_ARCH_SPARC64
52 /* On sparc64 Linux the kernel reports remapped port addresses and IRQ numbers */
53 #undef PCIADDR_PORT_FMT
54 #define PCIADDR_PORT_FMT PCIADDR_T_FMT
55 #define PCIIRQ_FMT "%08x"
56 #else
57 #define PCIIRQ_FMT "%d"
58 #endif