0001
0002
0003
0004
0005
0006
0007
0008 #ifndef _LINUX_ASM_VGA_H_
0009 #define _LINUX_ASM_VGA_H_
0010
0011 #include <asm/io.h>
0012
0013 #define VT_BUF_HAVE_RW
0014 #define VT_BUF_HAVE_MEMSETW
0015 #define VT_BUF_HAVE_MEMCPYW
0016
0017 static inline void scr_writew(u16 val, volatile u16 *addr)
0018 {
0019 if (__is_ioaddr(addr))
0020 __raw_writew(val, (volatile u16 __iomem *) addr);
0021 else
0022 *addr = val;
0023 }
0024
0025 static inline u16 scr_readw(volatile const u16 *addr)
0026 {
0027 if (__is_ioaddr(addr))
0028 return __raw_readw((volatile const u16 __iomem *) addr);
0029 else
0030 return *addr;
0031 }
0032
0033 static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
0034 {
0035 if (__is_ioaddr(s))
0036 memsetw_io((u16 __iomem *) s, c, count);
0037 else
0038 memset16(s, c, count / 2);
0039 }
0040
0041
0042 extern void scr_memcpyw(u16 *d, const u16 *s, unsigned int count);
0043
0044
0045
0046
0047 #define vga_readb(a) readb((u8 __iomem *)(a))
0048 #define vga_writeb(v,a) writeb(v, (u8 __iomem *)(a))
0049
0050 #ifdef CONFIG_VGA_HOSE
0051 #include <linux/ioport.h>
0052 #include <linux/pci.h>
0053
0054 extern struct pci_controller *pci_vga_hose;
0055
0056 # define __is_port_vga(a) \
0057 (((a) >= 0x3b0) && ((a) < 0x3e0) && \
0058 ((a) != 0x3b3) && ((a) != 0x3d3))
0059
0060 # define __is_mem_vga(a) \
0061 (((a) >= 0xa0000) && ((a) <= 0xc0000))
0062
0063 # define FIXUP_IOADDR_VGA(a) do { \
0064 if (pci_vga_hose && __is_port_vga(a)) \
0065 (a) += pci_vga_hose->io_space->start; \
0066 } while(0)
0067
0068 # define FIXUP_MEMADDR_VGA(a) do { \
0069 if (pci_vga_hose && __is_mem_vga(a)) \
0070 (a) += pci_vga_hose->mem_space->start; \
0071 } while(0)
0072
0073 #else
0074 # define pci_vga_hose 0
0075 # define __is_port_vga(a) 0
0076 # define __is_mem_vga(a) 0
0077 # define FIXUP_IOADDR_VGA(a)
0078 # define FIXUP_MEMADDR_VGA(a)
0079 #endif
0080
0081 #define VGA_MAP_MEM(x,s) ((unsigned long) ioremap(x, s))
0082
0083 #endif