1d356bf50SAlexander von Gluck IV /* 2d356bf50SAlexander von Gluck IV * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. 3d356bf50SAlexander von Gluck IV * Distributed under the terms of the MIT License. 4d356bf50SAlexander von Gluck IV * 5d356bf50SAlexander von Gluck IV * Authors: 6d356bf50SAlexander von Gluck IV * Alexander von Gluck, kallisti5@unixzen.com 7d356bf50SAlexander von Gluck IV */ 893d4d552SAlexander von Gluck IV #ifndef RADEON_HD_GPU_H 993d4d552SAlexander von Gluck IV #define RADEON_HD_GPU_H 10d356bf50SAlexander von Gluck IV 11d356bf50SAlexander von Gluck IV 12d3e8b642SAlexander von Gluck IV #include "accelerant.h" 13d3e8b642SAlexander von Gluck IV 1454fda1c6SAlexander von Gluck IV #include <video_configuration.h> 1554fda1c6SAlexander von Gluck IV 16817c114dSAlexander von Gluck IV #include "pll.h" 17817c114dSAlexander von Gluck IV 18d3e8b642SAlexander von Gluck IV 19d356bf50SAlexander von Gluck IV // GPU Control registers. These are combined as 20d356bf50SAlexander von Gluck IV // the registers exist on all models, some flags 21d356bf50SAlexander von Gluck IV // are different though and are commented as such 22d356bf50SAlexander von Gluck IV #define CP_ME_CNTL 0x86D8 23d356bf50SAlexander von Gluck IV #define CP_ME_HALT (1 << 28) 24d356bf50SAlexander von Gluck IV #define CP_PFP_HALT (1 << 26) 25d356bf50SAlexander von Gluck IV #define CP_ME_RAM_DATA 0xC160 26d356bf50SAlexander von Gluck IV #define CP_ME_RAM_RADDR 0xC158 27d356bf50SAlexander von Gluck IV #define CP_ME_RAM_WADDR 0xC15C 28d356bf50SAlexander von Gluck IV #define CP_MEQ_THRESHOLDS 0x8764 29d356bf50SAlexander von Gluck IV #define STQ_SPLIT(x) ((x) << 0) 30d356bf50SAlexander von Gluck IV #define CP_PERFMON_CNTL 0x87FC 31d356bf50SAlexander von Gluck IV #define CP_PFP_UCODE_ADDR 0xC150 32d356bf50SAlexander von Gluck IV #define CP_PFP_UCODE_DATA 0xC154 33d356bf50SAlexander von Gluck IV #define CP_QUEUE_THRESHOLDS 0x8760 34d356bf50SAlexander von Gluck IV #define ROQ_IB1_START(x) ((x) << 0) 35d356bf50SAlexander von Gluck IV #define ROQ_IB2_START(x) ((x) << 8) 36d356bf50SAlexander von Gluck IV #define CP_RB_BASE 0xC100 37d356bf50SAlexander von Gluck IV #define CP_RB_CNTL 0xC104 38d356bf50SAlexander von Gluck IV #define RB_BUFSZ(x) ((x) << 0) 39d356bf50SAlexander von Gluck IV #define RB_BLKSZ(x) ((x) << 8) 40d356bf50SAlexander von Gluck IV #define RB_NO_UPDATE (1 << 27) 41d356bf50SAlexander von Gluck IV #define RB_RPTR_WR_ENA (1 << 31) 42d356bf50SAlexander von Gluck IV #define BUF_SWAP_32BIT (2 << 16) 43d356bf50SAlexander von Gluck IV #define CP_RB_RPTR 0x8700 44d356bf50SAlexander von Gluck IV #define CP_RB_RPTR_ADDR 0xC10C 45d356bf50SAlexander von Gluck IV #define RB_RPTR_SWAP(x) ((x) << 0) 46d356bf50SAlexander von Gluck IV #define CP_RB_RPTR_ADDR_HI 0xC110 47d356bf50SAlexander von Gluck IV #define CP_RB_RPTR_WR 0xC108 48d356bf50SAlexander von Gluck IV #define CP_RB_WPTR 0xC114 49d356bf50SAlexander von Gluck IV #define CP_RB_WPTR_ADDR 0xC118 50d356bf50SAlexander von Gluck IV #define CP_RB_WPTR_ADDR_HI 0xC11C 51d356bf50SAlexander von Gluck IV #define CP_RB_WPTR_DELAY 0x8704 52d356bf50SAlexander von Gluck IV #define CP_SEM_WAIT_TIMER 0x85BC 53d356bf50SAlexander von Gluck IV #define CP_DEBUG 0xC1FC 54d356bf50SAlexander von Gluck IV 55d356bf50SAlexander von Gluck IV #define NI_GRBM_CNTL 0x8000 56d356bf50SAlexander von Gluck IV #define GRBM_READ_TIMEOUT(x) ((x) << 0) 57d356bf50SAlexander von Gluck IV #define GRBM_STATUS 0x8010 58d356bf50SAlexander von Gluck IV #define CMDFIFO_AVAIL_MASK 0x0000000F 59d356bf50SAlexander von Gluck IV #define RING2_RQ_PENDING (1 << 4) 60d356bf50SAlexander von Gluck IV #define SRBM_RQ_PENDING (1 << 5) 61d356bf50SAlexander von Gluck IV #define RING1_RQ_PENDING (1 << 6) 62d356bf50SAlexander von Gluck IV #define CF_RQ_PENDING (1 << 7) 63d356bf50SAlexander von Gluck IV #define PF_RQ_PENDING (1 << 8) 64d356bf50SAlexander von Gluck IV #define GDS_DMA_RQ_PENDING (1 << 9) 65d356bf50SAlexander von Gluck IV #define GRBM_EE_BUSY (1 << 10) 66d356bf50SAlexander von Gluck IV #define SX_CLEAN (1 << 11) // ni 67d356bf50SAlexander von Gluck IV #define VC_BUSY (1 << 11) // r600 68d356bf50SAlexander von Gluck IV #define DB_CLEAN (1 << 12) 69d356bf50SAlexander von Gluck IV #define CB_CLEAN (1 << 13) 70d356bf50SAlexander von Gluck IV #define TA_BUSY (1 << 14) 71d356bf50SAlexander von Gluck IV #define GDS_BUSY (1 << 15) 72d356bf50SAlexander von Gluck IV #define VGT_BUSY_NO_DMA (1 << 16) 73d356bf50SAlexander von Gluck IV #define VGT_BUSY (1 << 17) 74d356bf50SAlexander von Gluck IV #define IA_BUSY_NO_DMA (1 << 18) // ni 75d356bf50SAlexander von Gluck IV #define TA03_BUSY (1 << 18) // r600 76d356bf50SAlexander von Gluck IV #define IA_BUSY (1 << 19) // ni 77d356bf50SAlexander von Gluck IV #define TC_BUSY (1 << 19) // r600 78d356bf50SAlexander von Gluck IV #define SX_BUSY (1 << 20) 79d356bf50SAlexander von Gluck IV #define SH_BUSY (1 << 21) 80d356bf50SAlexander von Gluck IV #define SPI_BUSY (1 << 22) // AKA SPI03_BUSY r600 81d356bf50SAlexander von Gluck IV #define SMX_BUSY (1 << 23) 82d356bf50SAlexander von Gluck IV #define SC_BUSY (1 << 24) 83d356bf50SAlexander von Gluck IV #define PA_BUSY (1 << 25) 84d356bf50SAlexander von Gluck IV #define DB_BUSY (1 << 26) // AKA DB03_BUSY r600 85d356bf50SAlexander von Gluck IV #define CR_BUSY (1 << 27) 86d356bf50SAlexander von Gluck IV #define CP_COHERENCY_BUSY (1 << 28) 87d356bf50SAlexander von Gluck IV #define CP_BUSY (1 << 29) 88d356bf50SAlexander von Gluck IV #define CB_BUSY (1 << 30) 89d356bf50SAlexander von Gluck IV #define GUI_ACTIVE (1 << 31) 90d356bf50SAlexander von Gluck IV #define GRBM_STATUS2 0x8014 // AKA GRBM_STATUS_SE0 ON NI 91d356bf50SAlexander von Gluck IV #define CR_CLEAN (1 << 0) 92d356bf50SAlexander von Gluck IV #define SMX_CLEAN (1 << 1) 93d356bf50SAlexander von Gluck IV #define SPI0_BUSY (1 << 8) 94d356bf50SAlexander von Gluck IV #define SPI1_BUSY (1 << 9) 95d356bf50SAlexander von Gluck IV #define SPI2_BUSY (1 << 10) 96d356bf50SAlexander von Gluck IV #define SPI3_BUSY (1 << 11) 97d356bf50SAlexander von Gluck IV #define TA0_BUSY (1 << 12) 98d356bf50SAlexander von Gluck IV #define TA1_BUSY (1 << 13) 99d356bf50SAlexander von Gluck IV #define TA2_BUSY (1 << 14) 100d356bf50SAlexander von Gluck IV #define TA3_BUSY (1 << 15) 101d356bf50SAlexander von Gluck IV #define DB0_BUSY (1 << 16) 102d356bf50SAlexander von Gluck IV #define DB1_BUSY (1 << 17) 103d356bf50SAlexander von Gluck IV #define DB2_BUSY (1 << 18) 104d356bf50SAlexander von Gluck IV #define DB3_BUSY (1 << 19) 105d356bf50SAlexander von Gluck IV #define CB0_BUSY (1 << 20) 106d356bf50SAlexander von Gluck IV #define CB1_BUSY (1 << 21) 107d356bf50SAlexander von Gluck IV #define CB2_BUSY (1 << 22) 108d356bf50SAlexander von Gluck IV #define CB3_BUSY (1 << 23) 109d356bf50SAlexander von Gluck IV #define NI_GRBM_STATUS_SE1 0x8018 110d356bf50SAlexander von Gluck IV #define SE_SX_CLEAN (1 << 0) 111d356bf50SAlexander von Gluck IV #define SE_DB_CLEAN (1 << 1) 112d356bf50SAlexander von Gluck IV #define SE_CB_CLEAN (1 << 2) 113d356bf50SAlexander von Gluck IV #define SE_VGT_BUSY (1 << 23) 114d356bf50SAlexander von Gluck IV #define SE_PA_BUSY (1 << 24) 115d356bf50SAlexander von Gluck IV #define SE_TA_BUSY (1 << 25) 116d356bf50SAlexander von Gluck IV #define SE_SX_BUSY (1 << 26) 117d356bf50SAlexander von Gluck IV #define SE_SPI_BUSY (1 << 27) 118d356bf50SAlexander von Gluck IV #define SE_SH_BUSY (1 << 28) 119d356bf50SAlexander von Gluck IV #define SE_SC_BUSY (1 << 29) 120d356bf50SAlexander von Gluck IV #define SE_DB_BUSY (1 << 30) 121d356bf50SAlexander von Gluck IV #define SE_CB_BUSY (1 << 31) 122d356bf50SAlexander von Gluck IV #define GRBM_SOFT_RESET 0x8020 123d356bf50SAlexander von Gluck IV #define SRBM_STATUS 0x0E50 124d356bf50SAlexander von Gluck IV #define RLC_RQ_PENDING (1 << 3) 125d356bf50SAlexander von Gluck IV #define RCU_RQ_PENDING (1 << 4) 126d356bf50SAlexander von Gluck IV #define GRBM_RQ_PENDING (1 << 5) 127d356bf50SAlexander von Gluck IV #define HI_RQ_PENDING (1 << 6) 128d356bf50SAlexander von Gluck IV #define IO_EXTERN_SIGNAL (1 << 7) 129d356bf50SAlexander von Gluck IV #define VMC_BUSY (1 << 8) 130d356bf50SAlexander von Gluck IV #define MCB_BUSY (1 << 9) 131d356bf50SAlexander von Gluck IV #define MCDZ_BUSY (1 << 10) 132d356bf50SAlexander von Gluck IV #define MCDY_BUSY (1 << 11) 133d356bf50SAlexander von Gluck IV #define MCDX_BUSY (1 << 12) 134d356bf50SAlexander von Gluck IV #define MCDW_BUSY (1 << 13) 135d356bf50SAlexander von Gluck IV #define SEM_BUSY (1 << 14) 136d356bf50SAlexander von Gluck IV #define SRBM_STATUS__RLC_BUSY (1 << 15) 137d356bf50SAlexander von Gluck IV #define PDMA_BUSY (1 << 16) 138d356bf50SAlexander von Gluck IV #define IH_BUSY (1 << 17) 139d356bf50SAlexander von Gluck IV #define CSC_BUSY (1 << 20) 140d356bf50SAlexander von Gluck IV #define CMC7_BUSY (1 << 21) 141d356bf50SAlexander von Gluck IV #define CMC6_BUSY (1 << 22) 142d356bf50SAlexander von Gluck IV #define CMC5_BUSY (1 << 23) 143d356bf50SAlexander von Gluck IV #define CMC4_BUSY (1 << 24) 144d356bf50SAlexander von Gluck IV #define CMC3_BUSY (1 << 25) 145d356bf50SAlexander von Gluck IV #define CMC2_BUSY (1 << 26) 146d356bf50SAlexander von Gluck IV #define CMC1_BUSY (1 << 27) 147d356bf50SAlexander von Gluck IV #define CMC0_BUSY (1 << 28) 148d356bf50SAlexander von Gluck IV #define BIF_BUSY (1 << 29) 149d356bf50SAlexander von Gluck IV #define IDCT_BUSY (1 << 30) 150d356bf50SAlexander von Gluck IV #define SRBM_SOFT_RESET 0x0E60 151d356bf50SAlexander von Gluck IV #define SOFT_RESET_CP (1 << 0) 152d356bf50SAlexander von Gluck IV #define SOFT_RESET_CB (1 << 1) 153d356bf50SAlexander von Gluck IV #define SOFT_RESET_CR (1 << 2) 154d356bf50SAlexander von Gluck IV #define SOFT_RESET_DB (1 << 3) 155d356bf50SAlexander von Gluck IV #define SOFT_RESET_GDS (1 << 4) 156d356bf50SAlexander von Gluck IV #define SOFT_RESET_PA (1 << 5) 157d356bf50SAlexander von Gluck IV #define SOFT_RESET_SC (1 << 6) 158d356bf50SAlexander von Gluck IV #define SOFT_RESET_SMX (1 << 7) 159d356bf50SAlexander von Gluck IV #define SOFT_RESET_SPI (1 << 8) 160d356bf50SAlexander von Gluck IV #define SOFT_RESET_SH (1 << 9) 161d356bf50SAlexander von Gluck IV #define SOFT_RESET_SX (1 << 10) 162d356bf50SAlexander von Gluck IV #define SOFT_RESET_TC (1 << 11) 163d356bf50SAlexander von Gluck IV #define SOFT_RESET_TA (1 << 12) 164d356bf50SAlexander von Gluck IV #define SOFT_RESET_VC (1 << 13) 165d356bf50SAlexander von Gluck IV #define SOFT_RESET_VGT (1 << 14) 166d356bf50SAlexander von Gluck IV #define SOFT_RESET_IA (1 << 15) 167d356bf50SAlexander von Gluck IV 168*38f17b01SAlexander von Gluck IV #define TARGET_HW_I2C_CLOCK 50 169d356bf50SAlexander von Gluck IV 17063624e40SAlexander von Gluck IV status_t radeon_gpu_probe(); 171d356bf50SAlexander von Gluck IV status_t radeon_gpu_reset(); 172*38f17b01SAlexander von Gluck IV status_t radeon_gpu_quirks(); 173*38f17b01SAlexander von Gluck IV 174*38f17b01SAlexander von Gluck IV status_t radeon_gpu_i2c_cmd(uint16 slaveAddr, uint16 lineNumber, uint8 offset, 175*38f17b01SAlexander von Gluck IV uint8 data); 176*38f17b01SAlexander von Gluck IV 177*38f17b01SAlexander von Gluck IV 178e9e9c194SAlexander von Gluck IV void radeon_gpu_mc_halt(struct gpu_state *gpuState); 179e9e9c194SAlexander von Gluck IV void radeon_gpu_mc_resume(struct gpu_state *gpuState); 18059bfec57SAlexander von Gluck IV status_t radeon_gpu_mc_idlewait(); 181d356bf50SAlexander von Gluck IV status_t radeon_gpu_mc_setup(); 182745450adSAlexander von Gluck IV status_t radeon_gpu_ring_setup(); 183325089f1SAlexander von Gluck IV status_t radeon_gpu_ring_boot(uint32 ringType); 184817c114dSAlexander von Gluck IV status_t radeon_gpu_ss_control(pll_info* pll, bool enable); 185817c114dSAlexander von Gluck IV 186d356bf50SAlexander von Gluck IV 187d356bf50SAlexander von Gluck IV #endif 188