dat.h 5.7 KB

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