/* -*- linux-c -*- ------------------------------------------------------- *1*2* Copyright (C) 1991, 1992 Linus Torvalds3* Copyright 2007 rPath, Inc. - All Rights Reserved4*5* This file is part of the Linux kernel, and is made available under6* the terms of the GNU General Public License version 2.7*8* ----------------------------------------------------------------------- */910/*11* Header file for the real-mode video probing code12*/1314#ifndef BOOT_VIDEO_H15#define BOOT_VIDEO_H1617#include <linux/types.h>1819/*20* This code uses an extended set of video mode numbers. These include:21* Aliases for standard modes22* NORMAL_VGA (-1)23* EXTENDED_VGA (-2)24* ASK_VGA (-3)25* Video modes numbered by menu position -- NOT RECOMMENDED because of lack26* of compatibility when extending the table. These are between 0x00 and 0xff.27*/28#define VIDEO_FIRST_MENU 0x00002930/* Standard BIOS video modes (BIOS number + 0x0100) */31#define VIDEO_FIRST_BIOS 0x01003233/* VESA BIOS video modes (VESA number + 0x0200) */34#define VIDEO_FIRST_VESA 0x02003536/* Video7 special modes (BIOS number + 0x0900) */37#define VIDEO_FIRST_V7 0x09003839/* Special video modes */40#define VIDEO_FIRST_SPECIAL 0x0f0041#define VIDEO_80x25 0x0f0042#define VIDEO_8POINT 0x0f0143#define VIDEO_80x43 0x0f0244#define VIDEO_80x28 0x0f0345#define VIDEO_CURRENT_MODE 0x0f0446#define VIDEO_80x30 0x0f0547#define VIDEO_80x34 0x0f0648#define VIDEO_80x60 0x0f0749#define VIDEO_GFX_HACK 0x0f0850#define VIDEO_LAST_SPECIAL 0x0f095152/* Video modes given by resolution */53#define VIDEO_FIRST_RESOLUTION 0x10005455/* The "recalculate timings" flag */56#define VIDEO_RECALC 0x80005758void store_screen(void);59#define DO_STORE() store_screen()6061/*62* Mode table structures63*/6465struct mode_info {66u16 mode; /* Mode number (vga= style) */67u16 x, y; /* Width, height */68u16 depth; /* Bits per pixel, 0 for text mode */69};7071struct card_info {72const char *card_name;73int (*set_mode)(struct mode_info *mode);74int (*probe)(void);75struct mode_info *modes;76int nmodes; /* Number of probed modes so far */77int unsafe; /* Probing is unsafe, only do after "scan" */78u16 xmode_first; /* Unprobed modes to try to call anyway */79u16 xmode_n; /* Size of unprobed mode range */80};8182#define __videocard struct card_info __attribute__((section(".videocards")))83extern struct card_info video_cards[], video_cards_end[];8485int mode_defined(u16 mode); /* video.c */8687/* Basic video information */88#define ADAPTER_CGA 0 /* CGA/MDA/HGC */89#define ADAPTER_EGA 190#define ADAPTER_VGA 29192extern int adapter;93extern u16 video_segment;94extern int force_x, force_y; /* Don't query the BIOS for cols/rows */95extern int do_restore; /* Restore screen contents */96extern int graphic_mode; /* Graphics mode with linear frame buffer */9798/* Accessing VGA indexed registers */99static inline u8 in_idx(u16 port, u8 index)100{101outb(index, port);102return inb(port+1);103}104105static inline void out_idx(u8 v, u16 port, u8 index)106{107outw(index+(v << 8), port);108}109110/* Writes a value to an indexed port and then reads the port again */111static inline u8 tst_idx(u8 v, u16 port, u8 index)112{113out_idx(port, index, v);114return in_idx(port, index);115}116117/* Get the I/O port of the VGA CRTC */118u16 vga_crtc(void); /* video-vga.c */119120#endif /* BOOT_VIDEO_H */121122123