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 __RS400D_H__
2962306a36Sopenharmony_ci#define __RS400D_H__
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/* Registers */
3262306a36Sopenharmony_ci#define R_000148_MC_FB_LOCATION                      0x000148
3362306a36Sopenharmony_ci#define   S_000148_MC_FB_START(x)                      (((x) & 0xFFFF) << 0)
3462306a36Sopenharmony_ci#define   G_000148_MC_FB_START(x)                      (((x) >> 0) & 0xFFFF)
3562306a36Sopenharmony_ci#define   C_000148_MC_FB_START                         0xFFFF0000
3662306a36Sopenharmony_ci#define   S_000148_MC_FB_TOP(x)                        (((x) & 0xFFFF) << 16)
3762306a36Sopenharmony_ci#define   G_000148_MC_FB_TOP(x)                        (((x) >> 16) & 0xFFFF)
3862306a36Sopenharmony_ci#define   C_000148_MC_FB_TOP                           0x0000FFFF
3962306a36Sopenharmony_ci#define R_00015C_NB_TOM                              0x00015C
4062306a36Sopenharmony_ci#define   S_00015C_MC_FB_START(x)                      (((x) & 0xFFFF) << 0)
4162306a36Sopenharmony_ci#define   G_00015C_MC_FB_START(x)                      (((x) >> 0) & 0xFFFF)
4262306a36Sopenharmony_ci#define   C_00015C_MC_FB_START                         0xFFFF0000
4362306a36Sopenharmony_ci#define   S_00015C_MC_FB_TOP(x)                        (((x) & 0xFFFF) << 16)
4462306a36Sopenharmony_ci#define   G_00015C_MC_FB_TOP(x)                        (((x) >> 16) & 0xFFFF)
4562306a36Sopenharmony_ci#define   C_00015C_MC_FB_TOP                           0x0000FFFF
4662306a36Sopenharmony_ci#define R_0007C0_CP_STAT                             0x0007C0
4762306a36Sopenharmony_ci#define   S_0007C0_MRU_BUSY(x)                         (((x) & 0x1) << 0)
4862306a36Sopenharmony_ci#define   G_0007C0_MRU_BUSY(x)                         (((x) >> 0) & 0x1)
4962306a36Sopenharmony_ci#define   C_0007C0_MRU_BUSY                            0xFFFFFFFE
5062306a36Sopenharmony_ci#define   S_0007C0_MWU_BUSY(x)                         (((x) & 0x1) << 1)
5162306a36Sopenharmony_ci#define   G_0007C0_MWU_BUSY(x)                         (((x) >> 1) & 0x1)
5262306a36Sopenharmony_ci#define   C_0007C0_MWU_BUSY                            0xFFFFFFFD
5362306a36Sopenharmony_ci#define   S_0007C0_RSIU_BUSY(x)                        (((x) & 0x1) << 2)
5462306a36Sopenharmony_ci#define   G_0007C0_RSIU_BUSY(x)                        (((x) >> 2) & 0x1)
5562306a36Sopenharmony_ci#define   C_0007C0_RSIU_BUSY                           0xFFFFFFFB
5662306a36Sopenharmony_ci#define   S_0007C0_RCIU_BUSY(x)                        (((x) & 0x1) << 3)
5762306a36Sopenharmony_ci#define   G_0007C0_RCIU_BUSY(x)                        (((x) >> 3) & 0x1)
5862306a36Sopenharmony_ci#define   C_0007C0_RCIU_BUSY                           0xFFFFFFF7
5962306a36Sopenharmony_ci#define   S_0007C0_CSF_PRIMARY_BUSY(x)                 (((x) & 0x1) << 9)
6062306a36Sopenharmony_ci#define   G_0007C0_CSF_PRIMARY_BUSY(x)                 (((x) >> 9) & 0x1)
6162306a36Sopenharmony_ci#define   C_0007C0_CSF_PRIMARY_BUSY                    0xFFFFFDFF
6262306a36Sopenharmony_ci#define   S_0007C0_CSF_INDIRECT_BUSY(x)                (((x) & 0x1) << 10)
6362306a36Sopenharmony_ci#define   G_0007C0_CSF_INDIRECT_BUSY(x)                (((x) >> 10) & 0x1)
6462306a36Sopenharmony_ci#define   C_0007C0_CSF_INDIRECT_BUSY                   0xFFFFFBFF
6562306a36Sopenharmony_ci#define   S_0007C0_CSQ_PRIMARY_BUSY(x)                 (((x) & 0x1) << 11)
6662306a36Sopenharmony_ci#define   G_0007C0_CSQ_PRIMARY_BUSY(x)                 (((x) >> 11) & 0x1)
6762306a36Sopenharmony_ci#define   C_0007C0_CSQ_PRIMARY_BUSY                    0xFFFFF7FF
6862306a36Sopenharmony_ci#define   S_0007C0_CSQ_INDIRECT_BUSY(x)                (((x) & 0x1) << 12)
6962306a36Sopenharmony_ci#define   G_0007C0_CSQ_INDIRECT_BUSY(x)                (((x) >> 12) & 0x1)
7062306a36Sopenharmony_ci#define   C_0007C0_CSQ_INDIRECT_BUSY                   0xFFFFEFFF
7162306a36Sopenharmony_ci#define   S_0007C0_CSI_BUSY(x)                         (((x) & 0x1) << 13)
7262306a36Sopenharmony_ci#define   G_0007C0_CSI_BUSY(x)                         (((x) >> 13) & 0x1)
7362306a36Sopenharmony_ci#define   C_0007C0_CSI_BUSY                            0xFFFFDFFF
7462306a36Sopenharmony_ci#define   S_0007C0_CSF_INDIRECT2_BUSY(x)               (((x) & 0x1) << 14)
7562306a36Sopenharmony_ci#define   G_0007C0_CSF_INDIRECT2_BUSY(x)               (((x) >> 14) & 0x1)
7662306a36Sopenharmony_ci#define   C_0007C0_CSF_INDIRECT2_BUSY                  0xFFFFBFFF
7762306a36Sopenharmony_ci#define   S_0007C0_CSQ_INDIRECT2_BUSY(x)               (((x) & 0x1) << 15)
7862306a36Sopenharmony_ci#define   G_0007C0_CSQ_INDIRECT2_BUSY(x)               (((x) >> 15) & 0x1)
7962306a36Sopenharmony_ci#define   C_0007C0_CSQ_INDIRECT2_BUSY                  0xFFFF7FFF
8062306a36Sopenharmony_ci#define   S_0007C0_GUIDMA_BUSY(x)                      (((x) & 0x1) << 28)
8162306a36Sopenharmony_ci#define   G_0007C0_GUIDMA_BUSY(x)                      (((x) >> 28) & 0x1)
8262306a36Sopenharmony_ci#define   C_0007C0_GUIDMA_BUSY                         0xEFFFFFFF
8362306a36Sopenharmony_ci#define   S_0007C0_VIDDMA_BUSY(x)                      (((x) & 0x1) << 29)
8462306a36Sopenharmony_ci#define   G_0007C0_VIDDMA_BUSY(x)                      (((x) >> 29) & 0x1)
8562306a36Sopenharmony_ci#define   C_0007C0_VIDDMA_BUSY                         0xDFFFFFFF
8662306a36Sopenharmony_ci#define   S_0007C0_CMDSTRM_BUSY(x)                     (((x) & 0x1) << 30)
8762306a36Sopenharmony_ci#define   G_0007C0_CMDSTRM_BUSY(x)                     (((x) >> 30) & 0x1)
8862306a36Sopenharmony_ci#define   C_0007C0_CMDSTRM_BUSY                        0xBFFFFFFF
8962306a36Sopenharmony_ci#define   S_0007C0_CP_BUSY(x)                          (((x) & 0x1) << 31)
9062306a36Sopenharmony_ci#define   G_0007C0_CP_BUSY(x)                          (((x) >> 31) & 0x1)
9162306a36Sopenharmony_ci#define   C_0007C0_CP_BUSY                             0x7FFFFFFF
9262306a36Sopenharmony_ci#define R_000E40_RBBM_STATUS                         0x000E40
9362306a36Sopenharmony_ci#define   S_000E40_CMDFIFO_AVAIL(x)                    (((x) & 0x7F) << 0)
9462306a36Sopenharmony_ci#define   G_000E40_CMDFIFO_AVAIL(x)                    (((x) >> 0) & 0x7F)
9562306a36Sopenharmony_ci#define   C_000E40_CMDFIFO_AVAIL                       0xFFFFFF80
9662306a36Sopenharmony_ci#define   S_000E40_HIRQ_ON_RBB(x)                      (((x) & 0x1) << 8)
9762306a36Sopenharmony_ci#define   G_000E40_HIRQ_ON_RBB(x)                      (((x) >> 8) & 0x1)
9862306a36Sopenharmony_ci#define   C_000E40_HIRQ_ON_RBB                         0xFFFFFEFF
9962306a36Sopenharmony_ci#define   S_000E40_CPRQ_ON_RBB(x)                      (((x) & 0x1) << 9)
10062306a36Sopenharmony_ci#define   G_000E40_CPRQ_ON_RBB(x)                      (((x) >> 9) & 0x1)
10162306a36Sopenharmony_ci#define   C_000E40_CPRQ_ON_RBB                         0xFFFFFDFF
10262306a36Sopenharmony_ci#define   S_000E40_CFRQ_ON_RBB(x)                      (((x) & 0x1) << 10)
10362306a36Sopenharmony_ci#define   G_000E40_CFRQ_ON_RBB(x)                      (((x) >> 10) & 0x1)
10462306a36Sopenharmony_ci#define   C_000E40_CFRQ_ON_RBB                         0xFFFFFBFF
10562306a36Sopenharmony_ci#define   S_000E40_HIRQ_IN_RTBUF(x)                    (((x) & 0x1) << 11)
10662306a36Sopenharmony_ci#define   G_000E40_HIRQ_IN_RTBUF(x)                    (((x) >> 11) & 0x1)
10762306a36Sopenharmony_ci#define   C_000E40_HIRQ_IN_RTBUF                       0xFFFFF7FF
10862306a36Sopenharmony_ci#define   S_000E40_CPRQ_IN_RTBUF(x)                    (((x) & 0x1) << 12)
10962306a36Sopenharmony_ci#define   G_000E40_CPRQ_IN_RTBUF(x)                    (((x) >> 12) & 0x1)
11062306a36Sopenharmony_ci#define   C_000E40_CPRQ_IN_RTBUF                       0xFFFFEFFF
11162306a36Sopenharmony_ci#define   S_000E40_CFRQ_IN_RTBUF(x)                    (((x) & 0x1) << 13)
11262306a36Sopenharmony_ci#define   G_000E40_CFRQ_IN_RTBUF(x)                    (((x) >> 13) & 0x1)
11362306a36Sopenharmony_ci#define   C_000E40_CFRQ_IN_RTBUF                       0xFFFFDFFF
11462306a36Sopenharmony_ci#define   S_000E40_CF_PIPE_BUSY(x)                     (((x) & 0x1) << 14)
11562306a36Sopenharmony_ci#define   G_000E40_CF_PIPE_BUSY(x)                     (((x) >> 14) & 0x1)
11662306a36Sopenharmony_ci#define   C_000E40_CF_PIPE_BUSY                        0xFFFFBFFF
11762306a36Sopenharmony_ci#define   S_000E40_ENG_EV_BUSY(x)                      (((x) & 0x1) << 15)
11862306a36Sopenharmony_ci#define   G_000E40_ENG_EV_BUSY(x)                      (((x) >> 15) & 0x1)
11962306a36Sopenharmony_ci#define   C_000E40_ENG_EV_BUSY                         0xFFFF7FFF
12062306a36Sopenharmony_ci#define   S_000E40_CP_CMDSTRM_BUSY(x)                  (((x) & 0x1) << 16)
12162306a36Sopenharmony_ci#define   G_000E40_CP_CMDSTRM_BUSY(x)                  (((x) >> 16) & 0x1)
12262306a36Sopenharmony_ci#define   C_000E40_CP_CMDSTRM_BUSY                     0xFFFEFFFF
12362306a36Sopenharmony_ci#define   S_000E40_E2_BUSY(x)                          (((x) & 0x1) << 17)
12462306a36Sopenharmony_ci#define   G_000E40_E2_BUSY(x)                          (((x) >> 17) & 0x1)
12562306a36Sopenharmony_ci#define   C_000E40_E2_BUSY                             0xFFFDFFFF
12662306a36Sopenharmony_ci#define   S_000E40_RB2D_BUSY(x)                        (((x) & 0x1) << 18)
12762306a36Sopenharmony_ci#define   G_000E40_RB2D_BUSY(x)                        (((x) >> 18) & 0x1)
12862306a36Sopenharmony_ci#define   C_000E40_RB2D_BUSY                           0xFFFBFFFF
12962306a36Sopenharmony_ci#define   S_000E40_RB3D_BUSY(x)                        (((x) & 0x1) << 19)
13062306a36Sopenharmony_ci#define   G_000E40_RB3D_BUSY(x)                        (((x) >> 19) & 0x1)
13162306a36Sopenharmony_ci#define   C_000E40_RB3D_BUSY                           0xFFF7FFFF
13262306a36Sopenharmony_ci#define   S_000E40_VAP_BUSY(x)                         (((x) & 0x1) << 20)
13362306a36Sopenharmony_ci#define   G_000E40_VAP_BUSY(x)                         (((x) >> 20) & 0x1)
13462306a36Sopenharmony_ci#define   C_000E40_VAP_BUSY                            0xFFEFFFFF
13562306a36Sopenharmony_ci#define   S_000E40_RE_BUSY(x)                          (((x) & 0x1) << 21)
13662306a36Sopenharmony_ci#define   G_000E40_RE_BUSY(x)                          (((x) >> 21) & 0x1)
13762306a36Sopenharmony_ci#define   C_000E40_RE_BUSY                             0xFFDFFFFF
13862306a36Sopenharmony_ci#define   S_000E40_TAM_BUSY(x)                         (((x) & 0x1) << 22)
13962306a36Sopenharmony_ci#define   G_000E40_TAM_BUSY(x)                         (((x) >> 22) & 0x1)
14062306a36Sopenharmony_ci#define   C_000E40_TAM_BUSY                            0xFFBFFFFF
14162306a36Sopenharmony_ci#define   S_000E40_TDM_BUSY(x)                         (((x) & 0x1) << 23)
14262306a36Sopenharmony_ci#define   G_000E40_TDM_BUSY(x)                         (((x) >> 23) & 0x1)
14362306a36Sopenharmony_ci#define   C_000E40_TDM_BUSY                            0xFF7FFFFF
14462306a36Sopenharmony_ci#define   S_000E40_PB_BUSY(x)                          (((x) & 0x1) << 24)
14562306a36Sopenharmony_ci#define   G_000E40_PB_BUSY(x)                          (((x) >> 24) & 0x1)
14662306a36Sopenharmony_ci#define   C_000E40_PB_BUSY                             0xFEFFFFFF
14762306a36Sopenharmony_ci#define   S_000E40_TIM_BUSY(x)                         (((x) & 0x1) << 25)
14862306a36Sopenharmony_ci#define   G_000E40_TIM_BUSY(x)                         (((x) >> 25) & 0x1)
14962306a36Sopenharmony_ci#define   C_000E40_TIM_BUSY                            0xFDFFFFFF
15062306a36Sopenharmony_ci#define   S_000E40_GA_BUSY(x)                          (((x) & 0x1) << 26)
15162306a36Sopenharmony_ci#define   G_000E40_GA_BUSY(x)                          (((x) >> 26) & 0x1)
15262306a36Sopenharmony_ci#define   C_000E40_GA_BUSY                             0xFBFFFFFF
15362306a36Sopenharmony_ci#define   S_000E40_CBA2D_BUSY(x)                       (((x) & 0x1) << 27)
15462306a36Sopenharmony_ci#define   G_000E40_CBA2D_BUSY(x)                       (((x) >> 27) & 0x1)
15562306a36Sopenharmony_ci#define   C_000E40_CBA2D_BUSY                          0xF7FFFFFF
15662306a36Sopenharmony_ci#define   S_000E40_GUI_ACTIVE(x)                       (((x) & 0x1) << 31)
15762306a36Sopenharmony_ci#define   G_000E40_GUI_ACTIVE(x)                       (((x) >> 31) & 0x1)
15862306a36Sopenharmony_ci#define   C_000E40_GUI_ACTIVE                          0x7FFFFFFF
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci#endif
161