Subversion Repositories HelenOS

Rev

Rev 4343 | Rev 4345 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4343 Rev 4344
Line 39... Line 39...
39
#include <arch/types.h>
39
#include <arch/types.h>
40
#include <arch/register.h>
40
#include <arch/register.h>
41
 
41
 
42
#define IA64_IOSPACE_ADDRESS 0xE001000000000000ULL
42
#define IA64_IOSPACE_ADDRESS 0xE001000000000000ULL
43
 
43
 
44
static inline void pio_write_8(ioport_t port, uint8_t v)
44
static inline void pio_write_8(ioport8_t *port, uint8_t v)
45
{
45
{
-
 
46
    uintptr_t prt = (uintptr_t) port;
-
 
47
 
46
    *((uint8_t *)(IA64_IOSPACE_ADDRESS +
48
    *((uint8_t *)(IA64_IOSPACE_ADDRESS +
47
        ((port & 0xfff) | ((port >> 2) << 12)))) = v;
49
        ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
48
 
50
 
49
    asm volatile ("mf\n" ::: "memory");
51
    asm volatile ("mf\n" ::: "memory");
50
}
52
}
51
 
53
 
52
static inline void pio_write_16(ioport_t port, uint16_t v)
54
static inline void pio_write_16(ioport16_t *port, uint16_t v)
53
{
55
{
-
 
56
    uintptr_t prt = (uintptr_t) port;
-
 
57
 
54
    *((uint16_t *)(IA64_IOSPACE_ADDRESS +
58
    *((uint16_t *)(IA64_IOSPACE_ADDRESS +
55
        ((port & 0xfff) | ((port >> 2) << 12)))) = v;
59
        ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
56
 
60
 
57
    asm volatile ("mf\n" ::: "memory");
61
    asm volatile ("mf\n" ::: "memory");
58
}
62
}
59
 
63
 
60
static inline void pio_write_32(ioport_t port, uint32_t v)
64
static inline void pio_write_32(ioport32_t *port, uint32_t v)
61
{
65
{
-
 
66
    uintptr_t prt = (uintptr_t) port;
-
 
67
 
62
    *((uint32_t *)(IA64_IOSPACE_ADDRESS +
68
    *((uint32_t *)(IA64_IOSPACE_ADDRESS +
63
        ((port & 0xfff) | ((port >> 2) << 12)))) = v;
69
        ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
64
 
70
 
65
    asm volatile ("mf\n" ::: "memory");
71
    asm volatile ("mf\n" ::: "memory");
66
}
72
}
67
 
73
 
68
static inline uint8_t pio_read_8(ioport_t port)
74
static inline uint8_t pio_read_8(ioport8_t *port)
69
{
75
{
-
 
76
    uintptr_t prt = (uintptr_t) port;
-
 
77
 
70
    asm volatile ("mf\n" ::: "memory");
78
    asm volatile ("mf\n" ::: "memory");
71
 
79
 
72
    return *((uint8_t *)(IA64_IOSPACE_ADDRESS +
80
    return *((uint8_t *)(IA64_IOSPACE_ADDRESS +
73
        ((port & 0xfff) | ((port >> 2) << 12))));
81
        ((prt & 0xfff) | ((prt >> 2) << 12))));
74
}
82
}
75
 
83
 
76
static inline uint16_t pio_read_16(ioport_t port)
84
static inline uint16_t pio_read_16(ioport16_t *port)
77
{
85
{
-
 
86
    uintptr_t prt = (uintptr_t) port;
-
 
87
 
78
    asm volatile ("mf\n" ::: "memory");
88
    asm volatile ("mf\n" ::: "memory");
79
 
89
 
80
    return *((uint16_t *)(IA64_IOSPACE_ADDRESS +
90
    return *((uint16_t *)(IA64_IOSPACE_ADDRESS +
81
        ((port & 0xffE) | ((port >> 2) << 12))));
91
        ((prt & 0xffE) | ((prt >> 2) << 12))));
82
}
92
}
83
 
93
 
84
static inline uint32_t pio_read_32(ioport_t port)
94
static inline uint32_t pio_read_32(ioport32_t *port)
85
{
95
{
-
 
96
    uintptr_t prt = (uintptr_t) port;
-
 
97
 
86
    asm volatile ("mf\n" ::: "memory");
98
    asm volatile ("mf\n" ::: "memory");
87
 
99
 
88
    return *((uint32_t *)(IA64_IOSPACE_ADDRESS +
100
    return *((uint32_t *)(IA64_IOSPACE_ADDRESS +
89
        ((port & 0xfff) | ((port >> 2) << 12))));
101
        ((prt & 0xfff) | ((prt >> 2) << 12))));
90
}
102
}
91
 
103
 
92
/** Return base address of current stack
104
/** Return base address of current stack
93
 *
105
 *
94
 * Return the base address of the current stack.
106
 * Return the base address of the current stack.