1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_VGAREG_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_VGAREG_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate /* 37*7c478bd9Sstevel@tonic-gate * VGA frame buffer hardware definitions. 38*7c478bd9Sstevel@tonic-gate */ 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #define VGA8_DEPTH 8 41*7c478bd9Sstevel@tonic-gate #define VGA8_CMAP_ENTRIES 256 42*7c478bd9Sstevel@tonic-gate #define VGA_TEXT_CMAP_ENTRIES 64 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate /* 45*7c478bd9Sstevel@tonic-gate * General VGA registers 46*7c478bd9Sstevel@tonic-gate * These are relative to their register set, which 47*7c478bd9Sstevel@tonic-gate * the 3c0-3df set. 48*7c478bd9Sstevel@tonic-gate */ 49*7c478bd9Sstevel@tonic-gate #define VGA_ATR_AD 0x00 50*7c478bd9Sstevel@tonic-gate #define VGA_ATR_DATA 0x01 51*7c478bd9Sstevel@tonic-gate #define VGA_MISC_W 0x02 52*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_ADR 0x04 53*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_DATA 0x05 54*7c478bd9Sstevel@tonic-gate #define VGA_DAC_BASE 0x06 55*7c478bd9Sstevel@tonic-gate #define VGA_DAC_AD_MK 0x06 56*7c478bd9Sstevel@tonic-gate #define VGA_DAC_RD_AD 0x07 57*7c478bd9Sstevel@tonic-gate #define VGA_DAC_STS 0x07 58*7c478bd9Sstevel@tonic-gate #define VGA_DAC_WR_AD 0x08 59*7c478bd9Sstevel@tonic-gate #define VGA_DAC_DATA 0x09 60*7c478bd9Sstevel@tonic-gate #define VGA_MISC_R 0x0c 61*7c478bd9Sstevel@tonic-gate #define VGA_GRC_ADR 0x0e 62*7c478bd9Sstevel@tonic-gate #define VGA_GRC_DATA 0x0f 63*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_ADR 0x14 64*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_DATA 0x15 65*7c478bd9Sstevel@tonic-gate #define CGA_STAT 0x1a 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate /* 68*7c478bd9Sstevel@tonic-gate * Attribute controller index bits 69*7c478bd9Sstevel@tonic-gate */ 70*7c478bd9Sstevel@tonic-gate #define VGA_ATR_ENB_PLT 0x20 71*7c478bd9Sstevel@tonic-gate 72*7c478bd9Sstevel@tonic-gate /* 73*7c478bd9Sstevel@tonic-gate * Miscellaneous output bits 74*7c478bd9Sstevel@tonic-gate */ 75*7c478bd9Sstevel@tonic-gate #define VGA_MISC_IOA_SEL 0x01 76*7c478bd9Sstevel@tonic-gate #define VGA_MISC_ENB_RAM 0x02 77*7c478bd9Sstevel@tonic-gate #define VGA_MISC_VCLK 0x0c 78*7c478bd9Sstevel@tonic-gate #define VGA_MISC_VCLK0 0x00 79*7c478bd9Sstevel@tonic-gate #define VGA_MISC_VCLK1 0x04 80*7c478bd9Sstevel@tonic-gate #define VGA_MISC_VCLK2 0x08 81*7c478bd9Sstevel@tonic-gate #define VGA_MISC_VCLK3 0x0c 82*7c478bd9Sstevel@tonic-gate #define VGA_MISC_PGSL 0x20 83*7c478bd9Sstevel@tonic-gate #define VGA_MISC_HSP 0x40 84*7c478bd9Sstevel@tonic-gate #define VGA_MISC_VSP 0x80 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate /* 87*7c478bd9Sstevel@tonic-gate * CRT Controller registers 88*7c478bd9Sstevel@tonic-gate */ 89*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_H_TOTAL 0x00 90*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_H_D_END 0x01 91*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_S_H_BLNK 0x02 92*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_E_H_BLNK 0x03 93*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_E_H_BLNK_PUT_EHB(n) \ 94*7c478bd9Sstevel@tonic-gate ((n)&0x1f) 95*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_S_H_SY_P 0x04 96*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_E_H_SY_P 0x05 97*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_E_H_SY_P_HOR_SKW_SHIFT 5 98*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_E_H_SY_P_HOR_SKW 0x60 99*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_E_H_SY_P_EHB5 7 100*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_E_H_SY_P_PUT_HOR_SKW(skew) \ 101*7c478bd9Sstevel@tonic-gate ((skew)<<VGA_CRTC_E_H_SY_P_HOR_SKW_SHIFT) 102*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_E_H_SY_P_PUT_EHB(n) \ 103*7c478bd9Sstevel@tonic-gate ((((n)>>5)&1)<<VGA_CRTC_E_H_SY_P_EHB5) 104*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_E_H_SY_P_PUT_EHS(n) \ 105*7c478bd9Sstevel@tonic-gate ((n)&0x1f) 106*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_V_TOTAL 0x06 107*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG 0x07 108*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG_VT8 0 109*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG_VDE8 1 110*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG_VRS8 2 111*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG_SVB8 3 112*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG_LCM8 4 113*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG_VT9 5 114*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG_VDE9 6 115*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG_VRS9 7 116*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG_PUT_VT(n) \ 117*7c478bd9Sstevel@tonic-gate ((((n)>>8)&1)<<VGA_CRTC_OVFL_REG_VT8) \ 118*7c478bd9Sstevel@tonic-gate | ((((n)>>9)&1)<<VGA_CRTC_OVFL_REG_VT9) 119*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG_PUT_VDE(n) \ 120*7c478bd9Sstevel@tonic-gate ((((n)>>8)&1)<<VGA_CRTC_OVFL_REG_VDE8) \ 121*7c478bd9Sstevel@tonic-gate | ((((n)>>9)&1)<<VGA_CRTC_OVFL_REG_VDE9) 122*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG_PUT_VRS(n) \ 123*7c478bd9Sstevel@tonic-gate ((((n)>>8)&1)<<VGA_CRTC_OVFL_REG_VRS8) \ 124*7c478bd9Sstevel@tonic-gate | ((((n)>>9)&1)<<VGA_CRTC_OVFL_REG_VRS9) 125*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG_PUT_LCM(n) \ 126*7c478bd9Sstevel@tonic-gate ((((n)>>8)&1)<<VGA_CRTC_OVFL_REG_LCM8) 127*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_OVFL_REG_PUT_SVB(n) \ 128*7c478bd9Sstevel@tonic-gate ((((n)>>8)&1)<<VGA_CRTC_OVFL_REG_SVB8) 129*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_P_R_SCAN 0x08 130*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_MAX_S_LN 0x09 131*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_MAX_S_LN_SVB9 5 132*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_MAX_S_LN_LCM9 6 133*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_MAX_S_LN_PUT_SVB(n) \ 134*7c478bd9Sstevel@tonic-gate ((((n)>>9)&1)<<VGA_CRTC_MAX_S_LN_SVB9) 135*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_MAX_S_LN_PUT_LCM(n) \ 136*7c478bd9Sstevel@tonic-gate ((((n)>>9)&1)<<VGA_CRTC_MAX_S_LN_LCM9) 137*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_CSSL 0x0a 138*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_CESL 0x0b 139*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_STAH 0x0c 140*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_STAL 0x0d 141*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_CLAH 0x0e 142*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_CLAL 0x0f 143*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_VRS 0x10 144*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_VRE 0x11 145*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_VRE_LOCK 0x80 146*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_VRE_DIS_VINT 0x20 147*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_VRE_PUT_VRE(n) \ 148*7c478bd9Sstevel@tonic-gate ((n)&0x0f) 149*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_VDE 0x12 150*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_SCREEN_OFFSET 0x13 151*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_ULL 0x14 152*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_SVB 0x15 153*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_EVB 0x16 154*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_CRT_MD 0x17 155*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_CRT_MD_2BK_CGA 0x01 156*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_CRT_MD_4BK_HGC 0x02 157*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_CRT_MD_VT_X2 0x04 158*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_CRT_MD_WRD_MODE 0x08 159*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_CRT_MD_ADW_16K 0x20 160*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_CRT_MD_BYTE_MODE 0x40 161*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_CRT_MD_NO_RESET 0x80 162*7c478bd9Sstevel@tonic-gate #define VGA_CRTC_LCM 0x18 163*7c478bd9Sstevel@tonic-gate 164*7c478bd9Sstevel@tonic-gate /* 165*7c478bd9Sstevel@tonic-gate * Sequencer registers 166*7c478bd9Sstevel@tonic-gate */ 167*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_RST_SYN 0x00 168*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_RST_SYN_ASYNC_RESET 0x00 169*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_RST_SYN_NO_ASYNC_RESET 0x01 170*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_RST_SYN_SYNC_RESET 0x00 171*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_RST_SYN_NO_SYNC_RESET 0x02 172*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_CLK_MODE 0x01 173*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_CLK_MODE_8DC 0x01 174*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_EN_WT_PL 0x02 175*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_EN_WT_PL_ALL 0x0f 176*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_MEM_MODE 0x04 177*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_MEM_MODE_EXT_MEM 0x02 178*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_MEM_MODE_SEQ_MODE 0x04 179*7c478bd9Sstevel@tonic-gate #define VGA_SEQ_MEM_MODE_CHN_4M 0x08 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate /* 182*7c478bd9Sstevel@tonic-gate * Graphics Controller 183*7c478bd9Sstevel@tonic-gate */ 184*7c478bd9Sstevel@tonic-gate #define VGA_GRC_SET_RST_DT 0x00 185*7c478bd9Sstevel@tonic-gate #define VGA_GRC_EN_S_R_DT 0x01 186*7c478bd9Sstevel@tonic-gate #define VGA_GRC_COLOR_CMP 0x02 187*7c478bd9Sstevel@tonic-gate #define VGA_GRC_WT_ROP_RTC 0x03 188*7c478bd9Sstevel@tonic-gate #define VGA_GRC_RD_PL_SL 0x04 189*7c478bd9Sstevel@tonic-gate #define VGA_GRC_GRP_MODE 0x05 190*7c478bd9Sstevel@tonic-gate #define VGA_GRC_GRP_MODE_SHF_MODE_256 0x40 191*7c478bd9Sstevel@tonic-gate #define VGA_GRC_MISC_GM 0x06 192*7c478bd9Sstevel@tonic-gate #define VGA_GRC_MISC_GM_GRAPH 0x01 193*7c478bd9Sstevel@tonic-gate #define VGA_GRC_MISC_GM_MEM_MAP_1 0x04 194*7c478bd9Sstevel@tonic-gate #define VGA_GRC_CMP_DNTC 0x07 195*7c478bd9Sstevel@tonic-gate #define VGA_GRC_CMP_DNTC_ALL 0x0f 196*7c478bd9Sstevel@tonic-gate #define VGA_GRC_BIT_MASK 0x08 197*7c478bd9Sstevel@tonic-gate 198*7c478bd9Sstevel@tonic-gate /* 199*7c478bd9Sstevel@tonic-gate * Attribute controller registers 200*7c478bd9Sstevel@tonic-gate */ 201*7c478bd9Sstevel@tonic-gate #define VGA_ATR_PLT_REG 0x00 202*7c478bd9Sstevel@tonic-gate #define VGA_ATR_NUM_PLT 0x10 203*7c478bd9Sstevel@tonic-gate #define VGA_ATR_MODE 0x10 204*7c478bd9Sstevel@tonic-gate #define VGA_ATR_MODE_GRAPH 0x01 205*7c478bd9Sstevel@tonic-gate #define VGA_ATR_MODE_9WIDE 0x04 206*7c478bd9Sstevel@tonic-gate #define VGA_ATR_MODE_BLINK 0x08 207*7c478bd9Sstevel@tonic-gate #define VGA_ATR_MODE_256CLR 0x40 208*7c478bd9Sstevel@tonic-gate #define VGA_ATR_BDR_CLR 0x11 209*7c478bd9Sstevel@tonic-gate #define VGA_ATR_DISP_PLN 0x12 210*7c478bd9Sstevel@tonic-gate #define VGA_ATR_DISP_PLN_ALL 0x0f 211*7c478bd9Sstevel@tonic-gate #define VGA_ATR_H_PX_PAN 0x13 212*7c478bd9Sstevel@tonic-gate #define VGA_ATR_PX_PADD 0x14 213*7c478bd9Sstevel@tonic-gate 214*7c478bd9Sstevel@tonic-gate /* 215*7c478bd9Sstevel@tonic-gate * Low-memory frame buffer definitions. These are relative to the 216*7c478bd9Sstevel@tonic-gate * A0000 register set. 217*7c478bd9Sstevel@tonic-gate */ 218*7c478bd9Sstevel@tonic-gate #define VGA_MONO_BASE 0x10000 /* Base of monochrome text */ 219*7c478bd9Sstevel@tonic-gate #define VGA_COLOR_BASE 0x18000 /* Base of color text */ 220*7c478bd9Sstevel@tonic-gate #define VGA_TEXT_SIZE 0x8000 /* Size of text frame buffer */ 221*7c478bd9Sstevel@tonic-gate 222*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 223*7c478bd9Sstevel@tonic-gate } 224*7c478bd9Sstevel@tonic-gate #endif 225*7c478bd9Sstevel@tonic-gate 226*7c478bd9Sstevel@tonic-gate #endif /* _SYS_VGAREG_H */ 227