18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved. 48c2ecf20Sopenharmony_ci * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved. 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef __ACCEL_H__ 98c2ecf20Sopenharmony_ci#define __ACCEL_H__ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#define FB_ACCEL_VIA_UNICHROME 50 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* MMIO Base Address Definition */ 148c2ecf20Sopenharmony_ci#define MMIO_VGABASE 0x8000 158c2ecf20Sopenharmony_ci#define MMIO_CR_READ (MMIO_VGABASE + 0x3D4) 168c2ecf20Sopenharmony_ci#define MMIO_CR_WRITE (MMIO_VGABASE + 0x3D5) 178c2ecf20Sopenharmony_ci#define MMIO_SR_READ (MMIO_VGABASE + 0x3C4) 188c2ecf20Sopenharmony_ci#define MMIO_SR_WRITE (MMIO_VGABASE + 0x3C5) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci/* HW Cursor Status Define */ 218c2ecf20Sopenharmony_ci#define HW_Cursor_ON 0 228c2ecf20Sopenharmony_ci#define HW_Cursor_OFF 1 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define CURSOR_SIZE (8 * 1024) 258c2ecf20Sopenharmony_ci#define VQ_SIZE (256 * 1024) 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define VIA_MMIO_BLTBASE 0x200000 288c2ecf20Sopenharmony_ci#define VIA_MMIO_BLTSIZE 0x200000 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci/* Defines for 2D registers */ 318c2ecf20Sopenharmony_ci#define VIA_REG_GECMD 0x000 328c2ecf20Sopenharmony_ci#define VIA_REG_GEMODE 0x004 338c2ecf20Sopenharmony_ci#define VIA_REG_SRCPOS 0x008 348c2ecf20Sopenharmony_ci#define VIA_REG_DSTPOS 0x00C 358c2ecf20Sopenharmony_ci/* width and height */ 368c2ecf20Sopenharmony_ci#define VIA_REG_DIMENSION 0x010 378c2ecf20Sopenharmony_ci#define VIA_REG_PATADDR 0x014 388c2ecf20Sopenharmony_ci#define VIA_REG_FGCOLOR 0x018 398c2ecf20Sopenharmony_ci#define VIA_REG_BGCOLOR 0x01C 408c2ecf20Sopenharmony_ci/* top and left of clipping */ 418c2ecf20Sopenharmony_ci#define VIA_REG_CLIPTL 0x020 428c2ecf20Sopenharmony_ci/* bottom and right of clipping */ 438c2ecf20Sopenharmony_ci#define VIA_REG_CLIPBR 0x024 448c2ecf20Sopenharmony_ci#define VIA_REG_OFFSET 0x028 458c2ecf20Sopenharmony_ci/* color key control */ 468c2ecf20Sopenharmony_ci#define VIA_REG_KEYCONTROL 0x02C 478c2ecf20Sopenharmony_ci#define VIA_REG_SRCBASE 0x030 488c2ecf20Sopenharmony_ci#define VIA_REG_DSTBASE 0x034 498c2ecf20Sopenharmony_ci/* pitch of src and dst */ 508c2ecf20Sopenharmony_ci#define VIA_REG_PITCH 0x038 518c2ecf20Sopenharmony_ci#define VIA_REG_MONOPAT0 0x03C 528c2ecf20Sopenharmony_ci#define VIA_REG_MONOPAT1 0x040 538c2ecf20Sopenharmony_ci/* from 0x100 to 0x1ff */ 548c2ecf20Sopenharmony_ci#define VIA_REG_COLORPAT 0x100 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* defines for VIA 2D registers for vt3353/3409 (M1 engine)*/ 578c2ecf20Sopenharmony_ci#define VIA_REG_GECMD_M1 0x000 588c2ecf20Sopenharmony_ci#define VIA_REG_GEMODE_M1 0x004 598c2ecf20Sopenharmony_ci#define VIA_REG_GESTATUS_M1 0x004 /* as same as VIA_REG_GEMODE */ 608c2ecf20Sopenharmony_ci#define VIA_REG_PITCH_M1 0x008 /* pitch of src and dst */ 618c2ecf20Sopenharmony_ci#define VIA_REG_DIMENSION_M1 0x00C /* width and height */ 628c2ecf20Sopenharmony_ci#define VIA_REG_DSTPOS_M1 0x010 638c2ecf20Sopenharmony_ci#define VIA_REG_LINE_XY_M1 0x010 648c2ecf20Sopenharmony_ci#define VIA_REG_DSTBASE_M1 0x014 658c2ecf20Sopenharmony_ci#define VIA_REG_SRCPOS_M1 0x018 668c2ecf20Sopenharmony_ci#define VIA_REG_LINE_K1K2_M1 0x018 678c2ecf20Sopenharmony_ci#define VIA_REG_SRCBASE_M1 0x01C 688c2ecf20Sopenharmony_ci#define VIA_REG_PATADDR_M1 0x020 698c2ecf20Sopenharmony_ci#define VIA_REG_MONOPAT0_M1 0x024 708c2ecf20Sopenharmony_ci#define VIA_REG_MONOPAT1_M1 0x028 718c2ecf20Sopenharmony_ci#define VIA_REG_OFFSET_M1 0x02C 728c2ecf20Sopenharmony_ci#define VIA_REG_LINE_ERROR_M1 0x02C 738c2ecf20Sopenharmony_ci#define VIA_REG_CLIPTL_M1 0x040 /* top and left of clipping */ 748c2ecf20Sopenharmony_ci#define VIA_REG_CLIPBR_M1 0x044 /* bottom and right of clipping */ 758c2ecf20Sopenharmony_ci#define VIA_REG_KEYCONTROL_M1 0x048 /* color key control */ 768c2ecf20Sopenharmony_ci#define VIA_REG_FGCOLOR_M1 0x04C 778c2ecf20Sopenharmony_ci#define VIA_REG_DSTCOLORKEY_M1 0x04C /* as same as VIA_REG_FG */ 788c2ecf20Sopenharmony_ci#define VIA_REG_BGCOLOR_M1 0x050 798c2ecf20Sopenharmony_ci#define VIA_REG_SRCCOLORKEY_M1 0x050 /* as same as VIA_REG_BG */ 808c2ecf20Sopenharmony_ci#define VIA_REG_MONOPATFGC_M1 0x058 /* Add BG color of Pattern. */ 818c2ecf20Sopenharmony_ci#define VIA_REG_MONOPATBGC_M1 0x05C /* Add FG color of Pattern. */ 828c2ecf20Sopenharmony_ci#define VIA_REG_COLORPAT_M1 0x100 /* from 0x100 to 0x1ff */ 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci/* VIA_REG_PITCH(0x38): Pitch Setting */ 858c2ecf20Sopenharmony_ci#define VIA_PITCH_ENABLE 0x80000000 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci/* defines for VIA HW cursor registers */ 888c2ecf20Sopenharmony_ci#define VIA_REG_CURSOR_MODE 0x2D0 898c2ecf20Sopenharmony_ci#define VIA_REG_CURSOR_POS 0x2D4 908c2ecf20Sopenharmony_ci#define VIA_REG_CURSOR_ORG 0x2D8 918c2ecf20Sopenharmony_ci#define VIA_REG_CURSOR_BG 0x2DC 928c2ecf20Sopenharmony_ci#define VIA_REG_CURSOR_FG 0x2E0 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci/* VIA_REG_GEMODE(0x04): GE mode */ 958c2ecf20Sopenharmony_ci#define VIA_GEM_8bpp 0x00000000 968c2ecf20Sopenharmony_ci#define VIA_GEM_16bpp 0x00000100 978c2ecf20Sopenharmony_ci#define VIA_GEM_32bpp 0x00000300 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci/* VIA_REG_GECMD(0x00): 2D Engine Command */ 1008c2ecf20Sopenharmony_ci#define VIA_GEC_NOOP 0x00000000 1018c2ecf20Sopenharmony_ci#define VIA_GEC_BLT 0x00000001 1028c2ecf20Sopenharmony_ci#define VIA_GEC_LINE 0x00000005 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci/* Rotate Command */ 1058c2ecf20Sopenharmony_ci#define VIA_GEC_ROT 0x00000008 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define VIA_GEC_SRC_XY 0x00000000 1088c2ecf20Sopenharmony_ci#define VIA_GEC_SRC_LINEAR 0x00000010 1098c2ecf20Sopenharmony_ci#define VIA_GEC_DST_XY 0x00000000 1108c2ecf20Sopenharmony_ci#define VIA_GEC_DST_LINRAT 0x00000020 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci#define VIA_GEC_SRC_FB 0x00000000 1138c2ecf20Sopenharmony_ci#define VIA_GEC_SRC_SYS 0x00000040 1148c2ecf20Sopenharmony_ci#define VIA_GEC_DST_FB 0x00000000 1158c2ecf20Sopenharmony_ci#define VIA_GEC_DST_SYS 0x00000080 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci/* source is mono */ 1188c2ecf20Sopenharmony_ci#define VIA_GEC_SRC_MONO 0x00000100 1198c2ecf20Sopenharmony_ci/* pattern is mono */ 1208c2ecf20Sopenharmony_ci#define VIA_GEC_PAT_MONO 0x00000200 1218c2ecf20Sopenharmony_ci/* mono src is opaque */ 1228c2ecf20Sopenharmony_ci#define VIA_GEC_MSRC_OPAQUE 0x00000000 1238c2ecf20Sopenharmony_ci/* mono src is transparent */ 1248c2ecf20Sopenharmony_ci#define VIA_GEC_MSRC_TRANS 0x00000400 1258c2ecf20Sopenharmony_ci/* pattern is in frame buffer */ 1268c2ecf20Sopenharmony_ci#define VIA_GEC_PAT_FB 0x00000000 1278c2ecf20Sopenharmony_ci/* pattern is from reg setting */ 1288c2ecf20Sopenharmony_ci#define VIA_GEC_PAT_REG 0x00000800 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci#define VIA_GEC_CLIP_DISABLE 0x00000000 1318c2ecf20Sopenharmony_ci#define VIA_GEC_CLIP_ENABLE 0x00001000 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci#define VIA_GEC_FIXCOLOR_PAT 0x00002000 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci#define VIA_GEC_INCX 0x00000000 1368c2ecf20Sopenharmony_ci#define VIA_GEC_DECY 0x00004000 1378c2ecf20Sopenharmony_ci#define VIA_GEC_INCY 0x00000000 1388c2ecf20Sopenharmony_ci#define VIA_GEC_DECX 0x00008000 1398c2ecf20Sopenharmony_ci/* mono pattern is opaque */ 1408c2ecf20Sopenharmony_ci#define VIA_GEC_MPAT_OPAQUE 0x00000000 1418c2ecf20Sopenharmony_ci/* mono pattern is transparent */ 1428c2ecf20Sopenharmony_ci#define VIA_GEC_MPAT_TRANS 0x00010000 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci#define VIA_GEC_MONO_UNPACK 0x00000000 1458c2ecf20Sopenharmony_ci#define VIA_GEC_MONO_PACK 0x00020000 1468c2ecf20Sopenharmony_ci#define VIA_GEC_MONO_DWORD 0x00000000 1478c2ecf20Sopenharmony_ci#define VIA_GEC_MONO_WORD 0x00040000 1488c2ecf20Sopenharmony_ci#define VIA_GEC_MONO_BYTE 0x00080000 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#define VIA_GEC_LASTPIXEL_ON 0x00000000 1518c2ecf20Sopenharmony_ci#define VIA_GEC_LASTPIXEL_OFF 0x00100000 1528c2ecf20Sopenharmony_ci#define VIA_GEC_X_MAJOR 0x00000000 1538c2ecf20Sopenharmony_ci#define VIA_GEC_Y_MAJOR 0x00200000 1548c2ecf20Sopenharmony_ci#define VIA_GEC_QUICK_START 0x00800000 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci/* defines for VIA 3D registers */ 1578c2ecf20Sopenharmony_ci#define VIA_REG_STATUS 0x400 1588c2ecf20Sopenharmony_ci#define VIA_REG_CR_TRANSET 0x41C 1598c2ecf20Sopenharmony_ci#define VIA_REG_CR_TRANSPACE 0x420 1608c2ecf20Sopenharmony_ci#define VIA_REG_TRANSET 0x43C 1618c2ecf20Sopenharmony_ci#define VIA_REG_TRANSPACE 0x440 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci/* VIA_REG_STATUS(0x400): Engine Status */ 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci/* Command Regulator is busy */ 1668c2ecf20Sopenharmony_ci#define VIA_CMD_RGTR_BUSY 0x00000080 1678c2ecf20Sopenharmony_ci/* 2D Engine is busy */ 1688c2ecf20Sopenharmony_ci#define VIA_2D_ENG_BUSY 0x00000002 1698c2ecf20Sopenharmony_ci/* 3D Engine is busy */ 1708c2ecf20Sopenharmony_ci#define VIA_3D_ENG_BUSY 0x00000001 1718c2ecf20Sopenharmony_ci/* Virtual Queue is busy */ 1728c2ecf20Sopenharmony_ci#define VIA_VR_QUEUE_BUSY 0x00020000 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci/* VIA_REG_STATUS(0x400): Engine Status for H5 */ 1758c2ecf20Sopenharmony_ci#define VIA_CMD_RGTR_BUSY_H5 0x00000010 /* Command Regulator is busy */ 1768c2ecf20Sopenharmony_ci#define VIA_2D_ENG_BUSY_H5 0x00000002 /* 2D Engine is busy */ 1778c2ecf20Sopenharmony_ci#define VIA_3D_ENG_BUSY_H5 0x00001FE1 /* 3D Engine is busy */ 1788c2ecf20Sopenharmony_ci#define VIA_VR_QUEUE_BUSY_H5 0x00000004 /* Virtual Queue is busy */ 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci/* VIA_REG_STATUS(0x400): Engine Status for VT3353/3409 */ 1818c2ecf20Sopenharmony_ci#define VIA_CMD_RGTR_BUSY_M1 0x00000010 /* Command Regulator is busy */ 1828c2ecf20Sopenharmony_ci#define VIA_2D_ENG_BUSY_M1 0x00000002 /* 2D Engine is busy */ 1838c2ecf20Sopenharmony_ci#define VIA_3D_ENG_BUSY_M1 0x00001FE1 /* 3D Engine is busy */ 1848c2ecf20Sopenharmony_ci#define VIA_VR_QUEUE_BUSY_M1 0x00000004 /* Virtual Queue is busy */ 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci#define MAXLOOP 0xFFFFFF 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci#define VIA_BITBLT_COLOR 1 1898c2ecf20Sopenharmony_ci#define VIA_BITBLT_MONO 2 1908c2ecf20Sopenharmony_ci#define VIA_BITBLT_FILL 3 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ciint viafb_setup_engine(struct fb_info *info); 1938c2ecf20Sopenharmony_civoid viafb_reset_engine(struct viafb_par *viapar); 1948c2ecf20Sopenharmony_civoid viafb_show_hw_cursor(struct fb_info *info, int Status); 1958c2ecf20Sopenharmony_civoid viafb_wait_engine_idle(struct fb_info *info); 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci#endif /* __ACCEL_H__ */ 198