dat.h 5.8 KB

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