dat.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. typedef struct Cisdat Cisdat;
  2. typedef struct Conf Conf;
  3. typedef struct FPU FPU;
  4. typedef struct FPenv FPenv;
  5. typedef struct FPsave FPsave;
  6. typedef struct DevConf DevConf;
  7. typedef struct Label Label;
  8. typedef struct Lock Lock;
  9. typedef struct MMU MMU;
  10. typedef struct Mach Mach;
  11. typedef struct Notsave Notsave;
  12. typedef struct Page Page;
  13. typedef struct PCMmap PCMmap;
  14. typedef struct PCMslot PCMslot;
  15. typedef struct PCMconftab PCMconftab;
  16. typedef struct PhysUart PhysUart;
  17. typedef struct PMMU PMMU;
  18. typedef struct Proc Proc;
  19. typedef struct Uart Uart;
  20. typedef struct Ureg Ureg;
  21. typedef struct Vctl Vctl;
  22. #pragma incomplete Ureg
  23. typedef void IntrHandler(Ureg*, void*);
  24. #define MAXSYSARG 5 /* for mount(fd, mpt, flag, arg, srv) */
  25. /*
  26. * parameters for sysproc.c
  27. */
  28. #define AOUT_MAGIC (E_MAGIC)
  29. struct Lock
  30. {
  31. ulong key;
  32. ulong sr;
  33. ulong pc;
  34. Proc *p;
  35. ushort isilock;
  36. };
  37. struct Label
  38. {
  39. ulong sp;
  40. ulong pc;
  41. };
  42. /*
  43. * FPsave.status
  44. */
  45. enum
  46. {
  47. FPinit,
  48. FPactive,
  49. FPinactive,
  50. };
  51. struct FPsave
  52. {
  53. ulong status;
  54. ulong control;
  55. ulong regs[8][3]; /* emulated fp */
  56. };
  57. struct Conf
  58. {
  59. ulong nmach; /* processors */
  60. ulong nproc; /* processes */
  61. ulong npage0; /* total physical pages of memory */
  62. ulong npage1; /* total physical pages of memory */
  63. ulong npage; /* total physical pages of memory */
  64. ulong upages; /* user page pool */
  65. ulong nimage; /* number of page cache image headers */
  66. ulong nswap; /* number of swap pages */
  67. int nswppo; /* max # of pageouts per segment pass */
  68. ulong base0; /* base of bank 0 */
  69. ulong base1; /* base of bank 1 */
  70. ulong copymode; /* 0 is copy on write, 1 is copy on reference */
  71. int monitor;
  72. ulong ialloc; /* bytes available for interrupt time allocation */
  73. ulong pipeqsize; /* size in bytes of pipe queues */
  74. ulong hz; /* processor cycle freq */
  75. ulong mhz;
  76. };
  77. /*
  78. * MMU stuff in proc
  79. */
  80. enum
  81. {
  82. NCOLOR= 1, /* 1 level cache, don't worry about VCE's */
  83. Nmeg= 32, /* maximum size of user space */
  84. };
  85. struct PMMU
  86. {
  87. Page *l1page[Nmeg]; /* this's process' level 1 entries */
  88. ulong l1table[Nmeg]; /* ... */
  89. Page *mmufree; /* free mmu pages */
  90. };
  91. /*
  92. * things saved in the Proc structure during a notify
  93. */
  94. struct Notsave
  95. {
  96. int dummy;
  97. };
  98. #include "../port/portdat.h"
  99. struct Mach
  100. {
  101. int machno; /* physical id of processor */
  102. ulong splpc; /* pc of last caller to splhi */
  103. Proc *proc; /* current process */
  104. ulong mmupid; /* process id currently in mmu & cache */
  105. ulong ticks; /* of the clock since boot time */
  106. Label sched; /* scheduler wakeup */
  107. Lock alarmlock; /* access to alarm list */
  108. void* alarm; /* alarms bound to this clock */
  109. int inclockintr;
  110. Proc* readied; /* for runproc */
  111. ulong schedticks; /* next forced context switch */
  112. /* stats */
  113. int tlbfault;
  114. int tlbpurge;
  115. int pfault;
  116. int cs;
  117. int syscall;
  118. int load;
  119. int intr;
  120. vlong fastclock; /* last sampled value */
  121. uvlong inidle; /* time spent in idlehands() */
  122. ulong spuriousintr;
  123. int lastintr;
  124. int ilockdepth;
  125. Perf perf; /* performance counters */
  126. int flushmmu; /* make current proc flush it's mmu state */
  127. Proc *pid2proc[31]; /* what proc holds what pid */
  128. int lastpid; /* highest assigned pid slot */
  129. int cpumhz; /* speed of cpu */
  130. vlong cpuhz; /* ... */
  131. uvlong cyclefreq; /* Frequency of user readable cycle counter */
  132. /* save areas for exceptions */
  133. ulong sfiq[5];
  134. ulong sirq[5];
  135. ulong sund[5];
  136. ulong sabt[5];
  137. int stack[1];
  138. };
  139. /*
  140. * Fake kmap since we direct map dram
  141. */
  142. typedef void KMap;
  143. #define VA(k) ((ulong)(k))
  144. #define kmap(p) (KMap*)((p)->pa)
  145. #define kunmap(k)
  146. struct
  147. {
  148. Lock;
  149. int machs; /* bitmap of active CPUs */
  150. int exiting; /* shutdown */
  151. int ispanic; /* shutdown in response to a panic */
  152. }active;
  153. #define MACHP(n) ((Mach *)(MACHADDR+(n)*BY2PG))
  154. extern Mach *m;
  155. extern Proc *up;
  156. enum
  157. {
  158. OneMeg= 1024*1024,
  159. };
  160. /*
  161. * PCMCIA structures known by both port/cis.c and the pcmcia driver
  162. */
  163. /*
  164. * Map between ISA memory space and PCMCIA card memory space.
  165. */
  166. struct PCMmap {
  167. ulong ca; /* card address */
  168. ulong cea; /* card end address */
  169. ulong isa; /* local virtual address */
  170. int len; /* length of the ISA area */
  171. int attr; /* attribute memory */
  172. };
  173. /*
  174. * a PCMCIA configuration entry
  175. */
  176. struct PCMconftab
  177. {
  178. int index;
  179. ushort irqs; /* legal irqs */
  180. uchar irqtype;
  181. uchar bit16; /* true for 16 bit access */
  182. struct {
  183. ulong start;
  184. ulong len;
  185. } io[16];
  186. int nio;
  187. uchar vpp1;
  188. uchar vpp2;
  189. uchar memwait;
  190. ulong maxwait;
  191. ulong readywait;
  192. ulong otherwait;
  193. };
  194. /*
  195. * PCMCIA card slot
  196. */
  197. struct PCMslot
  198. {
  199. RWlock;
  200. Ref ref;
  201. long memlen; /* memory length */
  202. uchar slotno; /* slot number */
  203. void *regs; /* i/o registers */
  204. void *mem; /* memory */
  205. void *attr; /* attribute memory */
  206. /* status */
  207. uchar occupied; /* card in the slot */
  208. uchar configed; /* card configured */
  209. uchar inserted; /* card just inserted */
  210. Dev *dev; /* set in ctlwrite `configure' */
  211. /* cis info */
  212. int cisread; /* set when the cis has been read */
  213. char verstr[512]; /* version string */
  214. uchar cpresent; /* config registers present */
  215. ulong caddr; /* relative address of config registers */
  216. int nctab; /* number of config table entries */
  217. PCMconftab ctab[8];
  218. PCMconftab *def; /* default conftab */
  219. /* maps are fixed */
  220. PCMmap memmap;
  221. PCMmap attrmap;
  222. };
  223. /*
  224. * hardware info about a device
  225. */
  226. typedef struct {
  227. ulong port;
  228. int size;
  229. } Devport;
  230. struct DevConf
  231. {
  232. RWlock; /* write: configure/unconfigure/suspend; read: normal access */
  233. ulong mem; /* mapped memory address */
  234. Devport *ports; /* ports[0]: mapped i/o regs, access size */
  235. int nports; /* always 1 for the bitsy */
  236. int itype; /* type of interrupt */
  237. ulong intnum; /* interrupt number */
  238. char *type; /* card type, mallocated */
  239. };