creatorreg.h revision 146970
1139804Simp/*- 2103785Sjeff * Copyright (C) 2000 David S. Miller (davem@redhat.com) 3205959Slstewart * 4205959Slstewart * Permission is hereby granted, free of charge, to any person obtaining a copy 5103785Sjeff * of this software and associated documentation files (the "Software"), to deal 6103785Sjeff * in the Software without restriction, including without limitation the rights 7205959Slstewart * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8205959Slstewart * copies of the Software, and to permit persons to whom the Software is 9205959Slstewart * furnished to do so, subject to the following conditions: 10205959Slstewart * 11103785Sjeff * The above copyright notice and this permission notice shall be included in 12103785Sjeff * all copies or substantial portions of the Software. 13103785Sjeff * 14103785Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15103785Sjeff * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16103785Sjeff * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17103785Sjeff * DAVID MILLER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 18103785Sjeff * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19103785Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20103785Sjeff * 21103785Sjeff * from: XFree86: ffb_dac.h,v 1.1 2000/05/23 04:47:44 dawes Exp 22103785Sjeff */ 23103785Sjeff/*- 24103785Sjeff * Copyright (c) 2003 Jake Burkholder. 25103785Sjeff * All rights reserved. 26103785Sjeff * 27103785Sjeff * Redistribution and use in source and binary forms, with or without 28103785Sjeff * modification, are permitted provided that the following conditions 29103785Sjeff * are met: 30103785Sjeff * 1. Redistributions of source code must retain the above copyright 31103785Sjeff * notice, this list of conditions and the following disclaimer. 32103785Sjeff * 2. Redistributions in binary form must reproduce the above copyright 33116182Sobrien * notice, this list of conditions and the following disclaimer in the 34116182Sobrien * documentation and/or other materials provided with the distribution. 35116182Sobrien * 36205959Slstewart * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 37205959Slstewart * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38103785Sjeff * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 39103785Sjeff * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 40103785Sjeff * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 41103785Sjeff * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 42103785Sjeff * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 43157233Sjhb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 44103785Sjeff * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 45103785Sjeff * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 46103785Sjeff * SUCH DAMAGE. 47103785Sjeff * 48103785Sjeff * $FreeBSD: head/sys/dev/fb/creatorreg.h 146970 2005-06-04 21:15:27Z marius $ 49103785Sjeff */ 50103785Sjeff 51103785Sjeff#ifndef _DEV_FB_CREATOR_H_ 52103785Sjeff#define _DEV_FB_CREATOR_H_ 53103785Sjeff 54163606Srwatson#define FFB_NREG 24 55163606Srwatson 56103785Sjeff#define FFB_DAC 1 57103785Sjeff#define FFB_DAC_TYPE 0x0 58207223Slstewart#define FFB_DAC_VALUE 0x4 59103785Sjeff#define FFB_DAC_TYPE2 0x8 60103785Sjeff#define FFB_DAC_VALUE2 0xc 61207223Slstewart 62207223Slstewart/* FFB_DAC_TYPE configuration and palette register addresses */ 63207223Slstewart#define FFB_DAC_CFG_UCTRL 0x1001 /* User Control */ 64207223Slstewart#define FFB_DAC_CFG_TGEN 0x6000 /* Timing Generator Control */ 65207223Slstewart#define FFB_DAC_CFG_DID 0x8000 /* Device Identification */ 66103785Sjeff 67207223Slstewart/* FFB_DAC_CFG_UCTRL register */ 68207223Slstewart#define FFB_DAC_UCTRL_IPDISAB 0x0001 /* Input Pullup Resistor Dis. */ 69207223Slstewart#define FFB_DAC_UCTRL_ABLANK 0x0002 /* Asynchronous Blank */ 70207223Slstewart#define FFB_DAC_UCTRL_DBENAB 0x0004 /* Double-Buffer Enable */ 71207223Slstewart#define FFB_DAC_UCTRL_OVENAB 0x0008 /* Overlay Enable */ 72103785Sjeff#define FFB_DAC_UCTRL_WMODE 0x0030 /* Window Mode */ 73103785Sjeff#define FFB_DAC_UCTRL_WM_COMB 0x0000 /* Window Mode Combined */ 74103830Sjeff#define FFB_DAC_UCTRL_WM_S4 0x0010 /* Window Mode Separate 4 */ 75103785Sjeff#define FFB_DAC_UCTRL_WM_S8 0x0020 /* Window Mode Separate 8 */ 76103785Sjeff#define FFB_DAC_UCTRL_WM_RESV 0x0030 /* Window Mode Reserved */ 77103785Sjeff#define FFB_DAC_UCTRL_MANREV 0x0f00 /* Manufacturing Revision */ 78103785Sjeff 79103785Sjeff/* FFB_DAC_CFG_TGEN register */ 80103785Sjeff#define FFB_DAC_CFG_TGEN_VIDE 0x01 /* Video Enable */ 81103785Sjeff#define FFB_DAC_CFG_TGEN_TGE 0x02 /* Timing Generator Enable */ 82103785Sjeff#define FFB_DAC_CFG_TGEN_HSD 0x04 /* HSYNC* Disable */ 83207223Slstewart#define FFB_DAC_CFG_TGEN_VSD 0x08 /* VSYNC* Disable */ 84207223Slstewart#define FFB_DAC_CFG_TGEN_EQD 0x10 /* Equalization Disable */ 85103785Sjeff#define FFB_DAC_CFG_TGEN_MM 0x20 /* 0 = Slave, 1 = Master */ 86103785Sjeff#define FFB_DAC_CFG_TGEN_IM 0x40 /* 1 = Interlaced Mode */ 87103785Sjeff 88103785Sjeff/* FFB_DAC_CFG_DID register */ 89207223Slstewart#define FFB_DAC_CFG_DID_ONE 0x00000001 /* Always Set */ 90207223Slstewart#define FFB_DAC_CFG_DID_MANUF 0x00000ffe /* DAC Manufacturer ID */ 91103785Sjeff#define FFB_DAC_CFG_DID_PNUM 0x0ffff000 /* DAC Part Number */ 92103785Sjeff#define FFB_DAC_CFG_DID_REV 0xf0000000 /* DAC Revision */ 93103785Sjeff 94103785Sjeff/* FFB_DAC_TYPE2 cursor register addresses */ 95103785Sjeff#define FFB_DAC_CUR_BITMAP_P0 0x0 /* Plane 0 Cursor Bitmap */ 96103785Sjeff#define FFB_DAC_CUR_BITMAP_P1 0x80 /* Plane 1 Cursor Bitmap */ 97103785Sjeff#define FFB_DAC_CUR_CTRL 0x100 /* Cursor Control */ 98103785Sjeff#define FFB_DAC_CUR_COLOR0 0x101 /* Cursor Color 0 */ 99103785Sjeff#define FFB_DAC_CUR_COLOR1 0x102 /* Cursor Color 1 (bg) */ 100103995Sjeff#define FFB_DAC_CUR_COLOR2 0x103 /* Cursor Color 2 (fg) */ 101103995Sjeff#define FFB_DAC_CUR_POS 0x104 /* Active Cursor Position */ 102103785Sjeff 103103785Sjeff/* FFB_DAC_CUR_CTRL register (might be inverted on PAC1 DACs) */ 104103785Sjeff#define FFB_DAC_CUR_CTRL_P0 0x1 /* Plane0 Display Disable */ 105103785Sjeff#define FFB_DAC_CUR_CTRL_P1 0x2 /* Plane1 Display Disable */ 106103785Sjeff 107103785Sjeff#define FFB_FBC 2 108103785Sjeff#define FFB_FBC_BY 0x60 109103785Sjeff#define FFB_FBC_BX 0x64 110103785Sjeff#define FFB_FBC_DY 0x68 111103785Sjeff#define FFB_FBC_DX 0x6c 112103785Sjeff#define FFB_FBC_BH 0x70 113103785Sjeff#define FFB_FBC_BW 0x74 114103785Sjeff#define FFB_FBC_PPC 0x200 /* Pixel Processor Control */ 115103785Sjeff#define FFB_FBC_FG 0x208 /* Foreground */ 116103785Sjeff#define FFB_FBC_BG 0x20c /* Background */ 117206026Slstewart#define FFB_FBC_FBC 0x254 /* Frame Buffer Control */ 118103785Sjeff#define FFB_FBC_ROP 0x258 /* Raster Operation */ 119103785Sjeff#define FFB_FBC_PMASK 0x290 /* Pixel Mask */ 120103785Sjeff#define FFB_FBC_DRAWOP 0x300 /* Draw Operation */ 121103785Sjeff#define FFB_FBC_FONTXY 0x314 /* Font X/Y */ 122103785Sjeff#define FFB_FBC_FONTW 0x318 /* Font Width */ 123103785Sjeff#define FFB_FBC_FONTINC 0x31c /* Font Increment */ 124103785Sjeff#define FFB_FBC_FONT 0x320 /* Font Data */ 125103785Sjeff#define FFB_FBC_UCSR 0x900 /* User Control & Status */ 126103785Sjeff 127103785Sjeff#define FBC_PPC_VCE_DIS 0x00001000 128103785Sjeff#define FBC_PPC_APE_DIS 0x00000800 129103785Sjeff#define FBC_PPC_TBE_OPAQUE 0x00000200 130103785Sjeff#define FBC_PPC_CS_CONST 0x00000003 131103785Sjeff 132103785Sjeff#define FFB_FBC_WB_A 0x20000000 133103785Sjeff#define FFB_FBC_RB_A 0x00004000 134103785Sjeff#define FFB_FBC_SB_BOTH 0x00003000 135103785Sjeff#define FFB_FBC_XE_OFF 0x00000040 136103785Sjeff#define FFB_FBC_RGBE_MASK 0x0000003f 137103785Sjeff 138103785Sjeff#define FBC_ROP_NEW 0x83 139103785Sjeff 140103785Sjeff#define FBC_DRAWOP_RECTANGLE 0x08 141103785Sjeff 142103785Sjeff#define FBC_UCSR_FIFO_OVFL 0x80000000 143103785Sjeff#define FBC_UCSR_READ_ERR 0x40000000 144103785Sjeff#define FBC_UCSR_RP_BUSY 0x02000000 145103785Sjeff#define FBC_UCSR_FB_BUSY 0x01000000 146103785Sjeff#define FBC_UCSR_FIFO_MASK 0x00000fff 147103785Sjeff 148103785Sjeff#define FFB_VIRT_SFB8R 0x00000000 149103785Sjeff#define FFB_VIRT_SFB8G 0x00400000 150103785Sjeff#define FFB_VIRT_SFB8B 0x00800000 151103785Sjeff#define FFB_VIRT_SFB8X 0x00c00000 152103785Sjeff#define FFB_VIRT_SFB32 0x01000000 153103785Sjeff#define FFB_VIRT_SFB64 0x02000000 154103785Sjeff#define FFB_VIRT_FBC 0x04000000 155103785Sjeff#define FFB_VIRT_FBC_BM 0x04002000 156103785Sjeff#define FFB_VIRT_DFB8R 0x04004000 157103785Sjeff#define FFB_VIRT_DFB8G 0x04404000 158103785Sjeff#define FFB_VIRT_DFB8B 0x04804000 159103785Sjeff#define FFB_VIRT_DFB8X 0x04c04000 160103785Sjeff#define FFB_VIRT_DFB24 0x05004000 161103785Sjeff#define FFB_VIRT_DFB32 0x06004000 162103785Sjeff#define FFB_VIRT_DFB422A 0x07004000 163103785Sjeff#define FFB_VIRT_DFB422AD 0x07804000 164103785Sjeff#define FFB_VIRT_DFB24B 0x08004000 165103785Sjeff#define FFB_VIRT_DFB422B 0x09004000 166103785Sjeff#define FFB_VIRT_DFB422BD 0x09804000 167103785Sjeff#define FFB_VIRT_SFB16Z 0x0a004000 168103785Sjeff#define FFB_VIRT_SFB8Z 0x0a404000 169103785Sjeff#define FFB_VIRT_SFB422 0x0ac04000 170103785Sjeff#define FFB_VIRT_SFB422D 0x0b404000 171103785Sjeff#define FFB_VIRT_FBC_KREG 0x0bc04000 172103785Sjeff#define FFB_VIRT_DAC 0x0bc06000 173103785Sjeff#define FFB_VIRT_PROM 0x0bc08000 174103785Sjeff#define FFB_VIRT_EXP 0x0bc18000 175103785Sjeff 176103785Sjeff#define FFB_PHYS_SFB8R 0x04000000 177103785Sjeff#define FFB_PHYS_SFB8G 0x04400000 178103785Sjeff#define FFB_PHYS_SFB8B 0x04800000 179103785Sjeff#define FFB_PHYS_SFB8X 0x04c00000 180103785Sjeff#define FFB_PHYS_SFB32 0x05000000 181103785Sjeff#define FFB_PHYS_SFB64 0x06000000 182103785Sjeff#define FFB_PHYS_FBC 0x00600000 183103785Sjeff#define FFB_PHYS_FBC_BM 0x00600000 184103785Sjeff#define FFB_PHYS_DFB8R 0x01000000 185103785Sjeff#define FFB_PHYS_DFB8G 0x01400000 186103785Sjeff#define FFB_PHYS_DFB8B 0x01800000 187103785Sjeff#define FFB_PHYS_DFB8X 0x01c00000 188103785Sjeff#define FFB_PHYS_DFB24 0x02000000 189103785Sjeff#define FFB_PHYS_DFB32 0x03000000 190103785Sjeff#define FFB_PHYS_DFB422A 0x09000000 191103785Sjeff#define FFB_PHYS_DFB422AD 0x09800000 192103785Sjeff#define FFB_PHYS_DFB24B 0x0a000000 193103785Sjeff#define FFB_PHYS_DFB422B 0x0b000000 194103785Sjeff#define FFB_PHYS_DFB422BD 0x0b800000 195103995Sjeff#define FFB_PHYS_SFB16Z 0x0c800000 196103995Sjeff#define FFB_PHYS_SFB8Z 0x0c000000 197103785Sjeff#define FFB_PHYS_SFB422 0x0d000000 198103785Sjeff#define FFB_PHYS_SFB422D 0x0d800000 199103785Sjeff#define FFB_PHYS_FBC_KREG 0x00610000 200103785Sjeff#define FFB_PHYS_DAC 0x00400000 201103785Sjeff#define FFB_PHYS_PROM 0x00000000 202103785Sjeff#define FFB_PHYS_EXP 0x00200000 203205959Slstewart 204205959Slstewart#define FFB_READ(sc, reg, off) \ 205206027Slstewart bus_space_read_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off)) 206103785Sjeff#define FFB_WRITE(sc, reg, off, val) \ 207205959Slstewart bus_space_write_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off), (val)) 208205959Slstewart 209205959Slstewart#define CREATOR_DRIVER_NAME "creator" 210205959Slstewart 211205959Slstewartstruct creator_softc { 212205959Slstewart video_adapter_t sc_va; /* XXX must be first */ 213103785Sjeff 214103785Sjeff phandle_t sc_node; 215103785Sjeff 216103785Sjeff struct cdev *sc_si; 217103785Sjeff 218103785Sjeff int sc_rid[FFB_NREG]; 219207223Slstewart struct resource *sc_reg[FFB_NREG]; 220103785Sjeff bus_space_tag_t sc_bt[FFB_NREG]; 221103785Sjeff bus_space_handle_t sc_bh[FFB_NREG]; 222205959Slstewart 223205959Slstewart int sc_height; 224103785Sjeff int sc_width; 225103785Sjeff 226103785Sjeff int sc_xmargin; 227103785Sjeff int sc_ymargin; 228103785Sjeff 229103785Sjeff u_char *sc_font; 230103785Sjeff 231103785Sjeff int sc_bg_cache; 232205959Slstewart int sc_fg_cache; 233205959Slstewart int sc_fifo_cache; 234103785Sjeff 235103785Sjeff int sc_flags; 236205959Slstewart#define CREATOR_AFB (1 << 0) 237103785Sjeff#define CREATOR_CONSOLE (1 << 1) 238103785Sjeff#define CREATOR_CUREN (1 << 2) 239103785Sjeff#define CREATOR_CURINV (1 << 3) 240103785Sjeff#define CREATOR_PAC1 (1 << 4) 241103785Sjeff}; 242103785Sjeff 243205959Slstewart#endif /* !_DEV_FB_CREATOR_H_ */ 244205959Slstewart