dat.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. typedef struct Conf Conf;
  2. typedef struct Confmem Confmem;
  3. typedef struct FPsave FPsave;
  4. typedef struct ISAConf ISAConf;
  5. typedef struct Label Label;
  6. typedef struct Lock Lock;
  7. typedef struct Mach Mach;
  8. typedef struct Notsave Notsave;
  9. typedef struct Page Page;
  10. typedef struct PCArch PCArch;
  11. typedef struct PCB PCB;
  12. typedef struct Pcidev Pcidev;
  13. typedef struct PMMU PMMU;
  14. typedef struct Proc Proc;
  15. typedef struct Sys Sys;
  16. typedef struct Ureg Ureg;
  17. typedef struct Vctl Vctl;
  18. typedef vlong Tval;
  19. #define MAXSYSARG 6 /* for mount(fd, mpt, flag, arg, srv) */
  20. /*
  21. * parameters for sysproc.c
  22. */
  23. #define AOUT_MAGIC L_MAGIC
  24. /*
  25. * machine dependent definitions used by ../port/dat.h
  26. */
  27. struct Lock
  28. {
  29. ulong key; /* semaphore (non-zero = locked) */
  30. ulong sr;
  31. ulong pc;
  32. Proc *p;
  33. Mach *m;
  34. ulong pid;
  35. ushort isilock;
  36. };
  37. struct Label
  38. {
  39. ulong sp;
  40. ulong pc;
  41. };
  42. /*
  43. * Proc.fpstate
  44. */
  45. enum
  46. {
  47. /* floating point states */
  48. FPinit,
  49. FPactive,
  50. FPinactive,
  51. /* bit or'd with the state */
  52. FPillegal= 0x100,
  53. };
  54. struct FPsave
  55. {
  56. long fpreg[2*32];
  57. long dummy; /* lower bits of FPCR, useless */
  58. long fpstatus;
  59. };
  60. struct Confmem
  61. {
  62. ulong base;
  63. ulong npage;
  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; /* has display? */
  79. ulong ialloc; /* bytes available for interrupt time allocation */
  80. ulong pipeqsize; /* size in bytes of pipe queues */
  81. };
  82. /*
  83. * mmu goo in the Proc structure
  84. */
  85. struct PMMU
  86. {
  87. Page *mmutop; /* 1st level table */
  88. Page *mmulvl2; /* 2nd level table */
  89. Page *mmufree; /* unused page table pages */
  90. Page *mmuused; /* used page table pages, except for mmustk */
  91. };
  92. /*
  93. * things saved in the Proc structure during a notify
  94. */
  95. struct Notsave
  96. {
  97. ulong UNUSED;
  98. };
  99. #include "../port/portdat.h"
  100. /*
  101. * machine dependent definitions not used by ../port/dat.h
  102. */
  103. /*
  104. * Fake kmap
  105. */
  106. typedef void KMap;
  107. #define VA(k) ((ulong)(k))
  108. #define kmap(p) (KMap*)((p)->pa|KZERO)
  109. #define kunmap(k)
  110. /*
  111. * Process Control Block, used by PALcode
  112. */
  113. struct PCB {
  114. uvlong ksp;
  115. uvlong usp;
  116. uvlong ptbr;
  117. ulong asn;
  118. ulong pcc;
  119. uvlong unique;
  120. ulong fen;
  121. ulong dummy;
  122. uvlong rsrv1;
  123. uvlong rsrv2;
  124. };
  125. struct Mach
  126. {
  127. /* OFFSETS OF THE FOLLOWING KNOWN BY l.s */
  128. int machno; /* physical id of processor */
  129. ulong splpc; /* pc that called splhi() */
  130. Proc *proc; /* current process on this processor */
  131. /* ordering from here on irrelevant */
  132. ulong ticks; /* of the clock since boot time */
  133. Label sched; /* scheduler wakeup */
  134. Lock alarmlock; /* access to alarm list */
  135. void *alarm; /* alarms bound to this clock */
  136. int inclockintr;
  137. Proc* readied; /* for runproc */
  138. ulong schedticks; /* next forced context switch */
  139. vlong cpuhz; /* hwrpb->cfreq */
  140. uvlong cyclefreq; /* Frequency of user readable cycle counter */
  141. ulong pcclast;
  142. uvlong fastclock;
  143. Perf perf; /* performance counters */
  144. int tlbfault; /* only used by devproc; no access to tlb */
  145. int tlbpurge; /* ... */
  146. int pfault;
  147. int cs;
  148. int syscall;
  149. int load;
  150. int intr;
  151. int flushmmu; /* make current proc flush it's mmu state */
  152. int ilockdepth;
  153. ulong spuriousintr;
  154. int lastintr;
  155. PCB;
  156. /* MUST BE LAST */
  157. int stack[1];
  158. };
  159. struct
  160. {
  161. Lock;
  162. short machs;
  163. short exiting;
  164. short ispanic;
  165. }active;
  166. /*
  167. * Implementation-dependant functions (outside of Alpha architecture proper).
  168. * Called PCArch because that's what mkdevc calls it (for the PC).
  169. */
  170. struct PCArch
  171. {
  172. char* id;
  173. int (*ident)(void);
  174. void (*coreinit)(void); /* set up core logic, PCI mappings etc */
  175. void (*corehello)(void); /* identify core logic to user */
  176. void (*coredetach)(void); /* restore core logic before return to console */
  177. void *(*pcicfg)(int, int); /* map and point to PCI cfg space */
  178. void *(*pcimem)(int, int); /* map and point to PCI memory space */
  179. int (*intrenable)(Vctl*);
  180. int (*intrvecno)(int);
  181. int (*intrdisable)(int);
  182. int (*_inb)(int);
  183. ushort (*_ins)(int);
  184. ulong (*_inl)(int);
  185. void (*_outb)(int, int);
  186. void (*_outs)(int, ushort);
  187. void (*_outl)(int, ulong);
  188. void (*_insb)(int, void*, int);
  189. void (*_inss)(int, void*, int);
  190. void (*_insl)(int, void*, int);
  191. void (*_outsb)(int, void*, int);
  192. void (*_outss)(int, void*, int);
  193. void (*_outsl)(int, void*, int);
  194. };
  195. /*
  196. * a parsed plan9.ini line
  197. */
  198. #define NISAOPT 8
  199. struct ISAConf {
  200. char *type;
  201. ulong port;
  202. int irq;
  203. ulong dma;
  204. ulong mem;
  205. ulong size;
  206. ulong freq;
  207. int nopt;
  208. char *opt[NISAOPT];
  209. };
  210. extern PCArch *arch;
  211. #define MACHP(n) ((Mach *)((int)&mach0+n*BY2PG))
  212. extern Mach mach0;
  213. extern register Mach *m;
  214. extern register Proc *up;
  215. /*
  216. * hardware info about a device
  217. */
  218. typedef struct {
  219. ulong port;
  220. int size;
  221. } Devport;
  222. struct DevConf
  223. {
  224. ulong intnum; /* interrupt number */
  225. char *type; /* card type, malloced */
  226. int nports; /* Number of ports */
  227. Devport *ports; /* The ports themselves */
  228. };
  229. extern FPsave initfp;