From 1612dd69b6e82748f579e798b9a1a2348de61143 Mon Sep 17 00:00:00 2001 From: grehan Date: Mon, 15 Dec 2003 09:53:53 +0000 Subject: - 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. --- sys/dev/ofw/ofw_disk.c | 12 +++++++++--- 1 file 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"); -- cgit v1.1