Rev 3577 | Rev 3779 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3577 | Rev 3774 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | 41 | ||
42 | typedef uint64_t ioport_t; |
42 | typedef uint64_t ioport_t; |
43 | 43 | ||
44 | #define IA64_IOSPACE_ADDRESS 0xE001000000000000ULL |
44 | #define IA64_IOSPACE_ADDRESS 0xE001000000000000ULL |
45 | 45 | ||
46 | static inline void outb(ioport_t port,uint8_t v) |
46 | static inline void outb(ioport_t port, uint8_t v) |
47 | { |
47 | { |
- | 48 | *((uint8_t *)(IA64_IOSPACE_ADDRESS + |
|
48 | *((uint8_t *)(IA64_IOSPACE_ADDRESS + ( (port & 0xfff) | ( (port >> 2) << 12 )))) = v; |
49 | ((port & 0xfff) | ((port >> 2) << 12)))) = v; |
49 | 50 | ||
50 | asm volatile ("mf\n" ::: "memory"); |
51 | asm volatile ("mf\n" ::: "memory"); |
51 | } |
52 | } |
52 | 53 | ||
53 | static inline void outw(ioport_t port,uint16_t v) |
54 | static inline void outw(ioport_t port, uint16_t v) |
54 | { |
55 | { |
- | 56 | *((uint16_t *)(IA64_IOSPACE_ADDRESS + |
|
55 | *((uint16_t *)(IA64_IOSPACE_ADDRESS + ( (port & 0xfff) | ( (port >> 2) << 12 )))) = v; |
57 | ((port & 0xfff) | ((port >> 2) << 12)))) = v; |
56 | 58 | ||
57 | asm volatile ("mf\n" ::: "memory"); |
59 | asm volatile ("mf\n" ::: "memory"); |
58 | } |
60 | } |
59 | 61 | ||
60 | static inline void outl(ioport_t port,uint32_t v) |
62 | static inline void outl(ioport_t port, uint32_t v) |
61 | { |
63 | { |
- | 64 | *((uint32_t *)(IA64_IOSPACE_ADDRESS + |
|
62 | *((uint32_t *)(IA64_IOSPACE_ADDRESS + ( (port & 0xfff) | ( (port >> 2) << 12 )))) = v; |
65 | ((port & 0xfff) | ((port >> 2) << 12)))) = v; |
63 | 66 | ||
64 | asm volatile ("mf\n" ::: "memory"); |
67 | asm volatile ("mf\n" ::: "memory"); |
65 | } |
68 | } |
66 | 69 | ||
67 | - | ||
68 | - | ||
69 | static inline uint8_t inb(ioport_t port) |
70 | static inline uint8_t inb(ioport_t port) |
70 | { |
71 | { |
71 | asm volatile ("mf\n" ::: "memory"); |
72 | asm volatile ("mf\n" ::: "memory"); |
72 | 73 | ||
- | 74 | return *((uint8_t *)(IA64_IOSPACE_ADDRESS + |
|
73 | return *((uint8_t *)(IA64_IOSPACE_ADDRESS + ( (port & 0xfff) | ( (port >> 2) << 12 )))); |
75 | ((port & 0xfff) | ((port >> 2) << 12)))); |
74 | } |
76 | } |
75 | 77 | ||
76 | static inline uint16_t inw(ioport_t port) |
78 | static inline uint16_t inw(ioport_t port) |
77 | { |
79 | { |
78 | asm volatile ("mf\n" ::: "memory"); |
80 | asm volatile ("mf\n" ::: "memory"); |
79 | 81 | ||
- | 82 | return *((uint16_t *)(IA64_IOSPACE_ADDRESS + |
|
80 | return *((uint16_t *)(IA64_IOSPACE_ADDRESS + ( (port & 0xffE) | ( (port >> 2) << 12 )))); |
83 | ((port & 0xffE) | ((port >> 2) << 12)))); |
81 | } |
84 | } |
82 | 85 | ||
83 | static inline uint32_t inl(ioport_t port) |
86 | static inline uint32_t inl(ioport_t port) |
84 | { |
87 | { |
85 | asm volatile ("mf\n" ::: "memory"); |
88 | asm volatile ("mf\n" ::: "memory"); |
86 | 89 | ||
- | 90 | return *((uint32_t *)(IA64_IOSPACE_ADDRESS + |
|
87 | return *((uint32_t *)(IA64_IOSPACE_ADDRESS + ( (port & 0xfff) | ( (port >> 2) << 12 )))); |
91 | ((port & 0xfff) | ((port >> 2) << 12)))); |
88 | } |
92 | } |
89 | 93 | ||
90 | - | ||
91 | - | ||
92 | /** Return base address of current stack |
94 | /** Return base address of current stack |
93 | * |
95 | * |
94 | * Return the base address of the current stack. |
96 | * Return the base address of the current stack. |
95 | * The stack is assumed to be STACK_SIZE long. |
97 | * The stack is assumed to be STACK_SIZE long. |
96 | * The stack must start on page boundary. |
98 | * The stack must start on page boundary. |
Line 340... | Line 342... | ||
340 | 342 | ||
341 | extern void cpu_halt(void); |
343 | extern void cpu_halt(void); |
342 | extern void cpu_sleep(void); |
344 | extern void cpu_sleep(void); |
343 | extern void asm_delay_loop(uint32_t t); |
345 | extern void asm_delay_loop(uint32_t t); |
344 | 346 | ||
345 | extern void switch_to_userspace(uintptr_t entry, uintptr_t sp, uintptr_t bsp, uintptr_t uspace_uarg, uint64_t ipsr, uint64_t rsc); |
347 | extern void switch_to_userspace(uintptr_t, uintptr_t, uintptr_t, uintptr_t, |
- | 348 | uint64_t, uint64_t); |
|
346 | 349 | ||
347 | #endif |
350 | #endif |
348 | 351 | ||
349 | /** @} |
352 | /** @} |
350 | */ |
353 | */ |