platform/x86: Revert intel_pmc_ipc: Use MFD framework to create dependent devices
[linux-2.6-microblaze.git] / include / linux / vt_buffer.h
1 /*
2  *      include/linux/vt_buffer.h -- Access to VT screen buffer
3  *
4  *      (c) 1998 Martin Mares <mj@ucw.cz>
5  *
6  *      This is a set of macros and functions which are used in the
7  *      console driver and related code to access the screen buffer.
8  *      In most cases the console works with simple in-memory buffer,
9  *      but when handling hardware text mode consoles, we store
10  *      the foreground console directly in video memory.
11  */
12
13 #ifndef _LINUX_VT_BUFFER_H_
14 #define _LINUX_VT_BUFFER_H_
15
16 #include <linux/string.h>
17
18 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
19 #include <asm/vga.h>
20 #endif
21
22 #ifndef VT_BUF_HAVE_RW
23 #define scr_writew(val, addr) (*(addr) = (val))
24 #define scr_readw(addr) (*(addr))
25 #endif
26
27 #ifndef VT_BUF_HAVE_MEMSETW
28 static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
29 {
30 #ifdef VT_BUF_HAVE_RW
31         count /= 2;
32         while (count--)
33                 scr_writew(c, s++);
34 #else
35         memset16(s, c, count / 2);
36 #endif
37 }
38 #endif
39
40 #ifndef VT_BUF_HAVE_MEMCPYW
41 static inline void scr_memcpyw(u16 *d, const u16 *s, unsigned int count)
42 {
43 #ifdef VT_BUF_HAVE_RW
44         count /= 2;
45         while (count--)
46                 scr_writew(scr_readw(s++), d++);
47 #else
48         memcpy(d, s, count);
49 #endif
50 }
51 #endif
52
53 #ifndef VT_BUF_HAVE_MEMMOVEW
54 static inline void scr_memmovew(u16 *d, const u16 *s, unsigned int count)
55 {
56 #ifdef VT_BUF_HAVE_RW
57         if (d < s)
58                 scr_memcpyw(d, s, count);
59         else {
60                 count /= 2;
61                 d += count;
62                 s += count;
63                 while (count--)
64                         scr_writew(scr_readw(--s), --d);
65         }
66 #else
67         memmove(d, s, count);
68 #endif
69 }
70 #endif
71
72 #endif