6 #include <linux/kernel.h>
8 #include <asm/compiler.h>
9 #include <asm/pgtable.h>
10 #include <asm/machvec.h>
18 #define __SLOW_DOWN_IO do { } while (0)
19 #define SLOW_DOWN_IO do { } while (0)
24 #ifdef USE_48_BIT_KSEG
25 #define IDENT_ADDR 0xffff800000000000UL
27 #define IDENT_ADDR 0xfffffc0000000000UL
37 extern inline void __set_hae(
unsigned long new_hae)
43 alpha_mv.hae_cache = new_hae;
44 *alpha_mv.hae_register = new_hae;
47 new_hae = *alpha_mv.hae_register;
53 extern inline void set_hae(
unsigned long new_hae)
55 if (new_hae != alpha_mv.hae_cache)
62 #ifdef USE_48_BIT_KSEG
65 return (
unsigned long)address - IDENT_ADDR;
70 return (
void *) (address + IDENT_ADDR);
75 unsigned long phys = (
unsigned long)address;
79 phys = (
long)phys >> (64 - 41);
82 phys &= (1ul <<
hwrpb->pa_bits) - 1;
89 return (
void *)(IDENT_ADDR + (address & ((1ul << 41) - 1)));
93 #define page_to_phys(page) page_to_pa(page)
101 #define IO_SPACE_LIMIT 0xffff
118 return phys <= __direct_map_size ? bus : 0;
120 #define isa_virt_to_bus virt_to_bus
131 return (
long)address <= 0 ?
NULL : virt;
133 #define isa_bus_to_virt bus_to_virt
139 #define IO_CONCAT(a,b) _IO_CONCAT(a,b)
140 #define _IO_CONCAT(a,b) a ## _ ## b
142 #ifdef CONFIG_ALPHA_GENERIC
146 #define REMAP1(TYPE, NAME, QUAL) \
147 static inline TYPE generic_##NAME(QUAL void __iomem *addr) \
149 return alpha_mv.mv_##NAME(addr); \
152 #define REMAP2(TYPE, NAME, QUAL) \
153 static inline void generic_##NAME(TYPE b, QUAL void __iomem *addr) \
155 alpha_mv.mv_##NAME(b, addr); \
158 REMAP1(
unsigned int,
ioread8, )
169 REMAP2(u8,
writeb, volatile)
170 REMAP2(u16,
writew, volatile)
171 REMAP2(u32,
writel, volatile)
172 REMAP2(u64,
writeq, volatile)
177 extern inline void __iomem *generic_ioportmap(
unsigned long a)
179 return alpha_mv.mv_ioportmap(a);
182 static inline void __iomem *generic_ioremap(
unsigned long a,
unsigned long s)
184 return alpha_mv.mv_ioremap(a, s);
187 static inline void generic_iounmap(
volatile void __iomem *a)
189 return alpha_mv.mv_iounmap(a);
192 static inline int generic_is_ioaddr(
unsigned long a)
194 return alpha_mv.mv_is_ioaddr(a);
197 static inline int generic_is_mmio(
const volatile void __iomem *a)
199 return alpha_mv.mv_is_mmio(a);
202 #define __IO_PREFIX generic
203 #define generic_trivial_rw_bw 0
204 #define generic_trivial_rw_lq 0
205 #define generic_trivial_io_bw 0
206 #define generic_trivial_io_lq 0
207 #define generic_trivial_iounmap 0
211 #if defined(CONFIG_ALPHA_APECS)
213 #elif defined(CONFIG_ALPHA_CIA)
215 #elif defined(CONFIG_ALPHA_IRONGATE)
217 #elif defined(CONFIG_ALPHA_JENSEN)
219 #elif defined(CONFIG_ALPHA_LCA)
221 #elif defined(CONFIG_ALPHA_MARVEL)
223 #elif defined(CONFIG_ALPHA_MCPCIA)
225 #elif defined(CONFIG_ALPHA_POLARIS)
227 #elif defined(CONFIG_ALPHA_T2)
229 #elif defined(CONFIG_ALPHA_TSUNAMI)
231 #elif defined(CONFIG_ALPHA_TITAN)
233 #elif defined(CONFIG_ALPHA_WILDFIRE)
236 #error "What system is this?"
244 extern u8
inb(
unsigned long port);
245 extern u16
inw(
unsigned long port);
246 extern u32
inl(
unsigned long port);
247 extern void outb(u8
b,
unsigned long port);
248 extern void outw(u16
b,
unsigned long port);
249 extern void outl(u32
b,
unsigned long port);
307 static inline int __is_ioaddr(
unsigned long addr)
311 #define __is_ioaddr(a) __is_ioaddr((unsigned long)(a))
313 static inline int __is_mmio(
const volatile void __iomem *
addr)
323 #if IO_CONCAT(__IO_PREFIX,trivial_io_bw)
350 extern inline u8
inb(
unsigned long port)
355 extern inline u16
inw(
unsigned long port)
360 extern inline void outb(u8
b,
unsigned long port)
365 extern inline void outw(u16 b,
unsigned long port)
371 #if IO_CONCAT(__IO_PREFIX,trivial_io_lq)
385 extern inline u32
inl(
unsigned long port)
390 extern inline void outl(u32 b,
unsigned long port)
396 #if IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 1
444 #if IO_CONCAT(__IO_PREFIX,trivial_rw_lq) == 1
492 #define ioread16be(p) be16_to_cpu(ioread16(p))
493 #define ioread32be(p) be32_to_cpu(ioread32(p))
494 #define iowrite16be(v,p) iowrite16(cpu_to_be16(v), (p))
495 #define iowrite32be(v,p) iowrite32(cpu_to_be32(v), (p))
503 #define readb_relaxed(addr) __raw_readb(addr)
504 #define readw_relaxed(addr) __raw_readw(addr)
505 #define readl_relaxed(addr) __raw_readl(addr)
506 #define readq_relaxed(addr) __raw_readq(addr)
522 #define __HAVE_ARCH_MEMSETW_IO
523 static inline void memsetw_io(
volatile void __iomem *
addr, u16
c,
long len)
531 extern void insb (
unsigned long port,
void *
dst,
unsigned long count);
532 extern void insw (
unsigned long port,
void *
dst,
unsigned long count);
533 extern void insl (
unsigned long port,
void *
dst,
unsigned long count);
534 extern void outsb (
unsigned long port,
const void *
src,
unsigned long count);
535 extern void outsw (
unsigned long port,
const void *
src,
unsigned long count);
536 extern void outsl (
unsigned long port,
const void *
src,
unsigned long count);
546 #ifdef CONFIG_ALPHA_GENERIC
547 # define RTC_PORT(x) ((x) + alpha_mv.rtc_port)
549 # ifdef CONFIG_ALPHA_JENSEN
550 # define RTC_PORT(x) (0x170+(x))
552 # define RTC_PORT(x) (0x70 + (x))
555 #define RTC_ALWAYS_BCD 0
564 #define writeq writeq
571 #define xlate_dev_mem_ptr(p) __va(p)
576 #define xlate_dev_kmem_ptr(p) p