예제 #1
0
/*
 * Look at the string 'cp' and decode the boot device.
 * Boot names look like: scsi()disk(n)rdisk()partition(1)\bsd
 * (beware for empty scsi id's...)
 */
void
makebootdev(const char *cp)
{
	int ok, junk;
	static struct devmap devmap[] = {
		{ "multi", "fd" },
		{ "eisa", "wd" },
		{ "scsi", "sd" },
		{ NULL, NULL }
	};
	struct devmap *dp = &devmap[0];
	static struct bootdev_data bd;

	/* "scsi()" */
	while (dp->attachment) {
		if (strncmp(cp, dp->attachment, strlen(dp->attachment)) == 0)
			break;
		dp++;
	}
	if (!dp->attachment) {
		printf("Warning: boot device unrecognized: %s\n", cp);
		return;
	}
	bd.dev_type = dp->dev;
	ok = getpno(&cp, &bd.bus);

	/* "multi(2)scsi(0)disk(0)rdisk(0)partition(1)" case */
	if (ok && strcmp(dp->attachment, "multi") == 0 &&
	    memcmp(cp, "scsi", 4) == 0) {
		bd.dev_type = "sd";
		ok = getpno(&cp, &bd.bus);
	}

	/* "disk(N)" */
	if (ok)
		ok = getpno(&cp, &bd.unit);
	else
		bd.unit = 0;

	/* "rdisk()" */
	if (*cp++ == ')')
		ok = getpno(&cp, &junk);

	/* "partition(1)" */
#if 0 /* ignore partition number */
	if (ok && getpno(&cp, &bd.partition))
		--bd.partition;
	else
#endif
		bd.partition = 0;

	bootdev_data = &bd;
}
예제 #2
0
/*
 * Look at the string 'bp' and decode the boot device.
 * Boot names look like: '/pci/scsi@c/disk@0,0/bsd'
 *                       '/pci/mac-io/ide@20000/disk@0,0/bsd
 *                       '/pci/mac-io/ide/disk/bsd
 *			 '/ht@0,f2000000/pci@2/bcom5704@4/bsd'
 */
void
parseofwbp(char *bp)
{
	int	ptype;
	char   *dev, *cp;
	struct devmap *dp;

	cp = bp;
	do {
		while(*cp && *cp != '/')
			cp++;

		dp = findtype(&cp);
		if (!dp->att) {
			printf("Warning: bootpath unrecognized: %s\n", bp);
			return;
		}
	} while((dp->type & T_IFACE) == 0);

	if (dp->att && dp->type == T_IFACE) {
		bootdev_class = DV_IFNET;
		bootdev_type = dp->type;
		strlcpy(bootdev, dp->dev, sizeof bootdev);
		return;
	}
	dev = dp->dev;
	while(*cp && *cp != '/')
		cp++;
	ptype = dp->type;
	dp = findtype(&cp);
	if (dp->att && dp->type == T_DISK) {
		bootdev_class = DV_DISK;
		bootdev_type = ptype;
		bootdev_unit = getpno(&cp);
		return;
	}
	printf("Warning: boot device unrecognized: %s\n", bp);
}