aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sio
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2008-11-18 21:01:54 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2008-11-18 21:01:54 +0000
commit0d484d249f35fa0a471300e3a7f5a629aab472f8 (patch)
tree9f64d56b3288179bc04a3f77b610240093f70345 /sys/dev/sio
parentb652d3a3dc5f865808df439235c652b9b9a2d872 (diff)
downloadsrc-0d484d249f35fa0a471300e3a7f5a629aab472f8.tar.gz
src-0d484d249f35fa0a471300e3a7f5a629aab472f8.zip
Allow device hints to wire the unit numbers of devices.
- An "at" hint now reserves a device name. - A new BUS_HINT_DEVICE_UNIT method is added to the bus interface. When determining the unit number of a device, this method is invoked to let the bus driver specify the unit of a device given a specific devclass. This is the only way a device can be given a name reserved via an "at" hint. - Implement BUS_HINT_DEVICE_UNIT() for the acpi(4) and isa(4) bus drivers. Both of these busses implement this by comparing the resources for a given hint device with the resources enumerated by ACPI/PnPBIOS and wire a unit if the hint resources are a subset of the "real" resources. - Use bus_hinted_children() for adding hinted devices on isa(4) busses now instead of doing it by hand. - Remove the unit kludging from sio(4) as it is no longer necessary. Prodding from: peter, imp OK'd by: marcel MFC after: 1 month
Notes
Notes: svn path=/head/; revision=185059
Diffstat (limited to 'sys/dev/sio')
-rw-r--r--sys/dev/sio/sio_pci.c31
-rw-r--r--sys/dev/sio/sio_puc.c29
2 files changed, 0 insertions, 60 deletions
diff --git a/sys/dev/sio/sio_pci.c b/sys/dev/sio/sio_pci.c
index 459baa169366..dc9b0042f5d2 100644
--- a/sys/dev/sio/sio_pci.c
+++ b/sys/dev/sio/sio_pci.c
@@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
#include <dev/pci/pcivar.h>
static int sio_pci_attach(device_t dev);
-static void sio_pci_kludge_unit(device_t dev);
static int sio_pci_probe(device_t dev);
static device_method_t sio_pci_methods[] = {
@@ -101,39 +100,9 @@ sio_pci_attach(dev)
id++;
if (id->desc == NULL)
return (ENXIO);
- sio_pci_kludge_unit(dev);
return (sioattach(dev, id->rid, 0UL));
}
-/*
- * 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_pci_kludge_unit(dev)
- 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_pci_probe(dev)
device_t dev;
diff --git a/sys/dev/sio/sio_puc.c b/sys/dev/sio/sio_puc.c
index 37691f74d6f2..0ae0e7d6424d 100644
--- a/sys/dev/sio/sio_puc.c
+++ b/sys/dev/sio/sio_puc.c
@@ -62,34 +62,6 @@ static driver_t sio_puc_driver = {
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)
{
@@ -98,7 +70,6 @@ sio_puc_attach(device_t dev)
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));
}