1 /*
2  * xtensa/config/system.h -- HAL definitions that are dependent on SYSTEM configuration
3  *
4  *  NOTE: The location and contents of this file are highly subject to change.
5  *
6  *  Source for configuration-independent binaries (which link in a
7  *  configuration-specific HAL library) must NEVER include this file.
8  *  The HAL itself has historically included this file in some instances,
9  *  but this is not appropriate either, because the HAL is meant to be
10  *  core-specific but system independent.
11  */
12 
13 /* Customer ID=12153; Build=0x72343; Copyright (c) 2000-2010 Tensilica Inc.
14 
15    Permission is hereby granted, free of charge, to any person obtaining
16    a copy of this software and associated documentation files (the
17    "Software"), to deal in the Software without restriction, including
18    without limitation the rights to use, copy, modify, merge, publish,
19    distribute, sublicense, and/or sell copies of the Software, and to
20    permit persons to whom the Software is furnished to do so, subject to
21    the following conditions:
22 
23    The above copyright notice and this permission notice shall be included
24    in all copies or substantial portions of the Software.
25 
26    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
29    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
30    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
31    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
32    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
33 
34 
35 #ifndef XTENSA_CONFIG_SYSTEM_H
36 #define XTENSA_CONFIG_SYSTEM_H
37 
38 /*#include <xtensa/hal.h>*/
39 
40 
41 
42 /*----------------------------------------------------------------------
43 				CONFIGURED SOFTWARE OPTIONS
44   ----------------------------------------------------------------------*/
45 
46 #define XSHAL_USE_ABSOLUTE_LITERALS	0	/* (sw-only option, whether software uses absolute literals) */
47 #define XSHAL_HAVE_TEXT_SECTION_LITERALS 1 /* Set if there is some memory that allows both code and literals.  */
48 
49 #define XSHAL_ABI			XTHAL_ABI_WINDOWED	/* (sw-only option, selected ABI) */
50 /*  The above maps to one of the following constants:  */
51 #define XTHAL_ABI_WINDOWED		0
52 #define XTHAL_ABI_CALL0			1
53 /*  Alternatives:  */
54 /*#define XSHAL_WINDOWED_ABI		1*/	/* set if windowed ABI selected */
55 /*#define XSHAL_CALL0_ABI		0*/	/* set if call0 ABI selected */
56 
57 #define XSHAL_CLIB			XTHAL_CLIB_NEWLIB	/* (sw-only option, selected C library) */
58 /*  The above maps to one of the following constants:  */
59 #define XTHAL_CLIB_NEWLIB		0
60 #define XTHAL_CLIB_UCLIBC		1
61 #define XTHAL_CLIB_XCLIB		2
62 /*  Alternatives:  */
63 /*#define XSHAL_NEWLIB			1*/	/* set if newlib C library selected */
64 /*#define XSHAL_UCLIBC			0*/	/* set if uCLibC C library selected */
65 /*#define XSHAL_XCLIB			0*/	/* set if Xtensa C library selected */
66 
67 #define XSHAL_USE_FLOATING_POINT	1
68 
69 #define XSHAL_FLOATING_POINT_ABI	0
70 
71 /*  SW workarounds enabled for HW errata:  */
72 
73 /*----------------------------------------------------------------------
74 				DEVICE ADDRESSES
75   ----------------------------------------------------------------------*/
76 
77 /*
78  *  Strange place to find these, but the configuration GUI
79  *  allows moving these around to account for various core
80  *  configurations.  Specific boards (and their BSP software)
81  *  will have specific meanings for these components.
82  */
83 
84 /*  I/O Block areas:  */
85 #define XSHAL_IOBLOCK_CACHED_VADDR	0x70000000
86 #define XSHAL_IOBLOCK_CACHED_PADDR	0x70000000
87 #define XSHAL_IOBLOCK_CACHED_SIZE	0x0E000000
88 
89 #define XSHAL_IOBLOCK_BYPASS_VADDR	0x50000000
90 #define XSHAL_IOBLOCK_BYPASS_PADDR	0x50000000
91 #define XSHAL_IOBLOCK_BYPASS_SIZE	0x0E000000
92 
93 /*  System ROM:  */
94 /*#define XSHAL_ROM_[VP]ADDR		...not configured...*/
95 /*#define XSHAL_ROM_SIZE		...not configured...*/
96 /*#define XSHAL_ROM_AVAIL_V{ADDR,SIZE}	...not configured...*/
97 
98 /*  System RAM:  */
99 #define XSHAL_RAM_VADDR		0x40000000
100 #define XSHAL_RAM_PADDR		0x40000000
101 #define XSHAL_RAM_VSIZE		0x40000000
102 #define XSHAL_RAM_PSIZE		0x40000000
103 #define XSHAL_RAM_SIZE		XSHAL_RAM_PSIZE
104 /*  Largest available area (free of vectors):  */
105 #define XSHAL_RAM_AVAIL_VADDR	0x40000000
106 #define XSHAL_RAM_AVAIL_VSIZE	0x40000000
107 
108 /*
109  *  Shadow system RAM (same device as system RAM, at different address).
110  *  (Emulation boards need this for the SONIC Ethernet driver
111  *   when data caches are configured for writeback mode.)
112  *  NOTE: on full MMU configs, this points to the BYPASS virtual address
113  *  of system RAM, ie. is the same as XSHAL_RAM_* except that virtual
114  *  addresses are viewed through the BYPASS static map rather than
115  *  the CACHED static map.
116  */
117 #define XSHAL_RAM_BYPASS_VADDR		0x80000000
118 #define XSHAL_RAM_BYPASS_PADDR		0x80000000
119 #define XSHAL_RAM_BYPASS_PSIZE		0x20000000
120 
121 /*  Alternate system RAM (different device than system RAM):  */
122 /*#define XSHAL_ALTRAM_[VP]ADDR		...not configured...*/
123 /*#define XSHAL_ALTRAM_SIZE		...not configured...*/
124 
125 /*  Some available location in which to place devices in a simulation (eg. XTMP):  */
126 #define XSHAL_SIMIO_CACHED_VADDR	0xC0000000
127 #define XSHAL_SIMIO_BYPASS_VADDR	0xC0000000
128 #define XSHAL_SIMIO_PADDR		0xC0000000
129 #define XSHAL_SIMIO_SIZE		0x20000000
130 
131 
132 /*----------------------------------------------------------------------
133  *  For use by reference testbench exit and diagnostic routines.
134  */
135 #define XSHAL_MAGIC_EXIT		0x0
136 
137 /*----------------------------------------------------------------------
138  *			DEVICE-ADDRESS DEPENDENT...
139  *
140  *  Values written to CACHEATTR special register (or its equivalent)
141  *  to enable and disable caches in various modes.
142  *----------------------------------------------------------------------*/
143 
144 /*----------------------------------------------------------------------
145 			BACKWARD COMPATIBILITY ...
146   ----------------------------------------------------------------------*/
147 
148 /*
149  *  NOTE:  the following two macros are DEPRECATED.  Use the latter
150  *  board-specific macros instead, which are specially tuned for the
151  *  particular target environments' memory maps.
152  */
153 #define XSHAL_CACHEATTR_BYPASS		XSHAL_XT2000_CACHEATTR_BYPASS	/* disable caches in bypass mode */
154 #define XSHAL_CACHEATTR_DEFAULT		XSHAL_XT2000_CACHEATTR_DEFAULT	/* default setting to enable caches (no writeback!) */
155 
156 /*----------------------------------------------------------------------
157 				GENERIC
158   ----------------------------------------------------------------------*/
159 
160 /*  For the following, a 512MB region is used if it contains a system (PIF) RAM,
161  *  system (PIF) ROM, local memory, or XLMI.  */
162 
163 /*  These set any unused 512MB region to cache-BYPASS attribute:  */
164 #define XSHAL_ALLVALID_CACHEATTR_WRITEBACK	0x22221112	/* enable caches in write-back mode */
165 #define XSHAL_ALLVALID_CACHEATTR_WRITEALLOC	0x22221112	/* enable caches in write-allocate mode */
166 #define XSHAL_ALLVALID_CACHEATTR_WRITETHRU	0x22221112	/* enable caches in write-through mode */
167 #define XSHAL_ALLVALID_CACHEATTR_BYPASS		0x22222222	/* disable caches in bypass mode */
168 #define XSHAL_ALLVALID_CACHEATTR_DEFAULT	XSHAL_ALLVALID_CACHEATTR_WRITEBACK	/* default setting to enable caches */
169 
170 /*  These set any unused 512MB region to ILLEGAL attribute:  */
171 #define XSHAL_STRICT_CACHEATTR_WRITEBACK	0xFFFF111F	/* enable caches in write-back mode */
172 #define XSHAL_STRICT_CACHEATTR_WRITEALLOC	0xFFFF111F	/* enable caches in write-allocate mode */
173 #define XSHAL_STRICT_CACHEATTR_WRITETHRU	0xFFFF111F	/* enable caches in write-through mode */
174 #define XSHAL_STRICT_CACHEATTR_BYPASS		0xFFFF222F	/* disable caches in bypass mode */
175 #define XSHAL_STRICT_CACHEATTR_DEFAULT		XSHAL_STRICT_CACHEATTR_WRITEBACK	/* default setting to enable caches */
176 
177 /*  These set the first 512MB, if unused, to ILLEGAL attribute to help catch
178  *  NULL-pointer dereference bugs; all other unused 512MB regions are set
179  *  to cache-BYPASS attribute:  */
180 #define XSHAL_TRAPNULL_CACHEATTR_WRITEBACK	0x2222111F	/* enable caches in write-back mode */
181 #define XSHAL_TRAPNULL_CACHEATTR_WRITEALLOC	0x2222111F	/* enable caches in write-allocate mode */
182 #define XSHAL_TRAPNULL_CACHEATTR_WRITETHRU	0x2222111F	/* enable caches in write-through mode */
183 #define XSHAL_TRAPNULL_CACHEATTR_BYPASS		0x2222222F	/* disable caches in bypass mode */
184 #define XSHAL_TRAPNULL_CACHEATTR_DEFAULT	XSHAL_TRAPNULL_CACHEATTR_WRITEBACK	/* default setting to enable caches */
185 
186 /*----------------------------------------------------------------------
187 			ISS (Instruction Set Simulator) SPECIFIC ...
188   ----------------------------------------------------------------------*/
189 
190 /*  For now, ISS defaults to the TRAPNULL settings:  */
191 #define XSHAL_ISS_CACHEATTR_WRITEBACK	XSHAL_TRAPNULL_CACHEATTR_WRITEBACK
192 #define XSHAL_ISS_CACHEATTR_WRITEALLOC	XSHAL_TRAPNULL_CACHEATTR_WRITEALLOC
193 #define XSHAL_ISS_CACHEATTR_WRITETHRU	XSHAL_TRAPNULL_CACHEATTR_WRITETHRU
194 #define XSHAL_ISS_CACHEATTR_BYPASS	XSHAL_TRAPNULL_CACHEATTR_BYPASS
195 #define XSHAL_ISS_CACHEATTR_DEFAULT	XSHAL_TRAPNULL_CACHEATTR_WRITEBACK
196 
197 #define XSHAL_ISS_PIPE_REGIONS	0
198 #define XSHAL_ISS_SDRAM_REGIONS	0
199 
200 
201 /*----------------------------------------------------------------------
202 			XT2000 BOARD SPECIFIC ...
203   ----------------------------------------------------------------------*/
204 
205 /*  For the following, a 512MB region is used if it contains any system RAM,
206  *  system ROM, local memory, XLMI, or other XT2000 board device or memory.
207  *  Regions containing devices are forced to cache-BYPASS mode regardless
208  *  of whether the macro is _WRITEBACK vs. _BYPASS etc.  */
209 
210 /*  These set any 512MB region unused on the XT2000 to ILLEGAL attribute:  */
211 #define XSHAL_XT2000_CACHEATTR_WRITEBACK	0xFFF2121F	/* enable caches in write-back mode */
212 #define XSHAL_XT2000_CACHEATTR_WRITEALLOC	0xFFF2121F	/* enable caches in write-allocate mode */
213 #define XSHAL_XT2000_CACHEATTR_WRITETHRU	0xFFF2121F	/* enable caches in write-through mode */
214 #define XSHAL_XT2000_CACHEATTR_BYPASS		0xFFF2222F	/* disable caches in bypass mode */
215 #define XSHAL_XT2000_CACHEATTR_DEFAULT		XSHAL_XT2000_CACHEATTR_WRITEBACK	/* default setting to enable caches */
216 
217 #define XSHAL_XT2000_PIPE_REGIONS	0x00000000	/* BusInt pipeline regions */
218 #define XSHAL_XT2000_SDRAM_REGIONS	0x00000110	/* BusInt SDRAM regions */
219 
220 
221 /*----------------------------------------------------------------------
222 				VECTOR INFO AND SIZES
223   ----------------------------------------------------------------------*/
224 
225 #define XSHAL_VECTORS_PACKED		0
226 #define XSHAL_STATIC_VECTOR_SELECT	0
227 #define XSHAL_RESET_VECTOR_VADDR	0x20000000
228 #define XSHAL_RESET_VECTOR_PADDR	0x20000000
229 
230 /*
231  *  Sizes allocated to vectors by the system (memory map) configuration.
232  *  These sizes are constrained by core configuration (eg. one vector's
233  *  code cannot overflow into another vector) but are dependent on the
234  *  system or board (or LSP) memory map configuration.
235  *
236  *  Whether or not each vector happens to be in a system ROM is also
237  *  a system configuration matter, sometimes useful, included here also:
238  */
239 #define XSHAL_RESET_VECTOR_SIZE	0x00000300
240 #define XSHAL_RESET_VECTOR_ISROM	0
241 #define XSHAL_USER_VECTOR_SIZE	0x00000038
242 #define XSHAL_USER_VECTOR_ISROM	0
243 #define XSHAL_PROGRAMEXC_VECTOR_SIZE	XSHAL_USER_VECTOR_SIZE	/* for backward compatibility */
244 #define XSHAL_USEREXC_VECTOR_SIZE	XSHAL_USER_VECTOR_SIZE	/* for backward compatibility */
245 #define XSHAL_KERNEL_VECTOR_SIZE	0x00000038
246 #define XSHAL_KERNEL_VECTOR_ISROM	0
247 #define XSHAL_STACKEDEXC_VECTOR_SIZE	XSHAL_KERNEL_VECTOR_SIZE	/* for backward compatibility */
248 #define XSHAL_KERNELEXC_VECTOR_SIZE	XSHAL_KERNEL_VECTOR_SIZE	/* for backward compatibility */
249 #define XSHAL_DOUBLEEXC_VECTOR_SIZE	0x00000040
250 #define XSHAL_DOUBLEEXC_VECTOR_ISROM	0
251 #define XSHAL_WINDOW_VECTORS_SIZE	0x00000178
252 #define XSHAL_WINDOW_VECTORS_ISROM	0
253 #define XSHAL_INTLEVEL2_VECTOR_SIZE	0x00000038
254 #define XSHAL_INTLEVEL2_VECTOR_ISROM	0
255 #define XSHAL_INTLEVEL3_VECTOR_SIZE	0x00000038
256 #define XSHAL_INTLEVEL3_VECTOR_ISROM	0
257 #define XSHAL_INTLEVEL4_VECTOR_SIZE	0x00000038
258 #define XSHAL_INTLEVEL4_VECTOR_ISROM	0
259 #define XSHAL_INTLEVEL5_VECTOR_SIZE	0x00000038
260 #define XSHAL_INTLEVEL5_VECTOR_ISROM	0
261 #define XSHAL_INTLEVEL6_VECTOR_SIZE	0x00000038
262 #define XSHAL_INTLEVEL6_VECTOR_ISROM	0
263 #define XSHAL_DEBUG_VECTOR_SIZE		XSHAL_INTLEVEL6_VECTOR_SIZE
264 #define XSHAL_DEBUG_VECTOR_ISROM	XSHAL_INTLEVEL6_VECTOR_ISROM
265 #define XSHAL_NMI_VECTOR_SIZE	0x00000038
266 #define XSHAL_NMI_VECTOR_ISROM	0
267 #define XSHAL_INTLEVEL7_VECTOR_SIZE	XSHAL_NMI_VECTOR_SIZE
268 
269 
270 #endif /*XTENSA_CONFIG_SYSTEM_H*/
271 
272