summaryrefslogtreecommitdiffstats
path: root/sys/dev/ofw/ofw_disk.c
diff options
context:
space:
mode:
authorgrehan <grehan@FreeBSD.org>2003-12-15 09:53:53 +0000
committergrehan <grehan@FreeBSD.org>2003-12-15 09:53:53 +0000
commit1612dd69b6e82748f579e798b9a1a2348de61143 (patch)
tree80c2f35e265238884da7d6ed29b74deb2964a9af /sys/dev/ofw/ofw_disk.c
parent0593ac4cbb15c2a87a2c9c9ecd713118d935895a (diff)
downloadFreeBSD-src-1612dd69b6e82748f579e798b9a1a2348de61143.zip
FreeBSD-src-1612dd69b6e82748f579e798b9a1a2348de61143.tar.gz
- The last change conflicted with disks on a live system, as opposed to
the psim simulator. Look for the "file" property which only exists on psim disks, and as a bonus, print the contents of this at boot-time, which is the host file being used for the disk image. - remove remaining warnings.
Diffstat (limited to 'sys/dev/ofw/ofw_disk.c')
-rw-r--r--sys/dev/ofw/ofw_disk.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/ofw/ofw_disk.c b/sys/dev/ofw/ofw_disk.c
index c37af75..aa0213a 100644
--- a/sys/dev/ofw/ofw_disk.c
+++ b/sys/dev/ofw/ofw_disk.c
@@ -55,7 +55,6 @@ struct ofwd_softc
/*
* Disk device bus interface.
*/
-static void ofwd_identify(driver_t *, device_t);
static int ofwd_probe(device_t);
static int ofwd_attach(device_t);
@@ -141,13 +140,19 @@ static int
ofwd_probe(device_t dev)
{
char *type;
+ char fname[32];
+ phandle_t node;
type = nexus_get_device_type(dev);
+ node = nexus_get_node(dev);
if (type == NULL ||
(strcmp(type, "disk") != 0 && strcmp(type, "block") != 0))
return (ENXIO);
+ if (OF_getprop(node, "file", fname, sizeof(fname)) == -1)
+ return (ENXIO);
+
device_set_desc(dev, "OpenFirmware disk");
return (0);
}
@@ -157,14 +162,15 @@ ofwd_attach(device_t dev)
{
struct ofwd_softc *sc;
char path[128];
- dev_t dsk;
+ char fname[32];
sc = device_get_softc(dev);
sc->ofwd_dev = dev;
bzero(path, 128);
OF_package_to_path(nexus_get_node(dev), path, 128);
- device_printf(dev, "located at %s\n", path);
+ OF_getprop(nexus_get_node(dev), "file", fname, sizeof(fname));
+ device_printf(dev, "located at %s, file %s\n", path, fname);
sc->ofwd_instance = OF_open(path);
if (sc->ofwd_instance == -1) {
device_printf(dev, "could not create instance\n");
OpenPOWER on IntegriCloud