Changes in kernel/arch/ia64/include/asm.h [86a34d3e:314f3a3c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia64/include/asm.h
r86a34d3e r314f3a3c 38 38 #include <config.h> 39 39 #include <typedefs.h> 40 #include <typedefs.h>41 40 #include <arch/register.h> 41 #include <arch/legacyio.h> 42 42 #include <trace.h> 43 43 44 #define IA64_IOSPACE_ADDRESS 0xE001000000000000ULL45 46 44 #define IO_SPACE_BOUNDARY ((void *) (64 * 1024)) 47 45 46 /** Map the I/O port address to a legacy I/O address. */ 47 NO_TRACE static inline uintptr_t p2a(volatile void *p) 48 { 49 uintptr_t prt = (uintptr_t) p; 50 51 return legacyio_virt_base + (((prt >> 2) << 12) | (prt & 0xfff)); 52 } 53 48 54 NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v) 49 55 { 50 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 51 uintptr_t prt = (uintptr_t) port; 52 53 *((ioport8_t *) (IA64_IOSPACE_ADDRESS + 54 ((prt & 0xfff) | ((prt >> 2) << 12)))) = v; 55 } else { 56 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) 57 *((ioport8_t *) p2a(port)) = v; 58 else 56 59 *port = v; 57 }58 59 asm volatile (60 "mf \n"60 61 asm volatile ( 62 "mf\n" 63 "mf.a\n" 61 64 ::: "memory" 62 65 ); … … 65 68 NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t v) 66 69 { 67 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 68 uintptr_t prt = (uintptr_t) port; 69 70 *((ioport16_t *) (IA64_IOSPACE_ADDRESS + 71 ((prt & 0xfff) | ((prt >> 2) << 12)))) = v; 72 } else { 70 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) 71 *((ioport16_t *) p2a(port)) = v; 72 else 73 73 *port = v; 74 }75 76 asm volatile (77 "mf \n"74 75 asm volatile ( 76 "mf\n" 77 "mf.a\n" 78 78 ::: "memory" 79 79 ); … … 82 82 NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t v) 83 83 { 84 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 85 uintptr_t prt = (uintptr_t) port; 86 87 *((ioport32_t *) (IA64_IOSPACE_ADDRESS + 88 ((prt & 0xfff) | ((prt >> 2) << 12)))) = v; 89 } else { 84 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) 85 *((ioport32_t *) p2a(port)) = v; 86 else 90 87 *port = v; 91 }92 93 asm volatile (94 "mf \n"88 89 asm volatile ( 90 "mf\n" 91 "mf.a\n" 95 92 ::: "memory" 96 93 ); … … 106 103 ); 107 104 108 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 109 uintptr_t prt = (uintptr_t) port; 110 111 v = *((ioport8_t *) (IA64_IOSPACE_ADDRESS + 112 ((prt & 0xfff) | ((prt >> 2) << 12)))); 113 } else { 105 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) 106 v = *((ioport8_t *) p2a(port)); 107 else 114 108 v = *port; 115 } 109 110 asm volatile ( 111 "mf.a\n" 112 ::: "memory" 113 ); 116 114 117 115 return v; … … 127 125 ); 128 126 129 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 130 uintptr_t prt = (uintptr_t) port; 131 132 v = *((ioport16_t *) (IA64_IOSPACE_ADDRESS + 133 ((prt & 0xfff) | ((prt >> 2) << 12)))); 134 } else { 127 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) 128 v = *((ioport16_t *) p2a(port)); 129 else 135 130 v = *port; 136 } 131 132 asm volatile ( 133 "mf.a\n" 134 ::: "memory" 135 ); 137 136 138 137 return v; … … 148 147 ); 149 148 150 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 151 uintptr_t prt = (uintptr_t) port; 152 153 v = *((ioport32_t *) (IA64_IOSPACE_ADDRESS + 154 ((prt & 0xfff) | ((prt >> 2) << 12)))); 155 } else { 149 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) 150 v = *((ioport32_t *) p2a(port)); 151 else 156 152 v = *port; 157 } 153 154 asm volatile ( 155 "mf.a\n" 156 ::: "memory" 157 ); 158 158 159 159 return v;
Note:
See TracChangeset
for help on using the changeset viewer.