dat.h 5.1 KB

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