162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Permedia2 framebuffer driver definitions.
362306a36Sopenharmony_ci * Copyright (c) 1998-2000 Ilario Nardinocchi (nardinoc@CS.UniBO.IT)
462306a36Sopenharmony_ci * --------------------------------------------------------------------------
562306a36Sopenharmony_ci * $Id: pm2fb.h,v 1.26 2000/09/19 00:11:53 illo Exp $
662306a36Sopenharmony_ci * --------------------------------------------------------------------------
762306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
862306a36Sopenharmony_ci * License.  See the file COPYING in the main directory of this archive
962306a36Sopenharmony_ci * for more details.
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#ifndef PM2FB_H
1362306a36Sopenharmony_ci#define PM2FB_H
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#define PM2_REFERENCE_CLOCK	14318			/* in KHz */
1662306a36Sopenharmony_ci#define PM2_MAX_PIXCLOCK	230000			/* in KHz */
1762306a36Sopenharmony_ci#define PM2_REGS_SIZE		0x10000
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define PM2TAG(r) (u32 )(((r)-0x8000)>>3)
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/*****************************************************************************
2262306a36Sopenharmony_ci * Permedia2 registers used in the framebuffer
2362306a36Sopenharmony_ci *****************************************************************************/
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define PM2R_RESET_STATUS				0x0000
2662306a36Sopenharmony_ci#define PM2R_IN_FIFO_SPACE				0x0018
2762306a36Sopenharmony_ci#define PM2R_OUT_FIFO_WORDS				0x0020
2862306a36Sopenharmony_ci#define PM2R_APERTURE_ONE				0x0050
2962306a36Sopenharmony_ci#define PM2R_APERTURE_TWO				0x0058
3062306a36Sopenharmony_ci#define PM2R_FIFO_DISCON				0x0068
3162306a36Sopenharmony_ci#define PM2R_CHIP_CONFIG				0x0070
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define PM2R_REBOOT					0x1000
3462306a36Sopenharmony_ci#define PM2R_MEM_CONTROL				0x1040
3562306a36Sopenharmony_ci#define PM2R_BOOT_ADDRESS				0x1080
3662306a36Sopenharmony_ci#define PM2R_MEM_CONFIG					0x10c0
3762306a36Sopenharmony_ci#define PM2R_BYPASS_WRITE_MASK				0x1100
3862306a36Sopenharmony_ci#define PM2R_FRAMEBUFFER_WRITE_MASK			0x1140
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define PM2R_OUT_FIFO					0x2000
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#define PM2R_SCREEN_BASE				0x3000
4362306a36Sopenharmony_ci#define PM2R_SCREEN_STRIDE				0x3008
4462306a36Sopenharmony_ci#define PM2R_H_TOTAL					0x3010
4562306a36Sopenharmony_ci#define PM2R_HG_END					0x3018
4662306a36Sopenharmony_ci#define PM2R_HB_END					0x3020
4762306a36Sopenharmony_ci#define PM2R_HS_START					0x3028
4862306a36Sopenharmony_ci#define PM2R_HS_END					0x3030
4962306a36Sopenharmony_ci#define PM2R_V_TOTAL					0x3038
5062306a36Sopenharmony_ci#define PM2R_VB_END					0x3040
5162306a36Sopenharmony_ci#define PM2R_VS_START					0x3048
5262306a36Sopenharmony_ci#define PM2R_VS_END					0x3050
5362306a36Sopenharmony_ci#define PM2R_VIDEO_CONTROL				0x3058
5462306a36Sopenharmony_ci#define PM2R_LINE_COUNT					0x3070
5562306a36Sopenharmony_ci#define PM2R_FIFO_CONTROL				0x3078
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#define PM2R_RD_PALETTE_WRITE_ADDRESS			0x4000
5862306a36Sopenharmony_ci#define PM2R_RD_PALETTE_DATA				0x4008
5962306a36Sopenharmony_ci#define PM2R_RD_PIXEL_MASK				0x4010
6062306a36Sopenharmony_ci#define PM2R_RD_PALETTE_READ_ADDRESS			0x4018
6162306a36Sopenharmony_ci#define PM2R_RD_CURSOR_COLOR_ADDRESS		        0x4020
6262306a36Sopenharmony_ci#define PM2R_RD_CURSOR_COLOR_DATA		        0x4028
6362306a36Sopenharmony_ci#define PM2R_RD_INDEXED_DATA				0x4050
6462306a36Sopenharmony_ci#define PM2R_RD_CURSOR_DATA				0x4058
6562306a36Sopenharmony_ci#define PM2R_RD_CURSOR_X_LSB				0x4060
6662306a36Sopenharmony_ci#define PM2R_RD_CURSOR_X_MSB				0x4068
6762306a36Sopenharmony_ci#define PM2R_RD_CURSOR_Y_LSB				0x4070
6862306a36Sopenharmony_ci#define PM2R_RD_CURSOR_Y_MSB				0x4078
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#define PM2R_START_X_DOM				0x8000
7162306a36Sopenharmony_ci#define PM2R_D_X_DOM					0x8008
7262306a36Sopenharmony_ci#define PM2R_START_X_SUB				0x8010
7362306a36Sopenharmony_ci#define PM2R_D_X_SUB					0x8018
7462306a36Sopenharmony_ci#define PM2R_START_Y					0x8020
7562306a36Sopenharmony_ci#define PM2R_D_Y					0x8028
7662306a36Sopenharmony_ci#define PM2R_COUNT					0x8030
7762306a36Sopenharmony_ci#define PM2R_RENDER					0x8038
7862306a36Sopenharmony_ci#define PM2R_BIT_MASK_PATTERN				0x8068
7962306a36Sopenharmony_ci#define PM2R_RASTERIZER_MODE				0x80a0
8062306a36Sopenharmony_ci#define PM2R_RECTANGLE_ORIGIN				0x80d0
8162306a36Sopenharmony_ci#define PM2R_RECTANGLE_SIZE				0x80d8
8262306a36Sopenharmony_ci#define PM2R_PACKED_DATA_LIMITS				0x8150
8362306a36Sopenharmony_ci#define PM2R_SCISSOR_MODE				0x8180
8462306a36Sopenharmony_ci#define PM2R_SCISSOR_MIN_XY				0x8188
8562306a36Sopenharmony_ci#define PM2R_SCISSOR_MAX_XY				0x8190
8662306a36Sopenharmony_ci#define PM2R_SCREEN_SIZE				0x8198
8762306a36Sopenharmony_ci#define PM2R_AREA_STIPPLE_MODE				0x81a0
8862306a36Sopenharmony_ci#define PM2R_WINDOW_ORIGIN				0x81c8
8962306a36Sopenharmony_ci#define PM2R_TEXTURE_ADDRESS_MODE			0x8380
9062306a36Sopenharmony_ci#define PM2R_TEXTURE_MAP_FORMAT				0x8588
9162306a36Sopenharmony_ci#define PM2R_TEXTURE_DATA_FORMAT			0x8590
9262306a36Sopenharmony_ci#define PM2R_TEXTURE_READ_MODE				0x8670
9362306a36Sopenharmony_ci#define PM2R_TEXEL_LUT_MODE				0x8678
9462306a36Sopenharmony_ci#define PM2R_TEXTURE_COLOR_MODE				0x8680
9562306a36Sopenharmony_ci#define PM2R_FOG_MODE					0x8690
9662306a36Sopenharmony_ci#define PM2R_TEXEL0					0x8760
9762306a36Sopenharmony_ci#define PM2R_COLOR_DDA_MODE				0x87e0
9862306a36Sopenharmony_ci#define PM2R_CONSTANT_COLOR				0x87e8
9962306a36Sopenharmony_ci#define PM2R_ALPHA_BLEND_MODE				0x8810
10062306a36Sopenharmony_ci#define PM2R_DITHER_MODE				0x8818
10162306a36Sopenharmony_ci#define PM2R_FB_SOFT_WRITE_MASK				0x8820
10262306a36Sopenharmony_ci#define PM2R_LOGICAL_OP_MODE				0x8828
10362306a36Sopenharmony_ci#define PM2R_LB_READ_MODE				0x8880
10462306a36Sopenharmony_ci#define PM2R_LB_READ_FORMAT				0x8888
10562306a36Sopenharmony_ci#define PM2R_LB_SOURCE_OFFSET				0x8890
10662306a36Sopenharmony_ci#define PM2R_LB_WINDOW_BASE				0x88b8
10762306a36Sopenharmony_ci#define PM2R_LB_WRITE_FORMAT				0x88c8
10862306a36Sopenharmony_ci#define PM2R_STENCIL_MODE				0x8988
10962306a36Sopenharmony_ci#define PM2R_DEPTH_MODE					0x89a0
11062306a36Sopenharmony_ci#define PM2R_FB_READ_MODE				0x8a80
11162306a36Sopenharmony_ci#define PM2R_FB_SOURCE_OFFSET				0x8a88
11262306a36Sopenharmony_ci#define PM2R_FB_PIXEL_OFFSET				0x8a90
11362306a36Sopenharmony_ci#define PM2R_FB_WINDOW_BASE				0x8ab0
11462306a36Sopenharmony_ci#define PM2R_FB_WRITE_MODE				0x8ab8
11562306a36Sopenharmony_ci#define PM2R_FB_HARD_WRITE_MASK				0x8ac0
11662306a36Sopenharmony_ci#define PM2R_FB_BLOCK_COLOR				0x8ac8
11762306a36Sopenharmony_ci#define PM2R_FB_READ_PIXEL				0x8ad0
11862306a36Sopenharmony_ci#define PM2R_FILTER_MODE				0x8c00
11962306a36Sopenharmony_ci#define PM2R_SYNC					0x8c40
12062306a36Sopenharmony_ci#define PM2R_YUV_MODE					0x8f00
12162306a36Sopenharmony_ci#define PM2R_STATISTICS_MODE				0x8c08
12262306a36Sopenharmony_ci#define PM2R_FB_SOURCE_DELTA				0x8d88
12362306a36Sopenharmony_ci#define PM2R_CONFIG					0x8d90
12462306a36Sopenharmony_ci#define PM2R_DELTA_MODE					0x9300
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci/* Permedia2v */
12762306a36Sopenharmony_ci#define PM2VR_RD_INDEX_LOW				0x4020
12862306a36Sopenharmony_ci#define PM2VR_RD_INDEX_HIGH				0x4028
12962306a36Sopenharmony_ci#define PM2VR_RD_INDEXED_DATA				0x4030
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci/* Permedia2 RAMDAC indexed registers */
13262306a36Sopenharmony_ci#define PM2I_RD_CURSOR_CONTROL				0x06
13362306a36Sopenharmony_ci#define PM2I_RD_COLOR_MODE				0x18
13462306a36Sopenharmony_ci#define PM2I_RD_MODE_CONTROL				0x19
13562306a36Sopenharmony_ci#define PM2I_RD_MISC_CONTROL				0x1e
13662306a36Sopenharmony_ci#define PM2I_RD_PIXEL_CLOCK_A1				0x20
13762306a36Sopenharmony_ci#define PM2I_RD_PIXEL_CLOCK_A2				0x21
13862306a36Sopenharmony_ci#define PM2I_RD_PIXEL_CLOCK_A3				0x22
13962306a36Sopenharmony_ci#define PM2I_RD_PIXEL_CLOCK_STATUS			0x29
14062306a36Sopenharmony_ci#define PM2I_RD_MEMORY_CLOCK_1				0x30
14162306a36Sopenharmony_ci#define PM2I_RD_MEMORY_CLOCK_2				0x31
14262306a36Sopenharmony_ci#define PM2I_RD_MEMORY_CLOCK_3				0x32
14362306a36Sopenharmony_ci#define PM2I_RD_MEMORY_CLOCK_STATUS			0x33
14462306a36Sopenharmony_ci#define PM2I_RD_COLOR_KEY_CONTROL			0x40
14562306a36Sopenharmony_ci#define PM2I_RD_OVERLAY_KEY				0x41
14662306a36Sopenharmony_ci#define PM2I_RD_RED_KEY					0x42
14762306a36Sopenharmony_ci#define PM2I_RD_GREEN_KEY				0x43
14862306a36Sopenharmony_ci#define PM2I_RD_BLUE_KEY				0x44
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci/* Permedia2v extensions */
15162306a36Sopenharmony_ci#define PM2VI_RD_MISC_CONTROL				0x000
15262306a36Sopenharmony_ci#define PM2VI_RD_SYNC_CONTROL				0x001
15362306a36Sopenharmony_ci#define PM2VI_RD_DAC_CONTROL				0x002
15462306a36Sopenharmony_ci#define PM2VI_RD_PIXEL_SIZE				0x003
15562306a36Sopenharmony_ci#define PM2VI_RD_COLOR_FORMAT				0x004
15662306a36Sopenharmony_ci#define PM2VI_RD_CURSOR_MODE				0x005
15762306a36Sopenharmony_ci#define PM2VI_RD_CURSOR_X_LOW				0x007
15862306a36Sopenharmony_ci#define PM2VI_RD_CURSOR_X_HIGH				0x008
15962306a36Sopenharmony_ci#define PM2VI_RD_CURSOR_Y_LOW				0x009
16062306a36Sopenharmony_ci#define PM2VI_RD_CURSOR_Y_HIGH				0x00A
16162306a36Sopenharmony_ci#define PM2VI_RD_CURSOR_X_HOT				0x00B
16262306a36Sopenharmony_ci#define PM2VI_RD_CURSOR_Y_HOT				0x00C
16362306a36Sopenharmony_ci#define PM2VI_RD_OVERLAY_KEY				0x00D
16462306a36Sopenharmony_ci#define PM2VI_RD_CLK0_PRESCALE				0x201
16562306a36Sopenharmony_ci#define PM2VI_RD_CLK0_FEEDBACK				0x202
16662306a36Sopenharmony_ci#define PM2VI_RD_CLK0_POSTSCALE				0x203
16762306a36Sopenharmony_ci#define PM2VI_RD_CLK1_PRESCALE				0x204
16862306a36Sopenharmony_ci#define PM2VI_RD_CLK1_FEEDBACK				0x205
16962306a36Sopenharmony_ci#define PM2VI_RD_CLK1_POSTSCALE				0x206
17062306a36Sopenharmony_ci#define PM2VI_RD_MCLK_CONTROL				0x20D
17162306a36Sopenharmony_ci#define PM2VI_RD_MCLK_PRESCALE				0x20E
17262306a36Sopenharmony_ci#define PM2VI_RD_MCLK_FEEDBACK				0x20F
17362306a36Sopenharmony_ci#define PM2VI_RD_MCLK_POSTSCALE				0x210
17462306a36Sopenharmony_ci#define PM2VI_RD_CURSOR_PALETTE				0x303
17562306a36Sopenharmony_ci#define PM2VI_RD_CURSOR_PATTERN				0x400
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci/* Fields and flags */
17862306a36Sopenharmony_ci#define PM2F_RENDER_AREASTIPPLE				(1L<<0)
17962306a36Sopenharmony_ci#define PM2F_RENDER_FASTFILL				(1L<<3)
18062306a36Sopenharmony_ci#define PM2F_RENDER_PRIMITIVE_MASK			(3L<<6)
18162306a36Sopenharmony_ci#define PM2F_RENDER_LINE				0
18262306a36Sopenharmony_ci#define PM2F_RENDER_TRAPEZOID				(1L<<6)
18362306a36Sopenharmony_ci#define PM2F_RENDER_POINT				(2L<<6)
18462306a36Sopenharmony_ci#define PM2F_RENDER_RECTANGLE				(3L<<6)
18562306a36Sopenharmony_ci#define PM2F_RENDER_SYNC_ON_BIT_MASK			(1L<<11)
18662306a36Sopenharmony_ci#define PM2F_RENDER_TEXTURE_ENABLE			(1L<<13)
18762306a36Sopenharmony_ci#define PM2F_SYNCHRONIZATION				(1L<<10)
18862306a36Sopenharmony_ci#define PM2F_PLL_LOCKED					0x10
18962306a36Sopenharmony_ci#define PM2F_BEING_RESET				(1L<<31)
19062306a36Sopenharmony_ci#define PM2F_DATATYPE_COLOR				0x8000
19162306a36Sopenharmony_ci#define PM2F_VGA_ENABLE					0x02
19262306a36Sopenharmony_ci#define PM2F_VGA_FIXED					0x04
19362306a36Sopenharmony_ci#define PM2F_FB_WRITE_ENABLE				0x01
19462306a36Sopenharmony_ci#define PM2F_FB_READ_SOURCE_ENABLE			0x0200
19562306a36Sopenharmony_ci#define PM2F_RD_PALETTE_WIDTH_8				0x02
19662306a36Sopenharmony_ci#define PM2F_PART_PROD_MASK				0x01ff
19762306a36Sopenharmony_ci#define PM2F_SCREEN_SCISSOR_ENABLE			0x02
19862306a36Sopenharmony_ci#define PM2F_DATA_64_ENABLE				0x00010000
19962306a36Sopenharmony_ci#define PM2F_BLANK_LOW					0x02
20062306a36Sopenharmony_ci#define PM2F_HSYNC_MASK					0x18
20162306a36Sopenharmony_ci#define PM2F_VSYNC_MASK					0x60
20262306a36Sopenharmony_ci#define PM2F_HSYNC_ACT_HIGH				0x08
20362306a36Sopenharmony_ci#define PM2F_HSYNC_FORCED_LOW				0x10
20462306a36Sopenharmony_ci#define PM2F_HSYNC_ACT_LOW				0x18
20562306a36Sopenharmony_ci#define PM2F_VSYNC_ACT_HIGH				0x20
20662306a36Sopenharmony_ci#define PM2F_VSYNC_FORCED_LOW				0x40
20762306a36Sopenharmony_ci#define PM2F_VSYNC_ACT_LOW				0x60
20862306a36Sopenharmony_ci#define PM2F_LINE_DOUBLE				0x04
20962306a36Sopenharmony_ci#define PM2F_VIDEO_ENABLE				0x01
21062306a36Sopenharmony_ci#define PM2F_RD_PIXELFORMAT_SVGA			0x01
21162306a36Sopenharmony_ci#define PM2F_RD_PIXELFORMAT_RGB232OFFSET		0x02
21262306a36Sopenharmony_ci#define PM2F_RD_PIXELFORMAT_RGBA2321			0x03
21362306a36Sopenharmony_ci#define PM2F_RD_PIXELFORMAT_RGBA5551			0x04
21462306a36Sopenharmony_ci#define PM2F_RD_PIXELFORMAT_RGBA4444			0x05
21562306a36Sopenharmony_ci#define PM2F_RD_PIXELFORMAT_RGB565			0x06
21662306a36Sopenharmony_ci#define PM2F_RD_PIXELFORMAT_RGBA8888			0x08
21762306a36Sopenharmony_ci#define PM2F_RD_PIXELFORMAT_RGB888			0x09
21862306a36Sopenharmony_ci#define PM2F_RD_GUI_ACTIVE				0x10
21962306a36Sopenharmony_ci#define PM2F_RD_COLOR_MODE_RGB				0x20
22062306a36Sopenharmony_ci#define PM2F_DELTA_ORDER_RGB				(1L<<18)
22162306a36Sopenharmony_ci#define PM2F_RD_TRUECOLOR				0x80
22262306a36Sopenharmony_ci#define PM2F_NO_ALPHA_BUFFER				0x10
22362306a36Sopenharmony_ci#define PM2F_TEXTEL_SIZE_16				0x00080000
22462306a36Sopenharmony_ci#define PM2F_TEXTEL_SIZE_32				0x00100000
22562306a36Sopenharmony_ci#define PM2F_TEXTEL_SIZE_4				0x00180000
22662306a36Sopenharmony_ci#define PM2F_TEXTEL_SIZE_24				0x00200000
22762306a36Sopenharmony_ci#define PM2F_INCREASE_X					(1L<<21)
22862306a36Sopenharmony_ci#define PM2F_INCREASE_Y					(1L<<22)
22962306a36Sopenharmony_ci#define PM2F_CONFIG_FB_WRITE_ENABLE			(1L<<3)
23062306a36Sopenharmony_ci#define PM2F_CONFIG_FB_PACKED_DATA			(1L<<2)
23162306a36Sopenharmony_ci#define PM2F_CONFIG_FB_READ_DEST_ENABLE			(1L<<1)
23262306a36Sopenharmony_ci#define PM2F_CONFIG_FB_READ_SOURCE_ENABLE		(1L<<0)
23362306a36Sopenharmony_ci#define PM2F_COLOR_KEY_TEST_OFF				(1L<<4)
23462306a36Sopenharmony_ci#define PM2F_MEM_CONFIG_RAM_MASK			(3L<<29)
23562306a36Sopenharmony_ci#define PM2F_MEM_BANKS_1				0L
23662306a36Sopenharmony_ci#define PM2F_MEM_BANKS_2				(1L<<29)
23762306a36Sopenharmony_ci#define PM2F_MEM_BANKS_3				(2L<<29)
23862306a36Sopenharmony_ci#define PM2F_MEM_BANKS_4				(3L<<29)
23962306a36Sopenharmony_ci#define PM2F_APERTURE_STANDARD				0
24062306a36Sopenharmony_ci#define PM2F_APERTURE_BYTESWAP				1
24162306a36Sopenharmony_ci#define PM2F_APERTURE_HALFWORDSWAP			2
24262306a36Sopenharmony_ci#define PM2F_CURSORMODE_CURSOR_ENABLE			(1 << 0)
24362306a36Sopenharmony_ci#define PM2F_CURSORMODE_TYPE_X				(1 << 4)
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_citypedef enum {
24662306a36Sopenharmony_ci	PM2_TYPE_PERMEDIA2,
24762306a36Sopenharmony_ci	PM2_TYPE_PERMEDIA2V
24862306a36Sopenharmony_ci} pm2type_t;
24962306a36Sopenharmony_ci
25062306a36Sopenharmony_ci#endif /* PM2FB_H */
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ci/*****************************************************************************
25362306a36Sopenharmony_ci * That's all folks!
25462306a36Sopenharmony_ci *****************************************************************************/
255