boothowto |= RB_SINGLE;
hppa_init(start)	paddr_t start;{	extern int kernel_text;	vaddr_t v, vstart, vend;	register int error;	int hptsize;	/* size of HPT table if supported */	pdc_init();	/* init PDC iface, so we can call em easy */	cpu_hzticks = (PAGE0->mem_10msec * 100) / hz;	delay_init();	/* calculate cpu clock ratio */	/* cache parameters */	if ((error = pdc_call((iodcio_t)pdc, 0, PDC_CACHE, PDC_CACHE_DFLT,	    &pdc_cache)) < 0) {#ifdef DEBUG		printf("WARNING: PDC_CACHE error %d\n", error);#endif	}	/* XXX these gonna die */	dcache_line_mask = pdc_cache.dc_conf.cc_line * 16 - 1;	dcache_stride = pdc_cache.dc_stride;	icache_stride = pdc_cache.ic_stride;	/* cache coherence params (pbably available for 8k only) */	error = pdc_call((iodcio_t)pdc, 0, PDC_CACHE, PDC_CACHE_SETCS,	    &pdc_coherence, 1, 1, 1, 1);#ifdef DEBUG	printf ("PDC_CACHE_SETCS: %d, %d, %d, %d (%d)\n",	    pdc_coherence.ia_cst, pdc_coherence.da_cst,	    pdc_coherence.ita_cst, pdc_coherence.dta_cst, error);#endif	/* BTLB params */	if ((error = pdc_call((iodcio_t)pdc, 0, PDC_BLOCK_TLB,	    PDC_BTLB_DEFAULT, &pdc_btlb)) < 0)		panic("WARNING: PDC_BTLB error %d", error);	/* purge TLBs and caches */	if (pdc_call((iodcio_t)pdc, 0, PDC_BLOCK_TLB, PDC_BTLB_PURGE_ALL) < 0)		printf("WARNING: BTLB purge failed\n");	ptlball();	fcacheall();	totalphysmem = PAGE0->imm_max_mem / NBPG;	resvmem = ((vaddr_t)&kernel_text) / NBPG;	/* calculate HPT size */	for (hptsize = 1; hptsize < totalphysmem; hptsize *= 2);	mtctl(hptsize - 1, CR_HPTMASK);	if (pdc_call((iodcio_t)pdc, 0, PDC_TLB, PDC_TLB_INFO, &pdc_hwtlb) &&	    !pdc_hwtlb.min_size && !pdc_hwtlb.max_size) {		printf("WARNING: no HPT support, fine!\n");		hptsize = 0;	} else {		if (hptsize > pdc_hwtlb.max_size)			hptsize = pdc_hwtlb.max_size;		else if (hptsize < pdc_hwtlb.min_size)			hptsize = pdc_hwtlb.min_size;		/* have to reload after adjustment */		mtctl(hptsize - 1, CR_HPTMASK);	}	/* we hope this won't fail */	hppa_ex = extent_create("mem", 0x0, 0xffffffff, M_DEVBUF,	    (caddr_t)mem_ex_storage, sizeof(mem_ex_storage),	    EX_NOCOALESCE|EX_NOWAIT);	if (extent_alloc_region(hppa_ex, 0, (vaddr_t)PAGE0->imm_max_mem,	    EX_NOWAIT))		panic("cannot reserve main memory");	vstart = hppa_round_page(start);	vend = VM_MAX_KERNEL_ADDRESS;	/*	 * Now allocate kernel dynamic variables	 */	/* buffer cache parameters */#ifndef BUFCACHEPERCENT#define BUFCACHEPERCENT 10#endif /* BUFCACHEPERCENT */	if (bufpages == 0)		bufpages = totalphysmem / 100 *		    (totalphysmem <= 0x1000? 5 : BUFCACHEPERCENT);	if (nbuf == 0)		nbuf = bufpages < 16? 16 : bufpages;	/* Restrict to at most 70% filled kvm */	if (nbuf * MAXBSIZE >	    (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) * 7 / 10)		nbuf = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /		    MAXBSIZE * 7 / 10;	/* More buffer pages than fits into the buffers is senseless. */	if (bufpages > nbuf * MAXBSIZE / CLBYTES)		bufpages = nbuf * MAXBSIZE / CLBYTES;	if (nswbuf == 0) {		nswbuf = (nbuf / 2) &~ 1;		if (nswbuf > 256)			nswbuf = 256;	}		v = vstart;#define valloc(name, type, num) (name) = (type *)v; v = (vaddr_t)((name)+(num))#ifdef REAL_CLISTS	valloc(cfree, struct cblock, nclist);#endif	valloc(callout, struct callout, ncallout);	valloc(buf, struct buf, nbuf);#ifdef SYSVSHM	valloc(shmsegs, struct shmid_ds, shminfo.shmmni);#endif#ifdef SYSVSEM	valloc(sema, struct semid_ds, seminfo.semmni);	valloc(sem, struct sem, seminfo.semmns);	/* This is pretty disgusting! */	valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));#endif#ifdef SYSVMSG	valloc(msgpool, char, msginfo.msgmax);	valloc(msgmaps, struct msgmap, msginfo.msgseg);	valloc(msghdrs, struct msg, msginfo.msgtql);	valloc(msqids, struct msqid_ds, msginfo.msgmni);#endif#undef valloc	v = hppa_round_page(v);	bzero ((void *)vstart, (v - vstart));	vstart = v;	pmap_bootstrap(&vstart, &vend);	physmem = totalphysmem - btoc(vstart);	/* alloc msgbuf */	if (!(msgbufp = (void *)pmap_steal_memory(sizeof(struct msgbuf),	    NULL, NULL)))		panic("cannot allocate msgbuf");	msgbufmapped = 1;	/* Turn on the HW TLB assist */	if (hptsize) {		u_int hpt;		mfctl(CR_VTOP, hpt);		if ((error = pdc_call((iodcio_t)pdc, 0, PDC_TLB,		    PDC_TLB_CONFIG, &pdc_hwtlb, hpt, hptsize,		    PDC_TLB_CURRPDE)) < 0) {#ifdef DEBUG			printf("WARNING: HPT init error %d\n", error);#endif		} else {#ifdef PMAPDEBUG			printf("HPT: %d entries @ 0x%x\n",			    hptsize / sizeof(struct hpt_entry), hpt);#endif		}	}	/* locate coprocessors and SFUs */	if ((error = pdc_call((iodcio_t)pdc, 0, PDC_COPROC, PDC_COPROC_DFLT,	    &pdc_coproc)) < 0)		printf("WARNING: PDC_COPROC error %d\n", error);	else {#ifdef DEBUG		printf("pdc_coproc: %x, %x\n", pdc_coproc.ccr_enable,		    pdc_coproc.ccr_present);#endif		mtctl(pdc_coproc.ccr_enable & CCR_MASK, CR_CCR);	}	/* they say PDC_COPROC might turn fault light on */	pdc_call((iodcio_t)pdc, PDC_CHASSIS, PDC_CHASSIS_DISP,	    PDC_OSTAT(PDC_OSTAT_RUN) | 0xCEC0);#ifdef DDB	ddb_init();#endif}