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