1 #define checkmmu(a, b) 2 #define countpagerefs(a, b) 3 4 #include "../port/portfns.h" 5 6 typedef struct Dma Dma; 7 typedef struct Ether Ether; 8 #pragma incomplete Dma 9 10 void addconf(char*, char*); 11 long adec(long*); 12 long ainc(long*); 13 void archetherspeed(int, int); 14 void archinit(void); 15 uint archmiiport(int); 16 void archreboot(void); 17 void archreset(void); 18 ulong archuartclock(int, int); 19 void barriers(void); 20 uintptr cankaddr(uintptr pa); 21 Block* clallocb(void); 22 void clockinit(void); 23 void clockintr(Ureg*); 24 void clrmchk(void); 25 int cmpswap(long*, long, long); 26 // #define coherence() eieio() 27 #define coherence() /* uniprocessor */ 28 char *cputype2name(char *, int); 29 void cpuidprint(void); 30 #define cycles(ip) *(ip) = lcycles() 31 void dcflush(uintptr, usize); 32 void dcrcompile(void); 33 long decref(Ref*); 34 void delay(int); 35 void dtlbmiss(void); 36 void dumpmal(void); 37 void dumpregs(Ureg*); 38 void delayloopinit(void); 39 Dev* devtabget(int, int); 40 void devtabinit(void); 41 void devtabreset(void); 42 long devtabread(Chan*, void*, long, vlong); 43 void devtabshutdown(void); 44 void dump(void *, int); 45 void eieio(void); 46 void etherclock(void); 47 void fifoinit(Ether *); 48 void firmware(int); 49 int fpipower(Ureg*); 50 int fpuavail(Ureg*); 51 int fpudevprocio(Proc*, void*, long, uintptr, int); 52 int fpuemu(Ureg*); 53 void fpuinit(void); 54 void fpunoted(void); 55 void fpunotify(Ureg*); 56 void fpuprocresetore(Proc*); 57 #define fpuprocresetore(p) USED(p) 58 void fpuprocsave(Proc*); 59 #define fpuprocsave(p) USED(p) 60 void fpusysprocsetup(Proc*); 61 void fpusysrfork(Ureg*); 62 void fpusysrforkchild(Proc*, Ureg*, Proc*); 63 void fputrap(Ureg*, int); 64 char* getconf(char*); 65 u32int getccr0(void); 66 u32int getdar(void); 67 u32int getdcr(int); 68 u32int getdear(void); 69 u32int getdec(void); 70 u32int getesr(void); 71 u32int getmsr(void); 72 u32int getpid(void); 73 u32int getpir(void); 74 u32int getpit(void); 75 u32int getpvr(void); 76 u32int gettbl(void); 77 u32int gettsr(void); 78 void gotopc(uintptr); 79 int gotsecuremem(void); 80 int havetimer(void); 81 void icflush(uintptr, usize); 82 void idlehands(void); 83 int inb(int); 84 long incref(Ref*); 85 void insb(int, void*, int); 86 ushort ins(int); 87 void inss(int, void*, int); 88 ulong inl(int); 89 void insl(int, void*, int); 90 void intr(Ureg*); 91 void intrdisable(int, void (*)(Ureg*, void*), void*, int, char*); 92 void intrfmtcounts(char *s, char *se); 93 void intrinit(void); 94 void intrshutdown(void); 95 int ioalloc(int, int, int, char*); 96 void iofree(int); 97 void ioinit(void); 98 int iprint(char*, ...); 99 void isync(void); 100 void itlbmiss(void); 101 void kexit(Ureg*); 102 void* kmapphys(uintptr, uintptr, ulong, ulong, ulong); 103 uchar lightbitoff(int); 104 uchar lightbiton(int); 105 uchar lightstate(int); 106 void links(void); 107 void malinit(void); 108 void meminit(void); 109 void mmuinit(void); 110 void* mmucacheinhib(void*, ulong); 111 ulong mmumapsize(ulong); 112 void mutateproc(void *); 113 int mutatetrigger(void); 114 int newmmupid(void); 115 int notify(Ureg*); 116 void outb(int, int); 117 void outsb(int, void*, int); 118 void outs(int, ushort); 119 void outss(int, void*, int); 120 void outl(int, ulong); 121 void outsl(int, void*, int); 122 #define pokeaddr(a, v, w) probeaddr(a) 123 void ppc405console(void); 124 vlong probeaddr(uintptr addr); 125 #define procrestore(p) 126 void procsave(Proc*); 127 void procsetup(Proc*); 128 void putdcr(int, u32int); 129 void putdec(ulong); 130 void putesr(ulong); 131 void putevpr(ulong); 132 void putmsr(u32int); 133 void putpid(u32int); 134 void putpit(u32int); 135 void putsdr1(u32int); 136 void puttcr(u32int); 137 void puttsr(u32int); 138 ulong qtmborder(void); 139 void qtmclock(void); 140 void qtmerr(void); 141 void qtmerrs(char *); 142 void qtminit(void); 143 void shutdown(int ispanic); 144 void spldone(void); 145 int splhi(void); 146 int spllo(void); 147 void splx(int); 148 void splxpc(int); 149 void startcpu(int); 150 void sync(void); 151 void syscall(Ureg*); 152 uintptr sysexecstack(uintptr, int); 153 void sysprocsetup(Proc*); 154 #define tas tas32 155 void temactransmit(Ether *); 156 void touser(uintptr); 157 void trapinit(void); 158 void trapcritvec(void); 159 void trapvec(void); 160 void tlbdump(char *s); 161 u32int tlbrehi(int); 162 u32int tlbrelo(int); 163 int tlbsxcc(uintptr); 164 void tlbwrx(int, u32int, u32int); 165 void uartliteconsole(void); 166 void uartlputc(int); 167 void uartlputs(char *s); 168 void uncinit(void); 169 void uncinitwait(void); 170 #define userureg(ur) (((ur)->status & MSR_PR) != 0) 171 void validalign(uintptr, unsigned); 172 void verifyproc(Proc *); 173 void verifymach(Mach *); 174 #define waserror() (up->nerrlab++, setlabel(&up->errlab[up->nerrlab-1])) 175 void watchreset(void); 176 void whackether(Ether *); 177 void writeconf(void); 178 179 /* 180 * dma.c 181 */ 182 void dma0init(void); 183 void dmainit(void); 184 int dmastart(int, void *dest, void *src, ulong len, ulong flags, void (*f)(int)); 185 void dmawait(int); 186 187 /* 188 * intr.c 189 */ 190 void intrack(ulong); 191 void intrenable(ulong bit, int (*func)(ulong), char *); 192 void intrinit(void); 193 194 int cas32(void*, u32int, u32int); 195 int tas32(void*); 196 197 #define CASU(p, e, n) cas32((p), (u32int)(e), (u32int)(n)) 198 #define CASV(p, e, n) cas32((p), (u32int)(e), (u32int)(n)) 199 #define CASW(addr, exp, new) cas32((addr), (exp), (new)) 200 #define TAS(addr) tas32(addr) 201 202 void forkret(void); 203 204 #define PTR2UINT(p) ((uintptr)(p)) 205 #define UINT2PTR(i) ((void*)(i)) 206 207 #define isphys(a) (((ulong)(a)&KSEGM)!=KSEG0 && ((ulong)(a)&KSEGM)!=KSEG1) 208 #define KADDR(a) ((void*)((ulong)(a) | KZERO)) 209 #define PADDR(a) (isphys(a)? (ulong)(a): ((ulong)(a) & ~KSEGM)) 210 211 /* 212 * this low-level printing stuff is ugly, 213 * but there appears to be no other way to 214 * print until after #t is populated. 215 */ 216 217 #define wave(c) { \ 218 barriers(); \ 219 *(ulong *)Uartlite = (c); \ 220 barriers(); \ 221 } 222