arc.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2005 Ondrej Palkovsky
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00035 #ifndef __mips32_ARC_H__
00036 #define __mips32_ARC_H__
00037 
00038 #include <arch/types.h>
00039 #include <console/chardev.h>
00040 
00041 #define ARC_BASE_ADDR 0x1000;
00042 #define ARC_MAGIC 0x53435241
00043 /* Frame size used by ARC */
00044 #define ARC_FRAME 4096
00045 
00046 typedef enum {
00047         CmResourceTypeNull = 0,
00048         CmResourceTypePort,
00049         CmResourceTypeInterrupt,
00050         CmResourceTypeMemory,
00051         CmResourceTypeDma,
00052         CmResourceTypeDeviceSpecific,
00053         CmResourceTypeVendor,
00054         CmResourceTypeProductName,
00055         CmResourceTypeSerialNumber
00056 }cm_resource_type;
00057 
00058 typedef struct {
00059         __u8 type;
00060         __u8 sharedisposition;
00061         __u16 flags;
00062         union {
00063                 struct {
00064                         long long start; /* 64-bit phys address */
00065                         unsigned long length;
00066                 }port;
00067                 struct {
00068                         unsigned long level;
00069                         unsigned long vector;
00070                         unsigned long reserved1;
00071                 }interrupt;
00072                 struct {
00073                         long long start; /* 64-bit phys address */
00074                         unsigned long length;
00075                 }memory;
00076         }u;
00077 }__attribute__ ((packed)) cm_resource_descriptor;
00078 
00079 typedef struct {
00080         __u16 version;
00081         __u16 revision;
00082         unsigned long count;
00083         cm_resource_descriptor descr[1];
00084 }__attribute__ ((packed)) cm_resource_list;
00085 
00086 typedef enum {
00087         SystemClass = 0,
00088         ProcessorClass,
00089         CacheClass,
00090         AdapterClass,
00091         ControllerClass,
00092         PeripheralClass,
00093         MemoryClass
00094 } arc_component_class;
00095 
00096 typedef enum {
00097         ARC_type = 0,
00098         CPU_type,
00099         FPU_type,
00100         PrimaryICache,
00101         PrimaryDCache,
00102         SecondaryICache,
00103         SecondaryDCache,
00104         SecondaryCache,
00105         Memory, /* Not in NT PROM */
00106         EISAAdapter,
00107         TCAdapter,
00108         SCSIAdapter,
00109         DTIAdapter,
00110         MultiFunctionAdapter,
00111         DiskController,
00112         TapeController,
00113         CDROMController,
00114         WORMController,
00115         SerialController,
00116         NetworkController,
00117         DisplayController,
00118         ParallelController,
00119         PointerController,
00120         KeyboardController,
00121         AudioController,
00122         OtherController,
00123         DiskPeripheral,
00124         FloppyDiskPeripheral,
00125         TapePeripheral,
00126         ModemPeripheral,
00127         MonitorPeripheral,
00128         PrinterPeripheral,
00129         PointerPeripheral,
00130         KeyboardPeripheral,
00131         TerminalPeripheral,
00132         LinePeripheral,
00133         NetworkPeripheral,
00134         OtherPeripheral,
00135         XTalkAdapter,
00136         PCIAdapter,
00137         GIOAdapter,
00138         TPUAdapter,
00139         Anonymous
00140 }arc_component_type;
00141 
00142 typedef enum {
00143         Failed = 1,
00144         ReadOnly = 2,
00145         Removable = 4,
00146         ConsoleIn = 8,
00147         ConsoleOut = 16,
00148         Input = 32,
00149         Output = 64
00150 }arc_component_flags;
00151 
00152 typedef struct  {
00153         arc_component_class class;
00154         arc_component_type type;
00155         arc_component_flags flags;
00156         __u16 revision;
00157         __u16 version;
00158         __u32 key;
00159         __u32 affinitymask;
00160         __u32 configdatasize;
00161         __u32 identifier_len;
00162         char *identifier;
00163 } __attribute__ ((packed)) arc_component;
00164 
00165 typedef struct {
00166         __u16 year;
00167         __u16 month;
00168         __u16 day;
00169         __u16 hour;
00170         __u16 minutes;
00171         __u16 seconds;
00172         __u16 mseconds;
00173 } __attribute__ ((packed)) arc_timeinfo;
00174 
00175 /* This is the SGI block structure, WinNT has it different */
00176 typedef enum {
00177         ExceptionBlock,
00178         SystemParameterBlock,
00179         FreeContiguous,
00180         FreeMemory,
00181         BadMemory,
00182         LoadedProgram,
00183         FirmwareTemporary,
00184         FirmwarePermanent
00185 }arc_memorytype_t;
00186 
00187 typedef struct  {
00188         arc_memorytype_t type;
00189         __u32 basepage;  /* *4096 = baseaddr */
00190         __u32 basecount;
00191 }arc_memdescriptor_t;
00192 
00193 typedef struct {
00194         char vendorid[8];
00195         char prodid[8];
00196 }arc_sysid_t;
00197 
00198 typedef struct {
00199         long (*load)(void); /* ... */
00200         long (*invoke)(__u32 eaddr,__u32 saddr,__u32 argc,char **argv,
00201                        char **envp);
00202         long (*execute)(char *path,__u32 argc,char **argv,char **envp);
00203         void (*halt)(void);
00204         void (*powerdown)(void);
00205         void (*restart)(void);
00206         void (*reboot)(void);
00207         void (*enterinteractivemode)(void);
00208         long (*reserved)(void);
00209 /* 10 */        
00210         arc_component * (*getpeer)(arc_component *c); 
00211         arc_component * (*getchild)(arc_component *c);
00212         arc_component * (*getparent)(arc_component *c);
00213         long (*getconfigurationdata)(void *configdata, arc_component *c);
00214         long (*addchild)(arc_component *c, arc_component *template,
00215                          void *configdata);
00216         long (*deletecomponet)(arc_component *current);
00217         long (*getcomponent)(char *path);
00218         long (*saveconfiguration)(void);
00219         arc_sysid_t (*getsystemid)(void);
00220         arc_memdescriptor_t * (*getmemorydescriptor)(arc_memdescriptor_t *cur);
00221 /* 20 */
00222         long (*reserved2)(void);
00223         arc_timeinfo * (*gettime)(void);
00224         __u32 (*getrelativetime)(void);
00225         long (*getdirectoryentry)();
00226         long (*open)(void); /* ... */
00227         long (*close)(__u32 fileid);
00228         long (*read)(__u32 fileid,void *buf,__u32 n,__u32 *cnt);
00229         long (*getreadstatus)(__u32 fileid);
00230         long (*write)(__u32 fileid, void *buf,__u32 n,__u32 *cnt);
00231         long (*seek)(void); /* ... */
00232 /* 30 */
00233         long (*mount)(void); /* ... */
00234         char * (*getenvironmentvariable)(char *name);
00235         char * (*setenvironmentvariable)(char *name, char *value);
00236         long (*getfileinformation)(void); /* ... */
00237         long (*setfileinformation)(__u32 fileid,__u32 attflags,__u32 attmask);
00238         void (*flushallcaches)(void);
00239         long (*testunicodecharacter)(void); /* ... */
00240         long (*getdisplaystatus)(void); /* ... */
00241 } arc_func_vector_t;
00242 
00243 typedef struct {
00244         __u32 signature;
00245         __u32 length;
00246         __u16 version;
00247         __u16 revision;
00248         void *restartblock;
00249         void *debugblock;
00250         void *gevector;
00251         void *utlbmissvector;
00252         __u32 firmwarevectorlen;
00253         arc_func_vector_t *firmwarevector;
00254         __u32 privvectorlen;
00255         void *privvector;
00256         __u32 adaptercount;
00257 }__attribute__ ((packed)) arc_sbp;
00258 
00259 extern int arc_init(void);
00260 extern int arc_enabled(void);
00261 void arc_frame_init(void);
00262 void arc_console(void);
00263 
00264 #endif
00265 

Generated on Sun Jun 18 17:01:57 2006 for HelenOS Kernel (mips32) by  doxygen 1.4.6