1428d7b3dSmrg#ifndef SNA_REG_H
2428d7b3dSmrg#define SNA_REG_H
3428d7b3dSmrg
4428d7b3dSmrg/* Flush */
5428d7b3dSmrg#define MI_FLUSH			(0x04<<23)
6428d7b3dSmrg#define MI_FLUSH_DW			(0x26<<23)
7428d7b3dSmrg
8428d7b3dSmrg#define MI_WRITE_DIRTY_STATE		(1<<4)
9428d7b3dSmrg#define MI_END_SCENE			(1<<3)
10428d7b3dSmrg#define MI_GLOBAL_SNAPSHOT_COUNT_RESET	(1<<3)
11428d7b3dSmrg#define MI_INHIBIT_RENDER_CACHE_FLUSH	(1<<2)
12428d7b3dSmrg#define MI_STATE_INSTRUCTION_CACHE_FLUSH (1<<1)
13428d7b3dSmrg#define MI_INVALIDATE_MAP_CACHE		(1<<0)
14428d7b3dSmrg/* broadwater flush bits */
15428d7b3dSmrg#define BRW_MI_GLOBAL_SNAPSHOT_RESET   (1 << 3)
16428d7b3dSmrg
17428d7b3dSmrg#define MI_BATCH_BUFFER_END	(0xA << 23)
18428d7b3dSmrg
19428d7b3dSmrg/* Noop */
20428d7b3dSmrg#define MI_NOOP				0x00
21428d7b3dSmrg#define MI_NOOP_WRITE_ID		(1<<22)
22428d7b3dSmrg#define MI_NOOP_ID_MASK			(1<<22 - 1)
23428d7b3dSmrg
24428d7b3dSmrg/* Wait for Events */
25428d7b3dSmrg#define MI_WAIT_FOR_EVENT			(0x03<<23)
26428d7b3dSmrg#define MI_WAIT_FOR_PIPEB_SVBLANK		(1<<18)
27428d7b3dSmrg#define MI_WAIT_FOR_PIPEA_SVBLANK		(1<<17)
28428d7b3dSmrg#define MI_WAIT_FOR_OVERLAY_FLIP		(1<<16)
29428d7b3dSmrg#define MI_WAIT_FOR_PIPEB_VBLANK		(1<<7)
30428d7b3dSmrg#define MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW	(1<<5)
31428d7b3dSmrg#define MI_WAIT_FOR_PIPEA_VBLANK		(1<<3)
32428d7b3dSmrg#define MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW	(1<<1)
33428d7b3dSmrg
34428d7b3dSmrg/* Set the scan line for MI_WAIT_FOR_PIPE?_SCAN_LINE_WINDOW */
35428d7b3dSmrg#define MI_LOAD_SCAN_LINES_INCL			(0x12<<23)
36428d7b3dSmrg#define MI_LOAD_SCAN_LINES_DISPLAY_PIPEA	(0)
37428d7b3dSmrg#define MI_LOAD_SCAN_LINES_DISPLAY_PIPEB	(0x1<<20)
38428d7b3dSmrg
39428d7b3dSmrg/* BLT commands */
40428d7b3dSmrg#define BLT_WRITE_ALPHA		(1<<21)
41428d7b3dSmrg#define BLT_WRITE_RGB		(1<<20)
42428d7b3dSmrg#define BLT_SRC_TILED		(1<<15)
43428d7b3dSmrg#define BLT_DST_TILED		(1<<11)
44428d7b3dSmrg
45428d7b3dSmrg#define COLOR_BLT_CMD			(2<<29|0x40<<22|(0x3))
46428d7b3dSmrg#define XY_COLOR_BLT			(2<<29|0x50<<22|(0x4))
47428d7b3dSmrg#define XY_SETUP_BLT			(2<<29|0x01<<22)
48428d7b3dSmrg#define XY_SETUP_MONO_PATTERN_SL_BLT	(2<<29|0x11<<22)
49428d7b3dSmrg#define XY_SETUP_CLIP			(2<<29|0x03<<22|1)
50428d7b3dSmrg#define XY_PIXEL_BLT			(2<<29|0x24<<22)
51428d7b3dSmrg#define XY_SCANLINE_BLT			(2<<29|0x25<<22|1)
52428d7b3dSmrg#define XY_TEXT_IMMEDIATE_BLT		(2<<29|0x31<<22|(1<<16))
53428d7b3dSmrg#define XY_SRC_COPY_BLT_CMD		(2<<29|0x53<<22)
54428d7b3dSmrg#define SRC_COPY_BLT_CMD		(2<<29|0x43<<22|0x4)
55428d7b3dSmrg#define XY_PAT_BLT			(2<<29|0x51<<22)
56428d7b3dSmrg#define XY_PAT_BLT_IMMEDIATE		(2<<29|0x72<<22)
57428d7b3dSmrg#define XY_MONO_PAT			(2<<29|0x52<<22)
58428d7b3dSmrg#define XY_MONO_SRC_COPY		(2<<29|0x54<<22)
59428d7b3dSmrg#define XY_MONO_SRC_COPY_IMM		(2<<29|0x71<<22)
60428d7b3dSmrg#define XY_FULL_MONO_PATTERN_BLT	(2<<29|0x57<<22)
61428d7b3dSmrg#define XY_FULL_MONO_PATTERN_MONO_SRC_BLT (2<<29|0x58<<22)
62428d7b3dSmrg
63428d7b3dSmrg/* FLUSH commands */
64428d7b3dSmrg#define BRW_3D(Pipeline,Opcode,Subopcode) \
65428d7b3dSmrg	((3 << 29) | \
66428d7b3dSmrg	 ((Pipeline) << 27) | \
67428d7b3dSmrg	 ((Opcode) << 24) | \
68428d7b3dSmrg	 ((Subopcode) << 16))
69428d7b3dSmrg#define PIPE_CONTROL		BRW_3D(3, 2, 0)
70428d7b3dSmrg#define PIPE_CONTROL_NOWRITE       (0 << 14)
71428d7b3dSmrg#define PIPE_CONTROL_WRITE_QWORD   (1 << 14)
72428d7b3dSmrg#define PIPE_CONTROL_WRITE_DEPTH   (2 << 14)
73428d7b3dSmrg#define PIPE_CONTROL_WRITE_TIME    (3 << 14)
74428d7b3dSmrg#define PIPE_CONTROL_DEPTH_STALL   (1 << 13)
75428d7b3dSmrg#define PIPE_CONTROL_WC_FLUSH      (1 << 12)
76428d7b3dSmrg#define PIPE_CONTROL_IS_FLUSH      (1 << 11)
77428d7b3dSmrg#define PIPE_CONTROL_TC_FLUSH      (1 << 10)
78428d7b3dSmrg#define PIPE_CONTROL_NOTIFY_ENABLE (1 << 8)
79428d7b3dSmrg#define PIPE_CONTROL_GLOBAL_GTT    (1 << 2)
80428d7b3dSmrg#define PIPE_CONTROL_LOCAL_PGTT    (0 << 2)
81428d7b3dSmrg#define PIPE_CONTROL_DEPTH_CACHE_FLUSH	(1 << 0)
82428d7b3dSmrg
83428d7b3dSmrg#endif
84