Rev 1787 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1787 | Rev 1888 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (C) 2005 Ondrej Palkovsky |
2 | * Copyright (C) 2005 Ondrej Palkovsky |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
13 | * documentation and/or other materials provided with the distribution. |
14 | * - The name of the author may not be used to endorse or promote products |
14 | * - The name of the author may not be used to endorse or promote products |
15 | * derived from this software without specific prior written permission. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | /** @addtogroup mips32 |
29 | /** @addtogroup mips32 |
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | */ |
33 | */ |
34 | 34 | ||
35 | #ifndef __mips32_ARC_H__ |
35 | #ifndef KERN_mips32_ARC_H_ |
36 | #define __mips32_ARC_H__ |
36 | #define KERN_mips32_ARC_H_ |
37 | 37 | ||
38 | #include <arch/types.h> |
38 | #include <arch/types.h> |
39 | #include <console/chardev.h> |
39 | #include <console/chardev.h> |
40 | 40 | ||
41 | #define ARC_BASE_ADDR 0x1000; |
41 | #define ARC_BASE_ADDR 0x1000; |
42 | #define ARC_MAGIC 0x53435241 |
42 | #define ARC_MAGIC 0x53435241 |
43 | /* Frame size used by ARC */ |
43 | /* Frame size used by ARC */ |
44 | #define ARC_FRAME 4096 |
44 | #define ARC_FRAME 4096 |
45 | 45 | ||
46 | typedef enum { |
46 | typedef enum { |
47 | CmResourceTypeNull = 0, |
47 | CmResourceTypeNull = 0, |
48 | CmResourceTypePort, |
48 | CmResourceTypePort, |
49 | CmResourceTypeInterrupt, |
49 | CmResourceTypeInterrupt, |
50 | CmResourceTypeMemory, |
50 | CmResourceTypeMemory, |
51 | CmResourceTypeDma, |
51 | CmResourceTypeDma, |
52 | CmResourceTypeDeviceSpecific, |
52 | CmResourceTypeDeviceSpecific, |
53 | CmResourceTypeVendor, |
53 | CmResourceTypeVendor, |
54 | CmResourceTypeProductName, |
54 | CmResourceTypeProductName, |
55 | CmResourceTypeSerialNumber |
55 | CmResourceTypeSerialNumber |
56 | }cm_resource_type; |
56 | } cm_resource_type; |
57 | 57 | ||
58 | typedef struct { |
58 | typedef struct { |
59 | uint8_t type; |
59 | uint8_t type; |
60 | uint8_t sharedisposition; |
60 | uint8_t sharedisposition; |
61 | uint16_t flags; |
61 | uint16_t flags; |
62 | union { |
62 | union { |
63 | struct { |
63 | struct { |
64 | long long start; /* 64-bit phys address */ |
64 | long long start; /* 64-bit phys address */ |
65 | unsigned long length; |
65 | unsigned long length; |
66 | }port; |
66 | }port; |
67 | struct { |
67 | struct { |
68 | unsigned long level; |
68 | unsigned long level; |
69 | unsigned long vector; |
69 | unsigned long vector; |
70 | unsigned long reserved1; |
70 | unsigned long reserved1; |
71 | }interrupt; |
71 | }interrupt; |
72 | struct { |
72 | struct { |
73 | long long start; /* 64-bit phys address */ |
73 | long long start; /* 64-bit phys address */ |
74 | unsigned long length; |
74 | unsigned long length; |
75 | }memory; |
75 | }memory; |
76 | }u; |
76 | }u; |
77 | }__attribute__ ((packed)) cm_resource_descriptor; |
77 | } __attribute__ ((packed)) cm_resource_descriptor; |
78 | 78 | ||
79 | typedef struct { |
79 | typedef struct { |
80 | uint16_t version; |
80 | uint16_t version; |
81 | uint16_t revision; |
81 | uint16_t revision; |
82 | unsigned long count; |
82 | unsigned long count; |
83 | cm_resource_descriptor descr[1]; |
83 | cm_resource_descriptor descr[1]; |
84 | }__attribute__ ((packed)) cm_resource_list; |
84 | } __attribute__ ((packed)) cm_resource_list; |
85 | 85 | ||
86 | typedef enum { |
86 | typedef enum { |
87 | SystemClass = 0, |
87 | SystemClass = 0, |
88 | ProcessorClass, |
88 | ProcessorClass, |
89 | CacheClass, |
89 | CacheClass, |
90 | AdapterClass, |
90 | AdapterClass, |
91 | ControllerClass, |
91 | ControllerClass, |
92 | PeripheralClass, |
92 | PeripheralClass, |
93 | MemoryClass |
93 | MemoryClass |
94 | } arc_component_class; |
94 | } arc_component_class; |
95 | 95 | ||
96 | typedef enum { |
96 | typedef enum { |
97 | ARC_type = 0, |
97 | ARC_type = 0, |
98 | CPU_type, |
98 | CPU_type, |
99 | FPU_type, |
99 | FPU_type, |
100 | PrimaryICache, |
100 | PrimaryICache, |
101 | PrimaryDCache, |
101 | PrimaryDCache, |
102 | SecondaryICache, |
102 | SecondaryICache, |
103 | SecondaryDCache, |
103 | SecondaryDCache, |
104 | SecondaryCache, |
104 | SecondaryCache, |
105 | Memory, /* Not in NT PROM */ |
105 | Memory, /* Not in NT PROM */ |
106 | EISAAdapter, |
106 | EISAAdapter, |
107 | TCAdapter, |
107 | TCAdapter, |
108 | SCSIAdapter, |
108 | SCSIAdapter, |
109 | DTIAdapter, |
109 | DTIAdapter, |
110 | MultiFunctionAdapter, |
110 | MultiFunctionAdapter, |
111 | DiskController, |
111 | DiskController, |
112 | TapeController, |
112 | TapeController, |
113 | CDROMController, |
113 | CDROMController, |
114 | WORMController, |
114 | WORMController, |
115 | SerialController, |
115 | SerialController, |
116 | NetworkController, |
116 | NetworkController, |
117 | DisplayController, |
117 | DisplayController, |
118 | ParallelController, |
118 | ParallelController, |
119 | PointerController, |
119 | PointerController, |
120 | KeyboardController, |
120 | KeyboardController, |
121 | AudioController, |
121 | AudioController, |
122 | OtherController, |
122 | OtherController, |
123 | DiskPeripheral, |
123 | DiskPeripheral, |
124 | FloppyDiskPeripheral, |
124 | FloppyDiskPeripheral, |
125 | TapePeripheral, |
125 | TapePeripheral, |
126 | ModemPeripheral, |
126 | ModemPeripheral, |
127 | MonitorPeripheral, |
127 | MonitorPeripheral, |
128 | PrinterPeripheral, |
128 | PrinterPeripheral, |
129 | PointerPeripheral, |
129 | PointerPeripheral, |
130 | KeyboardPeripheral, |
130 | KeyboardPeripheral, |
131 | TerminalPeripheral, |
131 | TerminalPeripheral, |
132 | LinePeripheral, |
132 | LinePeripheral, |
133 | NetworkPeripheral, |
133 | NetworkPeripheral, |
134 | OtherPeripheral, |
134 | OtherPeripheral, |
135 | XTalkAdapter, |
135 | XTalkAdapter, |
136 | PCIAdapter, |
136 | PCIAdapter, |
137 | GIOAdapter, |
137 | GIOAdapter, |
138 | TPUAdapter, |
138 | TPUAdapter, |
139 | Anonymous |
139 | Anonymous |
140 | }arc_component_type; |
140 | } arc_component_type; |
141 | 141 | ||
142 | typedef enum { |
142 | typedef enum { |
143 | Failed = 1, |
143 | Failed = 1, |
144 | ReadOnly = 2, |
144 | ReadOnly = 2, |
145 | Removable = 4, |
145 | Removable = 4, |
146 | ConsoleIn = 8, |
146 | ConsoleIn = 8, |
147 | ConsoleOut = 16, |
147 | ConsoleOut = 16, |
148 | Input = 32, |
148 | Input = 32, |
149 | Output = 64 |
149 | Output = 64 |
150 | }arc_component_flags; |
150 | } arc_component_flags; |
151 | 151 | ||
152 | typedef struct { |
152 | typedef struct { |
153 | arc_component_class class; |
153 | arc_component_class class; |
154 | arc_component_type type; |
154 | arc_component_type type; |
155 | arc_component_flags flags; |
155 | arc_component_flags flags; |
156 | uint16_t revision; |
156 | uint16_t revision; |
157 | uint16_t version; |
157 | uint16_t version; |
158 | uint32_t key; |
158 | uint32_t key; |
159 | uint32_t affinitymask; |
159 | uint32_t affinitymask; |
160 | uint32_t configdatasize; |
160 | uint32_t configdatasize; |
161 | uint32_t identifier_len; |
161 | uint32_t identifier_len; |
162 | char *identifier; |
162 | char *identifier; |
163 | } __attribute__ ((packed)) arc_component; |
163 | } __attribute__ ((packed)) arc_component; |
164 | 164 | ||
165 | typedef struct { |
165 | typedef struct { |
166 | uint16_t year; |
166 | uint16_t year; |
167 | uint16_t month; |
167 | uint16_t month; |
168 | uint16_t day; |
168 | uint16_t day; |
169 | uint16_t hour; |
169 | uint16_t hour; |
170 | uint16_t minutes; |
170 | uint16_t minutes; |
171 | uint16_t seconds; |
171 | uint16_t seconds; |
172 | uint16_t mseconds; |
172 | uint16_t mseconds; |
173 | } __attribute__ ((packed)) arc_timeinfo; |
173 | } __attribute__ ((packed)) arc_timeinfo; |
174 | 174 | ||
175 | /* This is the SGI block structure, WinNT has it different */ |
175 | /* This is the SGI block structure, WinNT has it different */ |
176 | typedef enum { |
176 | typedef enum { |
177 | ExceptionBlock, |
177 | ExceptionBlock, |
178 | SystemParameterBlock, |
178 | SystemParameterBlock, |
179 | FreeContiguous, |
179 | FreeContiguous, |
180 | FreeMemory, |
180 | FreeMemory, |
181 | BadMemory, |
181 | BadMemory, |
182 | LoadedProgram, |
182 | LoadedProgram, |
183 | FirmwareTemporary, |
183 | FirmwareTemporary, |
184 | FirmwarePermanent |
184 | FirmwarePermanent |
185 | }arc_memorytype_t; |
185 | } arc_memorytype_t; |
186 | 186 | ||
187 | typedef struct { |
187 | typedef struct { |
188 | arc_memorytype_t type; |
188 | arc_memorytype_t type; |
189 | uint32_t basepage; /* *4096 = baseaddr */ |
189 | uint32_t basepage; /* *4096 = baseaddr */ |
190 | uint32_t basecount; |
190 | uint32_t basecount; |
191 | }arc_memdescriptor_t; |
191 | } arc_memdescriptor_t; |
192 | 192 | ||
193 | typedef struct { |
193 | typedef struct { |
194 | char vendorid[8]; |
194 | char vendorid[8]; |
195 | char prodid[8]; |
195 | char prodid[8]; |
196 | }arc_sysid_t; |
196 | } arc_sysid_t; |
197 | 197 | ||
198 | typedef struct { |
198 | typedef struct { |
199 | long (*load)(void); /* ... */ |
199 | long (*load)(void); /* ... */ |
200 | long (*invoke)(uint32_t eaddr,uint32_t saddr,uint32_t argc,char **argv, |
200 | long (*invoke)(uint32_t eaddr,uint32_t saddr,uint32_t argc,char **argv, |
201 | char **envp); |
201 | char **envp); |
202 | long (*execute)(char *path,uint32_t argc,char **argv,char **envp); |
202 | long (*execute)(char *path,uint32_t argc,char **argv,char **envp); |
203 | void (*halt)(void); |
203 | void (*halt)(void); |
204 | void (*powerdown)(void); |
204 | void (*powerdown)(void); |
205 | void (*restart)(void); |
205 | void (*restart)(void); |
206 | void (*reboot)(void); |
206 | void (*reboot)(void); |
207 | void (*enterinteractivemode)(void); |
207 | void (*enterinteractivemode)(void); |
208 | long (*reserved)(void); |
208 | long (*reserved)(void); |
209 | /* 10 */ |
209 | /* 10 */ |
210 | arc_component * (*getpeer)(arc_component *c); |
210 | arc_component * (*getpeer)(arc_component *c); |
211 | arc_component * (*getchild)(arc_component *c); |
211 | arc_component * (*getchild)(arc_component *c); |
212 | arc_component * (*getparent)(arc_component *c); |
212 | arc_component * (*getparent)(arc_component *c); |
213 | long (*getconfigurationdata)(void *configdata, arc_component *c); |
213 | long (*getconfigurationdata)(void *configdata, arc_component *c); |
214 | long (*addchild)(arc_component *c, arc_component *template, |
214 | long (*addchild)(arc_component *c, arc_component *template, |
215 | void *configdata); |
215 | void *configdata); |
216 | long (*deletecomponet)(arc_component *current); |
216 | long (*deletecomponet)(arc_component *current); |
217 | long (*getcomponent)(char *path); |
217 | long (*getcomponent)(char *path); |
218 | long (*saveconfiguration)(void); |
218 | long (*saveconfiguration)(void); |
219 | arc_sysid_t (*getsystemid)(void); |
219 | arc_sysid_t (*getsystemid)(void); |
220 | arc_memdescriptor_t * (*getmemorydescriptor)(arc_memdescriptor_t *cur); |
220 | arc_memdescriptor_t * (*getmemorydescriptor)(arc_memdescriptor_t *cur); |
221 | /* 20 */ |
221 | /* 20 */ |
222 | long (*reserved2)(void); |
222 | long (*reserved2)(void); |
223 | arc_timeinfo * (*gettime)(void); |
223 | arc_timeinfo * (*gettime)(void); |
224 | uint32_t (*getrelativetime)(void); |
224 | uint32_t (*getrelativetime)(void); |
225 | long (*getdirectoryentry)(); |
225 | long (*getdirectoryentry)(); |
226 | long (*open)(void); /* ... */ |
226 | long (*open)(void); /* ... */ |
227 | long (*close)(uint32_t fileid); |
227 | long (*close)(uint32_t fileid); |
228 | long (*read)(uint32_t fileid,void *buf,uint32_t n,uint32_t *cnt); |
228 | long (*read)(uint32_t fileid,void *buf,uint32_t n,uint32_t *cnt); |
229 | long (*getreadstatus)(uint32_t fileid); |
229 | long (*getreadstatus)(uint32_t fileid); |
230 | long (*write)(uint32_t fileid, void *buf,uint32_t n,uint32_t *cnt); |
230 | long (*write)(uint32_t fileid, void *buf,uint32_t n,uint32_t *cnt); |
231 | long (*seek)(void); /* ... */ |
231 | long (*seek)(void); /* ... */ |
232 | /* 30 */ |
232 | /* 30 */ |
233 | long (*mount)(void); /* ... */ |
233 | long (*mount)(void); /* ... */ |
234 | char * (*getenvironmentvariable)(char *name); |
234 | char * (*getenvironmentvariable)(char *name); |
235 | char * (*setenvironmentvariable)(char *name, char *value); |
235 | char * (*setenvironmentvariable)(char *name, char *value); |
236 | long (*getfileinformation)(void); /* ... */ |
236 | long (*getfileinformation)(void); /* ... */ |
237 | long (*setfileinformation)(uint32_t fileid,uint32_t attflags,uint32_t attmask); |
237 | long (*setfileinformation)(uint32_t fileid,uint32_t attflags,uint32_t attmask); |
238 | void (*flushallcaches)(void); |
238 | void (*flushallcaches)(void); |
239 | long (*testunicodecharacter)(void); /* ... */ |
239 | long (*testunicodecharacter)(void); /* ... */ |
240 | long (*getdisplaystatus)(void); /* ... */ |
240 | long (*getdisplaystatus)(void); /* ... */ |
241 | } arc_func_vector_t; |
241 | } arc_func_vector_t; |
242 | 242 | ||
243 | typedef struct { |
243 | typedef struct { |
244 | uint32_t signature; |
244 | uint32_t signature; |
245 | uint32_t length; |
245 | uint32_t length; |
246 | uint16_t version; |
246 | uint16_t version; |
247 | uint16_t revision; |
247 | uint16_t revision; |
248 | void *restartblock; |
248 | void *restartblock; |
249 | void *debugblock; |
249 | void *debugblock; |
250 | void *gevector; |
250 | void *gevector; |
251 | void *utlbmissvector; |
251 | void *utlbmissvector; |
252 | uint32_t firmwarevectorlen; |
252 | uint32_t firmwarevectorlen; |
253 | arc_func_vector_t *firmwarevector; |
253 | arc_func_vector_t *firmwarevector; |
254 | uint32_t privvectorlen; |
254 | uint32_t privvectorlen; |
255 | void *privvector; |
255 | void *privvector; |
256 | uint32_t adaptercount; |
256 | uint32_t adaptercount; |
257 | }__attribute__ ((packed)) arc_sbp; |
257 | } __attribute__ ((packed)) arc_sbp; |
258 | 258 | ||
259 | extern int arc_init(void); |
259 | extern int arc_init(void); |
260 | extern int arc_enabled(void); |
260 | extern int arc_enabled(void); |
261 | void arc_frame_init(void); |
261 | void arc_frame_init(void); |
262 | void arc_console(void); |
262 | void arc_console(void); |
263 | 263 | ||
264 | #endif |
264 | #endif |
265 | 265 | ||
266 | /** @} |
266 | /** @} |
267 | */ |
267 | */ |
268 | - | ||
269 | 268 |