{ "st",		6 },
{ "st",		7 }, { "rd",     9 },
struct	device *parsedisk __P((char *, int, int, dev_t *));void	setroot __P((void));/* XXX must be allocated statically because of early console init */struct	map extiomap[EIOMAPSIZE/16];extern	void *extiobase;void mainbus_attach __P((struct device *, struct device *, void *));int  mainbus_match __P((struct device *, void *, void *));struct cfattach mainbus_ca = {	sizeof(struct device), mainbus_match, mainbus_attach};struct cfdriver mainbus_cd = {	NULL, "mainbus", DV_DULL, 0};intmainbus_match(parent, cf, args)	struct device *parent;	void *cf;	void *args;{	return (1);}intmainbus_print(args, bus)	void *args;	const char *bus;{	struct confargs *ca = args;	if (ca->ca_paddr != (void *)-1)		printf(" addr 0x%x", (u_int32_t)ca->ca_paddr);	return (UNCONF);}intmainbus_scan(parent, child, args)	struct device *parent;	void *child, *args;{	struct cfdata *cf = child;	struct confargs oca;	bzero(&oca, sizeof oca);	oca.ca_paddr = (void *)cf->cf_loc[0];	oca.ca_vaddr = (void *)-1;	oca.ca_ipl = -1;	oca.ca_bustype = BUS_MAIN;	oca.ca_name = cf->cf_driver->cd_name;	if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)		return (0);	config_attach(parent, cf, &oca, mainbus_print);	return (1);}voidmainbus_attach(parent, self, args)	struct device *parent, *self;	void *args;{	printf("\n");	/* XXX	 * should have a please-attach-first list for mainbus,	 * to ensure that the pcc/vme2/mcc chips are attached	 * first.	 */	(void)config_search(mainbus_scan, self, args);}/* * Determine mass storage and memory configuration for a machine. */configure(){	bootdv = NULL; /* set by device drivers (if found) */	init_sir();	rminit(extiomap, (long)EIOMAPSIZE, (long)1, "extio", EIOMAPSIZE/16);	if (config_rootfound("mainbus", NULL) == NULL)		panic("autoconfig failed, no root");	setroot();	swapconf();	cold = 0;}/* * Allocate/deallocate a cache-inhibited range of kernel virtual address * space mapping the indicated physical address range [pa - pa+size) */void *mapiodev(pa, size)	void *pa;	int size;{	int ix, npf, offset;	void *kva;	size = roundup(size, NBPG);	offset = (int)pa & PGOFSET;	pa = (void *)((int)pa & ~PGOFSET);#ifdef DEBUG	if (((int)pa & PGOFSET) || (size & PGOFSET))	        panic("mapiodev: unaligned");#endif	npf = btoc(size);	ix = rmalloc(extiomap, npf);	if (ix == 0)	        return (0);	kva = extiobase + ctob(ix-1);	physaccess(kva, pa, size, PG_RW|PG_CI);	return (kva + offset);}voidunmapiodev(kva, size)	void *kva;	int size;{	int ix;#ifdef DEBUG	if (((int)kva & PGOFSET) || (size & PGOFSET))	        panic("unmapiodev: unaligned");	if (kva < extiobase || kva >= extiobase + ctob(EIOMAPSIZE))	        panic("unmapiodev: bad address");#endif	physunaccess(kva, size);	ix = btoc(kva - extiobase) + 1;	rmfree(extiomap, btoc(size), ix);}/* * Configure swap space and related parameters. */swapconf(){	register struct swdevt *swp;	register int nblks;	for (swp = swdevt; swp->sw_dev != NODEV; swp++)		if (bdevsw[major(swp->sw_dev)].d_psize) {			nblks =			  (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev);			if (nblks != -1 &&			    (swp->sw_nblks == 0 || swp->sw_nblks > nblks))				swp->sw_nblks = nblks;		}	dumpconf();}/* * the rest of this file was adapted from Theo de Raadt's code in the  * sparc port to nuke the "options GENERIC" stuff. */struct nam2blk {	char *name;	int maj;} nam2blk[] = {	{ "sd",		4 },	{ "st",		6 },};static intfindblkmajor(dv)	struct device *dv;{	char *name = dv->dv_xname;	register int i;	for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)		if (strncmp(name, nam2blk[i].name, strlen(nam2blk[0].name)) == 0)			return (nam2blk[i].maj);	return (-1);}static struct device *getdisk(str, len, defpart, devp)	char *str;	int len, defpart;	dev_t *devp;{	register struct device *dv;	if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {		printf("use one of:");		for (dv = alldevs.tqh_first; dv != NULL;		    dv = dv->dv_list.tqe_next) {			if (dv->dv_class == DV_DISK)				printf(" %s[a-h]", dv->dv_xname);#ifdef NFSCLIENT			if (dv->dv_class == DV_IFNET)				printf(" %s", dv->dv_xname);#endif		}		printf("\n");	}	return (dv);}struct device *parsedisk(str, len, defpart, devp)	char *str;	int len, defpart;	dev_t *devp;{	register struct device *dv;	register char *cp, c;	int majdev, mindev, part;	if (len == 0)		return (NULL);	cp = str + len - 1;	c = *cp;	if (c >= 'a' && c <= 'h') {		part = c - 'a';		*cp = '\0';	} else		part = defpart;	for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {		if (dv->dv_class == DV_DISK &&		    strcmp(str, dv->dv_xname) == 0) {			majdev = findblkmajor(dv);			if (majdev < 0)				panic("parsedisk");			mindev = (dv->dv_unit << PARTITIONSHIFT) + part;			*devp = makedev(majdev, mindev);			break;		}#ifdef NFSCLIENT		if (dv->dv_class == DV_IFNET &&		    strcmp(str, dv->dv_xname) == 0) {			*devp = NODEV;			break;		}#endif	}	*cp = c;	return (dv);}