Subversion Repositories HelenOS

Rev

Rev 2541 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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