Subversion Repositories HelenOS

Rev

Rev 1888 | Go to most recent revision | 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. /** @addtogroup mips32 
  30.  * @{
  31.  */
  32. /** @file
  33.  */
  34.  
  35. #ifndef KERN_mips32_ARC_H_
  36. #define KERN_mips32_ARC_H_
  37.  
  38. #include <arch/types.h>
  39. #include <console/chardev.h>
  40.  
  41. #define ARC_BASE_ADDR 0x1000;
  42. #define ARC_MAGIC 0x53435241
  43. /* Frame size used by ARC */
  44. #define ARC_FRAME 4096
  45.  
  46. typedef enum {
  47.     CmResourceTypeNull = 0,
  48.     CmResourceTypePort,
  49.     CmResourceTypeInterrupt,
  50.     CmResourceTypeMemory,
  51.     CmResourceTypeDma,
  52.     CmResourceTypeDeviceSpecific,
  53.     CmResourceTypeVendor,
  54.     CmResourceTypeProductName,
  55.     CmResourceTypeSerialNumber
  56. } cm_resource_type;
  57.  
  58. typedef struct {
  59.     uint8_t type;
  60.     uint8_t sharedisposition;
  61.     uint16_t flags;
  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;
  77. } __attribute__ ((packed)) cm_resource_descriptor;
  78.  
  79. typedef struct {
  80.     uint16_t version;
  81.     uint16_t revision;
  82.     unsigned long count;
  83.     cm_resource_descriptor descr[1];
  84. } __attribute__ ((packed)) cm_resource_list;
  85.  
  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
  140. } arc_component_type;
  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
  150. } arc_component_flags;
  151.  
  152. typedef struct  {
  153.     arc_component_class class;
  154.     arc_component_type type;
  155.     arc_component_flags flags;
  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;
  162.     char *identifier;
  163. } __attribute__ ((packed)) arc_component;
  164.  
  165. typedef struct {
  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;
  173. } __attribute__ ((packed)) arc_timeinfo;
  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
  185. } arc_memorytype_t;
  186.  
  187. typedef struct  {
  188.     arc_memorytype_t type;
  189.     uint32_t basepage;  /* *4096 = baseaddr */
  190.     uint32_t basecount;
  191. } arc_memdescriptor_t;
  192.  
  193. typedef struct {
  194.     char vendorid[8];
  195.     char prodid[8];
  196. } arc_sysid_t;
  197.  
  198. typedef struct {
  199.     long (*load)(void); /* ... */
  200.     long (*invoke)(uint32_t eaddr,uint32_t saddr,uint32_t argc,char **argv,
  201.                char **envp);
  202.     long (*execute)(char *path,uint32_t argc,char **argv,char **envp);
  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);
  224.     uint32_t (*getrelativetime)(void);
  225.     long (*getdirectoryentry)();
  226.     long (*open)(void); /* ... */
  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);
  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); /* ... */
  237.     long (*setfileinformation)(uint32_t fileid,uint32_t attflags,uint32_t attmask);
  238.     void (*flushallcaches)(void);
  239.     long (*testunicodecharacter)(void); /* ... */
  240.     long (*getdisplaystatus)(void); /* ... */
  241. } arc_func_vector_t;
  242.  
  243. typedef struct {
  244.     uint32_t signature;
  245.     uint32_t length;
  246.     uint16_t version;
  247.     uint16_t revision;
  248.     void *restartblock;
  249.     void *debugblock;
  250.     void *gevector;
  251.     void *utlbmissvector;
  252.     uint32_t firmwarevectorlen;
  253.     arc_func_vector_t *firmwarevector;
  254.     uint32_t privvectorlen;
  255.     void *privvector;
  256.     uint32_t adaptercount;
  257. } __attribute__ ((packed)) arc_sbp;
  258.  
  259. extern int arc_init(void);
  260. extern int arc_enabled(void);
  261. void arc_frame_init(void);
  262. void arc_console(void);
  263.  
  264. #endif
  265.  
  266.  /** @}
  267.  */
  268.