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=12445; Build=0x700c0; 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	1
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_VADDR		0x80720000
95 #define XSHAL_ROM_PADDR		0x80720000
96 #define XSHAL_ROM_SIZE		0x00020000
97 /*  Largest available area (free of vectors):  */
98 #define XSHAL_ROM_AVAIL_VADDR	0x80720000
99 #define XSHAL_ROM_AVAIL_VSIZE	0x00020000
100 
101 /*  System RAM:  */
102 #define XSHAL_RAM_VADDR		0x80700000
103 #define XSHAL_RAM_PADDR		0x80700000
104 #define XSHAL_RAM_VSIZE		0x00020000
105 #define XSHAL_RAM_PSIZE		0x00020000
106 #define XSHAL_RAM_SIZE		XSHAL_RAM_PSIZE
107 /*  Largest available area (free of vectors):  */
108 #define XSHAL_RAM_AVAIL_VADDR	0x80700000
109 #define XSHAL_RAM_AVAIL_VSIZE	0x00020000
110 
111 /*
112  *  Shadow system RAM (same device as system RAM, at different address).
113  *  (Emulation boards need this for the SONIC Ethernet driver
114  *   when data caches are configured for writeback mode.)
115  *  NOTE: on full MMU configs, this points to the BYPASS virtual address
116  *  of system RAM, ie. is the same as XSHAL_RAM_* except that virtual
117  *  addresses are viewed through the BYPASS static map rather than
118  *  the CACHED static map.
119  */
120 #define XSHAL_RAM_BYPASS_VADDR		0x20000000
121 #define XSHAL_RAM_BYPASS_PADDR		0x20000000
122 #define XSHAL_RAM_BYPASS_PSIZE		0x00020000
123 
124 /*  Alternate system RAM (different device than system RAM):  */
125 /*#define XSHAL_ALTRAM_[VP]ADDR		...not configured...*/
126 /*#define XSHAL_ALTRAM_SIZE		...not configured...*/
127 
128 /*  Some available location in which to place devices in a simulation (eg. XTMP):  */
129 #define XSHAL_SIMIO_CACHED_VADDR	0xC0000000
130 #define XSHAL_SIMIO_BYPASS_VADDR	0xC0000000
131 #define XSHAL_SIMIO_PADDR		0xC0000000
132 #define XSHAL_SIMIO_SIZE		0x20000000
133 
134 
135 /*----------------------------------------------------------------------
136  *  For use by reference testbench exit and diagnostic routines.
137  */
138 #define XSHAL_MAGIC_EXIT		0xa0000000
139 
140 /*----------------------------------------------------------------------
141  *			DEVICE-ADDRESS DEPENDENT...
142  *
143  *  Values written to CACHEATTR special register (or its equivalent)
144  *  to enable and disable caches in various modes.
145  *----------------------------------------------------------------------*/
146 
147 /*----------------------------------------------------------------------
148 			BACKWARD COMPATIBILITY ...
149   ----------------------------------------------------------------------*/
150 
151 /*
152  *  NOTE:  the following two macros are DEPRECATED.  Use the latter
153  *  board-specific macros instead, which are specially tuned for the
154  *  particular target environments' memory maps.
155  */
156 #define XSHAL_CACHEATTR_BYPASS		XSHAL_XT2000_CACHEATTR_BYPASS	/* disable caches in bypass mode */
157 #define XSHAL_CACHEATTR_DEFAULT		XSHAL_XT2000_CACHEATTR_DEFAULT	/* default setting to enable caches (no writeback!) */
158 
159 /*----------------------------------------------------------------------
160 				GENERIC
161   ----------------------------------------------------------------------*/
162 
163 /*  For the following, a 512MB region is used if it contains a system (PIF) RAM,
164  *  system (PIF) ROM, local memory, or XLMI.  */
165 
166 /*  These set any unused 512MB region to cache-BYPASS attribute:  */
167 #define XSHAL_ALLVALID_CACHEATTR_WRITEBACK	0x22242422	/* enable caches in write-back mode */
168 #define XSHAL_ALLVALID_CACHEATTR_WRITEALLOC	0x22212122	/* enable caches in write-allocate mode */
169 #define XSHAL_ALLVALID_CACHEATTR_WRITETHRU	0x22212122	/* enable caches in write-through mode */
170 #define XSHAL_ALLVALID_CACHEATTR_BYPASS		0x22222222	/* disable caches in bypass mode */
171 #define XSHAL_ALLVALID_CACHEATTR_DEFAULT	XSHAL_ALLVALID_CACHEATTR_WRITEBACK	/* default setting to enable caches */
172 
173 /*  These set any unused 512MB region to ILLEGAL attribute:  */
174 #define XSHAL_STRICT_CACHEATTR_WRITEBACK	0xFFF4F4FF	/* enable caches in write-back mode */
175 #define XSHAL_STRICT_CACHEATTR_WRITEALLOC	0xFFF1F1FF	/* enable caches in write-allocate mode */
176 #define XSHAL_STRICT_CACHEATTR_WRITETHRU	0xFFF1F1FF	/* enable caches in write-through mode */
177 #define XSHAL_STRICT_CACHEATTR_BYPASS		0xFFF2F2FF	/* disable caches in bypass mode */
178 #define XSHAL_STRICT_CACHEATTR_DEFAULT		XSHAL_STRICT_CACHEATTR_WRITEBACK	/* default setting to enable caches */
179 
180 /*  These set the first 512MB, if unused, to ILLEGAL attribute to help catch
181  *  NULL-pointer dereference bugs; all other unused 512MB regions are set
182  *  to cache-BYPASS attribute:  */
183 #define XSHAL_TRAPNULL_CACHEATTR_WRITEBACK	0x2224242F	/* enable caches in write-back mode */
184 #define XSHAL_TRAPNULL_CACHEATTR_WRITEALLOC	0x2221212F	/* enable caches in write-allocate mode */
185 #define XSHAL_TRAPNULL_CACHEATTR_WRITETHRU	0x2221212F	/* enable caches in write-through mode */
186 #define XSHAL_TRAPNULL_CACHEATTR_BYPASS		0x2222222F	/* disable caches in bypass mode */
187 #define XSHAL_TRAPNULL_CACHEATTR_DEFAULT	XSHAL_TRAPNULL_CACHEATTR_WRITEBACK	/* default setting to enable caches */
188 
189 /*----------------------------------------------------------------------
190 			ISS (Instruction Set Simulator) SPECIFIC ...
191   ----------------------------------------------------------------------*/
192 
193 /*  For now, ISS defaults to the TRAPNULL settings:  */
194 #define XSHAL_ISS_CACHEATTR_WRITEBACK	XSHAL_TRAPNULL_CACHEATTR_WRITEBACK
195 #define XSHAL_ISS_CACHEATTR_WRITEALLOC	XSHAL_TRAPNULL_CACHEATTR_WRITEALLOC
196 #define XSHAL_ISS_CACHEATTR_WRITETHRU	XSHAL_TRAPNULL_CACHEATTR_WRITETHRU
197 #define XSHAL_ISS_CACHEATTR_BYPASS	XSHAL_TRAPNULL_CACHEATTR_BYPASS
198 #define XSHAL_ISS_CACHEATTR_DEFAULT	XSHAL_TRAPNULL_CACHEATTR_WRITEBACK
199 
200 #define XSHAL_ISS_PIPE_REGIONS	0
201 #define XSHAL_ISS_SDRAM_REGIONS	0
202 
203 
204 /*----------------------------------------------------------------------
205 			XT2000 BOARD SPECIFIC ...
206   ----------------------------------------------------------------------*/
207 
208 /*  For the following, a 512MB region is used if it contains any system RAM,
209  *  system ROM, local memory, XLMI, or other XT2000 board device or memory.
210  *  Regions containing devices are forced to cache-BYPASS mode regardless
211  *  of whether the macro is _WRITEBACK vs. _BYPASS etc.  */
212 
213 /*  These set any 512MB region unused on the XT2000 to ILLEGAL attribute:  */
214 #define XSHAL_XT2000_CACHEATTR_WRITEBACK	0xFFF4422F	/* enable caches in write-back mode */
215 #define XSHAL_XT2000_CACHEATTR_WRITEALLOC	0xFFF1122F	/* enable caches in write-allocate mode */
216 #define XSHAL_XT2000_CACHEATTR_WRITETHRU	0xFFF1122F	/* enable caches in write-through mode */
217 #define XSHAL_XT2000_CACHEATTR_BYPASS		0xFFF2222F	/* disable caches in bypass mode */
218 #define XSHAL_XT2000_CACHEATTR_DEFAULT		XSHAL_XT2000_CACHEATTR_WRITEBACK	/* default setting to enable caches */
219 
220 #define XSHAL_XT2000_PIPE_REGIONS	0x00000000	/* BusInt pipeline regions */
221 #define XSHAL_XT2000_SDRAM_REGIONS	0x00000104	/* BusInt SDRAM regions */
222 
223 
224 /*----------------------------------------------------------------------
225 				VECTOR INFO AND SIZES
226   ----------------------------------------------------------------------*/
227 
228 #define XSHAL_VECTORS_PACKED		0
229 #define XSHAL_STATIC_VECTOR_SELECT	0
230 #define XSHAL_RESET_VECTOR_VADDR	0x596F8000
231 #define XSHAL_RESET_VECTOR_PADDR	0x596F8000
232 
233 /*
234  *  Sizes allocated to vectors by the system (memory map) configuration.
235  *  These sizes are constrained by core configuration (eg. one vector's
236  *  code cannot overflow into another vector) but are dependent on the
237  *  system or board (or LSP) memory map configuration.
238  *
239  *  Whether or not each vector happens to be in a system ROM is also
240  *  a system configuration matter, sometimes useful, included here also:
241  */
242 #define XSHAL_RESET_VECTOR_SIZE	0x000002E0
243 #define XSHAL_RESET_VECTOR_ISROM	0
244 #define XSHAL_USER_VECTOR_SIZE	0x0000001C
245 #define XSHAL_USER_VECTOR_ISROM	0
246 #define XSHAL_PROGRAMEXC_VECTOR_SIZE	XSHAL_USER_VECTOR_SIZE	/* for backward compatibility */
247 #define XSHAL_USEREXC_VECTOR_SIZE	XSHAL_USER_VECTOR_SIZE	/* for backward compatibility */
248 #define XSHAL_KERNEL_VECTOR_SIZE	0x0000001C
249 #define XSHAL_KERNEL_VECTOR_ISROM	0
250 #define XSHAL_STACKEDEXC_VECTOR_SIZE	XSHAL_KERNEL_VECTOR_SIZE	/* for backward compatibility */
251 #define XSHAL_KERNELEXC_VECTOR_SIZE	XSHAL_KERNEL_VECTOR_SIZE	/* for backward compatibility */
252 #define XSHAL_DOUBLEEXC_VECTOR_SIZE	0x0000001C
253 #define XSHAL_DOUBLEEXC_VECTOR_ISROM	0
254 #define XSHAL_WINDOW_VECTORS_SIZE	0x00000178
255 #define XSHAL_WINDOW_VECTORS_ISROM	0
256 #define XSHAL_INTLEVEL2_VECTOR_SIZE	0x0000001C
257 #define XSHAL_INTLEVEL2_VECTOR_ISROM	0
258 #define XSHAL_INTLEVEL3_VECTOR_SIZE	0x0000001C
259 #define XSHAL_INTLEVEL3_VECTOR_ISROM	0
260 #define XSHAL_INTLEVEL4_VECTOR_SIZE	0x0000001C
261 #define XSHAL_INTLEVEL4_VECTOR_ISROM	0
262 #define XSHAL_DEBUG_VECTOR_SIZE		XSHAL_INTLEVEL4_VECTOR_SIZE
263 #define XSHAL_DEBUG_VECTOR_ISROM	XSHAL_INTLEVEL4_VECTOR_ISROM
264 #define XSHAL_NMI_VECTOR_SIZE	0x0000001C
265 #define XSHAL_NMI_VECTOR_ISROM	0
266 #define XSHAL_INTLEVEL5_VECTOR_SIZE	XSHAL_NMI_VECTOR_SIZE
267 
268 
269 #endif /*XTENSA_CONFIG_SYSTEM_H*/
270 
271