1c0e09200SDave Airlie /* radeon_drv.h -- Private header for radeon driver -*- linux-c -*- 2c0e09200SDave Airlie * 3c0e09200SDave Airlie * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 4c0e09200SDave Airlie * Copyright 2000 VA Linux Systems, Inc., Fremont, California. 5c0e09200SDave Airlie * All rights reserved. 6c0e09200SDave Airlie * 7c0e09200SDave Airlie * Permission is hereby granted, free of charge, to any person obtaining a 8c0e09200SDave Airlie * copy of this software and associated documentation files (the "Software"), 9c0e09200SDave Airlie * to deal in the Software without restriction, including without limitation 10c0e09200SDave Airlie * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11c0e09200SDave Airlie * and/or sell copies of the Software, and to permit persons to whom the 12c0e09200SDave Airlie * Software is furnished to do so, subject to the following conditions: 13c0e09200SDave Airlie * 14c0e09200SDave Airlie * The above copyright notice and this permission notice (including the next 15c0e09200SDave Airlie * paragraph) shall be included in all copies or substantial portions of the 16c0e09200SDave Airlie * Software. 17c0e09200SDave Airlie * 18c0e09200SDave Airlie * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19c0e09200SDave Airlie * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20c0e09200SDave Airlie * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21c0e09200SDave Airlie * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 22c0e09200SDave Airlie * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 23c0e09200SDave Airlie * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24c0e09200SDave Airlie * DEALINGS IN THE SOFTWARE. 25c0e09200SDave Airlie * 26c0e09200SDave Airlie * Authors: 27c0e09200SDave Airlie * Kevin E. Martin <martin@valinux.com> 28c0e09200SDave Airlie * Gareth Hughes <gareth@valinux.com> 29c0e09200SDave Airlie */ 30c0e09200SDave Airlie 31c0e09200SDave Airlie #ifndef __RADEON_DRV_H__ 32c0e09200SDave Airlie #define __RADEON_DRV_H__ 33c0e09200SDave Airlie 34c0e09200SDave Airlie /* General customization: 35c0e09200SDave Airlie */ 36c0e09200SDave Airlie 37c0e09200SDave Airlie #define DRIVER_AUTHOR "Gareth Hughes, Keith Whitwell, others." 38c0e09200SDave Airlie 39c0e09200SDave Airlie #define DRIVER_NAME "radeon" 40c0e09200SDave Airlie #define DRIVER_DESC "ATI Radeon" 41c0e09200SDave Airlie #define DRIVER_DATE "20080528" 42c0e09200SDave Airlie 43c0e09200SDave Airlie /* Interface history: 44c0e09200SDave Airlie * 45c0e09200SDave Airlie * 1.1 - ?? 46c0e09200SDave Airlie * 1.2 - Add vertex2 ioctl (keith) 47c0e09200SDave Airlie * - Add stencil capability to clear ioctl (gareth, keith) 48c0e09200SDave Airlie * - Increase MAX_TEXTURE_LEVELS (brian) 49c0e09200SDave Airlie * 1.3 - Add cmdbuf ioctl (keith) 50c0e09200SDave Airlie * - Add support for new radeon packets (keith) 51c0e09200SDave Airlie * - Add getparam ioctl (keith) 52c0e09200SDave Airlie * - Add flip-buffers ioctl, deprecate fullscreen foo (keith). 53c0e09200SDave Airlie * 1.4 - Add scratch registers to get_param ioctl. 54c0e09200SDave Airlie * 1.5 - Add r200 packets to cmdbuf ioctl 55c0e09200SDave Airlie * - Add r200 function to init ioctl 56c0e09200SDave Airlie * - Add 'scalar2' instruction to cmdbuf 57c0e09200SDave Airlie * 1.6 - Add static GART memory manager 58c0e09200SDave Airlie * Add irq handler (won't be turned on unless X server knows to) 59c0e09200SDave Airlie * Add irq ioctls and irq_active getparam. 60c0e09200SDave Airlie * Add wait command for cmdbuf ioctl 61c0e09200SDave Airlie * Add GART offset query for getparam 62c0e09200SDave Airlie * 1.7 - Add support for cube map registers: R200_PP_CUBIC_FACES_[0..5] 63c0e09200SDave Airlie * and R200_PP_CUBIC_OFFSET_F1_[0..5]. 64c0e09200SDave Airlie * Added packets R200_EMIT_PP_CUBIC_FACES_[0..5] and 65c0e09200SDave Airlie * R200_EMIT_PP_CUBIC_OFFSETS_[0..5]. (brian) 66c0e09200SDave Airlie * 1.8 - Remove need to call cleanup ioctls on last client exit (keith) 67c0e09200SDave Airlie * Add 'GET' queries for starting additional clients on different VT's. 68c0e09200SDave Airlie * 1.9 - Add DRM_IOCTL_RADEON_CP_RESUME ioctl. 69c0e09200SDave Airlie * Add texture rectangle support for r100. 70c0e09200SDave Airlie * 1.10- Add SETPARAM ioctl; first parameter to set is FB_LOCATION, which 71c0e09200SDave Airlie * clients use to tell the DRM where they think the framebuffer is 72c0e09200SDave Airlie * located in the card's address space 73c0e09200SDave Airlie * 1.11- Add packet R200_EMIT_RB3D_BLENDCOLOR to support GL_EXT_blend_color 74c0e09200SDave Airlie * and GL_EXT_blend_[func|equation]_separate on r200 75c0e09200SDave Airlie * 1.12- Add R300 CP microcode support - this just loads the CP on r300 76c0e09200SDave Airlie * (No 3D support yet - just microcode loading). 77c0e09200SDave Airlie * 1.13- Add packet R200_EMIT_TCL_POINT_SPRITE_CNTL for ARB_point_parameters 78c0e09200SDave Airlie * - Add hyperz support, add hyperz flags to clear ioctl. 79c0e09200SDave Airlie * 1.14- Add support for color tiling 80c0e09200SDave Airlie * - Add R100/R200 surface allocation/free support 81c0e09200SDave Airlie * 1.15- Add support for texture micro tiling 82c0e09200SDave Airlie * - Add support for r100 cube maps 83c0e09200SDave Airlie * 1.16- Add R200_EMIT_PP_TRI_PERF_CNTL packet to support brilinear 84c0e09200SDave Airlie * texture filtering on r200 85c0e09200SDave Airlie * 1.17- Add initial support for R300 (3D). 86c0e09200SDave Airlie * 1.18- Add support for GL_ATI_fragment_shader, new packets 87c0e09200SDave Airlie * R200_EMIT_PP_AFS_0/1, R200_EMIT_PP_TXCTLALL_0-5 (replaces 88c0e09200SDave Airlie * R200_EMIT_PP_TXFILTER_0-5, 2 more regs) and R200_EMIT_ATF_TFACTOR 89c0e09200SDave Airlie * (replaces R200_EMIT_TFACTOR_0 (8 consts instead of 6) 90c0e09200SDave Airlie * 1.19- Add support for gart table in FB memory and PCIE r300 91c0e09200SDave Airlie * 1.20- Add support for r300 texrect 92c0e09200SDave Airlie * 1.21- Add support for card type getparam 93c0e09200SDave Airlie * 1.22- Add support for texture cache flushes (R300_TX_CNTL) 94c0e09200SDave Airlie * 1.23- Add new radeon memory map work from benh 95c0e09200SDave Airlie * 1.24- Add general-purpose packet for manipulating scratch registers (r300) 96c0e09200SDave Airlie * 1.25- Add support for r200 vertex programs (R200_EMIT_VAP_PVS_CNTL, 97c0e09200SDave Airlie * new packet type) 98c0e09200SDave Airlie * 1.26- Add support for variable size PCI(E) gart aperture 99c0e09200SDave Airlie * 1.27- Add support for IGP GART 100c0e09200SDave Airlie * 1.28- Add support for VBL on CRTC2 101c0e09200SDave Airlie * 1.29- R500 3D cmd buffer support 102c0e09200SDave Airlie */ 103c0e09200SDave Airlie #define DRIVER_MAJOR 1 104c0e09200SDave Airlie #define DRIVER_MINOR 29 105c0e09200SDave Airlie #define DRIVER_PATCHLEVEL 0 106c0e09200SDave Airlie 107c0e09200SDave Airlie /* 108c0e09200SDave Airlie * Radeon chip families 109c0e09200SDave Airlie */ 110c0e09200SDave Airlie enum radeon_family { 111c0e09200SDave Airlie CHIP_R100, 112c0e09200SDave Airlie CHIP_RV100, 113c0e09200SDave Airlie CHIP_RS100, 114c0e09200SDave Airlie CHIP_RV200, 115c0e09200SDave Airlie CHIP_RS200, 116c0e09200SDave Airlie CHIP_R200, 117c0e09200SDave Airlie CHIP_RV250, 118c0e09200SDave Airlie CHIP_RS300, 119c0e09200SDave Airlie CHIP_RV280, 120c0e09200SDave Airlie CHIP_R300, 121c0e09200SDave Airlie CHIP_R350, 122c0e09200SDave Airlie CHIP_RV350, 123c0e09200SDave Airlie CHIP_RV380, 124c0e09200SDave Airlie CHIP_R420, 125edc6f389SAlex Deucher CHIP_R423, 126c0e09200SDave Airlie CHIP_RV410, 127b2ceddfaSAlex Deucher CHIP_RS400, 128c0e09200SDave Airlie CHIP_RS480, 129c0e09200SDave Airlie CHIP_RS690, 130f0738e92SAlex Deucher CHIP_RS740, 131c0e09200SDave Airlie CHIP_RV515, 132c0e09200SDave Airlie CHIP_R520, 133c0e09200SDave Airlie CHIP_RV530, 134c0e09200SDave Airlie CHIP_RV560, 135c0e09200SDave Airlie CHIP_RV570, 136c0e09200SDave Airlie CHIP_R580, 137*befb73c2SAlex Deucher CHIP_R600, 138*befb73c2SAlex Deucher CHIP_RV610, 139*befb73c2SAlex Deucher CHIP_RV630, 140*befb73c2SAlex Deucher CHIP_RV620, 141*befb73c2SAlex Deucher CHIP_RV635, 142*befb73c2SAlex Deucher CHIP_RV670, 143*befb73c2SAlex Deucher CHIP_RS780, 144*befb73c2SAlex Deucher CHIP_RV770, 145*befb73c2SAlex Deucher CHIP_RV730, 146*befb73c2SAlex Deucher CHIP_RV710, 147c0e09200SDave Airlie CHIP_LAST, 148c0e09200SDave Airlie }; 149c0e09200SDave Airlie 150c0e09200SDave Airlie enum radeon_cp_microcode_version { 151c0e09200SDave Airlie UCODE_R100, 152c0e09200SDave Airlie UCODE_R200, 153c0e09200SDave Airlie UCODE_R300, 154c0e09200SDave Airlie }; 155c0e09200SDave Airlie 156c0e09200SDave Airlie /* 157c0e09200SDave Airlie * Chip flags 158c0e09200SDave Airlie */ 159c0e09200SDave Airlie enum radeon_chip_flags { 160c0e09200SDave Airlie RADEON_FAMILY_MASK = 0x0000ffffUL, 161c0e09200SDave Airlie RADEON_FLAGS_MASK = 0xffff0000UL, 162c0e09200SDave Airlie RADEON_IS_MOBILITY = 0x00010000UL, 163c0e09200SDave Airlie RADEON_IS_IGP = 0x00020000UL, 164c0e09200SDave Airlie RADEON_SINGLE_CRTC = 0x00040000UL, 165c0e09200SDave Airlie RADEON_IS_AGP = 0x00080000UL, 166c0e09200SDave Airlie RADEON_HAS_HIERZ = 0x00100000UL, 167c0e09200SDave Airlie RADEON_IS_PCIE = 0x00200000UL, 168c0e09200SDave Airlie RADEON_NEW_MEMMAP = 0x00400000UL, 169c0e09200SDave Airlie RADEON_IS_PCI = 0x00800000UL, 170c0e09200SDave Airlie RADEON_IS_IGPGART = 0x01000000UL, 171c0e09200SDave Airlie }; 172c0e09200SDave Airlie 173c0e09200SDave Airlie typedef struct drm_radeon_freelist { 174c0e09200SDave Airlie unsigned int age; 175c0e09200SDave Airlie struct drm_buf *buf; 176c0e09200SDave Airlie struct drm_radeon_freelist *next; 177c0e09200SDave Airlie struct drm_radeon_freelist *prev; 178c0e09200SDave Airlie } drm_radeon_freelist_t; 179c0e09200SDave Airlie 180c0e09200SDave Airlie typedef struct drm_radeon_ring_buffer { 181c0e09200SDave Airlie u32 *start; 182c0e09200SDave Airlie u32 *end; 183c0e09200SDave Airlie int size; 184c0e09200SDave Airlie int size_l2qw; 185c0e09200SDave Airlie 186c0e09200SDave Airlie int rptr_update; /* Double Words */ 187c0e09200SDave Airlie int rptr_update_l2qw; /* log2 Quad Words */ 188c0e09200SDave Airlie 189c0e09200SDave Airlie int fetch_size; /* Double Words */ 190c0e09200SDave Airlie int fetch_size_l2ow; /* log2 Oct Words */ 191c0e09200SDave Airlie 192c0e09200SDave Airlie u32 tail; 193c0e09200SDave Airlie u32 tail_mask; 194c0e09200SDave Airlie int space; 195c0e09200SDave Airlie 196c0e09200SDave Airlie int high_mark; 197c0e09200SDave Airlie } drm_radeon_ring_buffer_t; 198c0e09200SDave Airlie 199c0e09200SDave Airlie typedef struct drm_radeon_depth_clear_t { 200c0e09200SDave Airlie u32 rb3d_cntl; 201c0e09200SDave Airlie u32 rb3d_zstencilcntl; 202c0e09200SDave Airlie u32 se_cntl; 203c0e09200SDave Airlie } drm_radeon_depth_clear_t; 204c0e09200SDave Airlie 205c0e09200SDave Airlie struct drm_radeon_driver_file_fields { 206c0e09200SDave Airlie int64_t radeon_fb_delta; 207c0e09200SDave Airlie }; 208c0e09200SDave Airlie 209c0e09200SDave Airlie struct mem_block { 210c0e09200SDave Airlie struct mem_block *next; 211c0e09200SDave Airlie struct mem_block *prev; 212c0e09200SDave Airlie int start; 213c0e09200SDave Airlie int size; 214c0e09200SDave Airlie struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */ 215c0e09200SDave Airlie }; 216c0e09200SDave Airlie 217c0e09200SDave Airlie struct radeon_surface { 218c0e09200SDave Airlie int refcount; 219c0e09200SDave Airlie u32 lower; 220c0e09200SDave Airlie u32 upper; 221c0e09200SDave Airlie u32 flags; 222c0e09200SDave Airlie }; 223c0e09200SDave Airlie 224c0e09200SDave Airlie struct radeon_virt_surface { 225c0e09200SDave Airlie int surface_index; 226c0e09200SDave Airlie u32 lower; 227c0e09200SDave Airlie u32 upper; 228c0e09200SDave Airlie u32 flags; 229c0e09200SDave Airlie struct drm_file *file_priv; 2306abf6bb0SDavid Miller #define PCIGART_FILE_PRIV ((void *) -1L) 231c0e09200SDave Airlie }; 232c0e09200SDave Airlie 233b2665030SDavid Miller #define RADEON_FLUSH_EMITED (1 << 0) 234b2665030SDavid Miller #define RADEON_PURGE_EMITED (1 << 1) 23554f961a6SJerome Glisse 2367c1c2871SDave Airlie struct drm_radeon_master_private { 2377c1c2871SDave Airlie drm_local_map_t *sarea; 2387c1c2871SDave Airlie drm_radeon_sarea_t *sarea_priv; 2397c1c2871SDave Airlie }; 2407c1c2871SDave Airlie 241c0e09200SDave Airlie typedef struct drm_radeon_private { 242c0e09200SDave Airlie drm_radeon_ring_buffer_t ring; 243c0e09200SDave Airlie 244c0e09200SDave Airlie u32 fb_location; 245c0e09200SDave Airlie u32 fb_size; 246c0e09200SDave Airlie int new_memmap; 247c0e09200SDave Airlie 248c0e09200SDave Airlie int gart_size; 249c0e09200SDave Airlie u32 gart_vm_start; 250c0e09200SDave Airlie unsigned long gart_buffers_offset; 251c0e09200SDave Airlie 252c0e09200SDave Airlie int cp_mode; 253c0e09200SDave Airlie int cp_running; 254c0e09200SDave Airlie 255c0e09200SDave Airlie drm_radeon_freelist_t *head; 256c0e09200SDave Airlie drm_radeon_freelist_t *tail; 257c0e09200SDave Airlie int last_buf; 258c0e09200SDave Airlie int writeback_works; 259c0e09200SDave Airlie 260c0e09200SDave Airlie int usec_timeout; 261c0e09200SDave Airlie 262c0e09200SDave Airlie int microcode_version; 263c0e09200SDave Airlie 264c0e09200SDave Airlie struct { 265c0e09200SDave Airlie u32 boxes; 266c0e09200SDave Airlie int freelist_timeouts; 267c0e09200SDave Airlie int freelist_loops; 268c0e09200SDave Airlie int requested_bufs; 269c0e09200SDave Airlie int last_frame_reads; 270c0e09200SDave Airlie int last_clear_reads; 271c0e09200SDave Airlie int clears; 272c0e09200SDave Airlie int texture_uploads; 273c0e09200SDave Airlie } stats; 274c0e09200SDave Airlie 275c0e09200SDave Airlie int do_boxes; 276c0e09200SDave Airlie int page_flipping; 277c0e09200SDave Airlie 278c0e09200SDave Airlie u32 color_fmt; 279c0e09200SDave Airlie unsigned int front_offset; 280c0e09200SDave Airlie unsigned int front_pitch; 281c0e09200SDave Airlie unsigned int back_offset; 282c0e09200SDave Airlie unsigned int back_pitch; 283c0e09200SDave Airlie 284c0e09200SDave Airlie u32 depth_fmt; 285c0e09200SDave Airlie unsigned int depth_offset; 286c0e09200SDave Airlie unsigned int depth_pitch; 287c0e09200SDave Airlie 288c0e09200SDave Airlie u32 front_pitch_offset; 289c0e09200SDave Airlie u32 back_pitch_offset; 290c0e09200SDave Airlie u32 depth_pitch_offset; 291c0e09200SDave Airlie 292c0e09200SDave Airlie drm_radeon_depth_clear_t depth_clear; 293c0e09200SDave Airlie 294c0e09200SDave Airlie unsigned long ring_offset; 295c0e09200SDave Airlie unsigned long ring_rptr_offset; 296c0e09200SDave Airlie unsigned long buffers_offset; 297c0e09200SDave Airlie unsigned long gart_textures_offset; 298c0e09200SDave Airlie 299c0e09200SDave Airlie drm_local_map_t *sarea; 300c0e09200SDave Airlie drm_local_map_t *cp_ring; 301c0e09200SDave Airlie drm_local_map_t *ring_rptr; 302c0e09200SDave Airlie drm_local_map_t *gart_textures; 303c0e09200SDave Airlie 304c0e09200SDave Airlie struct mem_block *gart_heap; 305c0e09200SDave Airlie struct mem_block *fb_heap; 306c0e09200SDave Airlie 307c0e09200SDave Airlie /* SW interrupt */ 308c0e09200SDave Airlie wait_queue_head_t swi_queue; 309c0e09200SDave Airlie atomic_t swi_emitted; 310c0e09200SDave Airlie int vblank_crtc; 311c0e09200SDave Airlie uint32_t irq_enable_reg; 312c0e09200SDave Airlie uint32_t r500_disp_irq_reg; 313c0e09200SDave Airlie 314c0e09200SDave Airlie struct radeon_surface surfaces[RADEON_MAX_SURFACES]; 315c0e09200SDave Airlie struct radeon_virt_surface virt_surfaces[2 * RADEON_MAX_SURFACES]; 316c0e09200SDave Airlie 317c0e09200SDave Airlie unsigned long pcigart_offset; 318c0e09200SDave Airlie unsigned int pcigart_offset_set; 319c0e09200SDave Airlie struct drm_ati_pcigart_info gart_info; 320c0e09200SDave Airlie 321c0e09200SDave Airlie u32 scratch_ages[5]; 322c0e09200SDave Airlie 323c0e09200SDave Airlie /* starting from here on, data is preserved accross an open */ 324c0e09200SDave Airlie uint32_t flags; /* see radeon_chip_flags */ 325d883f7f1SBenjamin Herrenschmidt resource_size_t fb_aper_offset; 326c0e09200SDave Airlie 327c0e09200SDave Airlie int num_gb_pipes; 32854f961a6SJerome Glisse int track_flush; 32978538bf1SDave Airlie drm_local_map_t *mmio; 330*befb73c2SAlex Deucher 331*befb73c2SAlex Deucher /* r6xx/r7xx pipe/shader config */ 332*befb73c2SAlex Deucher int r600_max_pipes; 333*befb73c2SAlex Deucher int r600_max_tile_pipes; 334*befb73c2SAlex Deucher int r600_max_simds; 335*befb73c2SAlex Deucher int r600_max_backends; 336*befb73c2SAlex Deucher int r600_max_gprs; 337*befb73c2SAlex Deucher int r600_max_threads; 338*befb73c2SAlex Deucher int r600_max_stack_entries; 339*befb73c2SAlex Deucher int r600_max_hw_contexts; 340*befb73c2SAlex Deucher int r600_max_gs_threads; 341*befb73c2SAlex Deucher int r600_sx_max_export_size; 342*befb73c2SAlex Deucher int r600_sx_max_export_pos_size; 343*befb73c2SAlex Deucher int r600_sx_max_export_smx_size; 344*befb73c2SAlex Deucher int r600_sq_num_cf_insts; 345*befb73c2SAlex Deucher int r700_sx_num_of_sets; 346*befb73c2SAlex Deucher int r700_sc_prim_fifo_size; 347*befb73c2SAlex Deucher int r700_sc_hiz_tile_fifo_size; 348*befb73c2SAlex Deucher int r700_sc_earlyz_tile_fifo_fize; 349*befb73c2SAlex Deucher 350c0e09200SDave Airlie } drm_radeon_private_t; 351c0e09200SDave Airlie 352c0e09200SDave Airlie typedef struct drm_radeon_buf_priv { 353c0e09200SDave Airlie u32 age; 354c0e09200SDave Airlie } drm_radeon_buf_priv_t; 355c0e09200SDave Airlie 356c0e09200SDave Airlie typedef struct drm_radeon_kcmd_buffer { 357c0e09200SDave Airlie int bufsz; 358c0e09200SDave Airlie char *buf; 359c0e09200SDave Airlie int nbox; 360c0e09200SDave Airlie struct drm_clip_rect __user *boxes; 361c0e09200SDave Airlie } drm_radeon_kcmd_buffer_t; 362c0e09200SDave Airlie 363c0e09200SDave Airlie extern int radeon_no_wb; 364c0e09200SDave Airlie extern struct drm_ioctl_desc radeon_ioctls[]; 365c0e09200SDave Airlie extern int radeon_max_ioctl; 366c0e09200SDave Airlie 367b07fa022SDavid Miller extern u32 radeon_get_ring_head(drm_radeon_private_t *dev_priv); 368b07fa022SDavid Miller extern void radeon_set_ring_head(drm_radeon_private_t *dev_priv, u32 val); 369b07fa022SDavid Miller 370b07fa022SDavid Miller #define GET_RING_HEAD(dev_priv) radeon_get_ring_head(dev_priv) 371b07fa022SDavid Miller #define SET_RING_HEAD(dev_priv, val) radeon_set_ring_head(dev_priv, val) 372b07fa022SDavid Miller 373c0e09200SDave Airlie /* Check whether the given hardware address is inside the framebuffer or the 374c0e09200SDave Airlie * GART area. 375c0e09200SDave Airlie */ 376c0e09200SDave Airlie static __inline__ int radeon_check_offset(drm_radeon_private_t *dev_priv, 377c0e09200SDave Airlie u64 off) 378c0e09200SDave Airlie { 379c0e09200SDave Airlie u32 fb_start = dev_priv->fb_location; 380c0e09200SDave Airlie u32 fb_end = fb_start + dev_priv->fb_size - 1; 381c0e09200SDave Airlie u32 gart_start = dev_priv->gart_vm_start; 382c0e09200SDave Airlie u32 gart_end = gart_start + dev_priv->gart_size - 1; 383c0e09200SDave Airlie 384c0e09200SDave Airlie return ((off >= fb_start && off <= fb_end) || 385c0e09200SDave Airlie (off >= gart_start && off <= gart_end)); 386c0e09200SDave Airlie } 387c0e09200SDave Airlie 388c0e09200SDave Airlie /* radeon_cp.c */ 389c0e09200SDave Airlie extern int radeon_cp_init(struct drm_device *dev, void *data, struct drm_file *file_priv); 390c0e09200SDave Airlie extern int radeon_cp_start(struct drm_device *dev, void *data, struct drm_file *file_priv); 391c0e09200SDave Airlie extern int radeon_cp_stop(struct drm_device *dev, void *data, struct drm_file *file_priv); 392c0e09200SDave Airlie extern int radeon_cp_reset(struct drm_device *dev, void *data, struct drm_file *file_priv); 393c0e09200SDave Airlie extern int radeon_cp_idle(struct drm_device *dev, void *data, struct drm_file *file_priv); 394c0e09200SDave Airlie extern int radeon_cp_resume(struct drm_device *dev, void *data, struct drm_file *file_priv); 395c0e09200SDave Airlie extern int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv); 396c0e09200SDave Airlie extern int radeon_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_priv); 397c0e09200SDave Airlie extern int radeon_cp_buffers(struct drm_device *dev, void *data, struct drm_file *file_priv); 398c0e09200SDave Airlie extern u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv); 399*befb73c2SAlex Deucher extern u32 RADEON_READ_MM(drm_radeon_private_t *dev_priv, int addr); 400c0e09200SDave Airlie 401c0e09200SDave Airlie extern void radeon_freelist_reset(struct drm_device * dev); 402c0e09200SDave Airlie extern struct drm_buf *radeon_freelist_get(struct drm_device * dev); 403c0e09200SDave Airlie 404c0e09200SDave Airlie extern int radeon_wait_ring(drm_radeon_private_t * dev_priv, int n); 405c0e09200SDave Airlie 406c0e09200SDave Airlie extern int radeon_do_cp_idle(drm_radeon_private_t * dev_priv); 407c0e09200SDave Airlie 408c0e09200SDave Airlie extern int radeon_driver_preinit(struct drm_device *dev, unsigned long flags); 409c0e09200SDave Airlie extern int radeon_presetup(struct drm_device *dev); 410c0e09200SDave Airlie extern int radeon_driver_postcleanup(struct drm_device *dev); 411c0e09200SDave Airlie 412c0e09200SDave Airlie extern int radeon_mem_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv); 413c0e09200SDave Airlie extern int radeon_mem_free(struct drm_device *dev, void *data, struct drm_file *file_priv); 414c0e09200SDave Airlie extern int radeon_mem_init_heap(struct drm_device *dev, void *data, struct drm_file *file_priv); 415c0e09200SDave Airlie extern void radeon_mem_takedown(struct mem_block **heap); 416c0e09200SDave Airlie extern void radeon_mem_release(struct drm_file *file_priv, 417c0e09200SDave Airlie struct mem_block *heap); 418c0e09200SDave Airlie 419c0e09200SDave Airlie /* radeon_irq.c */ 4200a3e67a4SJesse Barnes extern void radeon_irq_set_state(struct drm_device *dev, u32 mask, int state); 421c0e09200SDave Airlie extern int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_priv); 422c0e09200SDave Airlie extern int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_priv); 423c0e09200SDave Airlie 424c0e09200SDave Airlie extern void radeon_do_release(struct drm_device * dev); 4250a3e67a4SJesse Barnes extern u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc); 4260a3e67a4SJesse Barnes extern int radeon_enable_vblank(struct drm_device *dev, int crtc); 4270a3e67a4SJesse Barnes extern void radeon_disable_vblank(struct drm_device *dev, int crtc); 428c0e09200SDave Airlie extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS); 429c0e09200SDave Airlie extern void radeon_driver_irq_preinstall(struct drm_device * dev); 4300a3e67a4SJesse Barnes extern int radeon_driver_irq_postinstall(struct drm_device *dev); 431c0e09200SDave Airlie extern void radeon_driver_irq_uninstall(struct drm_device * dev); 432c0e09200SDave Airlie extern void radeon_enable_interrupt(struct drm_device *dev); 433c0e09200SDave Airlie extern int radeon_vblank_crtc_get(struct drm_device *dev); 434c0e09200SDave Airlie extern int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value); 435c0e09200SDave Airlie 436c0e09200SDave Airlie extern int radeon_driver_load(struct drm_device *dev, unsigned long flags); 437c0e09200SDave Airlie extern int radeon_driver_unload(struct drm_device *dev); 438c0e09200SDave Airlie extern int radeon_driver_firstopen(struct drm_device *dev); 4390a3e67a4SJesse Barnes extern void radeon_driver_preclose(struct drm_device *dev, 4400a3e67a4SJesse Barnes struct drm_file *file_priv); 4410a3e67a4SJesse Barnes extern void radeon_driver_postclose(struct drm_device *dev, 4420a3e67a4SJesse Barnes struct drm_file *file_priv); 443c0e09200SDave Airlie extern void radeon_driver_lastclose(struct drm_device * dev); 4440a3e67a4SJesse Barnes extern int radeon_driver_open(struct drm_device *dev, 4450a3e67a4SJesse Barnes struct drm_file *file_priv); 446c0e09200SDave Airlie extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd, 447c0e09200SDave Airlie unsigned long arg); 448c0e09200SDave Airlie 4497c1c2871SDave Airlie extern int radeon_master_create(struct drm_device *dev, struct drm_master *master); 4507c1c2871SDave Airlie extern void radeon_master_destroy(struct drm_device *dev, struct drm_master *master); 4517c1c2871SDave Airlie extern void radeon_cp_dispatch_flip(struct drm_device *dev, struct drm_master *master); 452c0e09200SDave Airlie /* r300_cmdbuf.c */ 453c0e09200SDave Airlie extern void r300_init_reg_flags(struct drm_device *dev); 454c0e09200SDave Airlie 455c0e09200SDave Airlie extern int r300_do_cp_cmdbuf(struct drm_device *dev, 456c0e09200SDave Airlie struct drm_file *file_priv, 457c0e09200SDave Airlie drm_radeon_kcmd_buffer_t *cmdbuf); 458c0e09200SDave Airlie 459c0e09200SDave Airlie /* Flags for stats.boxes 460c0e09200SDave Airlie */ 461c0e09200SDave Airlie #define RADEON_BOX_DMA_IDLE 0x1 462c0e09200SDave Airlie #define RADEON_BOX_RING_FULL 0x2 463c0e09200SDave Airlie #define RADEON_BOX_FLIP 0x4 464c0e09200SDave Airlie #define RADEON_BOX_WAIT_IDLE 0x8 465c0e09200SDave Airlie #define RADEON_BOX_TEXTURE_LOAD 0x10 466c0e09200SDave Airlie 467c0e09200SDave Airlie /* Register definitions, register access macros and drmAddMap constants 468c0e09200SDave Airlie * for Radeon kernel driver. 469c0e09200SDave Airlie */ 470*befb73c2SAlex Deucher #define RADEON_MM_INDEX 0x0000 471*befb73c2SAlex Deucher #define RADEON_MM_DATA 0x0004 472c0e09200SDave Airlie 473c0e09200SDave Airlie #define RADEON_AGP_COMMAND 0x0f60 474c0e09200SDave Airlie #define RADEON_AGP_COMMAND_PCI_CONFIG 0x0060 /* offset in PCI config */ 475c0e09200SDave Airlie # define RADEON_AGP_ENABLE (1<<8) 476c0e09200SDave Airlie #define RADEON_AUX_SCISSOR_CNTL 0x26f0 477c0e09200SDave Airlie # define RADEON_EXCLUSIVE_SCISSOR_0 (1 << 24) 478c0e09200SDave Airlie # define RADEON_EXCLUSIVE_SCISSOR_1 (1 << 25) 479c0e09200SDave Airlie # define RADEON_EXCLUSIVE_SCISSOR_2 (1 << 26) 480c0e09200SDave Airlie # define RADEON_SCISSOR_0_ENABLE (1 << 28) 481c0e09200SDave Airlie # define RADEON_SCISSOR_1_ENABLE (1 << 29) 482c0e09200SDave Airlie # define RADEON_SCISSOR_2_ENABLE (1 << 30) 483c0e09200SDave Airlie 484edc6f389SAlex Deucher /* 485edc6f389SAlex Deucher * PCIE radeons (rv370/rv380, rv410, r423/r430/r480, r5xx) 486edc6f389SAlex Deucher * don't have an explicit bus mastering disable bit. It's handled 487edc6f389SAlex Deucher * by the PCI D-states. PMI_BM_DIS disables D-state bus master 488edc6f389SAlex Deucher * handling, not bus mastering itself. 489edc6f389SAlex Deucher */ 490c0e09200SDave Airlie #define RADEON_BUS_CNTL 0x0030 4914e270e9bSAlex Deucher /* r1xx, r2xx, r300, r(v)350, r420/r481, rs400/rs480 */ 492c0e09200SDave Airlie # define RADEON_BUS_MASTER_DIS (1 << 6) 4934e270e9bSAlex Deucher /* rs600/rs690/rs740 */ 4944e270e9bSAlex Deucher # define RS600_BUS_MASTER_DIS (1 << 14) 4954e270e9bSAlex Deucher # define RS600_MSI_REARM (1 << 20) 4964e270e9bSAlex Deucher /* see RS400_MSI_REARM in AIC_CNTL for rs480 */ 497edc6f389SAlex Deucher 498edc6f389SAlex Deucher #define RADEON_BUS_CNTL1 0x0034 499edc6f389SAlex Deucher # define RADEON_PMI_BM_DIS (1 << 2) 500edc6f389SAlex Deucher # define RADEON_PMI_INT_DIS (1 << 3) 501edc6f389SAlex Deucher 502edc6f389SAlex Deucher #define RV370_BUS_CNTL 0x004c 503edc6f389SAlex Deucher # define RV370_PMI_BM_DIS (1 << 5) 504edc6f389SAlex Deucher # define RV370_PMI_INT_DIS (1 << 6) 505edc6f389SAlex Deucher 506edc6f389SAlex Deucher #define RADEON_MSI_REARM_EN 0x0160 507edc6f389SAlex Deucher /* rv370/rv380, rv410, r423/r430/r480, r5xx */ 508edc6f389SAlex Deucher # define RV370_MSI_REARM_EN (1 << 0) 509c0e09200SDave Airlie 510c0e09200SDave Airlie #define RADEON_CLOCK_CNTL_DATA 0x000c 511c0e09200SDave Airlie # define RADEON_PLL_WR_EN (1 << 7) 512c0e09200SDave Airlie #define RADEON_CLOCK_CNTL_INDEX 0x0008 513c0e09200SDave Airlie #define RADEON_CONFIG_APER_SIZE 0x0108 514c0e09200SDave Airlie #define RADEON_CONFIG_MEMSIZE 0x00f8 515c0e09200SDave Airlie #define RADEON_CRTC_OFFSET 0x0224 516c0e09200SDave Airlie #define RADEON_CRTC_OFFSET_CNTL 0x0228 517c0e09200SDave Airlie # define RADEON_CRTC_TILE_EN (1 << 15) 518c0e09200SDave Airlie # define RADEON_CRTC_OFFSET_FLIP_CNTL (1 << 16) 519c0e09200SDave Airlie #define RADEON_CRTC2_OFFSET 0x0324 520c0e09200SDave Airlie #define RADEON_CRTC2_OFFSET_CNTL 0x0328 521c0e09200SDave Airlie 522c0e09200SDave Airlie #define RADEON_PCIE_INDEX 0x0030 523c0e09200SDave Airlie #define RADEON_PCIE_DATA 0x0034 524c0e09200SDave Airlie #define RADEON_PCIE_TX_GART_CNTL 0x10 525c0e09200SDave Airlie # define RADEON_PCIE_TX_GART_EN (1 << 0) 526c0e09200SDave Airlie # define RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_PASS_THRU (0 << 1) 527c0e09200SDave Airlie # define RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_CLAMP_LO (1 << 1) 528c0e09200SDave Airlie # define RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_DISCARD (3 << 1) 529c0e09200SDave Airlie # define RADEON_PCIE_TX_GART_MODE_32_128_CACHE (0 << 3) 530c0e09200SDave Airlie # define RADEON_PCIE_TX_GART_MODE_8_4_128_CACHE (1 << 3) 531c0e09200SDave Airlie # define RADEON_PCIE_TX_GART_CHK_RW_VALID_EN (1 << 5) 532c0e09200SDave Airlie # define RADEON_PCIE_TX_GART_INVALIDATE_TLB (1 << 8) 533c0e09200SDave Airlie #define RADEON_PCIE_TX_DISCARD_RD_ADDR_LO 0x11 534c0e09200SDave Airlie #define RADEON_PCIE_TX_DISCARD_RD_ADDR_HI 0x12 535c0e09200SDave Airlie #define RADEON_PCIE_TX_GART_BASE 0x13 536c0e09200SDave Airlie #define RADEON_PCIE_TX_GART_START_LO 0x14 537c0e09200SDave Airlie #define RADEON_PCIE_TX_GART_START_HI 0x15 538c0e09200SDave Airlie #define RADEON_PCIE_TX_GART_END_LO 0x16 539c0e09200SDave Airlie #define RADEON_PCIE_TX_GART_END_HI 0x17 540c0e09200SDave Airlie 541c0e09200SDave Airlie #define RS480_NB_MC_INDEX 0x168 542c0e09200SDave Airlie # define RS480_NB_MC_IND_WR_EN (1 << 8) 543c0e09200SDave Airlie #define RS480_NB_MC_DATA 0x16c 544c0e09200SDave Airlie 545c0e09200SDave Airlie #define RS690_MC_INDEX 0x78 546c0e09200SDave Airlie # define RS690_MC_INDEX_MASK 0x1ff 547c0e09200SDave Airlie # define RS690_MC_INDEX_WR_EN (1 << 9) 548c0e09200SDave Airlie # define RS690_MC_INDEX_WR_ACK 0x7f 549c0e09200SDave Airlie #define RS690_MC_DATA 0x7c 550c0e09200SDave Airlie 551c0e09200SDave Airlie /* MC indirect registers */ 552c0e09200SDave Airlie #define RS480_MC_MISC_CNTL 0x18 553c0e09200SDave Airlie # define RS480_DISABLE_GTW (1 << 1) 554c0e09200SDave Airlie /* switch between MCIND GART and MM GART registers. 0 = mmgart, 1 = mcind gart */ 555c0e09200SDave Airlie # define RS480_GART_INDEX_REG_EN (1 << 12) 556c0e09200SDave Airlie # define RS690_BLOCK_GFX_D3_EN (1 << 14) 557c0e09200SDave Airlie #define RS480_K8_FB_LOCATION 0x1e 558c0e09200SDave Airlie #define RS480_GART_FEATURE_ID 0x2b 559c0e09200SDave Airlie # define RS480_HANG_EN (1 << 11) 560c0e09200SDave Airlie # define RS480_TLB_ENABLE (1 << 18) 561c0e09200SDave Airlie # define RS480_P2P_ENABLE (1 << 19) 562c0e09200SDave Airlie # define RS480_GTW_LAC_EN (1 << 25) 563c0e09200SDave Airlie # define RS480_2LEVEL_GART (0 << 30) 564c0e09200SDave Airlie # define RS480_1LEVEL_GART (1 << 30) 565c0e09200SDave Airlie # define RS480_PDC_EN (1 << 31) 566c0e09200SDave Airlie #define RS480_GART_BASE 0x2c 567c0e09200SDave Airlie #define RS480_GART_CACHE_CNTRL 0x2e 568c0e09200SDave Airlie # define RS480_GART_CACHE_INVALIDATE (1 << 0) /* wait for it to clear */ 569c0e09200SDave Airlie #define RS480_AGP_ADDRESS_SPACE_SIZE 0x38 570c0e09200SDave Airlie # define RS480_GART_EN (1 << 0) 571c0e09200SDave Airlie # define RS480_VA_SIZE_32MB (0 << 1) 572c0e09200SDave Airlie # define RS480_VA_SIZE_64MB (1 << 1) 573c0e09200SDave Airlie # define RS480_VA_SIZE_128MB (2 << 1) 574c0e09200SDave Airlie # define RS480_VA_SIZE_256MB (3 << 1) 575c0e09200SDave Airlie # define RS480_VA_SIZE_512MB (4 << 1) 576c0e09200SDave Airlie # define RS480_VA_SIZE_1GB (5 << 1) 577c0e09200SDave Airlie # define RS480_VA_SIZE_2GB (6 << 1) 578c0e09200SDave Airlie #define RS480_AGP_MODE_CNTL 0x39 579c0e09200SDave Airlie # define RS480_POST_GART_Q_SIZE (1 << 18) 580c0e09200SDave Airlie # define RS480_NONGART_SNOOP (1 << 19) 581c0e09200SDave Airlie # define RS480_AGP_RD_BUF_SIZE (1 << 20) 582c0e09200SDave Airlie # define RS480_REQ_TYPE_SNOOP_SHIFT 22 583c0e09200SDave Airlie # define RS480_REQ_TYPE_SNOOP_MASK 0x3 584c0e09200SDave Airlie # define RS480_REQ_TYPE_SNOOP_DIS (1 << 24) 585c0e09200SDave Airlie #define RS480_MC_MISC_UMA_CNTL 0x5f 586c0e09200SDave Airlie #define RS480_MC_MCLK_CNTL 0x7a 587c0e09200SDave Airlie #define RS480_MC_UMA_DUALCH_CNTL 0x86 588c0e09200SDave Airlie 589c0e09200SDave Airlie #define RS690_MC_FB_LOCATION 0x100 590c0e09200SDave Airlie #define RS690_MC_AGP_LOCATION 0x101 591c0e09200SDave Airlie #define RS690_MC_AGP_BASE 0x102 592c0e09200SDave Airlie #define RS690_MC_AGP_BASE_2 0x103 593c0e09200SDave Airlie 594c0e09200SDave Airlie #define R520_MC_IND_INDEX 0x70 595c0e09200SDave Airlie #define R520_MC_IND_WR_EN (1 << 24) 596c0e09200SDave Airlie #define R520_MC_IND_DATA 0x74 597c0e09200SDave Airlie 598c0e09200SDave Airlie #define RV515_MC_FB_LOCATION 0x01 599c0e09200SDave Airlie #define RV515_MC_AGP_LOCATION 0x02 600c0e09200SDave Airlie #define RV515_MC_AGP_BASE 0x03 601c0e09200SDave Airlie #define RV515_MC_AGP_BASE_2 0x04 602c0e09200SDave Airlie 603c0e09200SDave Airlie #define R520_MC_FB_LOCATION 0x04 604c0e09200SDave Airlie #define R520_MC_AGP_LOCATION 0x05 605c0e09200SDave Airlie #define R520_MC_AGP_BASE 0x06 606c0e09200SDave Airlie #define R520_MC_AGP_BASE_2 0x07 607c0e09200SDave Airlie 608c0e09200SDave Airlie #define RADEON_MPP_TB_CONFIG 0x01c0 609c0e09200SDave Airlie #define RADEON_MEM_CNTL 0x0140 610c0e09200SDave Airlie #define RADEON_MEM_SDRAM_MODE_REG 0x0158 611c0e09200SDave Airlie #define RADEON_AGP_BASE_2 0x015c /* r200+ only */ 612c0e09200SDave Airlie #define RS480_AGP_BASE_2 0x0164 613c0e09200SDave Airlie #define RADEON_AGP_BASE 0x0170 614c0e09200SDave Airlie 615c0e09200SDave Airlie /* pipe config regs */ 616c0e09200SDave Airlie #define R400_GB_PIPE_SELECT 0x402c 617c0e09200SDave Airlie #define R500_DYN_SCLK_PWMEM_PIPE 0x000d /* PLL */ 618c0e09200SDave Airlie #define R500_SU_REG_DEST 0x42c8 619c0e09200SDave Airlie #define R300_GB_TILE_CONFIG 0x4018 620c0e09200SDave Airlie # define R300_ENABLE_TILING (1 << 0) 621c0e09200SDave Airlie # define R300_PIPE_COUNT_RV350 (0 << 1) 622c0e09200SDave Airlie # define R300_PIPE_COUNT_R300 (3 << 1) 623c0e09200SDave Airlie # define R300_PIPE_COUNT_R420_3P (6 << 1) 624c0e09200SDave Airlie # define R300_PIPE_COUNT_R420 (7 << 1) 625c0e09200SDave Airlie # define R300_TILE_SIZE_8 (0 << 4) 626c0e09200SDave Airlie # define R300_TILE_SIZE_16 (1 << 4) 627c0e09200SDave Airlie # define R300_TILE_SIZE_32 (2 << 4) 628c0e09200SDave Airlie # define R300_SUBPIXEL_1_12 (0 << 16) 629c0e09200SDave Airlie # define R300_SUBPIXEL_1_16 (1 << 16) 630c0e09200SDave Airlie #define R300_DST_PIPE_CONFIG 0x170c 631c0e09200SDave Airlie # define R300_PIPE_AUTO_CONFIG (1 << 31) 632c0e09200SDave Airlie #define R300_RB2D_DSTCACHE_MODE 0x3428 633c0e09200SDave Airlie # define R300_DC_AUTOFLUSH_ENABLE (1 << 8) 634c0e09200SDave Airlie # define R300_DC_DC_DISABLE_IGNORE_PE (1 << 17) 635c0e09200SDave Airlie 636c0e09200SDave Airlie #define RADEON_RB3D_COLOROFFSET 0x1c40 637c0e09200SDave Airlie #define RADEON_RB3D_COLORPITCH 0x1c48 638c0e09200SDave Airlie 639c0e09200SDave Airlie #define RADEON_SRC_X_Y 0x1590 640c0e09200SDave Airlie 641c0e09200SDave Airlie #define RADEON_DP_GUI_MASTER_CNTL 0x146c 642c0e09200SDave Airlie # define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) 643c0e09200SDave Airlie # define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) 644c0e09200SDave Airlie # define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4) 645c0e09200SDave Airlie # define RADEON_GMC_BRUSH_NONE (15 << 4) 646c0e09200SDave Airlie # define RADEON_GMC_DST_16BPP (4 << 8) 647c0e09200SDave Airlie # define RADEON_GMC_DST_24BPP (5 << 8) 648c0e09200SDave Airlie # define RADEON_GMC_DST_32BPP (6 << 8) 649c0e09200SDave Airlie # define RADEON_GMC_DST_DATATYPE_SHIFT 8 650c0e09200SDave Airlie # define RADEON_GMC_SRC_DATATYPE_COLOR (3 << 12) 651c0e09200SDave Airlie # define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24) 652c0e09200SDave Airlie # define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24) 653c0e09200SDave Airlie # define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28) 654c0e09200SDave Airlie # define RADEON_GMC_WR_MSK_DIS (1 << 30) 655c0e09200SDave Airlie # define RADEON_ROP3_S 0x00cc0000 656c0e09200SDave Airlie # define RADEON_ROP3_P 0x00f00000 657c0e09200SDave Airlie #define RADEON_DP_WRITE_MASK 0x16cc 658c0e09200SDave Airlie #define RADEON_SRC_PITCH_OFFSET 0x1428 659c0e09200SDave Airlie #define RADEON_DST_PITCH_OFFSET 0x142c 660c0e09200SDave Airlie #define RADEON_DST_PITCH_OFFSET_C 0x1c80 661c0e09200SDave Airlie # define RADEON_DST_TILE_LINEAR (0 << 30) 662c0e09200SDave Airlie # define RADEON_DST_TILE_MACRO (1 << 30) 663c0e09200SDave Airlie # define RADEON_DST_TILE_MICRO (2 << 30) 664c0e09200SDave Airlie # define RADEON_DST_TILE_BOTH (3 << 30) 665c0e09200SDave Airlie 666c0e09200SDave Airlie #define RADEON_SCRATCH_REG0 0x15e0 667c0e09200SDave Airlie #define RADEON_SCRATCH_REG1 0x15e4 668c0e09200SDave Airlie #define RADEON_SCRATCH_REG2 0x15e8 669c0e09200SDave Airlie #define RADEON_SCRATCH_REG3 0x15ec 670c0e09200SDave Airlie #define RADEON_SCRATCH_REG4 0x15f0 671c0e09200SDave Airlie #define RADEON_SCRATCH_REG5 0x15f4 672c0e09200SDave Airlie #define RADEON_SCRATCH_UMSK 0x0770 673c0e09200SDave Airlie #define RADEON_SCRATCH_ADDR 0x0774 674c0e09200SDave Airlie 675c0e09200SDave Airlie #define RADEON_SCRATCHOFF( x ) (RADEON_SCRATCH_REG_OFFSET + 4*(x)) 676c0e09200SDave Airlie 677b07fa022SDavid Miller extern u32 radeon_get_scratch(drm_radeon_private_t *dev_priv, int index); 678b07fa022SDavid Miller 679b07fa022SDavid Miller #define GET_SCRATCH(dev_priv, x) radeon_get_scratch(dev_priv, x) 680c0e09200SDave Airlie 681*befb73c2SAlex Deucher #define R600_SCRATCH_REG0 0x8500 682*befb73c2SAlex Deucher #define R600_SCRATCH_REG1 0x8504 683*befb73c2SAlex Deucher #define R600_SCRATCH_REG2 0x8508 684*befb73c2SAlex Deucher #define R600_SCRATCH_REG3 0x850c 685*befb73c2SAlex Deucher #define R600_SCRATCH_REG4 0x8510 686*befb73c2SAlex Deucher #define R600_SCRATCH_REG5 0x8514 687*befb73c2SAlex Deucher #define R600_SCRATCH_REG6 0x8518 688*befb73c2SAlex Deucher #define R600_SCRATCH_REG7 0x851c 689*befb73c2SAlex Deucher #define R600_SCRATCH_UMSK 0x8540 690*befb73c2SAlex Deucher #define R600_SCRATCH_ADDR 0x8544 691*befb73c2SAlex Deucher 692*befb73c2SAlex Deucher #define R600_SCRATCHOFF(x) (R600_SCRATCH_REG_OFFSET + 4*(x)) 693*befb73c2SAlex Deucher 694c0e09200SDave Airlie #define RADEON_GEN_INT_CNTL 0x0040 695c0e09200SDave Airlie # define RADEON_CRTC_VBLANK_MASK (1 << 0) 696c0e09200SDave Airlie # define RADEON_CRTC2_VBLANK_MASK (1 << 9) 697c0e09200SDave Airlie # define RADEON_GUI_IDLE_INT_ENABLE (1 << 19) 698c0e09200SDave Airlie # define RADEON_SW_INT_ENABLE (1 << 25) 699c0e09200SDave Airlie 700c0e09200SDave Airlie #define RADEON_GEN_INT_STATUS 0x0044 701c0e09200SDave Airlie # define RADEON_CRTC_VBLANK_STAT (1 << 0) 702c0e09200SDave Airlie # define RADEON_CRTC_VBLANK_STAT_ACK (1 << 0) 703c0e09200SDave Airlie # define RADEON_CRTC2_VBLANK_STAT (1 << 9) 704c0e09200SDave Airlie # define RADEON_CRTC2_VBLANK_STAT_ACK (1 << 9) 705c0e09200SDave Airlie # define RADEON_GUI_IDLE_INT_TEST_ACK (1 << 19) 706c0e09200SDave Airlie # define RADEON_SW_INT_TEST (1 << 25) 707c0e09200SDave Airlie # define RADEON_SW_INT_TEST_ACK (1 << 25) 708c0e09200SDave Airlie # define RADEON_SW_INT_FIRE (1 << 26) 7090a3e67a4SJesse Barnes # define R500_DISPLAY_INT_STATUS (1 << 0) 710c0e09200SDave Airlie 711c0e09200SDave Airlie #define RADEON_HOST_PATH_CNTL 0x0130 712c0e09200SDave Airlie # define RADEON_HDP_SOFT_RESET (1 << 26) 713c0e09200SDave Airlie # define RADEON_HDP_WC_TIMEOUT_MASK (7 << 28) 714c0e09200SDave Airlie # define RADEON_HDP_WC_TIMEOUT_28BCLK (7 << 28) 715c0e09200SDave Airlie 716c0e09200SDave Airlie #define RADEON_ISYNC_CNTL 0x1724 717c0e09200SDave Airlie # define RADEON_ISYNC_ANY2D_IDLE3D (1 << 0) 718c0e09200SDave Airlie # define RADEON_ISYNC_ANY3D_IDLE2D (1 << 1) 719c0e09200SDave Airlie # define RADEON_ISYNC_TRIG2D_IDLE3D (1 << 2) 720c0e09200SDave Airlie # define RADEON_ISYNC_TRIG3D_IDLE2D (1 << 3) 721c0e09200SDave Airlie # define RADEON_ISYNC_WAIT_IDLEGUI (1 << 4) 722c0e09200SDave Airlie # define RADEON_ISYNC_CPSCRATCH_IDLEGUI (1 << 5) 723c0e09200SDave Airlie 724c0e09200SDave Airlie #define RADEON_RBBM_GUICNTL 0x172c 725c0e09200SDave Airlie # define RADEON_HOST_DATA_SWAP_NONE (0 << 0) 726c0e09200SDave Airlie # define RADEON_HOST_DATA_SWAP_16BIT (1 << 0) 727c0e09200SDave Airlie # define RADEON_HOST_DATA_SWAP_32BIT (2 << 0) 728c0e09200SDave Airlie # define RADEON_HOST_DATA_SWAP_HDW (3 << 0) 729c0e09200SDave Airlie 730c0e09200SDave Airlie #define RADEON_MC_AGP_LOCATION 0x014c 731c0e09200SDave Airlie #define RADEON_MC_FB_LOCATION 0x0148 732c0e09200SDave Airlie #define RADEON_MCLK_CNTL 0x0012 733c0e09200SDave Airlie # define RADEON_FORCEON_MCLKA (1 << 16) 734c0e09200SDave Airlie # define RADEON_FORCEON_MCLKB (1 << 17) 735c0e09200SDave Airlie # define RADEON_FORCEON_YCLKA (1 << 18) 736c0e09200SDave Airlie # define RADEON_FORCEON_YCLKB (1 << 19) 737c0e09200SDave Airlie # define RADEON_FORCEON_MC (1 << 20) 738c0e09200SDave Airlie # define RADEON_FORCEON_AIC (1 << 21) 739c0e09200SDave Airlie 740c0e09200SDave Airlie #define RADEON_PP_BORDER_COLOR_0 0x1d40 741c0e09200SDave Airlie #define RADEON_PP_BORDER_COLOR_1 0x1d44 742c0e09200SDave Airlie #define RADEON_PP_BORDER_COLOR_2 0x1d48 743c0e09200SDave Airlie #define RADEON_PP_CNTL 0x1c38 744c0e09200SDave Airlie # define RADEON_SCISSOR_ENABLE (1 << 1) 745c0e09200SDave Airlie #define RADEON_PP_LUM_MATRIX 0x1d00 746c0e09200SDave Airlie #define RADEON_PP_MISC 0x1c14 747c0e09200SDave Airlie #define RADEON_PP_ROT_MATRIX_0 0x1d58 748c0e09200SDave Airlie #define RADEON_PP_TXFILTER_0 0x1c54 749c0e09200SDave Airlie #define RADEON_PP_TXOFFSET_0 0x1c5c 750c0e09200SDave Airlie #define RADEON_PP_TXFILTER_1 0x1c6c 751c0e09200SDave Airlie #define RADEON_PP_TXFILTER_2 0x1c84 752c0e09200SDave Airlie 753c0e09200SDave Airlie #define R300_RB2D_DSTCACHE_CTLSTAT 0x342c /* use R300_DSTCACHE_CTLSTAT */ 754c0e09200SDave Airlie #define R300_DSTCACHE_CTLSTAT 0x1714 755c0e09200SDave Airlie # define R300_RB2D_DC_FLUSH (3 << 0) 756c0e09200SDave Airlie # define R300_RB2D_DC_FREE (3 << 2) 757c0e09200SDave Airlie # define R300_RB2D_DC_FLUSH_ALL 0xf 758c0e09200SDave Airlie # define R300_RB2D_DC_BUSY (1 << 31) 759c0e09200SDave Airlie #define RADEON_RB3D_CNTL 0x1c3c 760c0e09200SDave Airlie # define RADEON_ALPHA_BLEND_ENABLE (1 << 0) 761c0e09200SDave Airlie # define RADEON_PLANE_MASK_ENABLE (1 << 1) 762c0e09200SDave Airlie # define RADEON_DITHER_ENABLE (1 << 2) 763c0e09200SDave Airlie # define RADEON_ROUND_ENABLE (1 << 3) 764c0e09200SDave Airlie # define RADEON_SCALE_DITHER_ENABLE (1 << 4) 765c0e09200SDave Airlie # define RADEON_DITHER_INIT (1 << 5) 766c0e09200SDave Airlie # define RADEON_ROP_ENABLE (1 << 6) 767c0e09200SDave Airlie # define RADEON_STENCIL_ENABLE (1 << 7) 768c0e09200SDave Airlie # define RADEON_Z_ENABLE (1 << 8) 769c0e09200SDave Airlie # define RADEON_ZBLOCK16 (1 << 15) 770c0e09200SDave Airlie #define RADEON_RB3D_DEPTHOFFSET 0x1c24 771c0e09200SDave Airlie #define RADEON_RB3D_DEPTHCLEARVALUE 0x3230 772c0e09200SDave Airlie #define RADEON_RB3D_DEPTHPITCH 0x1c28 773c0e09200SDave Airlie #define RADEON_RB3D_PLANEMASK 0x1d84 774c0e09200SDave Airlie #define RADEON_RB3D_STENCILREFMASK 0x1d7c 775c0e09200SDave Airlie #define RADEON_RB3D_ZCACHE_MODE 0x3250 776c0e09200SDave Airlie #define RADEON_RB3D_ZCACHE_CTLSTAT 0x3254 777c0e09200SDave Airlie # define RADEON_RB3D_ZC_FLUSH (1 << 0) 778c0e09200SDave Airlie # define RADEON_RB3D_ZC_FREE (1 << 2) 779c0e09200SDave Airlie # define RADEON_RB3D_ZC_FLUSH_ALL 0x5 780c0e09200SDave Airlie # define RADEON_RB3D_ZC_BUSY (1 << 31) 781c0e09200SDave Airlie #define R300_ZB_ZCACHE_CTLSTAT 0x4f18 782c0e09200SDave Airlie # define R300_ZC_FLUSH (1 << 0) 783c0e09200SDave Airlie # define R300_ZC_FREE (1 << 1) 784c0e09200SDave Airlie # define R300_ZC_BUSY (1 << 31) 785c0e09200SDave Airlie #define RADEON_RB3D_DSTCACHE_CTLSTAT 0x325c 786c0e09200SDave Airlie # define RADEON_RB3D_DC_FLUSH (3 << 0) 787c0e09200SDave Airlie # define RADEON_RB3D_DC_FREE (3 << 2) 788c0e09200SDave Airlie # define RADEON_RB3D_DC_FLUSH_ALL 0xf 789c0e09200SDave Airlie # define RADEON_RB3D_DC_BUSY (1 << 31) 790c0e09200SDave Airlie #define R300_RB3D_DSTCACHE_CTLSTAT 0x4e4c 79154f961a6SJerome Glisse # define R300_RB3D_DC_FLUSH (2 << 0) 79254f961a6SJerome Glisse # define R300_RB3D_DC_FREE (2 << 2) 793c0e09200SDave Airlie # define R300_RB3D_DC_FINISH (1 << 4) 794c0e09200SDave Airlie #define RADEON_RB3D_ZSTENCILCNTL 0x1c2c 795c0e09200SDave Airlie # define RADEON_Z_TEST_MASK (7 << 4) 796c0e09200SDave Airlie # define RADEON_Z_TEST_ALWAYS (7 << 4) 797c0e09200SDave Airlie # define RADEON_Z_HIERARCHY_ENABLE (1 << 8) 798c0e09200SDave Airlie # define RADEON_STENCIL_TEST_ALWAYS (7 << 12) 799c0e09200SDave Airlie # define RADEON_STENCIL_S_FAIL_REPLACE (2 << 16) 800c0e09200SDave Airlie # define RADEON_STENCIL_ZPASS_REPLACE (2 << 20) 801c0e09200SDave Airlie # define RADEON_STENCIL_ZFAIL_REPLACE (2 << 24) 802c0e09200SDave Airlie # define RADEON_Z_COMPRESSION_ENABLE (1 << 28) 803c0e09200SDave Airlie # define RADEON_FORCE_Z_DIRTY (1 << 29) 804c0e09200SDave Airlie # define RADEON_Z_WRITE_ENABLE (1 << 30) 805c0e09200SDave Airlie # define RADEON_Z_DECOMPRESSION_ENABLE (1 << 31) 806c0e09200SDave Airlie #define RADEON_RBBM_SOFT_RESET 0x00f0 807c0e09200SDave Airlie # define RADEON_SOFT_RESET_CP (1 << 0) 808c0e09200SDave Airlie # define RADEON_SOFT_RESET_HI (1 << 1) 809c0e09200SDave Airlie # define RADEON_SOFT_RESET_SE (1 << 2) 810c0e09200SDave Airlie # define RADEON_SOFT_RESET_RE (1 << 3) 811c0e09200SDave Airlie # define RADEON_SOFT_RESET_PP (1 << 4) 812c0e09200SDave Airlie # define RADEON_SOFT_RESET_E2 (1 << 5) 813c0e09200SDave Airlie # define RADEON_SOFT_RESET_RB (1 << 6) 814c0e09200SDave Airlie # define RADEON_SOFT_RESET_HDP (1 << 7) 815c0e09200SDave Airlie /* 816c0e09200SDave Airlie * 6:0 Available slots in the FIFO 817c0e09200SDave Airlie * 8 Host Interface active 818c0e09200SDave Airlie * 9 CP request active 819c0e09200SDave Airlie * 10 FIFO request active 820c0e09200SDave Airlie * 11 Host Interface retry active 821c0e09200SDave Airlie * 12 CP retry active 822c0e09200SDave Airlie * 13 FIFO retry active 823c0e09200SDave Airlie * 14 FIFO pipeline busy 824c0e09200SDave Airlie * 15 Event engine busy 825c0e09200SDave Airlie * 16 CP command stream busy 826c0e09200SDave Airlie * 17 2D engine busy 827c0e09200SDave Airlie * 18 2D portion of render backend busy 828c0e09200SDave Airlie * 20 3D setup engine busy 829c0e09200SDave Airlie * 26 GA engine busy 830c0e09200SDave Airlie * 27 CBA 2D engine busy 831c0e09200SDave Airlie * 31 2D engine busy or 3D engine busy or FIFO not empty or CP busy or 832c0e09200SDave Airlie * command stream queue not empty or Ring Buffer not empty 833c0e09200SDave Airlie */ 834c0e09200SDave Airlie #define RADEON_RBBM_STATUS 0x0e40 835c0e09200SDave Airlie /* Same as the previous RADEON_RBBM_STATUS; this is a mirror of that register. */ 836c0e09200SDave Airlie /* #define RADEON_RBBM_STATUS 0x1740 */ 837c0e09200SDave Airlie /* bits 6:0 are dword slots available in the cmd fifo */ 838c0e09200SDave Airlie # define RADEON_RBBM_FIFOCNT_MASK 0x007f 839c0e09200SDave Airlie # define RADEON_HIRQ_ON_RBB (1 << 8) 840c0e09200SDave Airlie # define RADEON_CPRQ_ON_RBB (1 << 9) 841c0e09200SDave Airlie # define RADEON_CFRQ_ON_RBB (1 << 10) 842c0e09200SDave Airlie # define RADEON_HIRQ_IN_RTBUF (1 << 11) 843c0e09200SDave Airlie # define RADEON_CPRQ_IN_RTBUF (1 << 12) 844c0e09200SDave Airlie # define RADEON_CFRQ_IN_RTBUF (1 << 13) 845c0e09200SDave Airlie # define RADEON_PIPE_BUSY (1 << 14) 846c0e09200SDave Airlie # define RADEON_ENG_EV_BUSY (1 << 15) 847c0e09200SDave Airlie # define RADEON_CP_CMDSTRM_BUSY (1 << 16) 848c0e09200SDave Airlie # define RADEON_E2_BUSY (1 << 17) 849c0e09200SDave Airlie # define RADEON_RB2D_BUSY (1 << 18) 850c0e09200SDave Airlie # define RADEON_RB3D_BUSY (1 << 19) /* not used on r300 */ 851c0e09200SDave Airlie # define RADEON_VAP_BUSY (1 << 20) 852c0e09200SDave Airlie # define RADEON_RE_BUSY (1 << 21) /* not used on r300 */ 853c0e09200SDave Airlie # define RADEON_TAM_BUSY (1 << 22) /* not used on r300 */ 854c0e09200SDave Airlie # define RADEON_TDM_BUSY (1 << 23) /* not used on r300 */ 855c0e09200SDave Airlie # define RADEON_PB_BUSY (1 << 24) /* not used on r300 */ 856c0e09200SDave Airlie # define RADEON_TIM_BUSY (1 << 25) /* not used on r300 */ 857c0e09200SDave Airlie # define RADEON_GA_BUSY (1 << 26) 858c0e09200SDave Airlie # define RADEON_CBA2D_BUSY (1 << 27) 859c0e09200SDave Airlie # define RADEON_RBBM_ACTIVE (1 << 31) 860c0e09200SDave Airlie #define RADEON_RE_LINE_PATTERN 0x1cd0 861c0e09200SDave Airlie #define RADEON_RE_MISC 0x26c4 862c0e09200SDave Airlie #define RADEON_RE_TOP_LEFT 0x26c0 863c0e09200SDave Airlie #define RADEON_RE_WIDTH_HEIGHT 0x1c44 864c0e09200SDave Airlie #define RADEON_RE_STIPPLE_ADDR 0x1cc8 865c0e09200SDave Airlie #define RADEON_RE_STIPPLE_DATA 0x1ccc 866c0e09200SDave Airlie 867c0e09200SDave Airlie #define RADEON_SCISSOR_TL_0 0x1cd8 868c0e09200SDave Airlie #define RADEON_SCISSOR_BR_0 0x1cdc 869c0e09200SDave Airlie #define RADEON_SCISSOR_TL_1 0x1ce0 870c0e09200SDave Airlie #define RADEON_SCISSOR_BR_1 0x1ce4 871c0e09200SDave Airlie #define RADEON_SCISSOR_TL_2 0x1ce8 872c0e09200SDave Airlie #define RADEON_SCISSOR_BR_2 0x1cec 873c0e09200SDave Airlie #define RADEON_SE_COORD_FMT 0x1c50 874c0e09200SDave Airlie #define RADEON_SE_CNTL 0x1c4c 875c0e09200SDave Airlie # define RADEON_FFACE_CULL_CW (0 << 0) 876c0e09200SDave Airlie # define RADEON_BFACE_SOLID (3 << 1) 877c0e09200SDave Airlie # define RADEON_FFACE_SOLID (3 << 3) 878c0e09200SDave Airlie # define RADEON_FLAT_SHADE_VTX_LAST (3 << 6) 879c0e09200SDave Airlie # define RADEON_DIFFUSE_SHADE_FLAT (1 << 8) 880c0e09200SDave Airlie # define RADEON_DIFFUSE_SHADE_GOURAUD (2 << 8) 881c0e09200SDave Airlie # define RADEON_ALPHA_SHADE_FLAT (1 << 10) 882c0e09200SDave Airlie # define RADEON_ALPHA_SHADE_GOURAUD (2 << 10) 883c0e09200SDave Airlie # define RADEON_SPECULAR_SHADE_FLAT (1 << 12) 884c0e09200SDave Airlie # define RADEON_SPECULAR_SHADE_GOURAUD (2 << 12) 885c0e09200SDave Airlie # define RADEON_FOG_SHADE_FLAT (1 << 14) 886c0e09200SDave Airlie # define RADEON_FOG_SHADE_GOURAUD (2 << 14) 887c0e09200SDave Airlie # define RADEON_VPORT_XY_XFORM_ENABLE (1 << 24) 888c0e09200SDave Airlie # define RADEON_VPORT_Z_XFORM_ENABLE (1 << 25) 889c0e09200SDave Airlie # define RADEON_VTX_PIX_CENTER_OGL (1 << 27) 890c0e09200SDave Airlie # define RADEON_ROUND_MODE_TRUNC (0 << 28) 891c0e09200SDave Airlie # define RADEON_ROUND_PREC_8TH_PIX (1 << 30) 892c0e09200SDave Airlie #define RADEON_SE_CNTL_STATUS 0x2140 893c0e09200SDave Airlie #define RADEON_SE_LINE_WIDTH 0x1db8 894c0e09200SDave Airlie #define RADEON_SE_VPORT_XSCALE 0x1d98 895c0e09200SDave Airlie #define RADEON_SE_ZBIAS_FACTOR 0x1db0 896c0e09200SDave Airlie #define RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED 0x2210 897c0e09200SDave Airlie #define RADEON_SE_TCL_OUTPUT_VTX_FMT 0x2254 898c0e09200SDave Airlie #define RADEON_SE_TCL_VECTOR_INDX_REG 0x2200 899c0e09200SDave Airlie # define RADEON_VEC_INDX_OCTWORD_STRIDE_SHIFT 16 900c0e09200SDave Airlie # define RADEON_VEC_INDX_DWORD_COUNT_SHIFT 28 901c0e09200SDave Airlie #define RADEON_SE_TCL_VECTOR_DATA_REG 0x2204 902c0e09200SDave Airlie #define RADEON_SE_TCL_SCALAR_INDX_REG 0x2208 903c0e09200SDave Airlie # define RADEON_SCAL_INDX_DWORD_STRIDE_SHIFT 16 904c0e09200SDave Airlie #define RADEON_SE_TCL_SCALAR_DATA_REG 0x220C 905c0e09200SDave Airlie #define RADEON_SURFACE_ACCESS_FLAGS 0x0bf8 906c0e09200SDave Airlie #define RADEON_SURFACE_ACCESS_CLR 0x0bfc 907c0e09200SDave Airlie #define RADEON_SURFACE_CNTL 0x0b00 908c0e09200SDave Airlie # define RADEON_SURF_TRANSLATION_DIS (1 << 8) 909c0e09200SDave Airlie # define RADEON_NONSURF_AP0_SWP_MASK (3 << 20) 910c0e09200SDave Airlie # define RADEON_NONSURF_AP0_SWP_LITTLE (0 << 20) 911c0e09200SDave Airlie # define RADEON_NONSURF_AP0_SWP_BIG16 (1 << 20) 912c0e09200SDave Airlie # define RADEON_NONSURF_AP0_SWP_BIG32 (2 << 20) 913c0e09200SDave Airlie # define RADEON_NONSURF_AP1_SWP_MASK (3 << 22) 914c0e09200SDave Airlie # define RADEON_NONSURF_AP1_SWP_LITTLE (0 << 22) 915c0e09200SDave Airlie # define RADEON_NONSURF_AP1_SWP_BIG16 (1 << 22) 916c0e09200SDave Airlie # define RADEON_NONSURF_AP1_SWP_BIG32 (2 << 22) 917c0e09200SDave Airlie #define RADEON_SURFACE0_INFO 0x0b0c 918c0e09200SDave Airlie # define RADEON_SURF_PITCHSEL_MASK (0x1ff << 0) 919c0e09200SDave Airlie # define RADEON_SURF_TILE_MODE_MASK (3 << 16) 920c0e09200SDave Airlie # define RADEON_SURF_TILE_MODE_MACRO (0 << 16) 921c0e09200SDave Airlie # define RADEON_SURF_TILE_MODE_MICRO (1 << 16) 922c0e09200SDave Airlie # define RADEON_SURF_TILE_MODE_32BIT_Z (2 << 16) 923c0e09200SDave Airlie # define RADEON_SURF_TILE_MODE_16BIT_Z (3 << 16) 924c0e09200SDave Airlie #define RADEON_SURFACE0_LOWER_BOUND 0x0b04 925c0e09200SDave Airlie #define RADEON_SURFACE0_UPPER_BOUND 0x0b08 926c0e09200SDave Airlie # define RADEON_SURF_ADDRESS_FIXED_MASK (0x3ff << 0) 927c0e09200SDave Airlie #define RADEON_SURFACE1_INFO 0x0b1c 928c0e09200SDave Airlie #define RADEON_SURFACE1_LOWER_BOUND 0x0b14 929c0e09200SDave Airlie #define RADEON_SURFACE1_UPPER_BOUND 0x0b18 930c0e09200SDave Airlie #define RADEON_SURFACE2_INFO 0x0b2c 931c0e09200SDave Airlie #define RADEON_SURFACE2_LOWER_BOUND 0x0b24 932c0e09200SDave Airlie #define RADEON_SURFACE2_UPPER_BOUND 0x0b28 933c0e09200SDave Airlie #define RADEON_SURFACE3_INFO 0x0b3c 934c0e09200SDave Airlie #define RADEON_SURFACE3_LOWER_BOUND 0x0b34 935c0e09200SDave Airlie #define RADEON_SURFACE3_UPPER_BOUND 0x0b38 936c0e09200SDave Airlie #define RADEON_SURFACE4_INFO 0x0b4c 937c0e09200SDave Airlie #define RADEON_SURFACE4_LOWER_BOUND 0x0b44 938c0e09200SDave Airlie #define RADEON_SURFACE4_UPPER_BOUND 0x0b48 939c0e09200SDave Airlie #define RADEON_SURFACE5_INFO 0x0b5c 940c0e09200SDave Airlie #define RADEON_SURFACE5_LOWER_BOUND 0x0b54 941c0e09200SDave Airlie #define RADEON_SURFACE5_UPPER_BOUND 0x0b58 942c0e09200SDave Airlie #define RADEON_SURFACE6_INFO 0x0b6c 943c0e09200SDave Airlie #define RADEON_SURFACE6_LOWER_BOUND 0x0b64 944c0e09200SDave Airlie #define RADEON_SURFACE6_UPPER_BOUND 0x0b68 945c0e09200SDave Airlie #define RADEON_SURFACE7_INFO 0x0b7c 946c0e09200SDave Airlie #define RADEON_SURFACE7_LOWER_BOUND 0x0b74 947c0e09200SDave Airlie #define RADEON_SURFACE7_UPPER_BOUND 0x0b78 948c0e09200SDave Airlie #define RADEON_SW_SEMAPHORE 0x013c 949c0e09200SDave Airlie 950c0e09200SDave Airlie #define RADEON_WAIT_UNTIL 0x1720 951c0e09200SDave Airlie # define RADEON_WAIT_CRTC_PFLIP (1 << 0) 952c0e09200SDave Airlie # define RADEON_WAIT_2D_IDLE (1 << 14) 953c0e09200SDave Airlie # define RADEON_WAIT_3D_IDLE (1 << 15) 954c0e09200SDave Airlie # define RADEON_WAIT_2D_IDLECLEAN (1 << 16) 955c0e09200SDave Airlie # define RADEON_WAIT_3D_IDLECLEAN (1 << 17) 956c0e09200SDave Airlie # define RADEON_WAIT_HOST_IDLECLEAN (1 << 18) 957c0e09200SDave Airlie 958c0e09200SDave Airlie #define RADEON_RB3D_ZMASKOFFSET 0x3234 959c0e09200SDave Airlie #define RADEON_RB3D_ZSTENCILCNTL 0x1c2c 960c0e09200SDave Airlie # define RADEON_DEPTH_FORMAT_16BIT_INT_Z (0 << 0) 961c0e09200SDave Airlie # define RADEON_DEPTH_FORMAT_24BIT_INT_Z (2 << 0) 962c0e09200SDave Airlie 963c0e09200SDave Airlie /* CP registers */ 964c0e09200SDave Airlie #define RADEON_CP_ME_RAM_ADDR 0x07d4 965c0e09200SDave Airlie #define RADEON_CP_ME_RAM_RADDR 0x07d8 966c0e09200SDave Airlie #define RADEON_CP_ME_RAM_DATAH 0x07dc 967c0e09200SDave Airlie #define RADEON_CP_ME_RAM_DATAL 0x07e0 968c0e09200SDave Airlie 969c0e09200SDave Airlie #define RADEON_CP_RB_BASE 0x0700 970c0e09200SDave Airlie #define RADEON_CP_RB_CNTL 0x0704 971c0e09200SDave Airlie # define RADEON_BUF_SWAP_32BIT (2 << 16) 972c0e09200SDave Airlie # define RADEON_RB_NO_UPDATE (1 << 27) 973*befb73c2SAlex Deucher # define RADEON_RB_RPTR_WR_ENA (1 << 31) 974c0e09200SDave Airlie #define RADEON_CP_RB_RPTR_ADDR 0x070c 975c0e09200SDave Airlie #define RADEON_CP_RB_RPTR 0x0710 976c0e09200SDave Airlie #define RADEON_CP_RB_WPTR 0x0714 977c0e09200SDave Airlie 978c0e09200SDave Airlie #define RADEON_CP_RB_WPTR_DELAY 0x0718 979c0e09200SDave Airlie # define RADEON_PRE_WRITE_TIMER_SHIFT 0 980c0e09200SDave Airlie # define RADEON_PRE_WRITE_LIMIT_SHIFT 23 981c0e09200SDave Airlie 982c0e09200SDave Airlie #define RADEON_CP_IB_BASE 0x0738 983c0e09200SDave Airlie 984c0e09200SDave Airlie #define RADEON_CP_CSQ_CNTL 0x0740 985c0e09200SDave Airlie # define RADEON_CSQ_CNT_PRIMARY_MASK (0xff << 0) 986c0e09200SDave Airlie # define RADEON_CSQ_PRIDIS_INDDIS (0 << 28) 987c0e09200SDave Airlie # define RADEON_CSQ_PRIPIO_INDDIS (1 << 28) 988c0e09200SDave Airlie # define RADEON_CSQ_PRIBM_INDDIS (2 << 28) 989c0e09200SDave Airlie # define RADEON_CSQ_PRIPIO_INDBM (3 << 28) 990c0e09200SDave Airlie # define RADEON_CSQ_PRIBM_INDBM (4 << 28) 991c0e09200SDave Airlie # define RADEON_CSQ_PRIPIO_INDPIO (15 << 28) 992c0e09200SDave Airlie 993c0e09200SDave Airlie #define RADEON_AIC_CNTL 0x01d0 994c0e09200SDave Airlie # define RADEON_PCIGART_TRANSLATE_EN (1 << 0) 9954e270e9bSAlex Deucher # define RS400_MSI_REARM (1 << 3) 996c0e09200SDave Airlie #define RADEON_AIC_STAT 0x01d4 997c0e09200SDave Airlie #define RADEON_AIC_PT_BASE 0x01d8 998c0e09200SDave Airlie #define RADEON_AIC_LO_ADDR 0x01dc 999c0e09200SDave Airlie #define RADEON_AIC_HI_ADDR 0x01e0 1000c0e09200SDave Airlie #define RADEON_AIC_TLB_ADDR 0x01e4 1001c0e09200SDave Airlie #define RADEON_AIC_TLB_DATA 0x01e8 1002c0e09200SDave Airlie 1003c0e09200SDave Airlie /* CP command packets */ 1004c0e09200SDave Airlie #define RADEON_CP_PACKET0 0x00000000 1005c0e09200SDave Airlie # define RADEON_ONE_REG_WR (1 << 15) 1006c0e09200SDave Airlie #define RADEON_CP_PACKET1 0x40000000 1007c0e09200SDave Airlie #define RADEON_CP_PACKET2 0x80000000 1008c0e09200SDave Airlie #define RADEON_CP_PACKET3 0xC0000000 1009c0e09200SDave Airlie # define RADEON_CP_NOP 0x00001000 1010c0e09200SDave Airlie # define RADEON_CP_NEXT_CHAR 0x00001900 1011c0e09200SDave Airlie # define RADEON_CP_PLY_NEXTSCAN 0x00001D00 1012c0e09200SDave Airlie # define RADEON_CP_SET_SCISSORS 0x00001E00 1013c0e09200SDave Airlie /* GEN_INDX_PRIM is unsupported starting with R300 */ 1014c0e09200SDave Airlie # define RADEON_3D_RNDR_GEN_INDX_PRIM 0x00002300 1015c0e09200SDave Airlie # define RADEON_WAIT_FOR_IDLE 0x00002600 1016c0e09200SDave Airlie # define RADEON_3D_DRAW_VBUF 0x00002800 1017c0e09200SDave Airlie # define RADEON_3D_DRAW_IMMD 0x00002900 1018c0e09200SDave Airlie # define RADEON_3D_DRAW_INDX 0x00002A00 1019c0e09200SDave Airlie # define RADEON_CP_LOAD_PALETTE 0x00002C00 1020c0e09200SDave Airlie # define RADEON_3D_LOAD_VBPNTR 0x00002F00 1021c0e09200SDave Airlie # define RADEON_MPEG_IDCT_MACROBLOCK 0x00003000 1022c0e09200SDave Airlie # define RADEON_MPEG_IDCT_MACROBLOCK_REV 0x00003100 1023c0e09200SDave Airlie # define RADEON_3D_CLEAR_ZMASK 0x00003200 1024c0e09200SDave Airlie # define RADEON_CP_INDX_BUFFER 0x00003300 1025c0e09200SDave Airlie # define RADEON_CP_3D_DRAW_VBUF_2 0x00003400 1026c0e09200SDave Airlie # define RADEON_CP_3D_DRAW_IMMD_2 0x00003500 1027c0e09200SDave Airlie # define RADEON_CP_3D_DRAW_INDX_2 0x00003600 1028c0e09200SDave Airlie # define RADEON_3D_CLEAR_HIZ 0x00003700 1029c0e09200SDave Airlie # define RADEON_CP_3D_CLEAR_CMASK 0x00003802 1030c0e09200SDave Airlie # define RADEON_CNTL_HOSTDATA_BLT 0x00009400 1031c0e09200SDave Airlie # define RADEON_CNTL_PAINT_MULTI 0x00009A00 1032c0e09200SDave Airlie # define RADEON_CNTL_BITBLT_MULTI 0x00009B00 1033c0e09200SDave Airlie # define RADEON_CNTL_SET_SCISSORS 0xC0001E00 1034c0e09200SDave Airlie 1035*befb73c2SAlex Deucher # define R600_IT_INDIRECT_BUFFER 0x00003200 1036*befb73c2SAlex Deucher # define R600_IT_ME_INITIALIZE 0x00004400 1037*befb73c2SAlex Deucher # define R600_ME_INITIALIZE_DEVICE_ID(x) ((x) << 16) 1038*befb73c2SAlex Deucher # define R600_IT_EVENT_WRITE 0x00004600 1039*befb73c2SAlex Deucher # define R600_IT_SET_CONFIG_REG 0x00006800 1040*befb73c2SAlex Deucher # define R600_SET_CONFIG_REG_OFFSET 0x00008000 1041*befb73c2SAlex Deucher # define R600_SET_CONFIG_REG_END 0x0000ac00 1042*befb73c2SAlex Deucher 1043c0e09200SDave Airlie #define RADEON_CP_PACKET_MASK 0xC0000000 1044c0e09200SDave Airlie #define RADEON_CP_PACKET_COUNT_MASK 0x3fff0000 1045c0e09200SDave Airlie #define RADEON_CP_PACKET0_REG_MASK 0x000007ff 1046c0e09200SDave Airlie #define RADEON_CP_PACKET1_REG0_MASK 0x000007ff 1047c0e09200SDave Airlie #define RADEON_CP_PACKET1_REG1_MASK 0x003ff800 1048c0e09200SDave Airlie 1049c0e09200SDave Airlie #define RADEON_VTX_Z_PRESENT (1 << 31) 1050c0e09200SDave Airlie #define RADEON_VTX_PKCOLOR_PRESENT (1 << 3) 1051c0e09200SDave Airlie 1052c0e09200SDave Airlie #define RADEON_PRIM_TYPE_NONE (0 << 0) 1053c0e09200SDave Airlie #define RADEON_PRIM_TYPE_POINT (1 << 0) 1054c0e09200SDave Airlie #define RADEON_PRIM_TYPE_LINE (2 << 0) 1055c0e09200SDave Airlie #define RADEON_PRIM_TYPE_LINE_STRIP (3 << 0) 1056c0e09200SDave Airlie #define RADEON_PRIM_TYPE_TRI_LIST (4 << 0) 1057c0e09200SDave Airlie #define RADEON_PRIM_TYPE_TRI_FAN (5 << 0) 1058c0e09200SDave Airlie #define RADEON_PRIM_TYPE_TRI_STRIP (6 << 0) 1059c0e09200SDave Airlie #define RADEON_PRIM_TYPE_TRI_TYPE2 (7 << 0) 1060c0e09200SDave Airlie #define RADEON_PRIM_TYPE_RECT_LIST (8 << 0) 1061c0e09200SDave Airlie #define RADEON_PRIM_TYPE_3VRT_POINT_LIST (9 << 0) 1062c0e09200SDave Airlie #define RADEON_PRIM_TYPE_3VRT_LINE_LIST (10 << 0) 1063c0e09200SDave Airlie #define RADEON_PRIM_TYPE_MASK 0xf 1064c0e09200SDave Airlie #define RADEON_PRIM_WALK_IND (1 << 4) 1065c0e09200SDave Airlie #define RADEON_PRIM_WALK_LIST (2 << 4) 1066c0e09200SDave Airlie #define RADEON_PRIM_WALK_RING (3 << 4) 1067c0e09200SDave Airlie #define RADEON_COLOR_ORDER_BGRA (0 << 6) 1068c0e09200SDave Airlie #define RADEON_COLOR_ORDER_RGBA (1 << 6) 1069c0e09200SDave Airlie #define RADEON_MAOS_ENABLE (1 << 7) 1070c0e09200SDave Airlie #define RADEON_VTX_FMT_R128_MODE (0 << 8) 1071c0e09200SDave Airlie #define RADEON_VTX_FMT_RADEON_MODE (1 << 8) 1072c0e09200SDave Airlie #define RADEON_NUM_VERTICES_SHIFT 16 1073c0e09200SDave Airlie 1074c0e09200SDave Airlie #define RADEON_COLOR_FORMAT_CI8 2 1075c0e09200SDave Airlie #define RADEON_COLOR_FORMAT_ARGB1555 3 1076c0e09200SDave Airlie #define RADEON_COLOR_FORMAT_RGB565 4 1077c0e09200SDave Airlie #define RADEON_COLOR_FORMAT_ARGB8888 6 1078c0e09200SDave Airlie #define RADEON_COLOR_FORMAT_RGB332 7 1079c0e09200SDave Airlie #define RADEON_COLOR_FORMAT_RGB8 9 1080c0e09200SDave Airlie #define RADEON_COLOR_FORMAT_ARGB4444 15 1081c0e09200SDave Airlie 1082c0e09200SDave Airlie #define RADEON_TXFORMAT_I8 0 1083c0e09200SDave Airlie #define RADEON_TXFORMAT_AI88 1 1084c0e09200SDave Airlie #define RADEON_TXFORMAT_RGB332 2 1085c0e09200SDave Airlie #define RADEON_TXFORMAT_ARGB1555 3 1086c0e09200SDave Airlie #define RADEON_TXFORMAT_RGB565 4 1087c0e09200SDave Airlie #define RADEON_TXFORMAT_ARGB4444 5 1088c0e09200SDave Airlie #define RADEON_TXFORMAT_ARGB8888 6 1089c0e09200SDave Airlie #define RADEON_TXFORMAT_RGBA8888 7 1090c0e09200SDave Airlie #define RADEON_TXFORMAT_Y8 8 1091c0e09200SDave Airlie #define RADEON_TXFORMAT_VYUY422 10 1092c0e09200SDave Airlie #define RADEON_TXFORMAT_YVYU422 11 1093c0e09200SDave Airlie #define RADEON_TXFORMAT_DXT1 12 1094c0e09200SDave Airlie #define RADEON_TXFORMAT_DXT23 14 1095c0e09200SDave Airlie #define RADEON_TXFORMAT_DXT45 15 1096c0e09200SDave Airlie 1097c0e09200SDave Airlie #define R200_PP_TXCBLEND_0 0x2f00 1098c0e09200SDave Airlie #define R200_PP_TXCBLEND_1 0x2f10 1099c0e09200SDave Airlie #define R200_PP_TXCBLEND_2 0x2f20 1100c0e09200SDave Airlie #define R200_PP_TXCBLEND_3 0x2f30 1101c0e09200SDave Airlie #define R200_PP_TXCBLEND_4 0x2f40 1102c0e09200SDave Airlie #define R200_PP_TXCBLEND_5 0x2f50 1103c0e09200SDave Airlie #define R200_PP_TXCBLEND_6 0x2f60 1104c0e09200SDave Airlie #define R200_PP_TXCBLEND_7 0x2f70 1105c0e09200SDave Airlie #define R200_SE_TCL_LIGHT_MODEL_CTL_0 0x2268 1106c0e09200SDave Airlie #define R200_PP_TFACTOR_0 0x2ee0 1107c0e09200SDave Airlie #define R200_SE_VTX_FMT_0 0x2088 1108c0e09200SDave Airlie #define R200_SE_VAP_CNTL 0x2080 1109c0e09200SDave Airlie #define R200_SE_TCL_MATRIX_SEL_0 0x2230 1110c0e09200SDave Airlie #define R200_SE_TCL_TEX_PROC_CTL_2 0x22a8 1111c0e09200SDave Airlie #define R200_SE_TCL_UCP_VERT_BLEND_CTL 0x22c0 1112c0e09200SDave Airlie #define R200_PP_TXFILTER_5 0x2ca0 1113c0e09200SDave Airlie #define R200_PP_TXFILTER_4 0x2c80 1114c0e09200SDave Airlie #define R200_PP_TXFILTER_3 0x2c60 1115c0e09200SDave Airlie #define R200_PP_TXFILTER_2 0x2c40 1116c0e09200SDave Airlie #define R200_PP_TXFILTER_1 0x2c20 1117c0e09200SDave Airlie #define R200_PP_TXFILTER_0 0x2c00 1118c0e09200SDave Airlie #define R200_PP_TXOFFSET_5 0x2d78 1119c0e09200SDave Airlie #define R200_PP_TXOFFSET_4 0x2d60 1120c0e09200SDave Airlie #define R200_PP_TXOFFSET_3 0x2d48 1121c0e09200SDave Airlie #define R200_PP_TXOFFSET_2 0x2d30 1122c0e09200SDave Airlie #define R200_PP_TXOFFSET_1 0x2d18 1123c0e09200SDave Airlie #define R200_PP_TXOFFSET_0 0x2d00 1124c0e09200SDave Airlie 1125c0e09200SDave Airlie #define R200_PP_CUBIC_FACES_0 0x2c18 1126c0e09200SDave Airlie #define R200_PP_CUBIC_FACES_1 0x2c38 1127c0e09200SDave Airlie #define R200_PP_CUBIC_FACES_2 0x2c58 1128c0e09200SDave Airlie #define R200_PP_CUBIC_FACES_3 0x2c78 1129c0e09200SDave Airlie #define R200_PP_CUBIC_FACES_4 0x2c98 1130c0e09200SDave Airlie #define R200_PP_CUBIC_FACES_5 0x2cb8 1131c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F1_0 0x2d04 1132c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F2_0 0x2d08 1133c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F3_0 0x2d0c 1134c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F4_0 0x2d10 1135c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F5_0 0x2d14 1136c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F1_1 0x2d1c 1137c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F2_1 0x2d20 1138c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F3_1 0x2d24 1139c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F4_1 0x2d28 1140c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F5_1 0x2d2c 1141c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F1_2 0x2d34 1142c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F2_2 0x2d38 1143c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F3_2 0x2d3c 1144c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F4_2 0x2d40 1145c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F5_2 0x2d44 1146c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F1_3 0x2d4c 1147c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F2_3 0x2d50 1148c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F3_3 0x2d54 1149c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F4_3 0x2d58 1150c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F5_3 0x2d5c 1151c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F1_4 0x2d64 1152c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F2_4 0x2d68 1153c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F3_4 0x2d6c 1154c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F4_4 0x2d70 1155c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F5_4 0x2d74 1156c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F1_5 0x2d7c 1157c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F2_5 0x2d80 1158c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F3_5 0x2d84 1159c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F4_5 0x2d88 1160c0e09200SDave Airlie #define R200_PP_CUBIC_OFFSET_F5_5 0x2d8c 1161c0e09200SDave Airlie 1162c0e09200SDave Airlie #define R200_RE_AUX_SCISSOR_CNTL 0x26f0 1163c0e09200SDave Airlie #define R200_SE_VTE_CNTL 0x20b0 1164c0e09200SDave Airlie #define R200_SE_TCL_OUTPUT_VTX_COMP_SEL 0x2250 1165c0e09200SDave Airlie #define R200_PP_TAM_DEBUG3 0x2d9c 1166c0e09200SDave Airlie #define R200_PP_CNTL_X 0x2cc4 1167c0e09200SDave Airlie #define R200_SE_VAP_CNTL_STATUS 0x2140 1168c0e09200SDave Airlie #define R200_RE_SCISSOR_TL_0 0x1cd8 1169c0e09200SDave Airlie #define R200_RE_SCISSOR_TL_1 0x1ce0 1170c0e09200SDave Airlie #define R200_RE_SCISSOR_TL_2 0x1ce8 1171c0e09200SDave Airlie #define R200_RB3D_DEPTHXY_OFFSET 0x1d60 1172c0e09200SDave Airlie #define R200_RE_AUX_SCISSOR_CNTL 0x26f0 1173c0e09200SDave Airlie #define R200_SE_VTX_STATE_CNTL 0x2180 1174c0e09200SDave Airlie #define R200_RE_POINTSIZE 0x2648 1175c0e09200SDave Airlie #define R200_SE_TCL_INPUT_VTX_VECTOR_ADDR_0 0x2254 1176c0e09200SDave Airlie 1177c0e09200SDave Airlie #define RADEON_PP_TEX_SIZE_0 0x1d04 /* NPOT */ 1178c0e09200SDave Airlie #define RADEON_PP_TEX_SIZE_1 0x1d0c 1179c0e09200SDave Airlie #define RADEON_PP_TEX_SIZE_2 0x1d14 1180c0e09200SDave Airlie 1181c0e09200SDave Airlie #define RADEON_PP_CUBIC_FACES_0 0x1d24 1182c0e09200SDave Airlie #define RADEON_PP_CUBIC_FACES_1 0x1d28 1183c0e09200SDave Airlie #define RADEON_PP_CUBIC_FACES_2 0x1d2c 1184c0e09200SDave Airlie #define RADEON_PP_CUBIC_OFFSET_T0_0 0x1dd0 /* bits [31:5] */ 1185c0e09200SDave Airlie #define RADEON_PP_CUBIC_OFFSET_T1_0 0x1e00 1186c0e09200SDave Airlie #define RADEON_PP_CUBIC_OFFSET_T2_0 0x1e14 1187c0e09200SDave Airlie 1188c0e09200SDave Airlie #define RADEON_SE_TCL_STATE_FLUSH 0x2284 1189c0e09200SDave Airlie 1190c0e09200SDave Airlie #define SE_VAP_CNTL__TCL_ENA_MASK 0x00000001 1191c0e09200SDave Airlie #define SE_VAP_CNTL__FORCE_W_TO_ONE_MASK 0x00010000 1192c0e09200SDave Airlie #define SE_VAP_CNTL__VF_MAX_VTX_NUM__SHIFT 0x00000012 1193c0e09200SDave Airlie #define SE_VTE_CNTL__VTX_XY_FMT_MASK 0x00000100 1194c0e09200SDave Airlie #define SE_VTE_CNTL__VTX_Z_FMT_MASK 0x00000200 1195c0e09200SDave Airlie #define SE_VTX_FMT_0__VTX_Z0_PRESENT_MASK 0x00000001 1196c0e09200SDave Airlie #define SE_VTX_FMT_0__VTX_W0_PRESENT_MASK 0x00000002 1197c0e09200SDave Airlie #define SE_VTX_FMT_0__VTX_COLOR_0_FMT__SHIFT 0x0000000b 1198c0e09200SDave Airlie #define R200_3D_DRAW_IMMD_2 0xC0003500 1199c0e09200SDave Airlie #define R200_SE_VTX_FMT_1 0x208c 1200c0e09200SDave Airlie #define R200_RE_CNTL 0x1c50 1201c0e09200SDave Airlie 1202c0e09200SDave Airlie #define R200_RB3D_BLENDCOLOR 0x3218 1203c0e09200SDave Airlie 1204c0e09200SDave Airlie #define R200_SE_TCL_POINT_SPRITE_CNTL 0x22c4 1205c0e09200SDave Airlie 1206c0e09200SDave Airlie #define R200_PP_TRI_PERF 0x2cf8 1207c0e09200SDave Airlie 1208c0e09200SDave Airlie #define R200_PP_AFS_0 0x2f80 1209c0e09200SDave Airlie #define R200_PP_AFS_1 0x2f00 /* same as txcblend_0 */ 1210c0e09200SDave Airlie 1211c0e09200SDave Airlie #define R200_VAP_PVS_CNTL_1 0x22D0 1212c0e09200SDave Airlie 12130a3e67a4SJesse Barnes #define RADEON_CRTC_CRNT_FRAME 0x0214 12140a3e67a4SJesse Barnes #define RADEON_CRTC2_CRNT_FRAME 0x0314 12150a3e67a4SJesse Barnes 1216c0e09200SDave Airlie #define R500_D1CRTC_STATUS 0x609c 1217c0e09200SDave Airlie #define R500_D2CRTC_STATUS 0x689c 1218c0e09200SDave Airlie #define R500_CRTC_V_BLANK (1<<0) 1219c0e09200SDave Airlie 1220c0e09200SDave Airlie #define R500_D1CRTC_FRAME_COUNT 0x60a4 1221c0e09200SDave Airlie #define R500_D2CRTC_FRAME_COUNT 0x68a4 1222c0e09200SDave Airlie 1223c0e09200SDave Airlie #define R500_D1MODE_V_COUNTER 0x6530 1224c0e09200SDave Airlie #define R500_D2MODE_V_COUNTER 0x6d30 1225c0e09200SDave Airlie 1226c0e09200SDave Airlie #define R500_D1MODE_VBLANK_STATUS 0x6534 1227c0e09200SDave Airlie #define R500_D2MODE_VBLANK_STATUS 0x6d34 1228c0e09200SDave Airlie #define R500_VBLANK_OCCURED (1<<0) 1229c0e09200SDave Airlie #define R500_VBLANK_ACK (1<<4) 1230c0e09200SDave Airlie #define R500_VBLANK_STAT (1<<12) 1231c0e09200SDave Airlie #define R500_VBLANK_INT (1<<16) 1232c0e09200SDave Airlie 1233c0e09200SDave Airlie #define R500_DxMODE_INT_MASK 0x6540 1234c0e09200SDave Airlie #define R500_D1MODE_INT_MASK (1<<0) 1235c0e09200SDave Airlie #define R500_D2MODE_INT_MASK (1<<8) 1236c0e09200SDave Airlie 1237c0e09200SDave Airlie #define R500_DISP_INTERRUPT_STATUS 0x7edc 1238c0e09200SDave Airlie #define R500_D1_VBLANK_INTERRUPT (1 << 4) 1239c0e09200SDave Airlie #define R500_D2_VBLANK_INTERRUPT (1 << 5) 1240c0e09200SDave Airlie 1241*befb73c2SAlex Deucher /* R6xx/R7xx registers */ 1242*befb73c2SAlex Deucher #define R600_MC_VM_FB_LOCATION 0x2180 1243*befb73c2SAlex Deucher #define R600_MC_VM_AGP_TOP 0x2184 1244*befb73c2SAlex Deucher #define R600_MC_VM_AGP_BOT 0x2188 1245*befb73c2SAlex Deucher #define R600_MC_VM_AGP_BASE 0x218c 1246*befb73c2SAlex Deucher #define R600_MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2190 1247*befb73c2SAlex Deucher #define R600_MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2194 1248*befb73c2SAlex Deucher #define R600_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x2198 1249*befb73c2SAlex Deucher 1250*befb73c2SAlex Deucher #define R700_MC_VM_FB_LOCATION 0x2024 1251*befb73c2SAlex Deucher #define R700_MC_VM_AGP_TOP 0x2028 1252*befb73c2SAlex Deucher #define R700_MC_VM_AGP_BOT 0x202c 1253*befb73c2SAlex Deucher #define R700_MC_VM_AGP_BASE 0x2030 1254*befb73c2SAlex Deucher #define R700_MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2034 1255*befb73c2SAlex Deucher #define R700_MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038 1256*befb73c2SAlex Deucher #define R700_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x203c 1257*befb73c2SAlex Deucher 1258*befb73c2SAlex Deucher #define R600_MCD_RD_A_CNTL 0x219c 1259*befb73c2SAlex Deucher #define R600_MCD_RD_B_CNTL 0x21a0 1260*befb73c2SAlex Deucher 1261*befb73c2SAlex Deucher #define R600_MCD_WR_A_CNTL 0x21a4 1262*befb73c2SAlex Deucher #define R600_MCD_WR_B_CNTL 0x21a8 1263*befb73c2SAlex Deucher 1264*befb73c2SAlex Deucher #define R600_MCD_RD_SYS_CNTL 0x2200 1265*befb73c2SAlex Deucher #define R600_MCD_WR_SYS_CNTL 0x2214 1266*befb73c2SAlex Deucher 1267*befb73c2SAlex Deucher #define R600_MCD_RD_GFX_CNTL 0x21fc 1268*befb73c2SAlex Deucher #define R600_MCD_RD_HDP_CNTL 0x2204 1269*befb73c2SAlex Deucher #define R600_MCD_RD_PDMA_CNTL 0x2208 1270*befb73c2SAlex Deucher #define R600_MCD_RD_SEM_CNTL 0x220c 1271*befb73c2SAlex Deucher #define R600_MCD_WR_GFX_CNTL 0x2210 1272*befb73c2SAlex Deucher #define R600_MCD_WR_HDP_CNTL 0x2218 1273*befb73c2SAlex Deucher #define R600_MCD_WR_PDMA_CNTL 0x221c 1274*befb73c2SAlex Deucher #define R600_MCD_WR_SEM_CNTL 0x2220 1275*befb73c2SAlex Deucher 1276*befb73c2SAlex Deucher # define R600_MCD_L1_TLB (1 << 0) 1277*befb73c2SAlex Deucher # define R600_MCD_L1_FRAG_PROC (1 << 1) 1278*befb73c2SAlex Deucher # define R600_MCD_L1_STRICT_ORDERING (1 << 2) 1279*befb73c2SAlex Deucher 1280*befb73c2SAlex Deucher # define R600_MCD_SYSTEM_ACCESS_MODE_MASK (3 << 6) 1281*befb73c2SAlex Deucher # define R600_MCD_SYSTEM_ACCESS_MODE_PA_ONLY (0 << 6) 1282*befb73c2SAlex Deucher # define R600_MCD_SYSTEM_ACCESS_MODE_USE_SYS_MAP (1 << 6) 1283*befb73c2SAlex Deucher # define R600_MCD_SYSTEM_ACCESS_MODE_IN_SYS (2 << 6) 1284*befb73c2SAlex Deucher # define R600_MCD_SYSTEM_ACCESS_MODE_NOT_IN_SYS (3 << 6) 1285*befb73c2SAlex Deucher 1286*befb73c2SAlex Deucher # define R600_MCD_SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU (0 << 8) 1287*befb73c2SAlex Deucher # define R600_MCD_SYSTEM_APERTURE_UNMAPPED_ACCESS_DEFAULT_PAGE (1 << 8) 1288*befb73c2SAlex Deucher 1289*befb73c2SAlex Deucher # define R600_MCD_SEMAPHORE_MODE (1 << 10) 1290*befb73c2SAlex Deucher # define R600_MCD_WAIT_L2_QUERY (1 << 11) 1291*befb73c2SAlex Deucher # define R600_MCD_EFFECTIVE_L1_TLB_SIZE(x) ((x) << 12) 1292*befb73c2SAlex Deucher # define R600_MCD_EFFECTIVE_L1_QUEUE_SIZE(x) ((x) << 15) 1293*befb73c2SAlex Deucher 1294*befb73c2SAlex Deucher #define R700_MC_VM_MD_L1_TLB0_CNTL 0x2654 1295*befb73c2SAlex Deucher #define R700_MC_VM_MD_L1_TLB1_CNTL 0x2658 1296*befb73c2SAlex Deucher #define R700_MC_VM_MD_L1_TLB2_CNTL 0x265c 1297*befb73c2SAlex Deucher 1298*befb73c2SAlex Deucher #define R700_MC_VM_MB_L1_TLB0_CNTL 0x2234 1299*befb73c2SAlex Deucher #define R700_MC_VM_MB_L1_TLB1_CNTL 0x2238 1300*befb73c2SAlex Deucher #define R700_MC_VM_MB_L1_TLB2_CNTL 0x223c 1301*befb73c2SAlex Deucher #define R700_MC_VM_MB_L1_TLB3_CNTL 0x2240 1302*befb73c2SAlex Deucher 1303*befb73c2SAlex Deucher # define R700_ENABLE_L1_TLB (1 << 0) 1304*befb73c2SAlex Deucher # define R700_ENABLE_L1_FRAGMENT_PROCESSING (1 << 1) 1305*befb73c2SAlex Deucher # define R700_SYSTEM_ACCESS_MODE_IN_SYS (2 << 3) 1306*befb73c2SAlex Deucher # define R700_SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU (0 << 5) 1307*befb73c2SAlex Deucher # define R700_EFFECTIVE_L1_TLB_SIZE(x) ((x) << 15) 1308*befb73c2SAlex Deucher # define R700_EFFECTIVE_L1_QUEUE_SIZE(x) ((x) << 18) 1309*befb73c2SAlex Deucher 1310*befb73c2SAlex Deucher #define R700_MC_ARB_RAMCFG 0x2760 1311*befb73c2SAlex Deucher # define R700_NOOFBANK_SHIFT 0 1312*befb73c2SAlex Deucher # define R700_NOOFBANK_MASK 0x3 1313*befb73c2SAlex Deucher # define R700_NOOFRANK_SHIFT 2 1314*befb73c2SAlex Deucher # define R700_NOOFRANK_MASK 0x1 1315*befb73c2SAlex Deucher # define R700_NOOFROWS_SHIFT 3 1316*befb73c2SAlex Deucher # define R700_NOOFROWS_MASK 0x7 1317*befb73c2SAlex Deucher # define R700_NOOFCOLS_SHIFT 6 1318*befb73c2SAlex Deucher # define R700_NOOFCOLS_MASK 0x3 1319*befb73c2SAlex Deucher # define R700_CHANSIZE_SHIFT 8 1320*befb73c2SAlex Deucher # define R700_CHANSIZE_MASK 0x1 1321*befb73c2SAlex Deucher # define R700_BURSTLENGTH_SHIFT 9 1322*befb73c2SAlex Deucher # define R700_BURSTLENGTH_MASK 0x1 1323*befb73c2SAlex Deucher #define R600_RAMCFG 0x2408 1324*befb73c2SAlex Deucher # define R600_NOOFBANK_SHIFT 0 1325*befb73c2SAlex Deucher # define R600_NOOFBANK_MASK 0x1 1326*befb73c2SAlex Deucher # define R600_NOOFRANK_SHIFT 1 1327*befb73c2SAlex Deucher # define R600_NOOFRANK_MASK 0x1 1328*befb73c2SAlex Deucher # define R600_NOOFROWS_SHIFT 2 1329*befb73c2SAlex Deucher # define R600_NOOFROWS_MASK 0x7 1330*befb73c2SAlex Deucher # define R600_NOOFCOLS_SHIFT 5 1331*befb73c2SAlex Deucher # define R600_NOOFCOLS_MASK 0x3 1332*befb73c2SAlex Deucher # define R600_CHANSIZE_SHIFT 7 1333*befb73c2SAlex Deucher # define R600_CHANSIZE_MASK 0x1 1334*befb73c2SAlex Deucher # define R600_BURSTLENGTH_SHIFT 8 1335*befb73c2SAlex Deucher # define R600_BURSTLENGTH_MASK 0x1 1336*befb73c2SAlex Deucher 1337*befb73c2SAlex Deucher #define R600_VM_L2_CNTL 0x1400 1338*befb73c2SAlex Deucher # define R600_VM_L2_CACHE_EN (1 << 0) 1339*befb73c2SAlex Deucher # define R600_VM_L2_FRAG_PROC (1 << 1) 1340*befb73c2SAlex Deucher # define R600_VM_ENABLE_PTE_CACHE_LRU_W (1 << 9) 1341*befb73c2SAlex Deucher # define R600_VM_L2_CNTL_QUEUE_SIZE(x) ((x) << 13) 1342*befb73c2SAlex Deucher # define R700_VM_L2_CNTL_QUEUE_SIZE(x) ((x) << 14) 1343*befb73c2SAlex Deucher 1344*befb73c2SAlex Deucher #define R600_VM_L2_CNTL2 0x1404 1345*befb73c2SAlex Deucher # define R600_VM_L2_CNTL2_INVALIDATE_ALL_L1_TLBS (1 << 0) 1346*befb73c2SAlex Deucher # define R600_VM_L2_CNTL2_INVALIDATE_L2_CACHE (1 << 1) 1347*befb73c2SAlex Deucher #define R600_VM_L2_CNTL3 0x1408 1348*befb73c2SAlex Deucher # define R600_VM_L2_CNTL3_BANK_SELECT_0(x) ((x) << 0) 1349*befb73c2SAlex Deucher # define R600_VM_L2_CNTL3_BANK_SELECT_1(x) ((x) << 5) 1350*befb73c2SAlex Deucher # define R600_VM_L2_CNTL3_CACHE_UPDATE_MODE(x) ((x) << 10) 1351*befb73c2SAlex Deucher # define R700_VM_L2_CNTL3_BANK_SELECT(x) ((x) << 0) 1352*befb73c2SAlex Deucher # define R700_VM_L2_CNTL3_CACHE_UPDATE_MODE(x) ((x) << 6) 1353*befb73c2SAlex Deucher 1354*befb73c2SAlex Deucher #define R600_VM_L2_STATUS 0x140c 1355*befb73c2SAlex Deucher 1356*befb73c2SAlex Deucher #define R600_VM_CONTEXT0_CNTL 0x1410 1357*befb73c2SAlex Deucher # define R600_VM_ENABLE_CONTEXT (1 << 0) 1358*befb73c2SAlex Deucher # define R600_VM_PAGE_TABLE_DEPTH_FLAT (0 << 1) 1359*befb73c2SAlex Deucher 1360*befb73c2SAlex Deucher #define R600_VM_CONTEXT0_CNTL2 0x1430 1361*befb73c2SAlex Deucher #define R600_VM_CONTEXT0_REQUEST_RESPONSE 0x1470 1362*befb73c2SAlex Deucher #define R600_VM_CONTEXT0_INVALIDATION_LOW_ADDR 0x1490 1363*befb73c2SAlex Deucher #define R600_VM_CONTEXT0_INVALIDATION_HIGH_ADDR 0x14b0 1364*befb73c2SAlex Deucher #define R600_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR 0x1574 1365*befb73c2SAlex Deucher #define R600_VM_CONTEXT0_PAGE_TABLE_START_ADDR 0x1594 1366*befb73c2SAlex Deucher #define R600_VM_CONTEXT0_PAGE_TABLE_END_ADDR 0x15b4 1367*befb73c2SAlex Deucher 1368*befb73c2SAlex Deucher #define R700_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR 0x153c 1369*befb73c2SAlex Deucher #define R700_VM_CONTEXT0_PAGE_TABLE_START_ADDR 0x155c 1370*befb73c2SAlex Deucher #define R700_VM_CONTEXT0_PAGE_TABLE_END_ADDR 0x157c 1371*befb73c2SAlex Deucher 1372*befb73c2SAlex Deucher #define R600_HDP_HOST_PATH_CNTL 0x2c00 1373*befb73c2SAlex Deucher 1374*befb73c2SAlex Deucher #define R600_GRBM_CNTL 0x8000 1375*befb73c2SAlex Deucher # define R600_GRBM_READ_TIMEOUT(x) ((x) << 0) 1376*befb73c2SAlex Deucher 1377*befb73c2SAlex Deucher #define R600_GRBM_STATUS 0x8010 1378*befb73c2SAlex Deucher # define R600_CMDFIFO_AVAIL_MASK 0x1f 1379*befb73c2SAlex Deucher # define R700_CMDFIFO_AVAIL_MASK 0xf 1380*befb73c2SAlex Deucher # define R600_GUI_ACTIVE (1 << 31) 1381*befb73c2SAlex Deucher #define R600_GRBM_STATUS2 0x8014 1382*befb73c2SAlex Deucher #define R600_GRBM_SOFT_RESET 0x8020 1383*befb73c2SAlex Deucher # define R600_SOFT_RESET_CP (1 << 0) 1384*befb73c2SAlex Deucher #define R600_WAIT_UNTIL 0x8040 1385*befb73c2SAlex Deucher 1386*befb73c2SAlex Deucher #define R600_CP_SEM_WAIT_TIMER 0x85bc 1387*befb73c2SAlex Deucher #define R600_CP_ME_CNTL 0x86d8 1388*befb73c2SAlex Deucher # define R600_CP_ME_HALT (1 << 28) 1389*befb73c2SAlex Deucher #define R600_CP_QUEUE_THRESHOLDS 0x8760 1390*befb73c2SAlex Deucher # define R600_ROQ_IB1_START(x) ((x) << 0) 1391*befb73c2SAlex Deucher # define R600_ROQ_IB2_START(x) ((x) << 8) 1392*befb73c2SAlex Deucher #define R600_CP_MEQ_THRESHOLDS 0x8764 1393*befb73c2SAlex Deucher # define R700_STQ_SPLIT(x) ((x) << 0) 1394*befb73c2SAlex Deucher # define R600_MEQ_END(x) ((x) << 16) 1395*befb73c2SAlex Deucher # define R600_ROQ_END(x) ((x) << 24) 1396*befb73c2SAlex Deucher #define R600_CP_PERFMON_CNTL 0x87fc 1397*befb73c2SAlex Deucher #define R600_CP_RB_BASE 0xc100 1398*befb73c2SAlex Deucher #define R600_CP_RB_CNTL 0xc104 1399*befb73c2SAlex Deucher # define R600_RB_BUFSZ(x) ((x) << 0) 1400*befb73c2SAlex Deucher # define R600_RB_BLKSZ(x) ((x) << 8) 1401*befb73c2SAlex Deucher # define R600_RB_NO_UPDATE (1 << 27) 1402*befb73c2SAlex Deucher # define R600_RB_RPTR_WR_ENA (1 << 31) 1403*befb73c2SAlex Deucher #define R600_CP_RB_RPTR_WR 0xc108 1404*befb73c2SAlex Deucher #define R600_CP_RB_RPTR_ADDR 0xc10c 1405*befb73c2SAlex Deucher #define R600_CP_RB_RPTR_ADDR_HI 0xc110 1406*befb73c2SAlex Deucher #define R600_CP_RB_WPTR 0xc114 1407*befb73c2SAlex Deucher #define R600_CP_RB_WPTR_ADDR 0xc118 1408*befb73c2SAlex Deucher #define R600_CP_RB_WPTR_ADDR_HI 0xc11c 1409*befb73c2SAlex Deucher #define R600_CP_RB_RPTR 0x8700 1410*befb73c2SAlex Deucher #define R600_CP_RB_WPTR_DELAY 0x8704 1411*befb73c2SAlex Deucher #define R600_CP_PFP_UCODE_ADDR 0xc150 1412*befb73c2SAlex Deucher #define R600_CP_PFP_UCODE_DATA 0xc154 1413*befb73c2SAlex Deucher #define R600_CP_ME_RAM_RADDR 0xc158 1414*befb73c2SAlex Deucher #define R600_CP_ME_RAM_WADDR 0xc15c 1415*befb73c2SAlex Deucher #define R600_CP_ME_RAM_DATA 0xc160 1416*befb73c2SAlex Deucher #define R600_CP_DEBUG 0xc1fc 1417*befb73c2SAlex Deucher 1418*befb73c2SAlex Deucher #define R600_PA_CL_ENHANCE 0x8a14 1419*befb73c2SAlex Deucher # define R600_CLIP_VTX_REORDER_ENA (1 << 0) 1420*befb73c2SAlex Deucher # define R600_NUM_CLIP_SEQ(x) ((x) << 1) 1421*befb73c2SAlex Deucher #define R600_PA_SC_LINE_STIPPLE_STATE 0x8b10 1422*befb73c2SAlex Deucher #define R600_PA_SC_MULTI_CHIP_CNTL 0x8b20 1423*befb73c2SAlex Deucher #define R700_PA_SC_FORCE_EOV_MAX_CNTS 0x8b24 1424*befb73c2SAlex Deucher # define R700_FORCE_EOV_MAX_CLK_CNT(x) ((x) << 0) 1425*befb73c2SAlex Deucher # define R700_FORCE_EOV_MAX_REZ_CNT(x) ((x) << 16) 1426*befb73c2SAlex Deucher #define R600_PA_SC_AA_SAMPLE_LOCS_2S 0x8b40 1427*befb73c2SAlex Deucher #define R600_PA_SC_AA_SAMPLE_LOCS_4S 0x8b44 1428*befb73c2SAlex Deucher #define R600_PA_SC_AA_SAMPLE_LOCS_8S_WD0 0x8b48 1429*befb73c2SAlex Deucher #define R600_PA_SC_AA_SAMPLE_LOCS_8S_WD1 0x8b4c 1430*befb73c2SAlex Deucher # define R600_S0_X(x) ((x) << 0) 1431*befb73c2SAlex Deucher # define R600_S0_Y(x) ((x) << 4) 1432*befb73c2SAlex Deucher # define R600_S1_X(x) ((x) << 8) 1433*befb73c2SAlex Deucher # define R600_S1_Y(x) ((x) << 12) 1434*befb73c2SAlex Deucher # define R600_S2_X(x) ((x) << 16) 1435*befb73c2SAlex Deucher # define R600_S2_Y(x) ((x) << 20) 1436*befb73c2SAlex Deucher # define R600_S3_X(x) ((x) << 24) 1437*befb73c2SAlex Deucher # define R600_S3_Y(x) ((x) << 28) 1438*befb73c2SAlex Deucher # define R600_S4_X(x) ((x) << 0) 1439*befb73c2SAlex Deucher # define R600_S4_Y(x) ((x) << 4) 1440*befb73c2SAlex Deucher # define R600_S5_X(x) ((x) << 8) 1441*befb73c2SAlex Deucher # define R600_S5_Y(x) ((x) << 12) 1442*befb73c2SAlex Deucher # define R600_S6_X(x) ((x) << 16) 1443*befb73c2SAlex Deucher # define R600_S6_Y(x) ((x) << 20) 1444*befb73c2SAlex Deucher # define R600_S7_X(x) ((x) << 24) 1445*befb73c2SAlex Deucher # define R600_S7_Y(x) ((x) << 28) 1446*befb73c2SAlex Deucher #define R600_PA_SC_FIFO_SIZE 0x8bd0 1447*befb73c2SAlex Deucher # define R600_SC_PRIM_FIFO_SIZE(x) ((x) << 0) 1448*befb73c2SAlex Deucher # define R600_SC_HIZ_TILE_FIFO_SIZE(x) ((x) << 8) 1449*befb73c2SAlex Deucher # define R600_SC_EARLYZ_TILE_FIFO_SIZE(x) ((x) << 16) 1450*befb73c2SAlex Deucher #define R700_PA_SC_FIFO_SIZE_R7XX 0x8bcc 1451*befb73c2SAlex Deucher # define R700_SC_PRIM_FIFO_SIZE(x) ((x) << 0) 1452*befb73c2SAlex Deucher # define R700_SC_HIZ_TILE_FIFO_SIZE(x) ((x) << 12) 1453*befb73c2SAlex Deucher # define R700_SC_EARLYZ_TILE_FIFO_SIZE(x) ((x) << 20) 1454*befb73c2SAlex Deucher #define R600_PA_SC_ENHANCE 0x8bf0 1455*befb73c2SAlex Deucher # define R600_FORCE_EOV_MAX_CLK_CNT(x) ((x) << 0) 1456*befb73c2SAlex Deucher # define R600_FORCE_EOV_MAX_TILE_CNT(x) ((x) << 12) 1457*befb73c2SAlex Deucher #define R600_PA_SC_CLIPRECT_RULE 0x2820c 1458*befb73c2SAlex Deucher #define R700_PA_SC_EDGERULE 0x28230 1459*befb73c2SAlex Deucher #define R600_PA_SC_LINE_STIPPLE 0x28a0c 1460*befb73c2SAlex Deucher #define R600_PA_SC_MODE_CNTL 0x28a4c 1461*befb73c2SAlex Deucher #define R600_PA_SC_AA_CONFIG 0x28c04 1462*befb73c2SAlex Deucher 1463*befb73c2SAlex Deucher #define R600_SX_EXPORT_BUFFER_SIZES 0x900c 1464*befb73c2SAlex Deucher # define R600_COLOR_BUFFER_SIZE(x) ((x) << 0) 1465*befb73c2SAlex Deucher # define R600_POSITION_BUFFER_SIZE(x) ((x) << 8) 1466*befb73c2SAlex Deucher # define R600_SMX_BUFFER_SIZE(x) ((x) << 16) 1467*befb73c2SAlex Deucher #define R600_SX_DEBUG_1 0x9054 1468*befb73c2SAlex Deucher # define R600_SMX_EVENT_RELEASE (1 << 0) 1469*befb73c2SAlex Deucher # define R600_ENABLE_NEW_SMX_ADDRESS (1 << 16) 1470*befb73c2SAlex Deucher #define R700_SX_DEBUG_1 0x9058 1471*befb73c2SAlex Deucher # define R700_ENABLE_NEW_SMX_ADDRESS (1 << 16) 1472*befb73c2SAlex Deucher #define R600_SX_MISC 0x28350 1473*befb73c2SAlex Deucher 1474*befb73c2SAlex Deucher #define R600_DB_DEBUG 0x9830 1475*befb73c2SAlex Deucher # define R600_PREZ_MUST_WAIT_FOR_POSTZ_DONE (1 << 31) 1476*befb73c2SAlex Deucher #define R600_DB_WATERMARKS 0x9838 1477*befb73c2SAlex Deucher # define R600_DEPTH_FREE(x) ((x) << 0) 1478*befb73c2SAlex Deucher # define R600_DEPTH_FLUSH(x) ((x) << 5) 1479*befb73c2SAlex Deucher # define R600_DEPTH_PENDING_FREE(x) ((x) << 15) 1480*befb73c2SAlex Deucher # define R600_DEPTH_CACHELINE_FREE(x) ((x) << 20) 1481*befb73c2SAlex Deucher #define R700_DB_DEBUG3 0x98b0 1482*befb73c2SAlex Deucher # define R700_DB_CLK_OFF_DELAY(x) ((x) << 11) 1483*befb73c2SAlex Deucher #define RV700_DB_DEBUG4 0x9b8c 1484*befb73c2SAlex Deucher # define RV700_DISABLE_TILE_COVERED_FOR_PS_ITER (1 << 6) 1485*befb73c2SAlex Deucher 1486*befb73c2SAlex Deucher #define R600_VGT_CACHE_INVALIDATION 0x88c4 1487*befb73c2SAlex Deucher # define R600_CACHE_INVALIDATION(x) ((x) << 0) 1488*befb73c2SAlex Deucher # define R600_VC_ONLY 0 1489*befb73c2SAlex Deucher # define R600_TC_ONLY 1 1490*befb73c2SAlex Deucher # define R600_VC_AND_TC 2 1491*befb73c2SAlex Deucher # define R700_AUTO_INVLD_EN(x) ((x) << 6) 1492*befb73c2SAlex Deucher # define R700_NO_AUTO 0 1493*befb73c2SAlex Deucher # define R700_ES_AUTO 1 1494*befb73c2SAlex Deucher # define R700_GS_AUTO 2 1495*befb73c2SAlex Deucher # define R700_ES_AND_GS_AUTO 3 1496*befb73c2SAlex Deucher #define R600_VGT_GS_PER_ES 0x88c8 1497*befb73c2SAlex Deucher #define R600_VGT_ES_PER_GS 0x88cc 1498*befb73c2SAlex Deucher #define R600_VGT_GS_PER_VS 0x88e8 1499*befb73c2SAlex Deucher #define R600_VGT_GS_VERTEX_REUSE 0x88d4 1500*befb73c2SAlex Deucher #define R600_VGT_NUM_INSTANCES 0x8974 1501*befb73c2SAlex Deucher #define R600_VGT_STRMOUT_EN 0x28ab0 1502*befb73c2SAlex Deucher #define R600_VGT_EVENT_INITIATOR 0x28a90 1503*befb73c2SAlex Deucher # define R600_CACHE_FLUSH_AND_INV_EVENT (0x16 << 0) 1504*befb73c2SAlex Deucher #define R600_VGT_VERTEX_REUSE_BLOCK_CNTL 0x28c58 1505*befb73c2SAlex Deucher # define R600_VTX_REUSE_DEPTH_MASK 0xff 1506*befb73c2SAlex Deucher #define R600_VGT_OUT_DEALLOC_CNTL 0x28c5c 1507*befb73c2SAlex Deucher # define R600_DEALLOC_DIST_MASK 0x7f 1508*befb73c2SAlex Deucher 1509*befb73c2SAlex Deucher #define R600_CB_COLOR0_BASE 0x28040 1510*befb73c2SAlex Deucher #define R600_CB_COLOR1_BASE 0x28044 1511*befb73c2SAlex Deucher #define R600_CB_COLOR2_BASE 0x28048 1512*befb73c2SAlex Deucher #define R600_CB_COLOR3_BASE 0x2804c 1513*befb73c2SAlex Deucher #define R600_CB_COLOR4_BASE 0x28050 1514*befb73c2SAlex Deucher #define R600_CB_COLOR5_BASE 0x28054 1515*befb73c2SAlex Deucher #define R600_CB_COLOR6_BASE 0x28058 1516*befb73c2SAlex Deucher #define R600_CB_COLOR7_BASE 0x2805c 1517*befb73c2SAlex Deucher #define R600_CB_COLOR7_FRAG 0x280fc 1518*befb73c2SAlex Deucher 1519*befb73c2SAlex Deucher #define R600_TC_CNTL 0x9608 1520*befb73c2SAlex Deucher # define R600_TC_L2_SIZE(x) ((x) << 5) 1521*befb73c2SAlex Deucher # define R600_L2_DISABLE_LATE_HIT (1 << 9) 1522*befb73c2SAlex Deucher 1523*befb73c2SAlex Deucher #define R600_ARB_POP 0x2418 1524*befb73c2SAlex Deucher # define R600_ENABLE_TC128 (1 << 30) 1525*befb73c2SAlex Deucher #define R600_ARB_GDEC_RD_CNTL 0x246c 1526*befb73c2SAlex Deucher 1527*befb73c2SAlex Deucher #define R600_TA_CNTL_AUX 0x9508 1528*befb73c2SAlex Deucher # define R600_DISABLE_CUBE_WRAP (1 << 0) 1529*befb73c2SAlex Deucher # define R600_DISABLE_CUBE_ANISO (1 << 1) 1530*befb73c2SAlex Deucher # define R700_GETLOD_SELECT(x) ((x) << 2) 1531*befb73c2SAlex Deucher # define R600_SYNC_GRADIENT (1 << 24) 1532*befb73c2SAlex Deucher # define R600_SYNC_WALKER (1 << 25) 1533*befb73c2SAlex Deucher # define R600_SYNC_ALIGNER (1 << 26) 1534*befb73c2SAlex Deucher # define R600_BILINEAR_PRECISION_6_BIT (0 << 31) 1535*befb73c2SAlex Deucher # define R600_BILINEAR_PRECISION_8_BIT (1 << 31) 1536*befb73c2SAlex Deucher 1537*befb73c2SAlex Deucher #define R700_TCP_CNTL 0x9610 1538*befb73c2SAlex Deucher 1539*befb73c2SAlex Deucher #define R600_SMX_DC_CTL0 0xa020 1540*befb73c2SAlex Deucher # define R700_USE_HASH_FUNCTION (1 << 0) 1541*befb73c2SAlex Deucher # define R700_CACHE_DEPTH(x) ((x) << 1) 1542*befb73c2SAlex Deucher # define R700_FLUSH_ALL_ON_EVENT (1 << 10) 1543*befb73c2SAlex Deucher # define R700_STALL_ON_EVENT (1 << 11) 1544*befb73c2SAlex Deucher #define R700_SMX_EVENT_CTL 0xa02c 1545*befb73c2SAlex Deucher # define R700_ES_FLUSH_CTL(x) ((x) << 0) 1546*befb73c2SAlex Deucher # define R700_GS_FLUSH_CTL(x) ((x) << 3) 1547*befb73c2SAlex Deucher # define R700_ACK_FLUSH_CTL(x) ((x) << 6) 1548*befb73c2SAlex Deucher # define R700_SYNC_FLUSH_CTL (1 << 8) 1549*befb73c2SAlex Deucher 1550*befb73c2SAlex Deucher #define R600_SQ_CONFIG 0x8c00 1551*befb73c2SAlex Deucher # define R600_VC_ENABLE (1 << 0) 1552*befb73c2SAlex Deucher # define R600_EXPORT_SRC_C (1 << 1) 1553*befb73c2SAlex Deucher # define R600_DX9_CONSTS (1 << 2) 1554*befb73c2SAlex Deucher # define R600_ALU_INST_PREFER_VECTOR (1 << 3) 1555*befb73c2SAlex Deucher # define R600_DX10_CLAMP (1 << 4) 1556*befb73c2SAlex Deucher # define R600_CLAUSE_SEQ_PRIO(x) ((x) << 8) 1557*befb73c2SAlex Deucher # define R600_PS_PRIO(x) ((x) << 24) 1558*befb73c2SAlex Deucher # define R600_VS_PRIO(x) ((x) << 26) 1559*befb73c2SAlex Deucher # define R600_GS_PRIO(x) ((x) << 28) 1560*befb73c2SAlex Deucher # define R600_ES_PRIO(x) ((x) << 30) 1561*befb73c2SAlex Deucher #define R600_SQ_GPR_RESOURCE_MGMT_1 0x8c04 1562*befb73c2SAlex Deucher # define R600_NUM_PS_GPRS(x) ((x) << 0) 1563*befb73c2SAlex Deucher # define R600_NUM_VS_GPRS(x) ((x) << 16) 1564*befb73c2SAlex Deucher # define R700_DYN_GPR_ENABLE (1 << 27) 1565*befb73c2SAlex Deucher # define R600_NUM_CLAUSE_TEMP_GPRS(x) ((x) << 28) 1566*befb73c2SAlex Deucher #define R600_SQ_GPR_RESOURCE_MGMT_2 0x8c08 1567*befb73c2SAlex Deucher # define R600_NUM_GS_GPRS(x) ((x) << 0) 1568*befb73c2SAlex Deucher # define R600_NUM_ES_GPRS(x) ((x) << 16) 1569*befb73c2SAlex Deucher #define R600_SQ_THREAD_RESOURCE_MGMT 0x8c0c 1570*befb73c2SAlex Deucher # define R600_NUM_PS_THREADS(x) ((x) << 0) 1571*befb73c2SAlex Deucher # define R600_NUM_VS_THREADS(x) ((x) << 8) 1572*befb73c2SAlex Deucher # define R600_NUM_GS_THREADS(x) ((x) << 16) 1573*befb73c2SAlex Deucher # define R600_NUM_ES_THREADS(x) ((x) << 24) 1574*befb73c2SAlex Deucher #define R600_SQ_STACK_RESOURCE_MGMT_1 0x8c10 1575*befb73c2SAlex Deucher # define R600_NUM_PS_STACK_ENTRIES(x) ((x) << 0) 1576*befb73c2SAlex Deucher # define R600_NUM_VS_STACK_ENTRIES(x) ((x) << 16) 1577*befb73c2SAlex Deucher #define R600_SQ_STACK_RESOURCE_MGMT_2 0x8c14 1578*befb73c2SAlex Deucher # define R600_NUM_GS_STACK_ENTRIES(x) ((x) << 0) 1579*befb73c2SAlex Deucher # define R600_NUM_ES_STACK_ENTRIES(x) ((x) << 16) 1580*befb73c2SAlex Deucher #define R600_SQ_MS_FIFO_SIZES 0x8cf0 1581*befb73c2SAlex Deucher # define R600_CACHE_FIFO_SIZE(x) ((x) << 0) 1582*befb73c2SAlex Deucher # define R600_FETCH_FIFO_HIWATER(x) ((x) << 8) 1583*befb73c2SAlex Deucher # define R600_DONE_FIFO_HIWATER(x) ((x) << 16) 1584*befb73c2SAlex Deucher # define R600_ALU_UPDATE_FIFO_HIWATER(x) ((x) << 24) 1585*befb73c2SAlex Deucher #define R700_SQ_DYN_GPR_SIZE_SIMD_AB_0 0x8db0 1586*befb73c2SAlex Deucher # define R700_SIMDA_RING0(x) ((x) << 0) 1587*befb73c2SAlex Deucher # define R700_SIMDA_RING1(x) ((x) << 8) 1588*befb73c2SAlex Deucher # define R700_SIMDB_RING0(x) ((x) << 16) 1589*befb73c2SAlex Deucher # define R700_SIMDB_RING1(x) ((x) << 24) 1590*befb73c2SAlex Deucher #define R700_SQ_DYN_GPR_SIZE_SIMD_AB_1 0x8db4 1591*befb73c2SAlex Deucher #define R700_SQ_DYN_GPR_SIZE_SIMD_AB_2 0x8db8 1592*befb73c2SAlex Deucher #define R700_SQ_DYN_GPR_SIZE_SIMD_AB_3 0x8dbc 1593*befb73c2SAlex Deucher #define R700_SQ_DYN_GPR_SIZE_SIMD_AB_4 0x8dc0 1594*befb73c2SAlex Deucher #define R700_SQ_DYN_GPR_SIZE_SIMD_AB_5 0x8dc4 1595*befb73c2SAlex Deucher #define R700_SQ_DYN_GPR_SIZE_SIMD_AB_6 0x8dc8 1596*befb73c2SAlex Deucher #define R700_SQ_DYN_GPR_SIZE_SIMD_AB_7 0x8dcc 1597*befb73c2SAlex Deucher 1598*befb73c2SAlex Deucher #define R600_SPI_PS_IN_CONTROL_0 0x286cc 1599*befb73c2SAlex Deucher # define R600_NUM_INTERP(x) ((x) << 0) 1600*befb73c2SAlex Deucher # define R600_POSITION_ENA (1 << 8) 1601*befb73c2SAlex Deucher # define R600_POSITION_CENTROID (1 << 9) 1602*befb73c2SAlex Deucher # define R600_POSITION_ADDR(x) ((x) << 10) 1603*befb73c2SAlex Deucher # define R600_PARAM_GEN(x) ((x) << 15) 1604*befb73c2SAlex Deucher # define R600_PARAM_GEN_ADDR(x) ((x) << 19) 1605*befb73c2SAlex Deucher # define R600_BARYC_SAMPLE_CNTL(x) ((x) << 26) 1606*befb73c2SAlex Deucher # define R600_PERSP_GRADIENT_ENA (1 << 28) 1607*befb73c2SAlex Deucher # define R600_LINEAR_GRADIENT_ENA (1 << 29) 1608*befb73c2SAlex Deucher # define R600_POSITION_SAMPLE (1 << 30) 1609*befb73c2SAlex Deucher # define R600_BARYC_AT_SAMPLE_ENA (1 << 31) 1610*befb73c2SAlex Deucher #define R600_SPI_PS_IN_CONTROL_1 0x286d0 1611*befb73c2SAlex Deucher # define R600_GEN_INDEX_PIX (1 << 0) 1612*befb73c2SAlex Deucher # define R600_GEN_INDEX_PIX_ADDR(x) ((x) << 1) 1613*befb73c2SAlex Deucher # define R600_FRONT_FACE_ENA (1 << 8) 1614*befb73c2SAlex Deucher # define R600_FRONT_FACE_CHAN(x) ((x) << 9) 1615*befb73c2SAlex Deucher # define R600_FRONT_FACE_ALL_BITS (1 << 11) 1616*befb73c2SAlex Deucher # define R600_FRONT_FACE_ADDR(x) ((x) << 12) 1617*befb73c2SAlex Deucher # define R600_FOG_ADDR(x) ((x) << 17) 1618*befb73c2SAlex Deucher # define R600_FIXED_PT_POSITION_ENA (1 << 24) 1619*befb73c2SAlex Deucher # define R600_FIXED_PT_POSITION_ADDR(x) ((x) << 25) 1620*befb73c2SAlex Deucher # define R700_POSITION_ULC (1 << 30) 1621*befb73c2SAlex Deucher #define R600_SPI_INPUT_Z 0x286d8 1622*befb73c2SAlex Deucher 1623*befb73c2SAlex Deucher #define R600_SPI_CONFIG_CNTL 0x9100 1624*befb73c2SAlex Deucher # define R600_GPR_WRITE_PRIORITY(x) ((x) << 0) 1625*befb73c2SAlex Deucher # define R600_DISABLE_INTERP_1 (1 << 5) 1626*befb73c2SAlex Deucher #define R600_SPI_CONFIG_CNTL_1 0x913c 1627*befb73c2SAlex Deucher # define R600_VTX_DONE_DELAY(x) ((x) << 0) 1628*befb73c2SAlex Deucher # define R600_INTERP_ONE_PRIM_PER_ROW (1 << 4) 1629*befb73c2SAlex Deucher 1630*befb73c2SAlex Deucher #define R600_GB_TILING_CONFIG 0x98f0 1631*befb73c2SAlex Deucher # define R600_PIPE_TILING(x) ((x) << 1) 1632*befb73c2SAlex Deucher # define R600_BANK_TILING(x) ((x) << 4) 1633*befb73c2SAlex Deucher # define R600_GROUP_SIZE(x) ((x) << 6) 1634*befb73c2SAlex Deucher # define R600_ROW_TILING(x) ((x) << 8) 1635*befb73c2SAlex Deucher # define R600_BANK_SWAPS(x) ((x) << 11) 1636*befb73c2SAlex Deucher # define R600_SAMPLE_SPLIT(x) ((x) << 14) 1637*befb73c2SAlex Deucher # define R600_BACKEND_MAP(x) ((x) << 16) 1638*befb73c2SAlex Deucher #define R600_DCP_TILING_CONFIG 0x6ca0 1639*befb73c2SAlex Deucher #define R600_HDP_TILING_CONFIG 0x2f3c 1640*befb73c2SAlex Deucher 1641*befb73c2SAlex Deucher #define R600_CC_RB_BACKEND_DISABLE 0x98f4 1642*befb73c2SAlex Deucher #define R700_CC_SYS_RB_BACKEND_DISABLE 0x3f88 1643*befb73c2SAlex Deucher # define R600_BACKEND_DISABLE(x) ((x) << 16) 1644*befb73c2SAlex Deucher 1645*befb73c2SAlex Deucher #define R600_CC_GC_SHADER_PIPE_CONFIG 0x8950 1646*befb73c2SAlex Deucher #define R600_GC_USER_SHADER_PIPE_CONFIG 0x8954 1647*befb73c2SAlex Deucher # define R600_INACTIVE_QD_PIPES(x) ((x) << 8) 1648*befb73c2SAlex Deucher # define R600_INACTIVE_QD_PIPES_MASK (0xff << 8) 1649*befb73c2SAlex Deucher # define R600_INACTIVE_SIMDS(x) ((x) << 16) 1650*befb73c2SAlex Deucher # define R600_INACTIVE_SIMDS_MASK (0xff << 16) 1651*befb73c2SAlex Deucher 1652*befb73c2SAlex Deucher #define R700_CGTS_SYS_TCC_DISABLE 0x3f90 1653*befb73c2SAlex Deucher #define R700_CGTS_USER_SYS_TCC_DISABLE 0x3f94 1654*befb73c2SAlex Deucher #define R700_CGTS_TCC_DISABLE 0x9148 1655*befb73c2SAlex Deucher #define R700_CGTS_USER_TCC_DISABLE 0x914c 1656*befb73c2SAlex Deucher 1657c0e09200SDave Airlie /* Constants */ 1658c0e09200SDave Airlie #define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ 1659c0e09200SDave Airlie 1660c0e09200SDave Airlie #define RADEON_LAST_FRAME_REG RADEON_SCRATCH_REG0 1661c0e09200SDave Airlie #define RADEON_LAST_DISPATCH_REG RADEON_SCRATCH_REG1 1662c0e09200SDave Airlie #define RADEON_LAST_CLEAR_REG RADEON_SCRATCH_REG2 1663c0e09200SDave Airlie #define RADEON_LAST_SWI_REG RADEON_SCRATCH_REG3 1664c0e09200SDave Airlie #define RADEON_LAST_DISPATCH 1 1665c0e09200SDave Airlie 1666*befb73c2SAlex Deucher #define R600_LAST_FRAME_REG R600_SCRATCH_REG0 1667*befb73c2SAlex Deucher #define R600_LAST_DISPATCH_REG R600_SCRATCH_REG1 1668*befb73c2SAlex Deucher #define R600_LAST_CLEAR_REG R600_SCRATCH_REG2 1669*befb73c2SAlex Deucher #define R600_LAST_SWI_REG R600_SCRATCH_REG3 1670*befb73c2SAlex Deucher 1671c0e09200SDave Airlie #define RADEON_MAX_VB_AGE 0x7fffffff 1672c0e09200SDave Airlie #define RADEON_MAX_VB_VERTS (0xffff) 1673c0e09200SDave Airlie 1674c0e09200SDave Airlie #define RADEON_RING_HIGH_MARK 128 1675c0e09200SDave Airlie 1676c0e09200SDave Airlie #define RADEON_PCIGART_TABLE_SIZE (32*1024) 1677c0e09200SDave Airlie 1678c0e09200SDave Airlie #define RADEON_READ(reg) DRM_READ32( dev_priv->mmio, (reg) ) 1679*befb73c2SAlex Deucher #define RADEON_WRITE(reg, val) \ 1680*befb73c2SAlex Deucher do { \ 1681*befb73c2SAlex Deucher if (reg < 0x10000) { \ 1682*befb73c2SAlex Deucher DRM_WRITE32(dev_priv->mmio, (reg), (val)); \ 1683*befb73c2SAlex Deucher } else { \ 1684*befb73c2SAlex Deucher DRM_WRITE32(dev_priv->mmio, RADEON_MM_INDEX, (reg)); \ 1685*befb73c2SAlex Deucher DRM_WRITE32(dev_priv->mmio, RADEON_MM_DATA, (val)); \ 1686*befb73c2SAlex Deucher } \ 1687*befb73c2SAlex Deucher } while (0) 1688c0e09200SDave Airlie #define RADEON_READ8(reg) DRM_READ8( dev_priv->mmio, (reg) ) 1689c0e09200SDave Airlie #define RADEON_WRITE8(reg,val) DRM_WRITE8( dev_priv->mmio, (reg), (val) ) 1690c0e09200SDave Airlie 1691c0e09200SDave Airlie #define RADEON_WRITE_PLL(addr, val) \ 1692c0e09200SDave Airlie do { \ 1693c0e09200SDave Airlie RADEON_WRITE8(RADEON_CLOCK_CNTL_INDEX, \ 1694c0e09200SDave Airlie ((addr) & 0x1f) | RADEON_PLL_WR_EN ); \ 1695c0e09200SDave Airlie RADEON_WRITE(RADEON_CLOCK_CNTL_DATA, (val)); \ 1696c0e09200SDave Airlie } while (0) 1697c0e09200SDave Airlie 1698c0e09200SDave Airlie #define RADEON_WRITE_PCIE(addr, val) \ 1699c0e09200SDave Airlie do { \ 1700c0e09200SDave Airlie RADEON_WRITE8(RADEON_PCIE_INDEX, \ 1701c0e09200SDave Airlie ((addr) & 0xff)); \ 1702c0e09200SDave Airlie RADEON_WRITE(RADEON_PCIE_DATA, (val)); \ 1703c0e09200SDave Airlie } while (0) 1704c0e09200SDave Airlie 1705c0e09200SDave Airlie #define R500_WRITE_MCIND(addr, val) \ 1706c0e09200SDave Airlie do { \ 1707c0e09200SDave Airlie RADEON_WRITE(R520_MC_IND_INDEX, 0xff0000 | ((addr) & 0xff)); \ 1708c0e09200SDave Airlie RADEON_WRITE(R520_MC_IND_DATA, (val)); \ 1709c0e09200SDave Airlie RADEON_WRITE(R520_MC_IND_INDEX, 0); \ 1710c0e09200SDave Airlie } while (0) 1711c0e09200SDave Airlie 1712c0e09200SDave Airlie #define RS480_WRITE_MCIND(addr, val) \ 1713c0e09200SDave Airlie do { \ 1714c0e09200SDave Airlie RADEON_WRITE(RS480_NB_MC_INDEX, \ 1715c0e09200SDave Airlie ((addr) & 0xff) | RS480_NB_MC_IND_WR_EN); \ 1716c0e09200SDave Airlie RADEON_WRITE(RS480_NB_MC_DATA, (val)); \ 1717c0e09200SDave Airlie RADEON_WRITE(RS480_NB_MC_INDEX, 0xff); \ 1718c0e09200SDave Airlie } while (0) 1719c0e09200SDave Airlie 1720c0e09200SDave Airlie #define RS690_WRITE_MCIND(addr, val) \ 1721c0e09200SDave Airlie do { \ 1722c0e09200SDave Airlie RADEON_WRITE(RS690_MC_INDEX, RS690_MC_INDEX_WR_EN | ((addr) & RS690_MC_INDEX_MASK)); \ 1723c0e09200SDave Airlie RADEON_WRITE(RS690_MC_DATA, val); \ 1724c0e09200SDave Airlie RADEON_WRITE(RS690_MC_INDEX, RS690_MC_INDEX_WR_ACK); \ 1725c0e09200SDave Airlie } while (0) 1726c0e09200SDave Airlie 1727c0e09200SDave Airlie #define IGP_WRITE_MCIND(addr, val) \ 1728c0e09200SDave Airlie do { \ 1729f0738e92SAlex Deucher if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || \ 1730f0738e92SAlex Deucher ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) \ 1731c0e09200SDave Airlie RS690_WRITE_MCIND(addr, val); \ 1732c0e09200SDave Airlie else \ 1733c0e09200SDave Airlie RS480_WRITE_MCIND(addr, val); \ 1734c0e09200SDave Airlie } while (0) 1735c0e09200SDave Airlie 1736c0e09200SDave Airlie #define CP_PACKET0( reg, n ) \ 1737c0e09200SDave Airlie (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) 1738c0e09200SDave Airlie #define CP_PACKET0_TABLE( reg, n ) \ 1739c0e09200SDave Airlie (RADEON_CP_PACKET0 | RADEON_ONE_REG_WR | ((n) << 16) | ((reg) >> 2)) 1740c0e09200SDave Airlie #define CP_PACKET1( reg0, reg1 ) \ 1741c0e09200SDave Airlie (RADEON_CP_PACKET1 | (((reg1) >> 2) << 15) | ((reg0) >> 2)) 1742c0e09200SDave Airlie #define CP_PACKET2() \ 1743c0e09200SDave Airlie (RADEON_CP_PACKET2) 1744c0e09200SDave Airlie #define CP_PACKET3( pkt, n ) \ 1745c0e09200SDave Airlie (RADEON_CP_PACKET3 | (pkt) | ((n) << 16)) 1746c0e09200SDave Airlie 1747c0e09200SDave Airlie /* ================================================================ 1748c0e09200SDave Airlie * Engine control helper macros 1749c0e09200SDave Airlie */ 1750c0e09200SDave Airlie 1751c0e09200SDave Airlie #define RADEON_WAIT_UNTIL_2D_IDLE() do { \ 1752c0e09200SDave Airlie OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ 1753c0e09200SDave Airlie OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ 1754c0e09200SDave Airlie RADEON_WAIT_HOST_IDLECLEAN) ); \ 1755c0e09200SDave Airlie } while (0) 1756c0e09200SDave Airlie 1757c0e09200SDave Airlie #define RADEON_WAIT_UNTIL_3D_IDLE() do { \ 1758c0e09200SDave Airlie OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ 1759c0e09200SDave Airlie OUT_RING( (RADEON_WAIT_3D_IDLECLEAN | \ 1760c0e09200SDave Airlie RADEON_WAIT_HOST_IDLECLEAN) ); \ 1761c0e09200SDave Airlie } while (0) 1762c0e09200SDave Airlie 1763c0e09200SDave Airlie #define RADEON_WAIT_UNTIL_IDLE() do { \ 1764c0e09200SDave Airlie OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ 1765c0e09200SDave Airlie OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ 1766c0e09200SDave Airlie RADEON_WAIT_3D_IDLECLEAN | \ 1767c0e09200SDave Airlie RADEON_WAIT_HOST_IDLECLEAN) ); \ 1768c0e09200SDave Airlie } while (0) 1769c0e09200SDave Airlie 1770c0e09200SDave Airlie #define RADEON_WAIT_UNTIL_PAGE_FLIPPED() do { \ 1771c0e09200SDave Airlie OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ 1772c0e09200SDave Airlie OUT_RING( RADEON_WAIT_CRTC_PFLIP ); \ 1773c0e09200SDave Airlie } while (0) 1774c0e09200SDave Airlie 1775c0e09200SDave Airlie #define RADEON_FLUSH_CACHE() do { \ 1776c0e09200SDave Airlie if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \ 1777c0e09200SDave Airlie OUT_RING(CP_PACKET0(RADEON_RB3D_DSTCACHE_CTLSTAT, 0)); \ 1778c0e09200SDave Airlie OUT_RING(RADEON_RB3D_DC_FLUSH); \ 1779c0e09200SDave Airlie } else { \ 1780c0e09200SDave Airlie OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \ 178154f961a6SJerome Glisse OUT_RING(R300_RB3D_DC_FLUSH); \ 1782c0e09200SDave Airlie } \ 1783c0e09200SDave Airlie } while (0) 1784c0e09200SDave Airlie 1785c0e09200SDave Airlie #define RADEON_PURGE_CACHE() do { \ 1786c0e09200SDave Airlie if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \ 1787c0e09200SDave Airlie OUT_RING(CP_PACKET0(RADEON_RB3D_DSTCACHE_CTLSTAT, 0)); \ 178854f961a6SJerome Glisse OUT_RING(RADEON_RB3D_DC_FLUSH | RADEON_RB3D_DC_FREE); \ 1789c0e09200SDave Airlie } else { \ 1790c0e09200SDave Airlie OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \ 179154f961a6SJerome Glisse OUT_RING(R300_RB3D_DC_FLUSH | R300_RB3D_DC_FREE); \ 1792c0e09200SDave Airlie } \ 1793c0e09200SDave Airlie } while (0) 1794c0e09200SDave Airlie 1795c0e09200SDave Airlie #define RADEON_FLUSH_ZCACHE() do { \ 1796c0e09200SDave Airlie if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \ 1797c0e09200SDave Airlie OUT_RING(CP_PACKET0(RADEON_RB3D_ZCACHE_CTLSTAT, 0)); \ 1798c0e09200SDave Airlie OUT_RING(RADEON_RB3D_ZC_FLUSH); \ 1799c0e09200SDave Airlie } else { \ 1800c0e09200SDave Airlie OUT_RING(CP_PACKET0(R300_ZB_ZCACHE_CTLSTAT, 0)); \ 1801c0e09200SDave Airlie OUT_RING(R300_ZC_FLUSH); \ 1802c0e09200SDave Airlie } \ 1803c0e09200SDave Airlie } while (0) 1804c0e09200SDave Airlie 1805c0e09200SDave Airlie #define RADEON_PURGE_ZCACHE() do { \ 1806c0e09200SDave Airlie if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \ 1807c0e09200SDave Airlie OUT_RING(CP_PACKET0(RADEON_RB3D_ZCACHE_CTLSTAT, 0)); \ 180854f961a6SJerome Glisse OUT_RING(RADEON_RB3D_ZC_FLUSH | RADEON_RB3D_ZC_FREE); \ 1809c0e09200SDave Airlie } else { \ 181054f961a6SJerome Glisse OUT_RING(CP_PACKET0(R300_ZB_ZCACHE_CTLSTAT, 0)); \ 181154f961a6SJerome Glisse OUT_RING(R300_ZC_FLUSH | R300_ZC_FREE); \ 1812c0e09200SDave Airlie } \ 1813c0e09200SDave Airlie } while (0) 1814c0e09200SDave Airlie 1815c0e09200SDave Airlie /* ================================================================ 1816c0e09200SDave Airlie * Misc helper macros 1817c0e09200SDave Airlie */ 1818c0e09200SDave Airlie 1819c0e09200SDave Airlie /* Perfbox functionality only. 1820c0e09200SDave Airlie */ 1821c0e09200SDave Airlie #define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \ 1822c0e09200SDave Airlie do { \ 1823c0e09200SDave Airlie if (!(dev_priv->stats.boxes & RADEON_BOX_DMA_IDLE)) { \ 1824c0e09200SDave Airlie u32 head = GET_RING_HEAD( dev_priv ); \ 1825c0e09200SDave Airlie if (head == dev_priv->ring.tail) \ 1826c0e09200SDave Airlie dev_priv->stats.boxes |= RADEON_BOX_DMA_IDLE; \ 1827c0e09200SDave Airlie } \ 1828c0e09200SDave Airlie } while (0) 1829c0e09200SDave Airlie 1830c0e09200SDave Airlie #define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ 1831c0e09200SDave Airlie do { \ 18327c1c2871SDave Airlie struct drm_radeon_master_private *master_priv = file_priv->master->driver_priv; \ 18337c1c2871SDave Airlie drm_radeon_sarea_t *sarea_priv = master_priv->sarea_priv; \ 1834c0e09200SDave Airlie if ( sarea_priv->last_dispatch >= RADEON_MAX_VB_AGE ) { \ 1835c0e09200SDave Airlie int __ret = radeon_do_cp_idle( dev_priv ); \ 1836c0e09200SDave Airlie if ( __ret ) return __ret; \ 1837c0e09200SDave Airlie sarea_priv->last_dispatch = 0; \ 1838c0e09200SDave Airlie radeon_freelist_reset( dev ); \ 1839c0e09200SDave Airlie } \ 1840c0e09200SDave Airlie } while (0) 1841c0e09200SDave Airlie 1842c0e09200SDave Airlie #define RADEON_DISPATCH_AGE( age ) do { \ 1843c0e09200SDave Airlie OUT_RING( CP_PACKET0( RADEON_LAST_DISPATCH_REG, 0 ) ); \ 1844c0e09200SDave Airlie OUT_RING( age ); \ 1845c0e09200SDave Airlie } while (0) 1846c0e09200SDave Airlie 1847c0e09200SDave Airlie #define RADEON_FRAME_AGE( age ) do { \ 1848c0e09200SDave Airlie OUT_RING( CP_PACKET0( RADEON_LAST_FRAME_REG, 0 ) ); \ 1849c0e09200SDave Airlie OUT_RING( age ); \ 1850c0e09200SDave Airlie } while (0) 1851c0e09200SDave Airlie 1852c0e09200SDave Airlie #define RADEON_CLEAR_AGE( age ) do { \ 1853c0e09200SDave Airlie OUT_RING( CP_PACKET0( RADEON_LAST_CLEAR_REG, 0 ) ); \ 1854c0e09200SDave Airlie OUT_RING( age ); \ 1855c0e09200SDave Airlie } while (0) 1856c0e09200SDave Airlie 1857*befb73c2SAlex Deucher #define R600_DISPATCH_AGE(age) do { \ 1858*befb73c2SAlex Deucher OUT_RING(CP_PACKET3(R600_IT_SET_CONFIG_REG, 1)); \ 1859*befb73c2SAlex Deucher OUT_RING((R600_LAST_DISPATCH_REG - R600_SET_CONFIG_REG_OFFSET) >> 2); \ 1860*befb73c2SAlex Deucher OUT_RING(age); \ 1861*befb73c2SAlex Deucher } while (0) 1862*befb73c2SAlex Deucher 1863*befb73c2SAlex Deucher #define R600_FRAME_AGE(age) do { \ 1864*befb73c2SAlex Deucher OUT_RING(CP_PACKET3(R600_IT_SET_CONFIG_REG, 1)); \ 1865*befb73c2SAlex Deucher OUT_RING((R600_LAST_FRAME_REG - R600_SET_CONFIG_REG_OFFSET) >> 2); \ 1866*befb73c2SAlex Deucher OUT_RING(age); \ 1867*befb73c2SAlex Deucher } while (0) 1868*befb73c2SAlex Deucher 1869*befb73c2SAlex Deucher #define R600_CLEAR_AGE(age) do { \ 1870*befb73c2SAlex Deucher OUT_RING(CP_PACKET3(R600_IT_SET_CONFIG_REG, 1)); \ 1871*befb73c2SAlex Deucher OUT_RING((R600_LAST_CLEAR_REG - R600_SET_CONFIG_REG_OFFSET) >> 2); \ 1872*befb73c2SAlex Deucher OUT_RING(age); \ 1873*befb73c2SAlex Deucher } while (0) 1874*befb73c2SAlex Deucher 1875c0e09200SDave Airlie /* ================================================================ 1876c0e09200SDave Airlie * Ring control 1877c0e09200SDave Airlie */ 1878c0e09200SDave Airlie 1879c0e09200SDave Airlie #define RADEON_VERBOSE 0 1880c0e09200SDave Airlie 18814247ca94SDave Airlie #define RING_LOCALS int write, _nr, _align_nr; unsigned int mask; u32 *ring; 1882c0e09200SDave Airlie 1883c0e09200SDave Airlie #define BEGIN_RING( n ) do { \ 1884c0e09200SDave Airlie if ( RADEON_VERBOSE ) { \ 1885c0e09200SDave Airlie DRM_INFO( "BEGIN_RING( %d )\n", (n)); \ 1886c0e09200SDave Airlie } \ 18874247ca94SDave Airlie _align_nr = (n + 0xf) & ~0xf; \ 18884247ca94SDave Airlie if (dev_priv->ring.space <= (_align_nr * sizeof(u32))) { \ 1889c0e09200SDave Airlie COMMIT_RING(); \ 18904247ca94SDave Airlie radeon_wait_ring( dev_priv, _align_nr * sizeof(u32)); \ 1891c0e09200SDave Airlie } \ 1892c0e09200SDave Airlie _nr = n; dev_priv->ring.space -= (n) * sizeof(u32); \ 1893c0e09200SDave Airlie ring = dev_priv->ring.start; \ 1894c0e09200SDave Airlie write = dev_priv->ring.tail; \ 1895c0e09200SDave Airlie mask = dev_priv->ring.tail_mask; \ 1896c0e09200SDave Airlie } while (0) 1897c0e09200SDave Airlie 1898c0e09200SDave Airlie #define ADVANCE_RING() do { \ 1899c0e09200SDave Airlie if ( RADEON_VERBOSE ) { \ 1900c0e09200SDave Airlie DRM_INFO( "ADVANCE_RING() wr=0x%06x tail=0x%06x\n", \ 1901c0e09200SDave Airlie write, dev_priv->ring.tail ); \ 1902c0e09200SDave Airlie } \ 1903c0e09200SDave Airlie if (((dev_priv->ring.tail + _nr) & mask) != write) { \ 1904c0e09200SDave Airlie DRM_ERROR( \ 1905c0e09200SDave Airlie "ADVANCE_RING(): mismatch: nr: %x write: %x line: %d\n", \ 1906c0e09200SDave Airlie ((dev_priv->ring.tail + _nr) & mask), \ 1907c0e09200SDave Airlie write, __LINE__); \ 1908c0e09200SDave Airlie } else \ 1909c0e09200SDave Airlie dev_priv->ring.tail = write; \ 1910c0e09200SDave Airlie } while (0) 1911c0e09200SDave Airlie 19124247ca94SDave Airlie extern void radeon_commit_ring(drm_radeon_private_t *dev_priv); 19134247ca94SDave Airlie 1914c0e09200SDave Airlie #define COMMIT_RING() do { \ 19154247ca94SDave Airlie radeon_commit_ring(dev_priv); \ 1916c0e09200SDave Airlie } while(0) 1917c0e09200SDave Airlie 1918c0e09200SDave Airlie #define OUT_RING( x ) do { \ 1919c0e09200SDave Airlie if ( RADEON_VERBOSE ) { \ 1920c0e09200SDave Airlie DRM_INFO( " OUT_RING( 0x%08x ) at 0x%x\n", \ 1921c0e09200SDave Airlie (unsigned int)(x), write ); \ 1922c0e09200SDave Airlie } \ 1923c0e09200SDave Airlie ring[write++] = (x); \ 1924c0e09200SDave Airlie write &= mask; \ 1925c0e09200SDave Airlie } while (0) 1926c0e09200SDave Airlie 1927c0e09200SDave Airlie #define OUT_RING_REG( reg, val ) do { \ 1928c0e09200SDave Airlie OUT_RING( CP_PACKET0( reg, 0 ) ); \ 1929c0e09200SDave Airlie OUT_RING( val ); \ 1930c0e09200SDave Airlie } while (0) 1931c0e09200SDave Airlie 1932c0e09200SDave Airlie #define OUT_RING_TABLE( tab, sz ) do { \ 1933c0e09200SDave Airlie int _size = (sz); \ 1934c0e09200SDave Airlie int *_tab = (int *)(tab); \ 1935c0e09200SDave Airlie \ 1936c0e09200SDave Airlie if (write + _size > mask) { \ 1937c0e09200SDave Airlie int _i = (mask+1) - write; \ 1938c0e09200SDave Airlie _size -= _i; \ 1939c0e09200SDave Airlie while (_i > 0 ) { \ 1940c0e09200SDave Airlie *(int *)(ring + write) = *_tab++; \ 1941c0e09200SDave Airlie write++; \ 1942c0e09200SDave Airlie _i--; \ 1943c0e09200SDave Airlie } \ 1944c0e09200SDave Airlie write = 0; \ 1945c0e09200SDave Airlie _tab += _i; \ 1946c0e09200SDave Airlie } \ 1947c0e09200SDave Airlie while (_size > 0) { \ 1948c0e09200SDave Airlie *(ring + write) = *_tab++; \ 1949c0e09200SDave Airlie write++; \ 1950c0e09200SDave Airlie _size--; \ 1951c0e09200SDave Airlie } \ 1952c0e09200SDave Airlie write &= mask; \ 1953c0e09200SDave Airlie } while (0) 1954c0e09200SDave Airlie 1955c0e09200SDave Airlie #endif /* __RADEON_DRV_H__ */ 1956