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