1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 1998 Michael Smith and Kazutaka YOKOTA 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer as 12 * the first lines of this file unmodified. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 31 #ifndef _DEV_FB_VESA_H_ 32 #define _DEV_FB_VESA_H_ 33 34 struct vesa_info 35 { 36 /* mandatory fields */ 37 u_int8_t v_sig[4]; /* VESA */ 38 u_int16_t v_version; /* ver in BCD */ 39 u_int32_t v_oemstr; /* OEM string */ 40 u_int32_t v_flags; /* flags */ 41 #define V_DAC8 (1<<0) 42 #define V_NONVGA (1<<1) 43 #define V_SNOW (1<<2) 44 u_int32_t v_modetable; /* modes */ 45 u_int16_t v_memsize; /* in 64K */ 46 /* 2.0 */ 47 u_int16_t v_revision; /* software rev */ 48 u_int32_t v_venderstr; /* vender */ 49 u_int32_t v_prodstr; /* product name */ 50 u_int32_t v_revstr; /* product rev */ 51 u_int8_t v_strach[222]; 52 u_int8_t v_oemdata[256]; 53 } __packed; 54 55 struct vesa_mode 56 { 57 /* mandatory fields */ 58 u_int16_t v_modeattr; 59 #define V_MODESUPP (1<<0) /* VESA mode attributes */ 60 #define V_MODEOPTINFO (1<<1) 61 #define V_MODEBIOSOUT (1<<2) 62 #define V_MODECOLOR (1<<3) 63 #define V_MODEGRAPHICS (1<<4) 64 #define V_MODENONVGA (1<<5) 65 #define V_MODENONBANK (1<<6) 66 #define V_MODELFB (1<<7) 67 #define V_MODEVESA (1<<16) /* Private attributes */ 68 u_int8_t v_waattr; 69 u_int8_t v_wbattr; 70 #define V_WATTREXIST (1<<0) 71 #define V_WATTRREAD (1<<1) 72 #define V_WATTRWRITE (1<<2) 73 u_int16_t v_wgran; 74 u_int16_t v_wsize; 75 u_int16_t v_waseg; 76 u_int16_t v_wbseg; 77 u_int32_t v_posfunc; 78 u_int16_t v_bpscanline; 79 /* fields optional for 1.0/1.1 implementations */ 80 u_int16_t v_width; 81 u_int16_t v_height; 82 u_int8_t v_cwidth; 83 u_int8_t v_cheight; 84 u_int8_t v_planes; 85 u_int8_t v_bpp; 86 u_int8_t v_banks; 87 u_int8_t v_memmodel; 88 #define V_MMTEXT 0 89 #define V_MMCGA 1 90 #define V_MMHGC 2 91 #define V_MMEGA 3 92 #define V_MMPACKED 4 93 #define V_MMSEQU256 5 94 #define V_MMDIRCOLOR 6 95 #define V_MMYUV 7 96 u_int8_t v_banksize; 97 u_int8_t v_ipages; 98 u_int8_t v_reserved0; 99 /* fields for 1.2+ implementations */ 100 u_int8_t v_redmasksize; 101 u_int8_t v_redfieldpos; 102 u_int8_t v_greenmasksize; 103 u_int8_t v_greenfieldpos; 104 u_int8_t v_bluemasksize; 105 u_int8_t v_bluefieldpos; 106 u_int8_t v_resmasksize; 107 u_int8_t v_resfieldpos; 108 u_int8_t v_dircolormode; 109 /* 2.0 implementations */ 110 u_int32_t v_lfb; 111 u_int32_t v_offscreen; 112 u_int16_t v_offscreensize; 113 /* 3.0 implementations */ 114 u_int16_t v_linbpscanline; 115 u_int8_t v_bankipages; 116 u_int8_t v_linipages; 117 u_int8_t v_linredmasksize; 118 u_int8_t v_linredfieldpos; 119 u_int8_t v_lingreenmasksize; 120 u_int8_t v_lingreenfieldpos; 121 u_int8_t v_linbluemasksize; 122 u_int8_t v_linbluefieldpos; 123 u_int8_t v_linresmasksize; 124 u_int8_t v_linresfieldpos; 125 u_int32_t v_maxpixelclock; 126 u_int8_t v_reserved1[190]; 127 } __packed; 128 129 #ifdef _KERNEL 130 131 #define VESA_MODE(x) ((x) >= M_VESA_BASE && (x) <= M_VESA_MODE_MAX) 132 133 int vesa_load_ioctl(void); 134 int vesa_unload_ioctl(void); 135 136 #endif 137 138 #endif /* !_DEV_FB_VESA_H_ */ 139