Subversion Repositories HelenOS

Rev

Rev 1962 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (C) 2005 Ondrej Palkovsky
  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.  
  29. #ifndef __mips32_ARC_H__
  30. #define __mips32_ARC_H__
  31.  
  32. #include <arch/types.h>
  33.  
  34. #define ARC_BASE_ADDR 0x1000;
  35. #define ARC_MAGIC 0x53435241
  36.  
  37. typedef enum {
  38.     SystemClass = 0,
  39.     ProcessorClass,
  40.     CacheClass,
  41.     AdapterClass,
  42.     ControllerClass,
  43.     PeripheralClass,
  44.     MemoryClass
  45. } arc_component_class;
  46.  
  47. typedef enum {
  48.     ARC_type = 0,
  49.     CPU_type,
  50.     FPU_type,
  51.     PrimaryICache,
  52.     PrimaryDCache,
  53.     SecondaryICache,
  54.     SecondaryDCache,
  55.     SecondaryCache,
  56.     Memory, /* Not in NT PROM */
  57.     EISAAdapter,
  58.     TCAdapter,
  59.     SCSIAdapter,
  60.     DTIAdapter,
  61.     MultiFunctionAdapter,
  62.     DiskController,
  63.     TapeController,
  64.     CDROMController,
  65.     WORMController,
  66.     SerialController,
  67.     NetworkController,
  68.     DisplayController,
  69.     ParallelController,
  70.     PointerController,
  71.     KeyboardController,
  72.     AudioController,
  73.     OtherController,
  74.     DiskPeripheral,
  75.     FloppyDiskPeripheral,
  76.     TapePeripheral,
  77.     ModemPeripheral,
  78.     MonitorPeripheral,
  79.     PrinterPeripheral,
  80.     PointerPeripheral,
  81.     KeyboardPeripheral,
  82.     TerminalPeripheral,
  83.     LinePeripheral,
  84.     NetworkPeripheral,
  85.     OtherPeripheral,
  86.     XTalkAdapter,
  87.     PCIAdapter,
  88.     GIOAdapter,
  89.     TPUAdapter,
  90.     Anonymous
  91. }arc_component_type;
  92.  
  93. typedef enum {
  94.     Failed = 1,
  95.     ReadOnly = 2,
  96.     Removable = 4,
  97.     ConsoleIn = 8,
  98.     ConsoleOut = 16,
  99.     Input = 32,
  100.     Output = 64
  101. }arc_component_flags;
  102.  
  103. typedef struct  {
  104.     arc_component_class class;
  105.     arc_component_type type;
  106.     arc_component_flags flags;
  107.     __u16 revision;
  108.     __u16 version;
  109.     __u32 key;
  110.     __u32 affinitymask;
  111.     __u32 configdatasize;
  112.     __u32 identifier_len;
  113.     char *identifier;
  114. } __attribute__ ((packed)) arc_component;
  115.  
  116. typedef struct {
  117.     __u16 year;
  118.     __u16 month;
  119.     __u16 day;
  120.     __u16 hour;
  121.     __u16 minutes;
  122.     __u16 seconds;
  123.     __u16 mseconds;
  124. } __attribute__ ((packed)) arc_timeinfo;
  125.  
  126. /* This is the SGI block structure, WinNT has it different */
  127. typedef enum {
  128.     ExceptionBlock,
  129.     SystemParameterBlock,
  130.     FreeContiguous,
  131.     FreeMemory,
  132.     BadMemory,
  133.     LoadedProgram,
  134.     FirmwareTemporary,
  135.     FirmwarePermanent
  136. }arc_memorytype_t;
  137.  
  138. typedef struct  {
  139.     arc_memorytype_t type;
  140.     __u32 basepage;  /* *4096 = baseaddr */
  141.     __u32 basecount;
  142. }arc_memdescriptor_t;
  143.  
  144. typedef struct {
  145.     char vendorid[8];
  146.     char prodid[8];
  147. }arc_sysid_t;
  148.  
  149. typedef struct {
  150.     long (*load)(void); /* ... */
  151.     long (*invoke)(__u32 eaddr,__u32 saddr,__u32 argc,char **argv,
  152.                char **envp);
  153.     long (*execute)(char *path,__u32 argc,char **argv,char **envp);
  154.     void (*halt)(void);
  155.     void (*powerdown)(void);
  156.     void (*restart)(void);
  157.     void (*reboot)(void);
  158.     void (*enterinteractivemode)(void);
  159.     long (*reserved)(void);
  160. /* 10 */   
  161.     arc_component * (*getpeer)(arc_component *c);
  162.     arc_component * (*getchild)(arc_component *c);
  163.     arc_component * (*getparent)(arc_component *c);
  164.     long (*getconfigurationdata)(void *configdata, arc_component *c);
  165.     long (*addchild)(arc_component *c, arc_component *template,
  166.              void *configdata);
  167.     long (*deletecomponet)(arc_component *current);
  168.     long (*getcomponent)(char *path);
  169.     long (*saveconfiguration)(void);
  170.     arc_sysid_t (*getsystemid)(void);
  171.     arc_memdescriptor_t * (*getmemorydescriptor)(arc_memdescriptor_t *cur);
  172. /* 20 */
  173.     long (*reserved2)(void);
  174.     arc_timeinfo * (*gettime)(void);
  175.     __u32 (*getrelativetime)(void);
  176.     long (*getdirectoryentry)();
  177.     long (*open)(void); /* ... */
  178.     long (*close)(__u32 fileid);
  179.     long (*read)(__u32 fileid,void *buf,__u32 n,__u32 *cnt);
  180.     long (*getreadstatus)();
  181.     long (*write)(__u32 fileid, void *buf,__u32 n,__u32 *cnt);
  182.     long (*seek)(void); /* ... */
  183. /* 30 */
  184.     long (*mount)(void); /* ... */
  185.     char * (*getenvironmentvariable)(char *name);
  186.     char * (*setenvironmentvariable)(char *name, char *value);
  187.     long (*getfileinformation)(void); /* ... */
  188.     long (*setfileinformation)(__u32 fileid,__u32 attflags,__u32 attmask);
  189.     void (*flushallcaches)(void);
  190.     long (*testunicodecharacter)(void); /* ... */
  191.     long (*getdisplaystatus)(void); /* ... */
  192. } arc_func_vector_t;
  193.  
  194. typedef struct {
  195.     __u32 signature;
  196.     __u32 length;
  197.     __u16 version;
  198.     __u16 revision;
  199.     void *restartblock;
  200.     void *debugblock;
  201.     void *gevector;
  202.     void *utlbmissvector;
  203.     __u32 firmwarevectorlen;
  204.     arc_func_vector_t *firmwarevector;
  205.     __u32 privvectorlen;
  206.     void *privvector;
  207.     __u32 adaptercount;
  208. }__attribute__ ((packed)) arc_sbp;
  209.  
  210. extern int init_arc(void);
  211. extern void arc_print_memory_map(void);
  212. extern int arc_enabled(void);
  213. extern void arc_putchar(char ch);
  214. extern void arc_print_devices(void);
  215.  
  216. #endif
  217.