dat.h 5.7 KB

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