1*6bbb6328Sjsg /* $OpenBSD: p9000.h,v 1.4 2007/05/22 04:14:03 jsg Exp $ */ 24429295dSmiod /* 34429295dSmiod * Copyright (c) 2003, Miodrag Vallat. 44429295dSmiod * 54429295dSmiod * Redistribution and use in source and binary forms, with or without 64429295dSmiod * modification, are permitted provided that the following conditions 74429295dSmiod * are met: 84429295dSmiod * 1. Redistributions of source code must retain the above copyright 94429295dSmiod * notice, this list of conditions and the following disclaimer. 104429295dSmiod * 2. Redistributions in binary form must reproduce the above copyright 114429295dSmiod * notice, this list of conditions and the following disclaimer in the 124429295dSmiod * documentation and/or other materials provided with the distribution. 134429295dSmiod * 144429295dSmiod * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 154429295dSmiod * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 164429295dSmiod * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 174429295dSmiod * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 184429295dSmiod * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 194429295dSmiod * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 204429295dSmiod * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 214429295dSmiod * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 224429295dSmiod * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 234429295dSmiod * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 244429295dSmiod * POSSIBILITY OF SUCH DAMAGE. 254429295dSmiod */ 264429295dSmiod 274429295dSmiod /* 284429295dSmiod * Weitek Power9000 and Power9100 definitions. 294429295dSmiod * 304429295dSmiod * Although the datasheet is not available anymore, a good source of 31*6bbb6328Sjsg * documentation is several code examples in XFree86 3.x (vga256/p9x00) and the 324429295dSmiod * {Net,Open}BSD source trees. 334429295dSmiod */ 344429295dSmiod 354429295dSmiod /* 364429295dSmiod * Frame buffer control registers 374429295dSmiod * 384429295dSmiod * Offsets below are relative to the following locations: 394429295dSmiod * P9000 at 0x00100000, P9100 at 0x000000 404429295dSmiod */ 414429295dSmiod 424429295dSmiod /* 434429295dSmiod * System control registers 444429295dSmiod */ 454429295dSmiod 464429295dSmiod /* System configuration register */ 474429295dSmiod #define P9000_SYSTEM_CONFIG 0x00000004 484429295dSmiod 494429295dSmiod #define SCR_PIXEL_MASK 0x1c000000 504429295dSmiod #define SCR_PIXEL_8BPP 0x08000000 514429295dSmiod #define SCR_PIXEL_16BPP 0x0c000000 524429295dSmiod #define SCR_PIXEL_24BPP 0x1c000000 534429295dSmiod #define SCR_PIXEL_32BPP 0x14000000 54e2863b4bSmiod #define SCR_SWAP_WORDS 0x00002000 55e2863b4bSmiod #define SCR_SWAP_BYTES 0x00001000 56e2863b4bSmiod #define SCR_SWAP_BITS 0x00000800 574429295dSmiod #define SCR_READ_BUFFER_MASK 0x00000400 584429295dSmiod #define SCR_WRITE_BUFFER_MASK 0x00000200 594429295dSmiod #define SCR_ID_MASK 0x00000007 60e2863b4bSmiod #define SCR_SC(sc0, sc1, sc2, sc3) \ 61e2863b4bSmiod (((sc0) << 14) | ((sc1) << 17) | ((sc2) << 20) | ((sc3) << 29)) 624429295dSmiod 634429295dSmiod /* Interrupt status register */ 644429295dSmiod #define P9000_INTERRUPT 0x00000008 654429295dSmiod 664429295dSmiod /* Interrupt enable register */ 674429295dSmiod #define P9000_INTERRUPT_ENABLE 0x0000000c 684429295dSmiod 694429295dSmiod #define IER_MASTER_ENABLE 0x00000080 704429295dSmiod #define IER_MASTER_INTERRUPT 0x00000040 714429295dSmiod #define IER_VBLANK_ENABLE 0x00000020 724429295dSmiod #define IER_VBLANK_INTERRUPT 0x00000010 734429295dSmiod #define IER_PICK_ENABLE 0x00000008 744429295dSmiod #define IER_PICK_INTERRUPT 0x00000004 754429295dSmiod #define IER_IDLE_ENABLE 0x00000002 764429295dSmiod #define IER_IDLE_INTERRUPT 0x00000001 774429295dSmiod 784429295dSmiod /* Alternate read bank register (bits 16-22) */ 794429295dSmiod #define P9000_ALTBANK_READ 0x00000010 804429295dSmiod 814429295dSmiod /* Alternate write bank register (bits 16-22) */ 824429295dSmiod #define P9000_ALTBANK_WRITE 0x00000014 834429295dSmiod 844429295dSmiod /* 854429295dSmiod * Video control registers 864429295dSmiod */ 874429295dSmiod 884429295dSmiod /* Horizontal counter */ 894429295dSmiod #define P9000_HCR 0x00000104 904429295dSmiod /* Horizontal total */ 914429295dSmiod #define P9000_HTR 0x00000108 924429295dSmiod /* Horizontal sync rising edge */ 934429295dSmiod #define P9000_HSRE 0x0000010c 944429295dSmiod /* Horizontal blank rising edge */ 954429295dSmiod #define P9000_HBRE 0x00000110 964429295dSmiod /* Horizontal blank falling edge */ 974429295dSmiod #define P9000_HBFE 0x00000114 984429295dSmiod /* Horizontal counter preload */ 994429295dSmiod #define P9000_HCP 0x00000118 1004429295dSmiod 1014429295dSmiod /* Vertical counter */ 1024429295dSmiod #define P9000_VCR 0x0000011c 1034429295dSmiod /* Vertical length */ 1044429295dSmiod #define P9000_VL 0x00000120 1054429295dSmiod /* Vertical sync rising edge */ 1064429295dSmiod #define P9000_VSRE 0x00000124 1074429295dSmiod /* Vertical blank rising edge */ 1084429295dSmiod #define P9000_VBRE 0x00000128 1094429295dSmiod /* Vertical blank falling edge */ 1104429295dSmiod #define P9000_VBFE 0x0000012c 1114429295dSmiod /* Vertical counter preload */ 1124429295dSmiod #define P9000_VCP 0x00000130 1134429295dSmiod 1144429295dSmiod /* Screen repaint address */ 1154429295dSmiod #define P9000_SRA 0x00000134 1164429295dSmiod /* Screen repaint timing control #1 */ 1174429295dSmiod #define P9000_SRTC1 0x00000138 1184429295dSmiod 1194429295dSmiod #define SRTC1_VSYNC_INTERNAL 0x00000100 1204429295dSmiod #define SRTC1_HSYNC_INTERNAL 0x00000080 1214429295dSmiod #define SRTC1_VIDEN 0x00000020 1224429295dSmiod #define SRTC1_RESTRICTED 0x00000010 1234429295dSmiod #define SRTC1_BUFFER1 0x00000008 1244429295dSmiod 1254429295dSmiod /* QSF counter. Film at 11 */ 1264429295dSmiod #define P9000_QSF 0x0000013c 1274429295dSmiod /* Screen repaint timing control #2 */ 1284429295dSmiod #define P9000_SRTC2 0x00000140 1294429295dSmiod 1304429295dSmiod /* 1314429295dSmiod * VRAM control registers 1324429295dSmiod */ 1334429295dSmiod 1344429295dSmiod /* Memory configuration */ 1354429295dSmiod #define P9000_MCR 0x00000184 1364429295dSmiod /* Refresh period */ 1374429295dSmiod #define P9000_REFRESH_PERIOD 0x00000188 1384429295dSmiod /* Refresh count */ 1394429295dSmiod #define P9000_REFRESH_COUNT 0x0000018c 1404429295dSmiod /* RAS low maximum */ 1414429295dSmiod #define P9000_RASLOW_MAXIMUM 0x00000190 1424429295dSmiod /* RAS low current */ 1434429295dSmiod #define P9000_RASLOW_CURRENT 0x00000194 1444429295dSmiod /* RAMDAC free FIFO (P9100 only, bits 12-15) and power-up configuration */ 1454429295dSmiod #define P9000_POWERUP_CONFIG 0x00000198 1464429295dSmiod #define P9100_FREE_FIFO 0x00000198 1474429295dSmiod 1484429295dSmiod /* 1494429295dSmiod * RAMDAC registers (P9100 only) 1504429295dSmiod */ 1514429295dSmiod 1524429295dSmiod #define P9100_RAMDAC_REGISTER(index) (0x00000200 + ((index) << 2)) 1534429295dSmiod 1544429295dSmiod 1554429295dSmiod /* 1564429295dSmiod * Accelerated features 1574429295dSmiod * 1584429295dSmiod * Offsets below are relative to the following locations: 1594429295dSmiod * P9000 at 0x00180000, P9100 at 0x002000 1604429295dSmiod */ 1614429295dSmiod 1624429295dSmiod /* 1634429295dSmiod * Parameter engine 1644429295dSmiod */ 1654429295dSmiod 1664429295dSmiod /* Status register */ 1674429295dSmiod #define P9000_PE_STATUS 0x00000000 1684429295dSmiod #define STATUS_QUAD_BUSY 0x80000000 1694429295dSmiod #define STATUS_BLIT_BUSY 0x40000000 1704429295dSmiod #define STATUS_PICK_DETECTED 0x00000080 1714429295dSmiod #define STATUS_PIXEL_ERROR 0x00000040 1724429295dSmiod #define STATUS_BLIT_ERROR 0x00000020 1734429295dSmiod #define STATUS_QUAD_ERROR 0x00000010 1744429295dSmiod #define STATUS_QUAD_CONCAVE 0x00000008 1754429295dSmiod #define STATUS_QUAD_OUTSIDE 0x00000004 1764429295dSmiod #define STATUS_QUAD_INSIDE 0x00000002 1774429295dSmiod #define STATUS_QUAD_STRADDLE 0x00000001 1784429295dSmiod 1794429295dSmiod /* Engine arguments / operation triggers */ 1804429295dSmiod #define P9000_PE_BLIT 0x00000004 1814429295dSmiod #define P9000_PE_QUAD 0x00000008 1824429295dSmiod #define P9000_PE_PIXEL8 0x0000000c 1834429295dSmiod #define P9000_PE_NEXTPIXELS 0x00000014 1844429295dSmiod #define P9000_PE_PIXEL1(index) (0x00000080 + ((index) << 2)) 1854429295dSmiod 1864429295dSmiod /* Control and conditions registers */ 1874429295dSmiod 1884429295dSmiod /* Out of range */ 1896694d40cSmiod #define P9000_PE_OOR 0x00000184 1904429295dSmiod /* Index register (0-3, for meta coordinates) */ 1916694d40cSmiod #define P9000_PE_INDEX 0x0000018c 1924429295dSmiod /* Window offset (16x16)*/ 1936694d40cSmiod #define P9000_PE_WINOFFSET 0x00000190 1944429295dSmiod /* Clipping window */ 1956694d40cSmiod #define P9000_PE_WINMIN 0x00000194 1966694d40cSmiod #define P9000_PE_WINMAX 0x00000198 1974429295dSmiod /* X Clip register */ 1986694d40cSmiod #define P9000_X_CLIPPING 0x000001a0 1994429295dSmiod /* Y Clip register */ 2006694d40cSmiod #define P9000_Y_CLIPPING 0x000001a4 2014429295dSmiod /* X Edge Less Than register */ 2026694d40cSmiod #define P9000_X_EDGE_LESS 0x000001a8 2034429295dSmiod /* X Edge Greater Than register */ 2046694d40cSmiod #define P9000_X_EDGE_GREATER 0x000001ac 2054429295dSmiod /* Y Edge Less Than register */ 2066694d40cSmiod #define P9000_Y_EDGE_LESS 0x000001b0 2074429295dSmiod /* Y Edge Greater Than register */ 2086694d40cSmiod #define P9000_Y_EDGE_GREATER 0x000001b4 2094429295dSmiod 2104429295dSmiod /* 2114429295dSmiod * Drawing engine 2124429295dSmiod */ 2134429295dSmiod 2144429295dSmiod /* Colors - 8 bit for P9000, 32 bit for P9100 */ 2154429295dSmiod #define P9000_DE_FG_COLOR 0x00000200 2164429295dSmiod #define P9000_DE_BG_COLOR 0x00000204 2174429295dSmiod #define P9100_DE_COLOR0 0x00000200 2184429295dSmiod #define P9100_DE_COLOR1 0x00000204 2194429295dSmiod #define P9100_DE_COLOR2 0x00000238 2204429295dSmiod #define P9100_DE_COLOR3 0x0000023c 2214429295dSmiod 2224429295dSmiod /* How to encode a colors in 8 and 16 bit mode, for the P9100 */ 2234429295dSmiod #define P9100_COLOR8(c) ((c) | ((c) << 8) | ((c) << 16) | ((c) << 24)) 2244429295dSmiod #define P9100_COLOR16(c) ((c) | ((c) << 16)) 2254429295dSmiod 2264429295dSmiod /* Plane mask (8 bits on P9000, 32 bits on P9100) */ 2274429295dSmiod #define P9000_DE_PLANEMASK 0x00000208 2284429295dSmiod 2294429295dSmiod /* Drawing mode */ 2304429295dSmiod #define P9000_DE_DRAWMODE 0x0000020c 2314429295dSmiod #define DM_PICK_CONTROL 0x00000008 2324429295dSmiod #define DM_PICK_ENABLE 0x00000004 2334429295dSmiod #define DM_BUFFER_CONTROL 0x00000002 2344429295dSmiod #define DM_BUFFER_ENABLE0 0x00000000 2354429295dSmiod #define DM_BUFFER_ENABLE1 0x00000001 2364429295dSmiod 2374429295dSmiod /* Pattern Origin (4 bit x 4 bit offset) */ 2384429295dSmiod #define P9000_DE_PATTERN_ORIGIN_X 0x00000210 2394429295dSmiod #define P9000_DE_PATTERN_ORIGIN_Y 0x00000214 2404429295dSmiod 2414429295dSmiod /* Raster operation */ 2424429295dSmiod #define P9000_DE_RASTER 0x00000218 2434429295dSmiod #define P9100_RASTER_NO_SOLID 0x00002000 2444429295dSmiod #define P9100_RASTER_PATTERN_4COLOR 0x00004000 2454429295dSmiod #define P9100_RASTER_PIXEL1_TRANSPARENT 0x00008000 2464429295dSmiod #define P9000_RASTER_QUAD_OVERSIZE 0x00010000 2474429295dSmiod #define P9000_RASTER_QUAD_PATTERN 0x00020000 2484429295dSmiod 2494429295dSmiod /* Raster minterms */ 2504429295dSmiod #define P9000_RASTER_SRC 0xcccc 2514429295dSmiod #define P9000_RASTER_DST 0xaaaa 2524429295dSmiod #define P9000_RASTER_PATTERN 0xff00 2534429295dSmiod #define P9000_RASTER_MASK 0xffff 2544429295dSmiod #define P9100_RASTER_SRC 0x00cc 2554429295dSmiod #define P9100_RASTER_DST 0x00aa 2564429295dSmiod #define P9100_RASTER_PATTERN 0x00f0 2574429295dSmiod #define P9100_RASTER_MASK 0x00ff 2584429295dSmiod 2594429295dSmiod /* Pixel8 excess storage */ 2604429295dSmiod #define P9000_DE_PIXEL8 0x0000021c 2614429295dSmiod 2624429295dSmiod /* Clipping window - same as in PE */ 2634429295dSmiod #define P9000_DE_WINMIN 0x00000220 2644429295dSmiod #define P9000_DE_WINMAX 0x00000224 2654429295dSmiod 2664429295dSmiod /* Quad pattern - up to 4 items on P9000, 8 on P9100 */ 2674429295dSmiod #define P9000_DE_PATTERN(index) (0x00000280 + ((index) << 2)) 2684429295dSmiod 2694429295dSmiod /* User pattern - up to 4 items */ 2704429295dSmiod #define P9000_DE_USER(index) (0x00000290 + ((index) << 2)) 2714429295dSmiod 2724429295dSmiod /* Byte clipping window */ 2734429295dSmiod #define P9100_DE_B_WINMIN 0x000002a0 2744429295dSmiod #define P9100_DE_B_WINMAX 0x000002a4 2754429295dSmiod 2764429295dSmiod /* 2774429295dSmiod * Coordinates 2784429295dSmiod */ 2794429295dSmiod 2804429295dSmiod /* 32 bit X value */ 2814429295dSmiod #define P9000_COORD_X 0x00000008 2824429295dSmiod /* 32 bit Y value */ 2834429295dSmiod #define P9000_COORD_Y 0x00000010 2844429295dSmiod /* 16 bit X, 16 bit Y values packed */ 2854429295dSmiod #define P9000_COORD_XY 0x00000018 2864429295dSmiod 2874429295dSmiod /* Absolute (screen) coordinates */ 2884429295dSmiod #define P9000_COORD_ABS 0x00000000 2894429295dSmiod /* Relative (in-window) coordinates */ 2904429295dSmiod #define P9000_COORD_REL 0x00000020 2914429295dSmiod 2924429295dSmiod /* How to pack a x16y16 value - note that they are in fact 12 bit values */ 2934429295dSmiod #define P9000_COORDS(x,y) ((((x) & 0x0fff) << 16) | ((y) & 0x0fff)) 2944429295dSmiod 2954429295dSmiod /* Device coordinates - 4 edges */ 2964429295dSmiod #define P9000_DC_COORD(index) (0x00001000 + ((index) * 0x40)) 2974429295dSmiod 2984429295dSmiod /* Load coordinates */ 2994429295dSmiod #define P9000_LC_POINT 0x00001200 3004429295dSmiod #define P9000_LC_LINE 0x00001240 3014429295dSmiod #define P9000_LC_TRI 0x00001280 3024429295dSmiod #define P9000_LC_QUAD 0x000012c0 3034429295dSmiod #define P9000_LC_RECT 0x00001300 304