savage_vbe.h revision ab47cfaa
1/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h,v 1.1 2000/12/02 01:16:15 dawes Exp $ */ 2 3/* 4This file was originally part of the Linux Real-Mode Interface, or LRMI. 5There is nothing LRMI-specific here; this is all good, general VBE info. 6 7Copyright (C) 1996 by Josh Vanderhoof 8 9You are free to distribute and modify this file, as long as you 10do not remove this copyright notice and clearly label modified 11versions as being modified. 12 13This software has NO WARRANTY. Use it at your own risk. 14*/ 15 16#ifndef _SAVAGEVBE_H 17#define _SAVAGEVBE_H 18 19/* 20 * Common BIOS functions 21 */ 22 23#define BIOS_SET_VBE_MODE 0x4F02 24#define BIOS_GET_VBE_MODE 0x4F03 25#define BIOS_SVGA_STATE 0x4F04 26#define BIOS_LOG_SCANLINE 0x4F06 27#define BIOS_VBE_PM_SERVICE 0x4F10 28#define S3_EXTBIOS_INFO 0x4F14 /* S3 Extended BIOS services */ 29#define BIOS_VBE_DDC 0x4F15 30 31/************************************************************************* 32 * Defines for BIOS compliant with S3 (Mobile and Desktop) PCI Video 33 * Bios External Interface Specification, Core Revision 3.02+ 34 * 35 * e.g. used by Trio3D, GX-3 36 *************************************************************************/ 37 38#define S3_GET_SVGA_BUF 0x0000 39#define S3_SAVE_SVGA_STATE 0x0001 40#define S3_RESTORE_SVGA_STATE 0x0002 41/* 42 * For S3_EXTBIOS_INFO (0x4F14) services 43 */ 44#define S3_VBE_INFO 0x0000 /* fn0: Query S3/VBE info */ 45 46#define S3_SET_REFRESH 0x0001 /* fn1,sub0: Set Refresh Rate for Mode */ 47#define S3_GET_REFRESH 0x0101 /* fn1,sub1: Get Refresh Rate for Mode */ 48#define S3_QUERY_REFRESH 0x0201 /* fn1,sub2: Query Refresh Rates for Mode */ 49 50#define S3_QUERY_MODELIST 0x0202 /* fn2,sub2: Query Mode List */ 51#define S3_GET_EXT_MODEINFO 0x0302 /* fn2,sub3: Get Extended Mode Info */ 52 53#define S3_QUERY_ATTACHED 0x0004 /* fn4,sub0: Query detected displays */ 54 55#define S3_GET_ACTIVE_DISP 0x0103 /* fn3,sub1: Get Active Display */ 56#define S3_SET_ACTIVE_DISP 0x0003 /* fn3,sub0: Set Active Display */ 57#define S3_ALT_SET_ACTIVE_DISP 0x8003 /* fn8003,sub0: Alternate Set Active Display */ 58 59#define S3_SET_TV_CONFIG 0x0007 /* fn7,sub0: Set TV Configuration */ 60#define S3_GET_TV_CONFIG 0x0107 /* fn7,sub1: Get TV Configuration */ 61 62 63#define BIOS_CRT1_ONLY 0x01 64#define BIOS_LCD_ONLY 0x02 65#define BIOS_TV_NTSC 0x04 66#define BIOS_TV_PAL 0x08 67#define BIOS_TV_ONLY 0x0c 68#define BIOS_DVI_ONLY 0x20 69#define BIOS_DEVICE_MASK (BIOS_CRT1_ONLY|BIOS_LCD_ONLY|BIOS_TV_ONLY|BIOS_DVI_ONLY) 70 71/* structures for vbe 2.0 */ 72 73#ifndef __GNUC__ 74#define __attribute__(a) 75#endif 76 77struct vbe_info_block 78 { 79 char vbe_signature[4]; 80 short vbe_version; 81 unsigned short oem_string_off; 82 unsigned short oem_string_seg; 83 int capabilities; 84 unsigned short video_mode_list_off; 85 unsigned short video_mode_list_seg; 86 short total_memory; 87 short oem_software_rev; 88 unsigned short oem_vendor_name_off; 89 unsigned short oem_vendor_name_seg; 90 unsigned short oem_product_name_off; 91 unsigned short oem_product_name_seg; 92 unsigned short oem_product_rev_off; 93 unsigned short oem_product_rev_seg; 94 char reserved[222]; 95 char oem_data[256]; 96 } __attribute__ ((packed)); 97 98#define VBE_ATTR_MODE_SUPPORTED (1 << 0) 99#define VBE_ATTR_TTY (1 << 2) 100#define VBE_ATTR_COLOR (1 << 3) 101#define VBE_ATTR_GRAPHICS (1 << 4) 102#define VBE_ATTR_NOT_VGA (1 << 5) 103#define VBE_ATTR_NOT_WINDOWED (1 << 6) 104#define VBE_ATTR_LINEAR (1 << 7) 105 106#define VBE_WIN_RELOCATABLE (1 << 0) 107#define VBE_WIN_READABLE (1 << 1) 108#define VBE_WIN_WRITEABLE (1 << 2) 109 110#define VBE_MODEL_TEXT 0 111#define VBE_MODEL_CGA 1 112#define VBE_MODEL_HERCULES 2 113#define VBE_MODEL_PLANAR 3 114#define VBE_MODEL_PACKED 4 115#define VBE_MODEL_256 5 116#define VBE_MODEL_RGB 6 117#define VBE_MODEL_YUV 7 118 119struct vbe_mode_info_block 120 { 121 unsigned short mode_attributes; 122 unsigned char win_a_attributes; 123 unsigned char win_b_attributes; 124 unsigned short win_granularity; 125 unsigned short win_size; 126 unsigned short win_a_segment; 127 unsigned short win_b_segment; 128 unsigned short win_func_ptr_off; 129 unsigned short win_func_ptr_seg; 130 unsigned short bytes_per_scanline; 131 unsigned short x_resolution; 132 unsigned short y_resolution; 133 unsigned char x_char_size; 134 unsigned char y_char_size; 135 unsigned char number_of_planes; 136 unsigned char bits_per_pixel; 137 unsigned char number_of_banks; 138 unsigned char memory_model; 139 unsigned char bank_size; 140 unsigned char number_of_image_pages; 141 unsigned char res1; 142 unsigned char red_mask_size; 143 unsigned char red_field_position; 144 unsigned char green_mask_size; 145 unsigned char green_field_position; 146 unsigned char blue_mask_size; 147 unsigned char blue_field_position; 148 unsigned char rsvd_mask_size; 149 unsigned char rsvd_field_position; 150 unsigned char direct_color_mode_info; 151 unsigned int phys_base_ptr; 152 unsigned int offscreen_mem_offset; 153 unsigned short offscreen_mem_size; 154 unsigned char res2[206]; 155 } __attribute__ ((packed)); 156 157struct vbe_palette_entry 158 { 159 unsigned char blue; 160 unsigned char green; 161 unsigned char red; 162 unsigned char align; 163 } __attribute__ ((packed)); 164 165#endif 166