1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Add a function for parsing an Open Firmware boot path into the

ofw_devdesc structure.
This commit is contained in:
Robert Drehmel 2001-10-15 09:25:30 +00:00
parent 8716f26121
commit cdfc68815b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=84968

View File

@ -185,6 +185,32 @@ ofw_parsedev(struct ofw_devdesc **dev, const char *devspec, const char **path)
return(err);
}
/* hack to correctly parse bootpath for currdev. */
int
ofw_parseofwdev(struct ofw_devdesc *dev, const char *devspec)
{
char *cp, *ep;
int i;
struct devsw *dv;
if ((cp = strrchr(devspec, '@')) == 0)
return EINVAL;
cp++;
ep = cp;
dev->d_kind.ofwdisk.unit = strtol(cp, &cp, 10);
if (cp == ep)
return EUNIT;
if (*cp != ',')
return ESLICE;
ep = ++cp;
dev->d_kind.ofwdisk.slice = strtol(cp, &cp, 10) + 1;
if (cp == ep)
return ESLICE;
if (*cp != ':')
return EPART;
dev->d_kind.ofwdisk.partition = *++cp - 'a';
}
char *
ofw_fmtdev(void *vdev)
{
@ -198,9 +224,9 @@ ofw_fmtdev(void *vdev)
break;
case DEVT_DISK:
/* XXX Insert stuff here */
sprintf(buf, "%s%d:", dev->d_dev->dv_name,
dev->d_kind.ofwdisk.unit);
sprintf(buf, "%s%ds%d%c:", dev->d_dev->dv_name,
dev->d_kind.ofwdisk.unit, dev->d_kind.ofwdisk.slice,
dev->d_kind.ofwdisk.partition + 'a');
break;
case DEVT_NET: