1 /*
2  * Copyright © 2007-2019 Advanced Micro Devices, Inc.
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sub license, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
15  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16  * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
17  * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20  * USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * The above copyright notice and this permission notice (including the
23  * next paragraph) shall be included in all copies or substantial portions
24  * of the Software.
25  */
26 
27 #if !defined (__SI_GB_REG_H__)
28 #define __SI_GB_REG_H__
29 
30 /*****************************************************************************************************************
31  *
32  *  si_gb_reg.h
33  *
34  *  Register Spec Release:  Chip Spec 0.28
35  *
36  *****************************************************************************************************************/
37 
38 //
39 // Make sure the necessary endian defines are there.
40 //
41 #if defined(LITTLEENDIAN_CPU)
42 #elif defined(BIGENDIAN_CPU)
43 #else
44 #error "BIGENDIAN_CPU or LITTLEENDIAN_CPU must be defined"
45 #endif
46 
47 /*
48  * GB_ADDR_CONFIG struct
49  */
50 
51 #if     defined(LITTLEENDIAN_CPU)
52 
53      typedef struct _GB_ADDR_CONFIG_T {
54           unsigned int num_pipes                      : 3;
55           unsigned int                                : 1;
56           unsigned int pipe_interleave_size           : 3;
57           unsigned int                                : 1;
58           unsigned int bank_interleave_size           : 3;
59           unsigned int                                : 1;
60           unsigned int num_shader_engines             : 2;
61           unsigned int                                : 2;
62           unsigned int shader_engine_tile_size        : 3;
63           unsigned int                                : 1;
64           unsigned int num_gpus                       : 3;
65           unsigned int                                : 1;
66           unsigned int multi_gpu_tile_size            : 2;
67           unsigned int                                : 2;
68           unsigned int row_size                       : 2;
69           unsigned int num_lower_pipes                : 1;
70           unsigned int                                : 1;
71      } GB_ADDR_CONFIG_T;
72 
73 #elif       defined(BIGENDIAN_CPU)
74 
75      typedef struct _GB_ADDR_CONFIG_T {
76           unsigned int                                : 1;
77           unsigned int num_lower_pipes                : 1;
78           unsigned int row_size                       : 2;
79           unsigned int                                : 2;
80           unsigned int multi_gpu_tile_size            : 2;
81           unsigned int                                : 1;
82           unsigned int num_gpus                       : 3;
83           unsigned int                                : 1;
84           unsigned int shader_engine_tile_size        : 3;
85           unsigned int                                : 2;
86           unsigned int num_shader_engines             : 2;
87           unsigned int                                : 1;
88           unsigned int bank_interleave_size           : 3;
89           unsigned int                                : 1;
90           unsigned int pipe_interleave_size           : 3;
91           unsigned int                                : 1;
92           unsigned int num_pipes                      : 3;
93      } GB_ADDR_CONFIG_T;
94 
95 #endif
96 
97 typedef union {
98      unsigned int val : 32;
99      GB_ADDR_CONFIG_T f;
100 } GB_ADDR_CONFIG;
101 
102 #if       defined(LITTLEENDIAN_CPU)
103 
104      typedef struct _GB_TILE_MODE_T {
105           unsigned int micro_tile_mode                : 2;
106           unsigned int array_mode                     : 4;
107           unsigned int pipe_config                    : 5;
108           unsigned int tile_split                     : 3;
109           unsigned int bank_width                     : 2;
110           unsigned int bank_height                    : 2;
111           unsigned int macro_tile_aspect              : 2;
112           unsigned int num_banks                      : 2;
113           unsigned int micro_tile_mode_new            : 3;
114           unsigned int sample_split                   : 2;
115           unsigned int alt_pipe_config                : 5;
116      } GB_TILE_MODE_T;
117 
118      typedef struct _GB_MACROTILE_MODE_T {
119           unsigned int bank_width                     : 2;
120           unsigned int bank_height                    : 2;
121           unsigned int macro_tile_aspect              : 2;
122           unsigned int num_banks                      : 2;
123           unsigned int alt_bank_height                : 2;
124           unsigned int alt_macro_tile_aspect          : 2;
125           unsigned int alt_num_banks                  : 2;
126           unsigned int                                : 18;
127      } GB_MACROTILE_MODE_T;
128 
129 #elif          defined(BIGENDIAN_CPU)
130 
131      typedef struct _GB_TILE_MODE_T {
132           unsigned int alt_pipe_config                : 5;
133           unsigned int sample_split                   : 2;
134           unsigned int micro_tile_mode_new            : 3;
135           unsigned int num_banks                      : 2;
136           unsigned int macro_tile_aspect              : 2;
137           unsigned int bank_height                    : 2;
138           unsigned int bank_width                     : 2;
139           unsigned int tile_split                     : 3;
140           unsigned int pipe_config                    : 5;
141           unsigned int array_mode                     : 4;
142           unsigned int micro_tile_mode                : 2;
143      } GB_TILE_MODE_T;
144 
145      typedef struct _GB_MACROTILE_MODE_T {
146           unsigned int                                : 18;
147           unsigned int alt_num_banks                  : 2;
148           unsigned int alt_macro_tile_aspect          : 2;
149           unsigned int alt_bank_height                : 2;
150           unsigned int num_banks                      : 2;
151           unsigned int macro_tile_aspect              : 2;
152           unsigned int bank_height                    : 2;
153           unsigned int bank_width                     : 2;
154      } GB_MACROTILE_MODE_T;
155 
156 #endif
157 
158 typedef union {
159      unsigned int val : 32;
160      GB_TILE_MODE_T f;
161 } GB_TILE_MODE;
162 
163 typedef union {
164      unsigned int val : 32;
165      GB_MACROTILE_MODE_T f;
166 } GB_MACROTILE_MODE;
167 
168 #endif
169 
170