unichromeaccel.h revision 1.1 1 1.1 jmcneill /* $NetBSD: unichromeaccel.h,v 1.1 2006/08/13 20:26:55 jmcneill Exp $ */
2 1.1 jmcneill
3 1.1 jmcneill /*
4 1.1 jmcneill * Copyright 1998-2006 VIA Technologies, Inc. All Rights Reserved.
5 1.1 jmcneill * Copyright 2001-2006 S3 Graphics, Inc. All Rights Reserved.
6 1.1 jmcneill *
7 1.1 jmcneill * Permission is hereby granted, free of charge, to any person obtaining a
8 1.1 jmcneill * copy of this software and associated documentation files (the "Software"),
9 1.1 jmcneill * to deal in the Software without restriction, including without limitation
10 1.1 jmcneill * the rights to use, copy, modify, merge, publish, distribute, sub license,
11 1.1 jmcneill * and/or sell copies of the Software, and to permit persons to whom the
12 1.1 jmcneill * Software is furnished to do so, subject to the following conditions:
13 1.1 jmcneill *
14 1.1 jmcneill * The above copyright notice and this permission notice (including the
15 1.1 jmcneill * next paragraph) shall be included in all copies or substantial portions
16 1.1 jmcneill * of the Software.
17 1.1 jmcneill *
18 1.1 jmcneill * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 1.1 jmcneill * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 1.1 jmcneill * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 1.1 jmcneill * THE AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 1.1 jmcneill * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 1.1 jmcneill * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 1.1 jmcneill * DEALINGS IN THE SOFTWARE.
25 1.1 jmcneill */
26 1.1 jmcneill
27 1.1 jmcneill #ifndef _DEV_PCI_UNICHROMEACCEL_H
28 1.1 jmcneill #define _DEV_PCI_UNICHROMEACCEL_H
29 1.1 jmcneill
30 1.1 jmcneill /* To be included in fb.h */
31 1.1 jmcneill #ifndef FB_ACCEL_VIA_UNICHROME
32 1.1 jmcneill #define FB_ACCEL_VIA_UNICHROME 50
33 1.1 jmcneill #endif
34 1.1 jmcneill
35 1.1 jmcneill /* MMIO Base Address Definition */
36 1.1 jmcneill #define MMIO_VGABASE 0x8000
37 1.1 jmcneill #define MMIO_CR_READ MMIO_VGABASE + 0x3D4
38 1.1 jmcneill #define MMIO_CR_WRITE MMIO_VGABASE + 0x3D5
39 1.1 jmcneill #define MMIO_SR_READ MMIO_VGABASE + 0x3C4
40 1.1 jmcneill #define MMIO_SR_WRITE MMIO_VGABASE + 0x3C5
41 1.1 jmcneill
42 1.1 jmcneill #define MMIO_OUT8(reg, val) \
43 1.1 jmcneill bus_space_write_1(sc->sc_memt, sc->sc_memh, reg, val)
44 1.1 jmcneill #define MMIO_OUT16(reg, val) \
45 1.1 jmcneill bus_space_write_2(sc->sc_memt, sc->sc_memh, reg, val)
46 1.1 jmcneill #define MMIO_OUT32(reg, val) \
47 1.1 jmcneill bus_space_write_4(sc->sc_memt, sc->sc_memh, reg, val)
48 1.1 jmcneill #define MMIO_IN8(reg) \
49 1.1 jmcneill bus_space_read_1(sc->sc_memt, sc->sc_memh, reg)
50 1.1 jmcneill #define MMIO_IN16(reg) \
51 1.1 jmcneill bus_space_read_2(sc->sc_memt, sc->sc_memh, reg)
52 1.1 jmcneill #define MMIO_IN32(reg) \
53 1.1 jmcneill bus_space_read_4(sc->sc_memt, sc->sc_memh, reg)
54 1.1 jmcneill
55 1.1 jmcneill /* HW Cursor Status Define */
56 1.1 jmcneill #define HW_Cursor_ON 0
57 1.1 jmcneill #define HW_Cursor_OFF 1
58 1.1 jmcneill
59 1.1 jmcneill /* Initial HW cursor flag */
60 1.1 jmcneill #if 0
61 1.1 jmcneill static int MAX_CURS = 32;
62 1.1 jmcneill static int HW_Cursor_Init = 1;
63 1.1 jmcneill #endif
64 1.1 jmcneill
65 1.1 jmcneill #define CURSOR_SIZE (8 * 1024)
66 1.1 jmcneill #define VQ_SIZE (256 * 1024)
67 1.1 jmcneill
68 1.1 jmcneill #define VIA_MMIO_BLTBASE 0x200000
69 1.1 jmcneill #define VIA_MMIO_BLTSIZE 0x200000
70 1.1 jmcneill
71 1.1 jmcneill /* Defines for 2D registers */
72 1.1 jmcneill #define VIA_REG_GECMD 0x000
73 1.1 jmcneill #define VIA_REG_GEMODE 0x004
74 1.1 jmcneill #define VIA_REG_SRCPOS 0x008
75 1.1 jmcneill #define VIA_REG_DSTPOS 0x00C
76 1.1 jmcneill #define VIA_REG_DIMENSION 0x010 /* width and height */
77 1.1 jmcneill #define VIA_REG_PATADDR 0x014
78 1.1 jmcneill #define VIA_REG_FGCOLOR 0x018
79 1.1 jmcneill #define VIA_REG_BGCOLOR 0x01C
80 1.1 jmcneill #define VIA_REG_CLIPTL 0x020 /* top and left of clipping */
81 1.1 jmcneill #define VIA_REG_CLIPBR 0x024 /* bottom and right of clipping */
82 1.1 jmcneill #define VIA_REG_OFFSET 0x028
83 1.1 jmcneill #define VIA_REG_KEYCONTROL 0x02C /* color key control */
84 1.1 jmcneill #define VIA_REG_SRCBASE 0x030
85 1.1 jmcneill #define VIA_REG_DSTBASE 0x034
86 1.1 jmcneill #define VIA_REG_PITCH 0x038 /* pitch of src and dst */
87 1.1 jmcneill #define VIA_REG_MONOPAT0 0x03C
88 1.1 jmcneill #define VIA_REG_MONOPAT1 0x040
89 1.1 jmcneill #define VIA_REG_COLORPAT 0x100 /* from 0x100 to 0x1ff */
90 1.1 jmcneill
91 1.1 jmcneill /* VIA_REG_PITCH(0x38): Pitch Setting */
92 1.1 jmcneill #define VIA_PITCH_ENABLE 0x80000000
93 1.1 jmcneill
94 1.1 jmcneill /* defines for VIA HW cursor registers */
95 1.1 jmcneill #define VIA_REG_CURSOR_MODE 0x2D0
96 1.1 jmcneill #define VIA_REG_CURSOR_POS 0x2D4
97 1.1 jmcneill #define VIA_REG_CURSOR_ORG 0x2D8
98 1.1 jmcneill #define VIA_REG_CURSOR_BG 0x2DC
99 1.1 jmcneill #define VIA_REG_CURSOR_FG 0x2E0
100 1.1 jmcneill
101 1.1 jmcneill /* VIA_REG_GEMODE(0x04): GE mode */
102 1.1 jmcneill #define VIA_GEM_8bpp 0x00000000
103 1.1 jmcneill #define VIA_GEM_16bpp 0x00000100
104 1.1 jmcneill #define VIA_GEM_32bpp 0x00000300
105 1.1 jmcneill
106 1.1 jmcneill /* defines for VIA 3D registers */
107 1.1 jmcneill #define VIA_REG_STATUS 0x400
108 1.1 jmcneill #define VIA_REG_TRANSET 0x43C
109 1.1 jmcneill #define VIA_REG_TRANSPACE 0x440
110 1.1 jmcneill
111 1.1 jmcneill /* VIA_REG_STATUS(0x400): Engine Status */
112 1.1 jmcneill #define VIA_CMD_RGTR_BUSY 0x00000080 /* Command Regulator is busy */
113 1.1 jmcneill #define VIA_2D_ENG_BUSY 0x00000001 /* 2D Engine is busy */
114 1.1 jmcneill #define VIA_3D_ENG_BUSY 0x00000002 /* 3D Engine is busy */
115 1.1 jmcneill #define VIA_VR_QUEUE_BUSY 0x00020000 /* Virtual Queue is busy */
116 1.1 jmcneill
117 1.1 jmcneill #define MAXLOOP 0xFFFFFF
118 1.1 jmcneill
119 1.1 jmcneill #endif /* _DEV_PCI_UNICHROMEACCEL_H */
120