Merge branch 'oprofile-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.git] / arch / x86 / boot / video.h
1 /* -*- linux-c -*- ------------------------------------------------------- *
2 *
3 * Copyright (C) 1991, 1992 Linus Torvalds
4 * Copyright 2007 rPath, Inc. - All Rights Reserved
5 *
6 * This file is part of the Linux kernel, and is made available under
7 * the terms of the GNU General Public License version 2.
8 *
9 * ----------------------------------------------------------------------- */
10
11 /*
12 * Header file for the real-mode video probing code
13 */
14
15 #ifndef BOOT_VIDEO_H
16 #define BOOT_VIDEO_H
17
18 #include <linux/types.h>
19
20 /* Enable autodetection of SVGA adapters and modes. */
21 #undef CONFIG_VIDEO_SVGA
22
23 /* Enable autodetection of VESA modes */
24 #define CONFIG_VIDEO_VESA
25
26 /* Retain screen contents when switching modes */
27 #define CONFIG_VIDEO_RETAIN
28
29 /* Force 400 scan lines for standard modes (hack to fix bad BIOS behaviour */
30 #undef CONFIG_VIDEO_400_HACK
31
32 /* This code uses an extended set of video mode numbers. These include:
33 * Aliases for standard modes
34 * NORMAL_VGA (-1)
35 * EXTENDED_VGA (-2)
36 * ASK_VGA (-3)
37 * Video modes numbered by menu position -- NOT RECOMMENDED because of lack
38 * of compatibility when extending the table. These are between 0x00 and 0xff.
39 */
40 #define VIDEO_FIRST_MENU 0x0000
41
42 /* Standard BIOS video modes (BIOS number + 0x0100) */
43 #define VIDEO_FIRST_BIOS 0x0100
44
45 /* VESA BIOS video modes (VESA number + 0x0200) */
46 #define VIDEO_FIRST_VESA 0x0200
47
48 /* Video7 special modes (BIOS number + 0x0900) */
49 #define VIDEO_FIRST_V7 0x0900
50
51 /* Special video modes */
52 #define VIDEO_FIRST_SPECIAL 0x0f00
53 #define VIDEO_80x25 0x0f00
54 #define VIDEO_8POINT 0x0f01
55 #define VIDEO_80x43 0x0f02
56 #define VIDEO_80x28 0x0f03
57 #define VIDEO_CURRENT_MODE 0x0f04
58 #define VIDEO_80x30 0x0f05
59 #define VIDEO_80x34 0x0f06
60 #define VIDEO_80x60 0x0f07
61 #define VIDEO_GFX_HACK 0x0f08
62 #define VIDEO_LAST_SPECIAL 0x0f09
63
64 /* Video modes given by resolution */
65 #define VIDEO_FIRST_RESOLUTION 0x1000
66
67 /* The "recalculate timings" flag */
68 #define VIDEO_RECALC 0x8000
69
70 /* Define DO_STORE according to CONFIG_VIDEO_RETAIN */
71 #ifdef CONFIG_VIDEO_RETAIN
72 void store_screen(void);
73 #define DO_STORE() store_screen()
74 #else
75 #define DO_STORE() ((void)0)
76 #endif /* CONFIG_VIDEO_RETAIN */
77
78 /*
79 * Mode table structures
80 */
81
82 struct mode_info {
83 u16 mode; /* Mode number (vga= style) */
84 u16 x, y; /* Width, height */
85 u16 depth; /* Bits per pixel, 0 for text mode */
86 };
87
88 struct card_info {
89 const char *card_name;
90 int (*set_mode)(struct mode_info *mode);
91 int (*probe)(void);
92 struct mode_info *modes;
93 int nmodes; /* Number of probed modes so far */
94 int unsafe; /* Probing is unsafe, only do after "scan" */
95 u16 xmode_first; /* Unprobed modes to try to call anyway */
96 u16 xmode_n; /* Size of unprobed mode range */
97 };
98
99 #define __videocard struct card_info __attribute__((section(".videocards")))
100 extern struct card_info video_cards[], video_cards_end[];
101
102 int mode_defined(u16 mode); /* video.c */
103
104 /* Basic video information */
105 #define ADAPTER_CGA 0 /* CGA/MDA/HGC */
106 #define ADAPTER_EGA 1
107 #define ADAPTER_VGA 2
108
109 extern int adapter;
110 extern u16 video_segment;
111 extern int force_x, force_y; /* Don't query the BIOS for cols/rows */
112 extern int do_restore; /* Restore screen contents */
113 extern int graphic_mode; /* Graphics mode with linear frame buffer */
114
115 /* Accessing VGA indexed registers */
116 static inline u8 in_idx(u16 port, u8 index)
117 {
118 outb(index, port);
119 return inb(port+1);
120 }
121
122 static inline void out_idx(u8 v, u16 port, u8 index)
123 {
124 outw(index+(v << 8), port);
125 }
126
127 /* Writes a value to an indexed port and then reads the port again */
128 static inline u8 tst_idx(u8 v, u16 port, u8 index)
129 {
130 out_idx(port, index, v);
131 return in_idx(port, index);
132 }
133
134 /* Get the I/O port of the VGA CRTC */
135 u16 vga_crtc(void); /* video-vga.c */
136
137 #endif /* BOOT_VIDEO_H */
This page took 0.041526 seconds and 5 git commands to generate.