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