Home | History | Annotate | Line # | Download | only in ofppc
machdep.c revision 1.49
      1 /*	$NetBSD: machdep.c,v 1.49 1999/12/18 01:37:00 thorpej Exp $	*/
      2 
      3 /*
      4  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
      5  * Copyright (C) 1995, 1996 TooLs GmbH.
      6  * All rights reserved.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  * 3. All advertising materials mentioning features or use of this software
     17  *    must display the following acknowledgement:
     18  *	This product includes software developed by TooLs GmbH.
     19  * 4. The name of TooLs GmbH may not be used to endorse or promote products
     20  *    derived from this software without specific prior written permission.
     21  *
     22  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
     23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     27  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     28  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     29  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     30  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     31  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32  */
     33 
     34 #include "opt_compat_netbsd.h"
     35 #include "opt_ddb.h"
     36 #include "opt_inet.h"
     37 #include "opt_ccitt.h"
     38 #include "opt_iso.h"
     39 #include "opt_ns.h"
     40 #include "ipkdb.h"
     41 
     42 #include <sys/param.h>
     43 #include <sys/buf.h>
     44 #include <sys/callout.h>
     45 #include <sys/exec.h>
     46 #include <sys/malloc.h>
     47 #include <sys/map.h>
     48 #include <sys/mbuf.h>
     49 #include <sys/mount.h>
     50 #include <sys/msgbuf.h>
     51 #include <sys/proc.h>
     52 #include <sys/reboot.h>
     53 #include <sys/syscallargs.h>
     54 #include <sys/syslog.h>
     55 #include <sys/systm.h>
     56 #include <sys/kernel.h>
     57 #include <sys/user.h>
     58 
     59 #include <vm/vm.h>
     60 #include <vm/vm_kern.h>
     61 
     62 #include <uvm/uvm_extern.h>
     63 
     64 #include <net/netisr.h>
     65 
     66 #include <machine/bat.h>
     67 #include <machine/pmap.h>
     68 #include <machine/powerpc.h>
     69 #include <machine/trap.h>
     70 
     71 /*
     72  * Global variables used here and there
     73  */
     74 vm_map_t exec_map = NULL;
     75 vm_map_t mb_map = NULL;
     76 vm_map_t phys_map = NULL;
     77 
     78 struct pcb *curpcb;
     79 struct pmap *curpm;
     80 struct proc *fpuproc;
     81 
     82 extern struct user *proc0paddr;
     83 
     84 struct bat battable[16];
     85 
     86 int astpending;
     87 
     88 char *bootpath;
     89 
     90 paddr_t msgbuf_paddr;
     91 vaddr_t msgbuf_vaddr;
     92 
     93 static int fake_spl __P((void));
     94 static int fake_splx __P((int));
     95 static void fake_setsoft __P((void));
     96 static void fake_clock_return __P((struct clockframe *, int));
     97 static void fake_irq_establish __P((int, int, void (*)(void *), void *));
     98 
     99 struct machvec machine_interface = {
    100 	fake_spl,
    101 	fake_spl,
    102 	fake_spl,
    103 	fake_spl,
    104 	fake_spl,
    105 	fake_spl,
    106 	fake_spl,
    107 	fake_spl,
    108 	fake_spl,
    109 	fake_spl,
    110 	fake_splx,
    111 	fake_setsoft,
    112 	fake_setsoft,
    113 	fake_clock_return,
    114 	fake_irq_establish,
    115 };
    116 
    117 void
    118 initppc(startkernel, endkernel, args)
    119 	u_int startkernel, endkernel;
    120 	char *args;
    121 {
    122 	int phandle, qhandle;
    123 	char name[32];
    124 	struct machvec *mp;
    125 	extern trapcode, trapsize;
    126 	extern dsitrap, dsisize;
    127 	extern isitrap, isisize;
    128 	extern decrint, decrsize;
    129 	extern tlbimiss, tlbimsize;
    130 	extern tlbdlmiss, tlbdlmsize;
    131 	extern tlbdsmiss, tlbdsmsize;
    132 #ifdef DDB
    133 	extern ddblow, ddbsize;
    134 	extern void *startsym, *endsym;
    135 #endif
    136 #if NIPKDB > 0
    137 	extern ipkdblow, ipkdbsize;
    138 #endif
    139 	extern void consinit __P((void));
    140 	extern void callback __P((void *));
    141 	int exc, scratch;
    142 
    143 	proc0.p_addr = proc0paddr;
    144 	bzero(proc0.p_addr, sizeof *proc0.p_addr);
    145 
    146 	curpcb = &proc0paddr->u_pcb;
    147 
    148 	curpm = curpcb->pcb_pmreal = curpcb->pcb_pm = pmap_kernel();
    149 
    150 	/*
    151 	 * i386 port says, that this shouldn't be here,
    152 	 * but I really think the console should be initialized
    153 	 * as early as possible.
    154 	 */
    155 	consinit();
    156 
    157 #ifdef	__notyet__		/* Needs some rethinking regarding real/virtual OFW */
    158 	OF_set_callback(callback);
    159 #endif
    160 	/*
    161 	 * Initialize BAT registers to unmapped to not generate
    162 	 * overlapping mappings below.
    163 	 */
    164 	asm volatile ("mtibatu 0,%0" :: "r"(0));
    165 	asm volatile ("mtibatu 1,%0" :: "r"(0));
    166 	asm volatile ("mtibatu 2,%0" :: "r"(0));
    167 	asm volatile ("mtibatu 3,%0" :: "r"(0));
    168 	asm volatile ("mtdbatu 0,%0" :: "r"(0));
    169 	asm volatile ("mtdbatu 1,%0" :: "r"(0));
    170 	asm volatile ("mtdbatu 2,%0" :: "r"(0));
    171 	asm volatile ("mtdbatu 3,%0" :: "r"(0));
    172 
    173 	/*
    174 	 * Set up initial BAT table to only map the lowest 256 MB area
    175 	 */
    176 	battable[0].batl = BATL(0x00000000, BAT_M, BAT_PP_RW);
    177 	battable[0].batu = BATU(0x00000000, BAT_BL_256M, BAT_Vs);
    178 
    179 	/*
    180 	 * Now setup fixed bat registers
    181 	 *
    182 	 * Note that we still run in real mode, and the BAT
    183 	 * registers were cleared above.
    184 	 */
    185 	/* IBAT0 used for initial 256 MB segment */
    186 	asm volatile ("mtibatl 0,%0; mtibatu 0,%1"
    187 		      :: "r"(battable[0].batl), "r"(battable[0].batu));
    188 	/* DBAT0 used similar */
    189 	asm volatile ("mtdbatl 0,%0; mtdbatu 0,%1"
    190 		      :: "r"(battable[0].batl), "r"(battable[0].batu));
    191 
    192 	/*
    193 	 * Set up trap vectors
    194 	 */
    195 	for (exc = EXC_RSVD; exc <= EXC_LAST; exc += 0x100)
    196 		switch (exc) {
    197 		default:
    198 			bcopy(&trapcode, (void *)exc, (size_t)&trapsize);
    199 			break;
    200 		case EXC_EXI:
    201 			/*
    202 			 * This one is (potentially) installed during autoconf
    203 			 */
    204 			break;
    205 		case EXC_DSI:
    206 			bcopy(&dsitrap, (void *)EXC_DSI, (size_t)&dsisize);
    207 			break;
    208 		case EXC_ISI:
    209 			bcopy(&isitrap, (void *)EXC_ISI, (size_t)&isisize);
    210 			break;
    211 		case EXC_DECR:
    212 			bcopy(&decrint, (void *)EXC_DECR, (size_t)&decrsize);
    213 			break;
    214 		case EXC_IMISS:
    215 			bcopy(&tlbimiss, (void *)EXC_IMISS, (size_t)&tlbimsize);
    216 			break;
    217 		case EXC_DLMISS:
    218 			bcopy(&tlbdlmiss, (void *)EXC_DLMISS, (size_t)&tlbdlmsize);
    219 			break;
    220 		case EXC_DSMISS:
    221 			bcopy(&tlbdsmiss, (void *)EXC_DSMISS, (size_t)&tlbdsmsize);
    222 			break;
    223 #if defined(DDB) || NIPKDB > 0
    224 		case EXC_PGM:
    225 		case EXC_TRC:
    226 		case EXC_BPT:
    227 #if defined(DDB)
    228 			bcopy(&ddblow, (void *)exc, (size_t)&ddbsize);
    229 #else
    230 			bcopy(&ipkdblow, (void *)exc, (size_t)&ipkdbsize);
    231 #endif
    232 			break;
    233 #endif /* DDB || NIPKDB > 0 */
    234 		}
    235 
    236 	__syncicache((void *)EXC_RST, EXC_LAST - EXC_RST + 0x100);
    237 
    238 	/*
    239 	 * Now enable translation (and machine checks/recoverable interrupts).
    240 	 */
    241 	asm volatile ("mfmsr %0; ori %0,%0,%1; mtmsr %0; isync"
    242 		      : "=r"(scratch) : "K"(PSL_IR|PSL_DR|PSL_ME|PSL_RI));
    243 
    244 	/*
    245 	 * Parse arg string.
    246 	 */
    247 	bootpath = args;
    248 	while (*++args && *args != ' ');
    249 	if (*args) {
    250 		*args++ = 0;
    251 		while (*args) {
    252 			switch (*args++) {
    253 			case 'a':
    254 				boothowto |= RB_ASKNAME;
    255 				break;
    256 			case 's':
    257 				boothowto |= RB_SINGLE;
    258 				break;
    259 			case 'd':
    260 				boothowto |= RB_KDB;
    261 				break;
    262 			}
    263 		}
    264 	}
    265 
    266 #ifdef DDB
    267 	/* ddb_init((int)(endsym - startsym), startsym, endsym); */
    268 #endif
    269 #if NIPKDB > 0
    270 	/*
    271 	 * Now trap to IPKDB
    272 	 */
    273 	ipkdb_init();
    274 	if (boothowto & RB_KDB)
    275 		ipkdb_connect(0);
    276 #endif
    277 
    278 	/*
    279 	 * Set the page size.
    280 	 */
    281 	uvm_setpagesize();
    282 
    283 	/*
    284 	 * Initialize pmap module.
    285 	 */
    286 	pmap_bootstrap(startkernel, endkernel);
    287 }
    288 
    289 /*
    290  * This should probably be in autoconf!				XXX
    291  */
    292 int cpu;
    293 char cpu_model[80];
    294 char machine[] = MACHINE;		/* from <machine/param.h> */
    295 char machine_arch[] = MACHINE_ARCH;	/* from <machine/param.h> */
    296 
    297 void
    298 identifycpu()
    299 {
    300 	int phandle, pvr;
    301 	char name[32];
    302 
    303 	/*
    304 	 * Find cpu type (Do it by OpenFirmware?)
    305 	 */
    306 	asm ("mfpvr %0" : "=r"(pvr));
    307 	cpu = pvr >> 16;
    308 	switch (cpu) {
    309 	case 1:
    310 		sprintf(cpu_model, "601");
    311 		break;
    312 	case 3:
    313 		sprintf(cpu_model, "603");
    314 		break;
    315 	case 4:
    316 		sprintf(cpu_model, "604");
    317 		break;
    318 	case 5:
    319 		sprintf(cpu_model, "602");
    320 		break;
    321 	case 6:
    322 		sprintf(cpu_model, "603e");
    323 		break;
    324 	case 7:
    325 		sprintf(cpu_model, "603ev");
    326 		break;
    327 	case 9:
    328 		sprintf(cpu_model, "604ev");
    329 		break;
    330 	case 20:
    331 		sprintf(cpu_model, "620");
    332 		break;
    333 	default:
    334 		sprintf(cpu_model, "Version %x", cpu);
    335 		break;
    336 	}
    337 	sprintf(cpu_model + strlen(cpu_model), " (Revision %x)", pvr & 0xffff);
    338 	printf("CPU: %s\n", cpu_model);
    339 }
    340 
    341 void
    342 install_extint(handler)
    343 	void (*handler) __P((void));
    344 {
    345 	extern extint, extsize;
    346 	extern u_long extint_call;
    347 	u_long offset = (u_long)handler - (u_long)&extint_call;
    348 	int omsr, msr;
    349 
    350 #ifdef	DIAGNOSTIC
    351 	if (offset > 0x1ffffff)
    352 		panic("install_extint: too far away");
    353 #endif
    354 	asm volatile ("mfmsr %0; andi. %1,%0,%2; mtmsr %1"
    355 		      : "=r"(omsr), "=r"(msr) : "K"((u_short)~PSL_EE));
    356 	extint_call = (extint_call & 0xfc000003) | offset;
    357 	bcopy(&extint, (void *)EXC_EXI, (size_t)&extsize);
    358 	__syncicache((void *)&extint_call, sizeof extint_call);
    359 	__syncicache((void *)EXC_EXI, (int)&extsize);
    360 	asm volatile ("mtmsr %0" :: "r"(omsr));
    361 }
    362 
    363 /*
    364  * Machine dependent startup code.
    365  */
    366 void
    367 cpu_startup()
    368 {
    369 	int sz, i;
    370 	caddr_t v;
    371 	paddr_t minaddr, maxaddr;
    372 	int base, residual;
    373 	char pbuf[9];
    374 
    375 	proc0.p_addr = proc0paddr;
    376 	v = (caddr_t)proc0paddr + USPACE;
    377 
    378 	/*
    379 	 * Initialize error message buffer (at end of core).
    380 	 */
    381 	if (!(msgbuf_vaddr = uvm_km_alloc(kernel_map, round_page(MSGBUFSIZE))))
    382 		panic("startup: no room for message buffer");
    383 	for (i = 0; i < btoc(MSGBUFSIZE); i++)
    384 		pmap_enter(pmap_kernel(), msgbuf_vaddr + i * NBPG,
    385 		    msgbuf_paddr + i * NBPG, VM_PROT_READ|VM_PROT_WRITE,
    386 		    VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
    387 	initmsgbuf((caddr_t)msgbuf_vaddr, round_page(MSGBUFSIZE));
    388 
    389 	printf("%s", version);
    390 	identifycpu();
    391 
    392 	format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
    393 	printf("total memory = %s\n", pbuf);
    394 
    395 	/*
    396 	 * Find out how much space we need, allocate it,
    397 	 * and then give everything true virtual addresses.
    398 	 */
    399 	sz = (int)allocsys(NULL, NULL);
    400 	if ((v = (caddr_t)uvm_km_zalloc(kernel_map, round_page(sz))) == 0)
    401 		panic("startup: no room for tables");
    402 	if (allocsys(v, NULL) - v != sz)
    403 		panic("startup: table size inconsistency");
    404 
    405 	/*
    406 	 * Now allocate buffers proper.  They are different than the above
    407 	 * in that they usually occupy more virtual memory than physical.
    408 	 */
    409 	sz = MAXBSIZE * nbuf;
    410 	if (uvm_map(kernel_map, (vaddr_t *)&buffers, round_page(sz),
    411 		    NULL, UVM_UNKNOWN_OFFSET,
    412 		    UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
    413 				UVM_ADV_NORMAL, 0)) != KERN_SUCCESS)
    414 		panic("startup: cannot allocate VM for buffers");
    415 	minaddr = (vaddr_t)buffers;
    416 	base = bufpages / nbuf;
    417 	residual = bufpages % nbuf;
    418 	if (base >= MAXBSIZE) {
    419 		/* Don't want to alloc more physical mem than ever needed */
    420 		base = MAXBSIZE;
    421 		residual = 0;
    422 	}
    423 	for (i = 0; i < nbuf; i++) {
    424 		vsize_t curbufsize;
    425 		vaddr_t curbuf;
    426 		struct vm_page *pg;
    427 
    428 		/*
    429 		 * Each buffer has MAXBSIZE bytes of VM space allocated.  Of
    430 		 * that MAXBSIZE space, we allocate and map (base+1) pages
    431 		 * for the first "residual" buffers, and then we allocate
    432 		 * "base" pages for the rest.
    433 		 */
    434 		curbuf = (vaddr_t) buffers + (i * MAXBSIZE);
    435 		curbufsize = NBPG * ((i < residual) ? (base+1) : base);
    436 
    437 		while (curbufsize) {
    438 			pg = uvm_pagealloc(NULL, 0, NULL, 0);
    439 			if (pg == NULL)
    440 				panic("startup: not enough memory for "
    441 					"buffer cache");
    442 			pmap_enter(kernel_map->pmap, curbuf,
    443 			    VM_PAGE_TO_PHYS(pg), VM_PROT_READ|VM_PROT_WRITE,
    444 			    VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
    445 			curbuf += PAGE_SIZE;
    446 			curbufsize -= PAGE_SIZE;
    447 		}
    448 	}
    449 
    450 	/*
    451 	 * Allocate a submap for exec arguments.  This map effectively
    452 	 * limits the number of processes exec'ing at any time.
    453 	 */
    454 	exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
    455 				 16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
    456 
    457 	/*
    458 	 * Allocate a submap for physio
    459 	 */
    460 	phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
    461 				 VM_PHYS_SIZE, 0, FALSE, NULL);
    462 
    463 	/*
    464 	 * No need to allocate an mbuf cluster submap.  Mbuf clusters
    465 	 * are allocated via the pool allocator, and we use direct-mapped
    466 	 * pool pages.
    467 	 */
    468 
    469 	/*
    470 	 * Initialize callouts.
    471 	 */
    472 	callfree = callout;
    473 	for (i = 1; i < ncallout; i++)
    474 		callout[i - 1].c_next = &callout[i];
    475 
    476 	format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
    477 	printf("avail memory = %s\n", pbuf);
    478 	format_bytes(pbuf, sizeof(pbuf), bufpages * NBPG);
    479 	printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
    480 
    481 	/*
    482 	 * Set up the buffers.
    483 	 */
    484 	bufinit();
    485 
    486 	/*
    487 	 * For now, use soft spl handling.
    488 	 */
    489 	{
    490 		extern struct machvec soft_machvec;
    491 
    492 		machine_interface = soft_machvec;
    493 	}
    494 
    495 	/*
    496 	 * Now allow hardware interrupts.
    497 	 */
    498 	{
    499 		int msr;
    500 
    501 		splhigh();
    502 		asm volatile ("mfmsr %0; ori %0,%0,%1; mtmsr %0"
    503 			      : "=r"(msr) : "K"((u_short)(PSL_EE|PSL_RI)));
    504 	}
    505 }
    506 
    507 /*
    508  * consinit
    509  * Initialize system console.
    510  */
    511 void
    512 consinit()
    513 {
    514 	static int initted;
    515 
    516 	if (initted)
    517 		return;
    518 	initted = 1;
    519 	cninit();
    520 }
    521 
    522 /*
    523  * Set set up registers on exec.
    524  */
    525 void
    526 setregs(p, pack, stack)
    527 	struct proc *p;
    528 	struct exec_package *pack;
    529 	u_long stack;
    530 {
    531 	struct trapframe *tf = trapframe(p);
    532 	struct ps_strings arginfo;
    533 
    534 	bzero(tf, sizeof *tf);
    535 	tf->fixreg[1] = -roundup(-stack + 8, 16);
    536 
    537 	/*
    538 	 * XXX Machine-independent code has already copied arguments and
    539 	 * XXX environment to userland.  Get them back here.
    540 	 */
    541 	(void)copyin((char *)PS_STRINGS, &arginfo, sizeof (arginfo));
    542 
    543 	/*
    544 	 * Set up arguments for _start():
    545 	 *	_start(argc, argv, envp, obj, cleanup, ps_strings);
    546 	 *
    547 	 * Notes:
    548 	 *	- obj and cleanup are the auxilliary and termination
    549 	 *	  vectors.  They are fixed up by ld.elf_so.
    550 	 *	- ps_strings is a NetBSD extention, and will be
    551 	 * 	  ignored by executables which are strictly
    552 	 *	  compliant with the SVR4 ABI.
    553 	 *
    554 	 * XXX We have to set both regs and retval here due to different
    555 	 * XXX calling convention in trap.c and init_main.c.
    556 	 */
    557 	tf->fixreg[3] = arginfo.ps_nargvstr;
    558 	tf->fixreg[4] = (register_t)arginfo.ps_argvstr;
    559 	tf->fixreg[5] = (register_t)arginfo.ps_envstr;
    560 	tf->fixreg[6] = 0;			/* auxillary vector */
    561 	tf->fixreg[7] = 0;			/* termination vector */
    562 	tf->fixreg[8] = (register_t)PS_STRINGS;	/* NetBSD extension */
    563 
    564 	tf->srr0 = pack->ep_entry;
    565 	tf->srr1 = PSL_MBO | PSL_USERSET | PSL_FE_DFLT;
    566 	p->p_addr->u_pcb.pcb_flags = 0;
    567 }
    568 
    569 /*
    570  * Machine dependent system variables.
    571  */
    572 int
    573 cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
    574 	int *name;
    575 	u_int namelen;
    576 	void *oldp;
    577 	size_t *oldlenp;
    578 	void *newp;
    579 	size_t newlen;
    580 	struct proc *p;
    581 {
    582 	/* all sysctl names at this level are terminal */
    583 	if (namelen != 1)
    584 		return (ENOTDIR);
    585 
    586 	switch (name[0]) {
    587 	case CPU_CACHELINE:
    588 		return sysctl_rdint(oldp, oldlenp, newp, CACHELINESIZE);
    589 	default:
    590 		return (EOPNOTSUPP);
    591 	}
    592 }
    593 
    594 /*
    595  * Crash dump handling.
    596  */
    597 u_long dumpmag = 0x8fca0101;		/* magic number */
    598 int dumpsize = 0;			/* size of dump in pages */
    599 long dumplo = -1;			/* blocks */
    600 
    601 void
    602 dumpsys()
    603 {
    604 	printf("dumpsys: TBD\n");
    605 }
    606 
    607 /*
    608  * Soft networking interrupts.
    609  */
    610 void
    611 softnet()
    612 {
    613 	int isr = netisr;
    614 
    615 	netisr = 0;
    616 #ifdef	INET
    617 #include "arp.h"
    618 #if NARP > 0
    619 	if (isr & (1 << NETISR_ARP))
    620 		arpintr();
    621 #endif
    622 	if (isr & (1 << NETISR_IP))
    623 		ipintr();
    624 #endif
    625 #ifdef	INET6
    626 	if (isr & (1 << NETISR_IPV6))
    627 		ip6intr();
    628 #endif
    629 #ifdef	IMP
    630 	if (isr & (1 << NETISR_IMP))
    631 		impintr();
    632 #endif
    633 #ifdef	NS
    634 	if (isr & (1 << NETISR_NS))
    635 		nsintr();
    636 #endif
    637 #ifdef	ISO
    638 	if (isr & (1 << NETISR_ISO))
    639 		clnlintr();
    640 #endif
    641 #ifdef	CCITT
    642 	if (isr & (1 << NETISR_CCITT))
    643 		ccittintr();
    644 #endif
    645 #include "ppp.h"
    646 #if NPPP > 0
    647 	if (isr & (1 << NETISR_PPP))
    648 		pppintr();
    649 #endif
    650 }
    651 
    652 /*
    653  * Stray interrupts.
    654  */
    655 void
    656 strayintr(irq)
    657 	int irq;
    658 {
    659 	log(LOG_ERR, "stray interrupt %d\n", irq);
    660 }
    661 
    662 /*
    663  * Halt or reboot the machine after syncing/dumping according to howto.
    664  */
    665 void
    666 cpu_reboot(howto, what)
    667 	int howto;
    668 	char *what;
    669 {
    670 	static int syncing;
    671 	static char str[256];
    672 	char *ap = str, *ap1 = ap;
    673 
    674 	boothowto = howto;
    675 	if (!cold && !(howto & RB_NOSYNC) && !syncing) {
    676 		syncing = 1;
    677 		vfs_shutdown();		/* sync */
    678 		resettodr();		/* set wall clock */
    679 	}
    680 	splhigh();
    681 	if (howto & RB_HALT) {
    682 		doshutdownhooks();
    683 		printf("halted\n\n");
    684 		ppc_exit();
    685 	}
    686 	if (!cold && (howto & RB_DUMP))
    687 		dumpsys();
    688 	doshutdownhooks();
    689 	printf("rebooting\n\n");
    690 	if (what && *what) {
    691 		if (strlen(what) > sizeof str - 5)
    692 			printf("boot string too large, ignored\n");
    693 		else {
    694 			strcpy(str, what);
    695 			ap1 = ap = str + strlen(str);
    696 			*ap++ = ' ';
    697 		}
    698 	}
    699 	*ap++ = '-';
    700 	if (howto & RB_SINGLE)
    701 		*ap++ = 's';
    702 	if (howto & RB_KDB)
    703 		*ap++ = 'd';
    704 	*ap++ = 0;
    705 	if (ap[-2] == '-')
    706 		*ap1 = 0;
    707 	ppc_boot(str);
    708 }
    709 
    710 /*
    711  * OpenFirmware callback routine
    712  */
    713 void
    714 callback(p)
    715 	void *p;
    716 {
    717 	panic("callback");	/* for now			XXX */
    718 }
    719 
    720 /*
    721  * Initial Machine Interface.
    722  */
    723 static int
    724 fake_spl()
    725 {
    726 	int scratch;
    727 
    728 	asm volatile ("mfmsr %0; andi. %0,%0,%1; mtmsr %0; isync"
    729 	    : "=r"(scratch) : "K"((u_short)~(PSL_EE|PSL_ME)));
    730 	return (-1);
    731 }
    732 
    733 static void
    734 fake_setsoft()
    735 {
    736 	/* Do nothing */
    737 }
    738 
    739 static int
    740 fake_splx(new)
    741 	int new;
    742 {
    743 	return (fake_spl());
    744 }
    745 
    746 static void
    747 fake_clock_return(frame, nticks)
    748 	struct clockframe *frame;
    749 	int nticks;
    750 {
    751 	/* Do nothing */
    752 }
    753 
    754 static void
    755 fake_irq_establish(irq, level, handler, arg)
    756 	int irq, level;
    757 	void (*handler) __P((void *));
    758 	void *arg;
    759 {
    760 	panic("fake_irq_establish");
    761 }
    762