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