Subversion Repositories HelenOS

Rev

Rev 1787 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1301 jermar 1
/*
2
 *  The PCI Library -- Types and Format Strings
3
 *
4
 *  Copyright (c) 1997--2005 Martin Mares <mj@ucw.cz>
5
 *
1324 jermar 6
 *  May 8, 2006 - Modified and ported to HelenOS by Jakub Jermar.
1301 jermar 7
 *
8
 *  Can be freely distributed and used under the terms of the GNU GPL.
9
 */
10
 
11
#include <types.h>
12
 
13
#ifndef PCI_HAVE_Uxx_TYPES
14
 
15
typedef uint8_t u8;
16
typedef uint16_t u16;
17
typedef uint32_t u32;
18
 
19
#ifdef PCI_HAVE_64BIT_ADDRESS
20
#include <limits.h>
21
#if ULONG_MAX > 0xffffffff
22
typedef unsigned long u64;
23
#define PCI_U64_FMT "l"
24
#else
25
typedef unsigned long long u64;
26
#define PCI_U64_FMT "ll"
27
#endif
28
#endif
29
 
1302 jermar 30
#endif              /* PCI_HAVE_Uxx_TYPES */
1301 jermar 31
 
32
#ifdef PCI_HAVE_64BIT_ADDRESS
33
typedef u64 pciaddr_t;
34
#define PCIADDR_T_FMT "%08" PCI_U64_FMT "x"
35
#define PCIADDR_PORT_FMT "%04" PCI_U64_FMT "x"
36
#else
37
typedef u32 pciaddr_t;
38
#define PCIADDR_T_FMT "%08x"
39
#define PCIADDR_PORT_FMT "%04x"
40
#endif
41
 
42
#ifdef PCI_ARCH_SPARC64
43
/* On sparc64 Linux the kernel reports remapped port addresses and IRQ numbers */
44
#undef PCIADDR_PORT_FMT
45
#define PCIADDR_PORT_FMT PCIADDR_T_FMT
46
#define PCIIRQ_FMT "%08x"
47
#else
48
#define PCIIRQ_FMT "%d"
49
#endif