Date: Thu, 11 Jan 2007 02:11:01 GMT From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 112755 for review Message-ID: <200701110211.l0B2B1sl023597@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=112755 Change 112755 by peter@peter_overcee on 2007/01/11 02:10:31 Ignore the warnings and copy this bit of necessary code to avoid sio unit numbers from sio_pci to sio_puc. Marcel left this out in the great puc rewrite. Affected files ... .. //depot/projects/hammer/sys/dev/sio/sio_puc.c#8 edit Differences ... ==== //depot/projects/hammer/sys/dev/sio/sio_puc.c#8 (text+ko) ==== @@ -62,6 +62,34 @@ 0, }; +/* + * Don't cut and paste this to other drivers. It is a horrible kludge + * which will fail to work and also be unnecessary in future versions. + */ +static void +sio_puc_kludge_unit(device_t dev) +{ + devclass_t dc; + int err; + int start; + int unit; + + unit = 0; + start = 0; + while (resource_int_value("sio", unit, "port", &start) == 0 && + start > 0) + unit++; + if (device_get_unit(dev) < unit) { + dc = device_get_devclass(dev); + while (devclass_get_device(dc, unit)) + unit++; + device_printf(dev, "moving to sio%d\n", unit); + err = device_set_unit(dev, unit); /* EVIL DO NOT COPY */ + if (err) + device_printf(dev, "error moving device %d\n", err); + } +} + static int sio_puc_attach(device_t dev) { @@ -70,6 +98,7 @@ if (BUS_READ_IVAR(device_get_parent(dev), dev, PUC_IVAR_CLOCK, &rclk) != 0) rclk = DEFAULT_RCLK; + sio_puc_kludge_unit(dev); return (sioattach(dev, 0, rclk)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701110211.l0B2B1sl023597>