18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2008 Advanced Micro Devices, Inc.
38c2ecf20Sopenharmony_ci * Copyright 2008 Red Hat Inc.
48c2ecf20Sopenharmony_ci * Copyright 2009 Jerome Glisse.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
78c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
88c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
98c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
108c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
118c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
148c2ecf20Sopenharmony_ci * all copies or substantial portions of the Software.
158c2ecf20Sopenharmony_ci *
168c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
178c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
188c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
198c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
208c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
218c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
228c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * Authors: Dave Airlie
258c2ecf20Sopenharmony_ci *          Alex Deucher
268c2ecf20Sopenharmony_ci *          Jerome Glisse
278c2ecf20Sopenharmony_ci */
288c2ecf20Sopenharmony_ci#ifndef __R520D_H__
298c2ecf20Sopenharmony_ci#define __R520D_H__
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* Registers */
328c2ecf20Sopenharmony_ci#define R_0000F8_CONFIG_MEMSIZE                      0x0000F8
338c2ecf20Sopenharmony_ci#define   S_0000F8_CONFIG_MEMSIZE(x)                   (((x) & 0xFFFFFFFF) << 0)
348c2ecf20Sopenharmony_ci#define   G_0000F8_CONFIG_MEMSIZE(x)                   (((x) >> 0) & 0xFFFFFFFF)
358c2ecf20Sopenharmony_ci#define   C_0000F8_CONFIG_MEMSIZE                      0x00000000
368c2ecf20Sopenharmony_ci#define R_000134_HDP_FB_LOCATION                     0x000134
378c2ecf20Sopenharmony_ci#define   S_000134_HDP_FB_START(x)                     (((x) & 0xFFFF) << 0)
388c2ecf20Sopenharmony_ci#define   G_000134_HDP_FB_START(x)                     (((x) >> 0) & 0xFFFF)
398c2ecf20Sopenharmony_ci#define   C_000134_HDP_FB_START                        0xFFFF0000
408c2ecf20Sopenharmony_ci#define R_0007C0_CP_STAT                             0x0007C0
418c2ecf20Sopenharmony_ci#define   S_0007C0_MRU_BUSY(x)                         (((x) & 0x1) << 0)
428c2ecf20Sopenharmony_ci#define   G_0007C0_MRU_BUSY(x)                         (((x) >> 0) & 0x1)
438c2ecf20Sopenharmony_ci#define   C_0007C0_MRU_BUSY                            0xFFFFFFFE
448c2ecf20Sopenharmony_ci#define   S_0007C0_MWU_BUSY(x)                         (((x) & 0x1) << 1)
458c2ecf20Sopenharmony_ci#define   G_0007C0_MWU_BUSY(x)                         (((x) >> 1) & 0x1)
468c2ecf20Sopenharmony_ci#define   C_0007C0_MWU_BUSY                            0xFFFFFFFD
478c2ecf20Sopenharmony_ci#define   S_0007C0_RSIU_BUSY(x)                        (((x) & 0x1) << 2)
488c2ecf20Sopenharmony_ci#define   G_0007C0_RSIU_BUSY(x)                        (((x) >> 2) & 0x1)
498c2ecf20Sopenharmony_ci#define   C_0007C0_RSIU_BUSY                           0xFFFFFFFB
508c2ecf20Sopenharmony_ci#define   S_0007C0_RCIU_BUSY(x)                        (((x) & 0x1) << 3)
518c2ecf20Sopenharmony_ci#define   G_0007C0_RCIU_BUSY(x)                        (((x) >> 3) & 0x1)
528c2ecf20Sopenharmony_ci#define   C_0007C0_RCIU_BUSY                           0xFFFFFFF7
538c2ecf20Sopenharmony_ci#define   S_0007C0_CSF_PRIMARY_BUSY(x)                 (((x) & 0x1) << 9)
548c2ecf20Sopenharmony_ci#define   G_0007C0_CSF_PRIMARY_BUSY(x)                 (((x) >> 9) & 0x1)
558c2ecf20Sopenharmony_ci#define   C_0007C0_CSF_PRIMARY_BUSY                    0xFFFFFDFF
568c2ecf20Sopenharmony_ci#define   S_0007C0_CSF_INDIRECT_BUSY(x)                (((x) & 0x1) << 10)
578c2ecf20Sopenharmony_ci#define   G_0007C0_CSF_INDIRECT_BUSY(x)                (((x) >> 10) & 0x1)
588c2ecf20Sopenharmony_ci#define   C_0007C0_CSF_INDIRECT_BUSY                   0xFFFFFBFF
598c2ecf20Sopenharmony_ci#define   S_0007C0_CSQ_PRIMARY_BUSY(x)                 (((x) & 0x1) << 11)
608c2ecf20Sopenharmony_ci#define   G_0007C0_CSQ_PRIMARY_BUSY(x)                 (((x) >> 11) & 0x1)
618c2ecf20Sopenharmony_ci#define   C_0007C0_CSQ_PRIMARY_BUSY                    0xFFFFF7FF
628c2ecf20Sopenharmony_ci#define   S_0007C0_CSQ_INDIRECT_BUSY(x)                (((x) & 0x1) << 12)
638c2ecf20Sopenharmony_ci#define   G_0007C0_CSQ_INDIRECT_BUSY(x)                (((x) >> 12) & 0x1)
648c2ecf20Sopenharmony_ci#define   C_0007C0_CSQ_INDIRECT_BUSY                   0xFFFFEFFF
658c2ecf20Sopenharmony_ci#define   S_0007C0_CSI_BUSY(x)                         (((x) & 0x1) << 13)
668c2ecf20Sopenharmony_ci#define   G_0007C0_CSI_BUSY(x)                         (((x) >> 13) & 0x1)
678c2ecf20Sopenharmony_ci#define   C_0007C0_CSI_BUSY                            0xFFFFDFFF
688c2ecf20Sopenharmony_ci#define   S_0007C0_CSF_INDIRECT2_BUSY(x)               (((x) & 0x1) << 14)
698c2ecf20Sopenharmony_ci#define   G_0007C0_CSF_INDIRECT2_BUSY(x)               (((x) >> 14) & 0x1)
708c2ecf20Sopenharmony_ci#define   C_0007C0_CSF_INDIRECT2_BUSY                  0xFFFFBFFF
718c2ecf20Sopenharmony_ci#define   S_0007C0_CSQ_INDIRECT2_BUSY(x)               (((x) & 0x1) << 15)
728c2ecf20Sopenharmony_ci#define   G_0007C0_CSQ_INDIRECT2_BUSY(x)               (((x) >> 15) & 0x1)
738c2ecf20Sopenharmony_ci#define   C_0007C0_CSQ_INDIRECT2_BUSY                  0xFFFF7FFF
748c2ecf20Sopenharmony_ci#define   S_0007C0_GUIDMA_BUSY(x)                      (((x) & 0x1) << 28)
758c2ecf20Sopenharmony_ci#define   G_0007C0_GUIDMA_BUSY(x)                      (((x) >> 28) & 0x1)
768c2ecf20Sopenharmony_ci#define   C_0007C0_GUIDMA_BUSY                         0xEFFFFFFF
778c2ecf20Sopenharmony_ci#define   S_0007C0_VIDDMA_BUSY(x)                      (((x) & 0x1) << 29)
788c2ecf20Sopenharmony_ci#define   G_0007C0_VIDDMA_BUSY(x)                      (((x) >> 29) & 0x1)
798c2ecf20Sopenharmony_ci#define   C_0007C0_VIDDMA_BUSY                         0xDFFFFFFF
808c2ecf20Sopenharmony_ci#define   S_0007C0_CMDSTRM_BUSY(x)                     (((x) & 0x1) << 30)
818c2ecf20Sopenharmony_ci#define   G_0007C0_CMDSTRM_BUSY(x)                     (((x) >> 30) & 0x1)
828c2ecf20Sopenharmony_ci#define   C_0007C0_CMDSTRM_BUSY                        0xBFFFFFFF
838c2ecf20Sopenharmony_ci#define   S_0007C0_CP_BUSY(x)                          (((x) & 0x1) << 31)
848c2ecf20Sopenharmony_ci#define   G_0007C0_CP_BUSY(x)                          (((x) >> 31) & 0x1)
858c2ecf20Sopenharmony_ci#define   C_0007C0_CP_BUSY                             0x7FFFFFFF
868c2ecf20Sopenharmony_ci#define R_000E40_RBBM_STATUS                         0x000E40
878c2ecf20Sopenharmony_ci#define   S_000E40_CMDFIFO_AVAIL(x)                    (((x) & 0x7F) << 0)
888c2ecf20Sopenharmony_ci#define   G_000E40_CMDFIFO_AVAIL(x)                    (((x) >> 0) & 0x7F)
898c2ecf20Sopenharmony_ci#define   C_000E40_CMDFIFO_AVAIL                       0xFFFFFF80
908c2ecf20Sopenharmony_ci#define   S_000E40_HIRQ_ON_RBB(x)                      (((x) & 0x1) << 8)
918c2ecf20Sopenharmony_ci#define   G_000E40_HIRQ_ON_RBB(x)                      (((x) >> 8) & 0x1)
928c2ecf20Sopenharmony_ci#define   C_000E40_HIRQ_ON_RBB                         0xFFFFFEFF
938c2ecf20Sopenharmony_ci#define   S_000E40_CPRQ_ON_RBB(x)                      (((x) & 0x1) << 9)
948c2ecf20Sopenharmony_ci#define   G_000E40_CPRQ_ON_RBB(x)                      (((x) >> 9) & 0x1)
958c2ecf20Sopenharmony_ci#define   C_000E40_CPRQ_ON_RBB                         0xFFFFFDFF
968c2ecf20Sopenharmony_ci#define   S_000E40_CFRQ_ON_RBB(x)                      (((x) & 0x1) << 10)
978c2ecf20Sopenharmony_ci#define   G_000E40_CFRQ_ON_RBB(x)                      (((x) >> 10) & 0x1)
988c2ecf20Sopenharmony_ci#define   C_000E40_CFRQ_ON_RBB                         0xFFFFFBFF
998c2ecf20Sopenharmony_ci#define   S_000E40_HIRQ_IN_RTBUF(x)                    (((x) & 0x1) << 11)
1008c2ecf20Sopenharmony_ci#define   G_000E40_HIRQ_IN_RTBUF(x)                    (((x) >> 11) & 0x1)
1018c2ecf20Sopenharmony_ci#define   C_000E40_HIRQ_IN_RTBUF                       0xFFFFF7FF
1028c2ecf20Sopenharmony_ci#define   S_000E40_CPRQ_IN_RTBUF(x)                    (((x) & 0x1) << 12)
1038c2ecf20Sopenharmony_ci#define   G_000E40_CPRQ_IN_RTBUF(x)                    (((x) >> 12) & 0x1)
1048c2ecf20Sopenharmony_ci#define   C_000E40_CPRQ_IN_RTBUF                       0xFFFFEFFF
1058c2ecf20Sopenharmony_ci#define   S_000E40_CFRQ_IN_RTBUF(x)                    (((x) & 0x1) << 13)
1068c2ecf20Sopenharmony_ci#define   G_000E40_CFRQ_IN_RTBUF(x)                    (((x) >> 13) & 0x1)
1078c2ecf20Sopenharmony_ci#define   C_000E40_CFRQ_IN_RTBUF                       0xFFFFDFFF
1088c2ecf20Sopenharmony_ci#define   S_000E40_CF_PIPE_BUSY(x)                     (((x) & 0x1) << 14)
1098c2ecf20Sopenharmony_ci#define   G_000E40_CF_PIPE_BUSY(x)                     (((x) >> 14) & 0x1)
1108c2ecf20Sopenharmony_ci#define   C_000E40_CF_PIPE_BUSY                        0xFFFFBFFF
1118c2ecf20Sopenharmony_ci#define   S_000E40_ENG_EV_BUSY(x)                      (((x) & 0x1) << 15)
1128c2ecf20Sopenharmony_ci#define   G_000E40_ENG_EV_BUSY(x)                      (((x) >> 15) & 0x1)
1138c2ecf20Sopenharmony_ci#define   C_000E40_ENG_EV_BUSY                         0xFFFF7FFF
1148c2ecf20Sopenharmony_ci#define   S_000E40_CP_CMDSTRM_BUSY(x)                  (((x) & 0x1) << 16)
1158c2ecf20Sopenharmony_ci#define   G_000E40_CP_CMDSTRM_BUSY(x)                  (((x) >> 16) & 0x1)
1168c2ecf20Sopenharmony_ci#define   C_000E40_CP_CMDSTRM_BUSY                     0xFFFEFFFF
1178c2ecf20Sopenharmony_ci#define   S_000E40_E2_BUSY(x)                          (((x) & 0x1) << 17)
1188c2ecf20Sopenharmony_ci#define   G_000E40_E2_BUSY(x)                          (((x) >> 17) & 0x1)
1198c2ecf20Sopenharmony_ci#define   C_000E40_E2_BUSY                             0xFFFDFFFF
1208c2ecf20Sopenharmony_ci#define   S_000E40_RB2D_BUSY(x)                        (((x) & 0x1) << 18)
1218c2ecf20Sopenharmony_ci#define   G_000E40_RB2D_BUSY(x)                        (((x) >> 18) & 0x1)
1228c2ecf20Sopenharmony_ci#define   C_000E40_RB2D_BUSY                           0xFFFBFFFF
1238c2ecf20Sopenharmony_ci#define   S_000E40_RB3D_BUSY(x)                        (((x) & 0x1) << 19)
1248c2ecf20Sopenharmony_ci#define   G_000E40_RB3D_BUSY(x)                        (((x) >> 19) & 0x1)
1258c2ecf20Sopenharmony_ci#define   C_000E40_RB3D_BUSY                           0xFFF7FFFF
1268c2ecf20Sopenharmony_ci#define   S_000E40_VAP_BUSY(x)                         (((x) & 0x1) << 20)
1278c2ecf20Sopenharmony_ci#define   G_000E40_VAP_BUSY(x)                         (((x) >> 20) & 0x1)
1288c2ecf20Sopenharmony_ci#define   C_000E40_VAP_BUSY                            0xFFEFFFFF
1298c2ecf20Sopenharmony_ci#define   S_000E40_RE_BUSY(x)                          (((x) & 0x1) << 21)
1308c2ecf20Sopenharmony_ci#define   G_000E40_RE_BUSY(x)                          (((x) >> 21) & 0x1)
1318c2ecf20Sopenharmony_ci#define   C_000E40_RE_BUSY                             0xFFDFFFFF
1328c2ecf20Sopenharmony_ci#define   S_000E40_TAM_BUSY(x)                         (((x) & 0x1) << 22)
1338c2ecf20Sopenharmony_ci#define   G_000E40_TAM_BUSY(x)                         (((x) >> 22) & 0x1)
1348c2ecf20Sopenharmony_ci#define   C_000E40_TAM_BUSY                            0xFFBFFFFF
1358c2ecf20Sopenharmony_ci#define   S_000E40_TDM_BUSY(x)                         (((x) & 0x1) << 23)
1368c2ecf20Sopenharmony_ci#define   G_000E40_TDM_BUSY(x)                         (((x) >> 23) & 0x1)
1378c2ecf20Sopenharmony_ci#define   C_000E40_TDM_BUSY                            0xFF7FFFFF
1388c2ecf20Sopenharmony_ci#define   S_000E40_PB_BUSY(x)                          (((x) & 0x1) << 24)
1398c2ecf20Sopenharmony_ci#define   G_000E40_PB_BUSY(x)                          (((x) >> 24) & 0x1)
1408c2ecf20Sopenharmony_ci#define   C_000E40_PB_BUSY                             0xFEFFFFFF
1418c2ecf20Sopenharmony_ci#define   S_000E40_TIM_BUSY(x)                         (((x) & 0x1) << 25)
1428c2ecf20Sopenharmony_ci#define   G_000E40_TIM_BUSY(x)                         (((x) >> 25) & 0x1)
1438c2ecf20Sopenharmony_ci#define   C_000E40_TIM_BUSY                            0xFDFFFFFF
1448c2ecf20Sopenharmony_ci#define   S_000E40_GA_BUSY(x)                          (((x) & 0x1) << 26)
1458c2ecf20Sopenharmony_ci#define   G_000E40_GA_BUSY(x)                          (((x) >> 26) & 0x1)
1468c2ecf20Sopenharmony_ci#define   C_000E40_GA_BUSY                             0xFBFFFFFF
1478c2ecf20Sopenharmony_ci#define   S_000E40_CBA2D_BUSY(x)                       (((x) & 0x1) << 27)
1488c2ecf20Sopenharmony_ci#define   G_000E40_CBA2D_BUSY(x)                       (((x) >> 27) & 0x1)
1498c2ecf20Sopenharmony_ci#define   C_000E40_CBA2D_BUSY                          0xF7FFFFFF
1508c2ecf20Sopenharmony_ci#define   S_000E40_RBBM_HIBUSY(x)                      (((x) & 0x1) << 28)
1518c2ecf20Sopenharmony_ci#define   G_000E40_RBBM_HIBUSY(x)                      (((x) >> 28) & 0x1)
1528c2ecf20Sopenharmony_ci#define   C_000E40_RBBM_HIBUSY                         0xEFFFFFFF
1538c2ecf20Sopenharmony_ci#define   S_000E40_SKID_CFBUSY(x)                      (((x) & 0x1) << 29)
1548c2ecf20Sopenharmony_ci#define   G_000E40_SKID_CFBUSY(x)                      (((x) >> 29) & 0x1)
1558c2ecf20Sopenharmony_ci#define   C_000E40_SKID_CFBUSY                         0xDFFFFFFF
1568c2ecf20Sopenharmony_ci#define   S_000E40_VAP_VF_BUSY(x)                      (((x) & 0x1) << 30)
1578c2ecf20Sopenharmony_ci#define   G_000E40_VAP_VF_BUSY(x)                      (((x) >> 30) & 0x1)
1588c2ecf20Sopenharmony_ci#define   C_000E40_VAP_VF_BUSY                         0xBFFFFFFF
1598c2ecf20Sopenharmony_ci#define   S_000E40_GUI_ACTIVE(x)                       (((x) & 0x1) << 31)
1608c2ecf20Sopenharmony_ci#define   G_000E40_GUI_ACTIVE(x)                       (((x) >> 31) & 0x1)
1618c2ecf20Sopenharmony_ci#define   C_000E40_GUI_ACTIVE                          0x7FFFFFFF
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci#define R_000004_MC_FB_LOCATION                      0x000004
1658c2ecf20Sopenharmony_ci#define   S_000004_MC_FB_START(x)                      (((x) & 0xFFFF) << 0)
1668c2ecf20Sopenharmony_ci#define   G_000004_MC_FB_START(x)                      (((x) >> 0) & 0xFFFF)
1678c2ecf20Sopenharmony_ci#define   C_000004_MC_FB_START                         0xFFFF0000
1688c2ecf20Sopenharmony_ci#define   S_000004_MC_FB_TOP(x)                        (((x) & 0xFFFF) << 16)
1698c2ecf20Sopenharmony_ci#define   G_000004_MC_FB_TOP(x)                        (((x) >> 16) & 0xFFFF)
1708c2ecf20Sopenharmony_ci#define   C_000004_MC_FB_TOP                           0x0000FFFF
1718c2ecf20Sopenharmony_ci#define R_000005_MC_AGP_LOCATION                     0x000005
1728c2ecf20Sopenharmony_ci#define   S_000005_MC_AGP_START(x)                     (((x) & 0xFFFF) << 0)
1738c2ecf20Sopenharmony_ci#define   G_000005_MC_AGP_START(x)                     (((x) >> 0) & 0xFFFF)
1748c2ecf20Sopenharmony_ci#define   C_000005_MC_AGP_START                        0xFFFF0000
1758c2ecf20Sopenharmony_ci#define   S_000005_MC_AGP_TOP(x)                       (((x) & 0xFFFF) << 16)
1768c2ecf20Sopenharmony_ci#define   G_000005_MC_AGP_TOP(x)                       (((x) >> 16) & 0xFFFF)
1778c2ecf20Sopenharmony_ci#define   C_000005_MC_AGP_TOP                          0x0000FFFF
1788c2ecf20Sopenharmony_ci#define R_000006_AGP_BASE                            0x000006
1798c2ecf20Sopenharmony_ci#define   S_000006_AGP_BASE_ADDR(x)                    (((x) & 0xFFFFFFFF) << 0)
1808c2ecf20Sopenharmony_ci#define   G_000006_AGP_BASE_ADDR(x)                    (((x) >> 0) & 0xFFFFFFFF)
1818c2ecf20Sopenharmony_ci#define   C_000006_AGP_BASE_ADDR                       0x00000000
1828c2ecf20Sopenharmony_ci#define R_000007_AGP_BASE_2                          0x000007
1838c2ecf20Sopenharmony_ci#define   S_000007_AGP_BASE_ADDR_2(x)                  (((x) & 0xF) << 0)
1848c2ecf20Sopenharmony_ci#define   G_000007_AGP_BASE_ADDR_2(x)                  (((x) >> 0) & 0xF)
1858c2ecf20Sopenharmony_ci#define   C_000007_AGP_BASE_ADDR_2                     0xFFFFFFF0
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci#endif
188