Rev 3577 | Rev 3902 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3577 | Rev 3580 | ||
---|---|---|---|
Line 40... | Line 40... | ||
40 | #include <typedefs.h> |
40 | #include <typedefs.h> |
41 | #include <align.h> |
41 | #include <align.h> |
42 | #include <arch/register.h> |
42 | #include <arch/register.h> |
43 | #include <config.h> |
43 | #include <config.h> |
44 | #include <arch/stack.h> |
44 | #include <arch/stack.h> |
- | 45 | #include <arch/barrier.h> |
|
45 | 46 | ||
46 | typedef uint64_t ioport_t; |
- | |
47 | - | ||
48 | - | ||
49 | static inline void outb(ioport_t port,uint8_t v) |
47 | static inline void outb(ioport_t port, uint8_t v) |
50 | { |
48 | { |
51 | *((uint8_t *)(port)) = v; |
49 | *((volatile uint8_t *)(port)) = v; |
- | 50 | memory_barrier(); |
|
52 | } |
51 | } |
53 | 52 | ||
54 | static inline void outw(ioport_t port,uint16_t v) |
53 | static inline void outw(ioport_t port, uint16_t v) |
55 | { |
54 | { |
56 | *((uint16_t *)(port)) = v; |
55 | *((volatile uint16_t *)(port)) = v; |
- | 56 | memory_barrier(); |
|
57 | } |
57 | } |
58 | 58 | ||
59 | static inline void outl(ioport_t port,uint32_t v) |
59 | static inline void outl(ioport_t port, uint32_t v) |
60 | { |
60 | { |
61 | *((uint32_t *)(port)) = v; |
61 | *((volatile uint32_t *)(port)) = v; |
- | 62 | memory_barrier(); |
|
62 | } |
63 | } |
63 | 64 | ||
64 | - | ||
65 | - | ||
66 | static inline uint8_t inb(ioport_t port) |
65 | static inline uint8_t inb(ioport_t port) |
67 | { |
66 | { |
- | 67 | uint8_t rv; |
|
- | 68 | ||
68 | return *((uint8_t *)(port)); |
69 | rv = *((volatile uint8_t *)(port)); |
- | 70 | memory_barrier(); |
|
- | 71 | ||
- | 72 | return rv; |
|
69 | } |
73 | } |
70 | 74 | ||
71 | static inline uint16_t inw(ioport_t port) |
75 | static inline uint16_t inw(ioport_t port) |
72 | { |
76 | { |
- | 77 | uint16_t rv; |
|
- | 78 | ||
73 | return *((uint16_t *)(port)); |
79 | rv = *((volatile uint16_t *)(port)); |
- | 80 | memory_barrier(); |
|
- | 81 | ||
- | 82 | return rv; |
|
74 | } |
83 | } |
75 | 84 | ||
76 | static inline uint32_t inl(ioport_t port) |
85 | static inline uint32_t inl(ioport_t port) |
77 | { |
86 | { |
78 | return *((uint32_t *)(port)); |
87 | uint32_t rv; |
79 | } |
- | |
80 | - | ||
81 | - | ||
82 | 88 | ||
- | 89 | rv = *((volatile uint32_t *)(port)); |
|
- | 90 | memory_barrier(); |
|
83 | 91 | ||
- | 92 | return rv; |
|
- | 93 | } |
|
84 | 94 | ||
85 | /** Read Processor State register. |
95 | /** Read Processor State register. |
86 | * |
96 | * |
87 | * @return Value of PSTATE register. |
97 | * @return Value of PSTATE register. |
88 | */ |
98 | */ |