summaryrefslogtreecommitdiffstats
path: root/sys/boot/ofw
diff options
context:
space:
mode:
authorrobert <robert@FreeBSD.org>2001-10-15 09:25:30 +0000
committerrobert <robert@FreeBSD.org>2001-10-15 09:25:30 +0000
commite2f56100f9076fb6118d038676da1cb488459555 (patch)
tree26cb9f68fb4107126857ef27849e8240103e9307 /sys/boot/ofw
parentea6b1a25c37b4663a13e048bc97f2600acbf19c3 (diff)
downloadFreeBSD-src-e2f56100f9076fb6118d038676da1cb488459555.zip
FreeBSD-src-e2f56100f9076fb6118d038676da1cb488459555.tar.gz
Add a function for parsing an Open Firmware boot path into the
ofw_devdesc structure.
Diffstat (limited to 'sys/boot/ofw')
-rw-r--r--sys/boot/ofw/libofw/devicename.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/sys/boot/ofw/libofw/devicename.c b/sys/boot/ofw/libofw/devicename.c
index ff67d6e..af6302f 100644
--- a/sys/boot/ofw/libofw/devicename.c
+++ b/sys/boot/ofw/libofw/devicename.c
@@ -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:
OpenPOWER on IntegriCloud