2 * Copyright (C) 2002 David McCullough <davidm@snapgear.com>
3 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
4 * Based largely on io_se.c.
6 * I/O routine for Hitachi 7751 SolutionEngine.
8 * Initial version only to support LAN access; some
9 * placeholder code from io_se.c left in with the
10 * expectation of later SuperIO and PCMCIA access.
12 #include <linux/kernel.h>
13 #include <linux/types.h>
14 #include <linux/pci.h>
16 #include <asm/addrspace.h>
18 #ifdef CONFIG_SH_SECUREEDGE5410
19 unsigned short secureedge5410_ioport
;
22 static inline volatile __u16
*port2adr(unsigned int port
)
24 maybebadio((unsigned long)port
);
25 return (volatile __u16
*)port
;
29 * General outline: remap really low stuff [eventually] to SuperIO,
30 * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO)
31 * is mapped through the PCI IO window. Stuff with high bits (PXSEG)
32 * should be way beyond the window, and is used w/o translation for
35 unsigned char snapgear_inb(unsigned long port
)
38 return *(volatile unsigned char *)port
;
40 return (*port2adr(port
)) & 0xff;
43 unsigned char snapgear_inb_p(unsigned long port
)
48 v
= *(volatile unsigned char *)port
;
50 v
= (*port2adr(port
))&0xff;
55 unsigned short snapgear_inw(unsigned long port
)
58 return *(volatile unsigned short *)port
;
59 else if (port
>= 0x2000)
60 return *port2adr(port
);
66 unsigned int snapgear_inl(unsigned long port
)
69 return *(volatile unsigned long *)port
;
70 else if (port
>= 0x2000)
71 return *port2adr(port
);
77 void snapgear_outb(unsigned char value
, unsigned long port
)
81 *(volatile unsigned char *)port
= value
;
83 *(port2adr(port
)) = value
;
86 void snapgear_outb_p(unsigned char value
, unsigned long port
)
89 *(volatile unsigned char *)port
= value
;
91 *(port2adr(port
)) = value
;
95 void snapgear_outw(unsigned short value
, unsigned long port
)
98 *(volatile unsigned short *)port
= value
;
99 else if (port
>= 0x2000)
100 *port2adr(port
) = value
;
105 void snapgear_outl(unsigned int value
, unsigned long port
)
108 *(volatile unsigned long *)port
= value
;
113 void snapgear_insl(unsigned long port
, void *addr
, unsigned long count
)
118 void snapgear_outsl(unsigned long port
, const void *addr
, unsigned long count
)