162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright 2008 Advanced Micro Devices, Inc.
362306a36Sopenharmony_ci * Copyright 2008 Red Hat Inc.
462306a36Sopenharmony_ci * Copyright 2009 Jerome Glisse.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
762306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
862306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation
962306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1062306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
1162306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
1262306a36Sopenharmony_ci *
1362306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
1462306a36Sopenharmony_ci * all copies or substantial portions of the Software.
1562306a36Sopenharmony_ci *
1662306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1762306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1862306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1962306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
2062306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2162306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2262306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci * Authors: Dave Airlie
2562306a36Sopenharmony_ci *          Alex Deucher
2662306a36Sopenharmony_ci *          Jerome Glisse
2762306a36Sopenharmony_ci */
2862306a36Sopenharmony_ci#ifndef __R520D_H__
2962306a36Sopenharmony_ci#define __R520D_H__
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/* Registers */
3262306a36Sopenharmony_ci#define R_0000F8_CONFIG_MEMSIZE                      0x0000F8
3362306a36Sopenharmony_ci#define   S_0000F8_CONFIG_MEMSIZE(x)                   (((x) & 0xFFFFFFFF) << 0)
3462306a36Sopenharmony_ci#define   G_0000F8_CONFIG_MEMSIZE(x)                   (((x) >> 0) & 0xFFFFFFFF)
3562306a36Sopenharmony_ci#define   C_0000F8_CONFIG_MEMSIZE                      0x00000000
3662306a36Sopenharmony_ci#define R_000134_HDP_FB_LOCATION                     0x000134
3762306a36Sopenharmony_ci#define   S_000134_HDP_FB_START(x)                     (((x) & 0xFFFF) << 0)
3862306a36Sopenharmony_ci#define   G_000134_HDP_FB_START(x)                     (((x) >> 0) & 0xFFFF)
3962306a36Sopenharmony_ci#define   C_000134_HDP_FB_START                        0xFFFF0000
4062306a36Sopenharmony_ci#define R_0007C0_CP_STAT                             0x0007C0
4162306a36Sopenharmony_ci#define   S_0007C0_MRU_BUSY(x)                         (((x) & 0x1) << 0)
4262306a36Sopenharmony_ci#define   G_0007C0_MRU_BUSY(x)                         (((x) >> 0) & 0x1)
4362306a36Sopenharmony_ci#define   C_0007C0_MRU_BUSY                            0xFFFFFFFE
4462306a36Sopenharmony_ci#define   S_0007C0_MWU_BUSY(x)                         (((x) & 0x1) << 1)
4562306a36Sopenharmony_ci#define   G_0007C0_MWU_BUSY(x)                         (((x) >> 1) & 0x1)
4662306a36Sopenharmony_ci#define   C_0007C0_MWU_BUSY                            0xFFFFFFFD
4762306a36Sopenharmony_ci#define   S_0007C0_RSIU_BUSY(x)                        (((x) & 0x1) << 2)
4862306a36Sopenharmony_ci#define   G_0007C0_RSIU_BUSY(x)                        (((x) >> 2) & 0x1)
4962306a36Sopenharmony_ci#define   C_0007C0_RSIU_BUSY                           0xFFFFFFFB
5062306a36Sopenharmony_ci#define   S_0007C0_RCIU_BUSY(x)                        (((x) & 0x1) << 3)
5162306a36Sopenharmony_ci#define   G_0007C0_RCIU_BUSY(x)                        (((x) >> 3) & 0x1)
5262306a36Sopenharmony_ci#define   C_0007C0_RCIU_BUSY                           0xFFFFFFF7
5362306a36Sopenharmony_ci#define   S_0007C0_CSF_PRIMARY_BUSY(x)                 (((x) & 0x1) << 9)
5462306a36Sopenharmony_ci#define   G_0007C0_CSF_PRIMARY_BUSY(x)                 (((x) >> 9) & 0x1)
5562306a36Sopenharmony_ci#define   C_0007C0_CSF_PRIMARY_BUSY                    0xFFFFFDFF
5662306a36Sopenharmony_ci#define   S_0007C0_CSF_INDIRECT_BUSY(x)                (((x) & 0x1) << 10)
5762306a36Sopenharmony_ci#define   G_0007C0_CSF_INDIRECT_BUSY(x)                (((x) >> 10) & 0x1)
5862306a36Sopenharmony_ci#define   C_0007C0_CSF_INDIRECT_BUSY                   0xFFFFFBFF
5962306a36Sopenharmony_ci#define   S_0007C0_CSQ_PRIMARY_BUSY(x)                 (((x) & 0x1) << 11)
6062306a36Sopenharmony_ci#define   G_0007C0_CSQ_PRIMARY_BUSY(x)                 (((x) >> 11) & 0x1)
6162306a36Sopenharmony_ci#define   C_0007C0_CSQ_PRIMARY_BUSY                    0xFFFFF7FF
6262306a36Sopenharmony_ci#define   S_0007C0_CSQ_INDIRECT_BUSY(x)                (((x) & 0x1) << 12)
6362306a36Sopenharmony_ci#define   G_0007C0_CSQ_INDIRECT_BUSY(x)                (((x) >> 12) & 0x1)
6462306a36Sopenharmony_ci#define   C_0007C0_CSQ_INDIRECT_BUSY                   0xFFFFEFFF
6562306a36Sopenharmony_ci#define   S_0007C0_CSI_BUSY(x)                         (((x) & 0x1) << 13)
6662306a36Sopenharmony_ci#define   G_0007C0_CSI_BUSY(x)                         (((x) >> 13) & 0x1)
6762306a36Sopenharmony_ci#define   C_0007C0_CSI_BUSY                            0xFFFFDFFF
6862306a36Sopenharmony_ci#define   S_0007C0_CSF_INDIRECT2_BUSY(x)               (((x) & 0x1) << 14)
6962306a36Sopenharmony_ci#define   G_0007C0_CSF_INDIRECT2_BUSY(x)               (((x) >> 14) & 0x1)
7062306a36Sopenharmony_ci#define   C_0007C0_CSF_INDIRECT2_BUSY                  0xFFFFBFFF
7162306a36Sopenharmony_ci#define   S_0007C0_CSQ_INDIRECT2_BUSY(x)               (((x) & 0x1) << 15)
7262306a36Sopenharmony_ci#define   G_0007C0_CSQ_INDIRECT2_BUSY(x)               (((x) >> 15) & 0x1)
7362306a36Sopenharmony_ci#define   C_0007C0_CSQ_INDIRECT2_BUSY                  0xFFFF7FFF
7462306a36Sopenharmony_ci#define   S_0007C0_GUIDMA_BUSY(x)                      (((x) & 0x1) << 28)
7562306a36Sopenharmony_ci#define   G_0007C0_GUIDMA_BUSY(x)                      (((x) >> 28) & 0x1)
7662306a36Sopenharmony_ci#define   C_0007C0_GUIDMA_BUSY                         0xEFFFFFFF
7762306a36Sopenharmony_ci#define   S_0007C0_VIDDMA_BUSY(x)                      (((x) & 0x1) << 29)
7862306a36Sopenharmony_ci#define   G_0007C0_VIDDMA_BUSY(x)                      (((x) >> 29) & 0x1)
7962306a36Sopenharmony_ci#define   C_0007C0_VIDDMA_BUSY                         0xDFFFFFFF
8062306a36Sopenharmony_ci#define   S_0007C0_CMDSTRM_BUSY(x)                     (((x) & 0x1) << 30)
8162306a36Sopenharmony_ci#define   G_0007C0_CMDSTRM_BUSY(x)                     (((x) >> 30) & 0x1)
8262306a36Sopenharmony_ci#define   C_0007C0_CMDSTRM_BUSY                        0xBFFFFFFF
8362306a36Sopenharmony_ci#define   S_0007C0_CP_BUSY(x)                          (((x) & 0x1) << 31)
8462306a36Sopenharmony_ci#define   G_0007C0_CP_BUSY(x)                          (((x) >> 31) & 0x1)
8562306a36Sopenharmony_ci#define   C_0007C0_CP_BUSY                             0x7FFFFFFF
8662306a36Sopenharmony_ci#define R_000E40_RBBM_STATUS                         0x000E40
8762306a36Sopenharmony_ci#define   S_000E40_CMDFIFO_AVAIL(x)                    (((x) & 0x7F) << 0)
8862306a36Sopenharmony_ci#define   G_000E40_CMDFIFO_AVAIL(x)                    (((x) >> 0) & 0x7F)
8962306a36Sopenharmony_ci#define   C_000E40_CMDFIFO_AVAIL                       0xFFFFFF80
9062306a36Sopenharmony_ci#define   S_000E40_HIRQ_ON_RBB(x)                      (((x) & 0x1) << 8)
9162306a36Sopenharmony_ci#define   G_000E40_HIRQ_ON_RBB(x)                      (((x) >> 8) & 0x1)
9262306a36Sopenharmony_ci#define   C_000E40_HIRQ_ON_RBB                         0xFFFFFEFF
9362306a36Sopenharmony_ci#define   S_000E40_CPRQ_ON_RBB(x)                      (((x) & 0x1) << 9)
9462306a36Sopenharmony_ci#define   G_000E40_CPRQ_ON_RBB(x)                      (((x) >> 9) & 0x1)
9562306a36Sopenharmony_ci#define   C_000E40_CPRQ_ON_RBB                         0xFFFFFDFF
9662306a36Sopenharmony_ci#define   S_000E40_CFRQ_ON_RBB(x)                      (((x) & 0x1) << 10)
9762306a36Sopenharmony_ci#define   G_000E40_CFRQ_ON_RBB(x)                      (((x) >> 10) & 0x1)
9862306a36Sopenharmony_ci#define   C_000E40_CFRQ_ON_RBB                         0xFFFFFBFF
9962306a36Sopenharmony_ci#define   S_000E40_HIRQ_IN_RTBUF(x)                    (((x) & 0x1) << 11)
10062306a36Sopenharmony_ci#define   G_000E40_HIRQ_IN_RTBUF(x)                    (((x) >> 11) & 0x1)
10162306a36Sopenharmony_ci#define   C_000E40_HIRQ_IN_RTBUF                       0xFFFFF7FF
10262306a36Sopenharmony_ci#define   S_000E40_CPRQ_IN_RTBUF(x)                    (((x) & 0x1) << 12)
10362306a36Sopenharmony_ci#define   G_000E40_CPRQ_IN_RTBUF(x)                    (((x) >> 12) & 0x1)
10462306a36Sopenharmony_ci#define   C_000E40_CPRQ_IN_RTBUF                       0xFFFFEFFF
10562306a36Sopenharmony_ci#define   S_000E40_CFRQ_IN_RTBUF(x)                    (((x) & 0x1) << 13)
10662306a36Sopenharmony_ci#define   G_000E40_CFRQ_IN_RTBUF(x)                    (((x) >> 13) & 0x1)
10762306a36Sopenharmony_ci#define   C_000E40_CFRQ_IN_RTBUF                       0xFFFFDFFF
10862306a36Sopenharmony_ci#define   S_000E40_CF_PIPE_BUSY(x)                     (((x) & 0x1) << 14)
10962306a36Sopenharmony_ci#define   G_000E40_CF_PIPE_BUSY(x)                     (((x) >> 14) & 0x1)
11062306a36Sopenharmony_ci#define   C_000E40_CF_PIPE_BUSY                        0xFFFFBFFF
11162306a36Sopenharmony_ci#define   S_000E40_ENG_EV_BUSY(x)                      (((x) & 0x1) << 15)
11262306a36Sopenharmony_ci#define   G_000E40_ENG_EV_BUSY(x)                      (((x) >> 15) & 0x1)
11362306a36Sopenharmony_ci#define   C_000E40_ENG_EV_BUSY                         0xFFFF7FFF
11462306a36Sopenharmony_ci#define   S_000E40_CP_CMDSTRM_BUSY(x)                  (((x) & 0x1) << 16)
11562306a36Sopenharmony_ci#define   G_000E40_CP_CMDSTRM_BUSY(x)                  (((x) >> 16) & 0x1)
11662306a36Sopenharmony_ci#define   C_000E40_CP_CMDSTRM_BUSY                     0xFFFEFFFF
11762306a36Sopenharmony_ci#define   S_000E40_E2_BUSY(x)                          (((x) & 0x1) << 17)
11862306a36Sopenharmony_ci#define   G_000E40_E2_BUSY(x)                          (((x) >> 17) & 0x1)
11962306a36Sopenharmony_ci#define   C_000E40_E2_BUSY                             0xFFFDFFFF
12062306a36Sopenharmony_ci#define   S_000E40_RB2D_BUSY(x)                        (((x) & 0x1) << 18)
12162306a36Sopenharmony_ci#define   G_000E40_RB2D_BUSY(x)                        (((x) >> 18) & 0x1)
12262306a36Sopenharmony_ci#define   C_000E40_RB2D_BUSY                           0xFFFBFFFF
12362306a36Sopenharmony_ci#define   S_000E40_RB3D_BUSY(x)                        (((x) & 0x1) << 19)
12462306a36Sopenharmony_ci#define   G_000E40_RB3D_BUSY(x)                        (((x) >> 19) & 0x1)
12562306a36Sopenharmony_ci#define   C_000E40_RB3D_BUSY                           0xFFF7FFFF
12662306a36Sopenharmony_ci#define   S_000E40_VAP_BUSY(x)                         (((x) & 0x1) << 20)
12762306a36Sopenharmony_ci#define   G_000E40_VAP_BUSY(x)                         (((x) >> 20) & 0x1)
12862306a36Sopenharmony_ci#define   C_000E40_VAP_BUSY                            0xFFEFFFFF
12962306a36Sopenharmony_ci#define   S_000E40_RE_BUSY(x)                          (((x) & 0x1) << 21)
13062306a36Sopenharmony_ci#define   G_000E40_RE_BUSY(x)                          (((x) >> 21) & 0x1)
13162306a36Sopenharmony_ci#define   C_000E40_RE_BUSY                             0xFFDFFFFF
13262306a36Sopenharmony_ci#define   S_000E40_TAM_BUSY(x)                         (((x) & 0x1) << 22)
13362306a36Sopenharmony_ci#define   G_000E40_TAM_BUSY(x)                         (((x) >> 22) & 0x1)
13462306a36Sopenharmony_ci#define   C_000E40_TAM_BUSY                            0xFFBFFFFF
13562306a36Sopenharmony_ci#define   S_000E40_TDM_BUSY(x)                         (((x) & 0x1) << 23)
13662306a36Sopenharmony_ci#define   G_000E40_TDM_BUSY(x)                         (((x) >> 23) & 0x1)
13762306a36Sopenharmony_ci#define   C_000E40_TDM_BUSY                            0xFF7FFFFF
13862306a36Sopenharmony_ci#define   S_000E40_PB_BUSY(x)                          (((x) & 0x1) << 24)
13962306a36Sopenharmony_ci#define   G_000E40_PB_BUSY(x)                          (((x) >> 24) & 0x1)
14062306a36Sopenharmony_ci#define   C_000E40_PB_BUSY                             0xFEFFFFFF
14162306a36Sopenharmony_ci#define   S_000E40_TIM_BUSY(x)                         (((x) & 0x1) << 25)
14262306a36Sopenharmony_ci#define   G_000E40_TIM_BUSY(x)                         (((x) >> 25) & 0x1)
14362306a36Sopenharmony_ci#define   C_000E40_TIM_BUSY                            0xFDFFFFFF
14462306a36Sopenharmony_ci#define   S_000E40_GA_BUSY(x)                          (((x) & 0x1) << 26)
14562306a36Sopenharmony_ci#define   G_000E40_GA_BUSY(x)                          (((x) >> 26) & 0x1)
14662306a36Sopenharmony_ci#define   C_000E40_GA_BUSY                             0xFBFFFFFF
14762306a36Sopenharmony_ci#define   S_000E40_CBA2D_BUSY(x)                       (((x) & 0x1) << 27)
14862306a36Sopenharmony_ci#define   G_000E40_CBA2D_BUSY(x)                       (((x) >> 27) & 0x1)
14962306a36Sopenharmony_ci#define   C_000E40_CBA2D_BUSY                          0xF7FFFFFF
15062306a36Sopenharmony_ci#define   S_000E40_RBBM_HIBUSY(x)                      (((x) & 0x1) << 28)
15162306a36Sopenharmony_ci#define   G_000E40_RBBM_HIBUSY(x)                      (((x) >> 28) & 0x1)
15262306a36Sopenharmony_ci#define   C_000E40_RBBM_HIBUSY                         0xEFFFFFFF
15362306a36Sopenharmony_ci#define   S_000E40_SKID_CFBUSY(x)                      (((x) & 0x1) << 29)
15462306a36Sopenharmony_ci#define   G_000E40_SKID_CFBUSY(x)                      (((x) >> 29) & 0x1)
15562306a36Sopenharmony_ci#define   C_000E40_SKID_CFBUSY                         0xDFFFFFFF
15662306a36Sopenharmony_ci#define   S_000E40_VAP_VF_BUSY(x)                      (((x) & 0x1) << 30)
15762306a36Sopenharmony_ci#define   G_000E40_VAP_VF_BUSY(x)                      (((x) >> 30) & 0x1)
15862306a36Sopenharmony_ci#define   C_000E40_VAP_VF_BUSY                         0xBFFFFFFF
15962306a36Sopenharmony_ci#define   S_000E40_GUI_ACTIVE(x)                       (((x) & 0x1) << 31)
16062306a36Sopenharmony_ci#define   G_000E40_GUI_ACTIVE(x)                       (((x) >> 31) & 0x1)
16162306a36Sopenharmony_ci#define   C_000E40_GUI_ACTIVE                          0x7FFFFFFF
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci#define R_000004_MC_FB_LOCATION                      0x000004
16562306a36Sopenharmony_ci#define   S_000004_MC_FB_START(x)                      (((x) & 0xFFFF) << 0)
16662306a36Sopenharmony_ci#define   G_000004_MC_FB_START(x)                      (((x) >> 0) & 0xFFFF)
16762306a36Sopenharmony_ci#define   C_000004_MC_FB_START                         0xFFFF0000
16862306a36Sopenharmony_ci#define   S_000004_MC_FB_TOP(x)                        (((x) & 0xFFFF) << 16)
16962306a36Sopenharmony_ci#define   G_000004_MC_FB_TOP(x)                        (((x) >> 16) & 0xFFFF)
17062306a36Sopenharmony_ci#define   C_000004_MC_FB_TOP                           0x0000FFFF
17162306a36Sopenharmony_ci#define R_000005_MC_AGP_LOCATION                     0x000005
17262306a36Sopenharmony_ci#define   S_000005_MC_AGP_START(x)                     (((x) & 0xFFFF) << 0)
17362306a36Sopenharmony_ci#define   G_000005_MC_AGP_START(x)                     (((x) >> 0) & 0xFFFF)
17462306a36Sopenharmony_ci#define   C_000005_MC_AGP_START                        0xFFFF0000
17562306a36Sopenharmony_ci#define   S_000005_MC_AGP_TOP(x)                       (((x) & 0xFFFF) << 16)
17662306a36Sopenharmony_ci#define   G_000005_MC_AGP_TOP(x)                       (((x) >> 16) & 0xFFFF)
17762306a36Sopenharmony_ci#define   C_000005_MC_AGP_TOP                          0x0000FFFF
17862306a36Sopenharmony_ci#define R_000006_AGP_BASE                            0x000006
17962306a36Sopenharmony_ci#define   S_000006_AGP_BASE_ADDR(x)                    (((x) & 0xFFFFFFFF) << 0)
18062306a36Sopenharmony_ci#define   G_000006_AGP_BASE_ADDR(x)                    (((x) >> 0) & 0xFFFFFFFF)
18162306a36Sopenharmony_ci#define   C_000006_AGP_BASE_ADDR                       0x00000000
18262306a36Sopenharmony_ci#define R_000007_AGP_BASE_2                          0x000007
18362306a36Sopenharmony_ci#define   S_000007_AGP_BASE_ADDR_2(x)                  (((x) & 0xF) << 0)
18462306a36Sopenharmony_ci#define   G_000007_AGP_BASE_ADDR_2(x)                  (((x) >> 0) & 0xF)
18562306a36Sopenharmony_ci#define   C_000007_AGP_BASE_ADDR_2                     0xFFFFFFF0
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci#endif
188