summaryrefslogtreecommitdiffstats
path: root/sys/isa
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-06-12 09:40:04 +0000
committerpeter <peter@FreeBSD.org>2001-06-12 09:40:04 +0000
commitbbbe8875f0844bdf4e10cbc01dc9c7f2a2c8368a (patch)
treeddf23af998adfeb85fbbf912b89e3fa83f84fd4b /sys/isa
parentb44fc46ed5521eb3028aafbc0c4aef220ed24141 (diff)
downloadFreeBSD-src-bbbe8875f0844bdf4e10cbc01dc9c7f2a2c8368a.zip
FreeBSD-src-bbbe8875f0844bdf4e10cbc01dc9c7f2a2c8368a.tar.gz
Hints overhaul:
- Replace some very poorly thought out API hacks that should have been fixed a long while ago. - Provide some much more flexible search functions (resource_find_*()) - Use strings for storage instead of an outgrowth of the rather inconvenient temporary ioconf table from config(). We already had a fallback to using strings before malloc/vm was running anyway.
Diffstat (limited to 'sys/isa')
-rw-r--r--sys/isa/atkbdc_isa.c18
-rw-r--r--sys/isa/fd.c11
-rw-r--r--sys/isa/isahint.c22
3 files changed, 23 insertions, 28 deletions
diff --git a/sys/isa/atkbdc_isa.c b/sys/isa/atkbdc_isa.c
index d99b648..2685164 100644
--- a/sys/isa/atkbdc_isa.c
+++ b/sys/isa/atkbdc_isa.c
@@ -169,11 +169,11 @@ static int
atkbdc_attach(device_t dev)
{
atkbdc_softc_t *sc;
- int unit;
+ int unit, dunit;
int error;
int rid;
int i;
- const char *name;
+ const char *name, *dname;
unit = device_get_unit(dev);
sc = *(atkbdc_softc_t **)device_get_softc(dev);
@@ -215,19 +215,17 @@ atkbdc_attach(device_t dev)
* Add all devices configured to be attached to atkbdc0.
*/
name = device_get_nameunit(dev);
- i = -1;
- while ((i = resource_query_string(i, "at", name)) != -1)
- atkbdc_add_device(dev, resource_query_name(i),
- resource_query_unit(i));
+ i = 0;
+ while ((resource_find_match(&i, &dname, &dunit, "at", name)) == 0)
+ atkbdc_add_device(dev, dname, dunit);
/*
* and atkbdc?
*/
name = device_get_name(dev);
- i = -1;
- while ((i = resource_query_string(i, "at", name)) != -1)
- atkbdc_add_device(dev, resource_query_name(i),
- resource_query_unit(i));
+ i = 0;
+ while ((resource_find_match(&i, &dname, &dunit, "at", name)) == 0)
+ atkbdc_add_device(dev, dname, dunit);
bus_generic_attach(dev);
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index 7524921..d29240e 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -817,8 +817,8 @@ static int
fdc_attach(device_t dev)
{
struct fdc_data *fdc;
- int i, error;
- const char *name;
+ int i, error, dunit;
+ const char *name, *dname;
fdc = device_get_softc(dev);
error = fdc_alloc_resources(fdc);
@@ -856,10 +856,9 @@ fdc_attach(device_t dev)
* devices from the BIOS unless overridden.
*/
name = device_get_nameunit(dev);
- i = -1;
- while ((i = resource_query_string(i, "at", name)) != -1)
- fdc_add_child(dev, resource_query_name(i),
- resource_query_unit(i));
+ i = 0;
+ while ((resource_find_match(&i, &dname, &dunit, "at", name)) == 0)
+ fdc_add_child(dev, dname, dunit);
return (bus_generic_attach(dev));
}
diff --git a/sys/isa/isahint.c b/sys/isa/isahint.c
index 8b21a62..12f32d2 100644
--- a/sys/isa/isahint.c
+++ b/sys/isa/isahint.c
@@ -87,30 +87,28 @@ isahint_identify(driver_t *driver, device_t parent)
{
int i;
static char buf[] = "isaXXX";
+ const char *dname;
+ int dunit;
/*
* Add all devices configured to be attached to parent.
*/
sprintf(buf, "isa%d", device_get_unit(parent));
- i = -1;
- while ((i = resource_query_string(i, "at", buf)) != -1) {
- if (strcmp(resource_query_name(i), "atkbd") == 0)
+ i = 0;
+ while ((resource_find_match(&i, &dname, &dunit, "at", buf)) == 0) {
+ if (strcmp(dname, "atkbd") == 0)
continue; /* old GENERIC kludge */
- isahint_add_device(parent,
- resource_query_name(i),
- resource_query_unit(i));
+ isahint_add_device(parent, dname, dunit);
}
/*
* and isa?
*/
- i = -1;
- while ((i = resource_query_string(i, "at", "isa")) != -1) {
- if (strcmp(resource_query_name(i), "atkbd") == 0)
+ i = 0;
+ while ((resource_find_match(&i, &dname, &dunit, "at", "isa")) == 0) {
+ if (strcmp(dname, "atkbd") == 0)
continue; /* old GENERIC kludge */
- isahint_add_device(parent,
- resource_query_name(i),
- resource_query_unit(i));
+ isahint_add_device(parent, dname, dunit);
}
}
OpenPOWER on IntegriCloud