From 72ad681e8442865d104086e9a6961818cc435085 Mon Sep 17 00:00:00 2001 From: njl Date: Tue, 29 Jun 2004 19:02:27 +0000 Subject: Use the acpi_id_probe() method instead of acpi_MatchHid(), which is now static. --- sys/dev/acpica/acpi_acad.c | 16 ++++++++----- sys/dev/acpica/acpi_button.c | 52 +++++++++++++++++++++-------------------- sys/dev/acpica/acpi_cmbat.c | 13 ++++++----- sys/dev/acpica/acpi_ec.c | 4 +++- sys/dev/acpica/acpi_isab.c | 20 +++++++--------- sys/dev/acpica/acpi_lid.c | 13 ++++++----- sys/dev/acpica/acpi_pcib_acpi.c | 16 ++++++------- sys/dev/acpica/acpi_resource.c | 5 ++-- 8 files changed, 73 insertions(+), 66 deletions(-) (limited to 'sys') diff --git a/sys/dev/acpica/acpi_acad.c b/sys/dev/acpica/acpi_acad.c index 6063a71..b4422b8 100644 --- a/sys/dev/acpica/acpi_acad.c +++ b/sys/dev/acpica/acpi_acad.c @@ -42,6 +42,8 @@ #include "acpi.h" #include #include +#include +#include /* Hooks for the ACPI CA debugging infrastructure */ #define _COMPONENT ACPI_AC_ADAPTER @@ -136,12 +138,14 @@ acpi_acad_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) static int acpi_acad_probe(device_t dev) { - if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("acad") && - acpi_MatchHid(acpi_get_handle(dev), "ACPI0003")) { - device_set_desc(dev, "AC Adapter"); - return (0); - } - return (ENXIO); + static char *acad_ids[] = { "ACPI0003", NULL }; + + if (acpi_disabled("acad") || + ACPI_ID_PROBE(device_get_parent(dev), dev, acad_ids) == NULL) + return (ENXIO); + + device_set_desc(dev, "AC Adapter"); + return (0); } static int diff --git a/sys/dev/acpica/acpi_button.c b/sys/dev/acpica/acpi_button.c index 4ea77db..17fe84a 100644 --- a/sys/dev/acpica/acpi_button.c +++ b/sys/dev/acpica/acpi_button.c @@ -64,6 +64,11 @@ static ACPI_STATUS static void acpi_button_notify_sleep(void *arg); static void acpi_button_notify_wakeup(void *arg); +static char *btn_ids[] = { + "PNP0C0C", "ACPI_FPB", "PNP0C0E", "ACPI_FSB", + NULL +}; + static device_method_t acpi_button_methods[] = { /* Device interface */ DEVMETHOD(device_probe, acpi_button_probe), @@ -89,34 +94,31 @@ MODULE_DEPEND(acpi_button, acpi, 1, 1, 1); static int acpi_button_probe(device_t dev) { - struct acpi_button_softc *sc; - ACPI_HANDLE h; - int ret = ENXIO; + struct acpi_button_softc *sc; + char *str; + + if (acpi_disabled("button") || + (str = ACPI_ID_PROBE(device_get_parent(dev), dev, btn_ids)) == NULL) + return (ENXIO); - h = acpi_get_handle(dev); sc = device_get_softc(dev); - if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("button")) { - if (acpi_MatchHid(h, "PNP0C0C")) { - device_set_desc(dev, "Power Button"); - sc->button_type = ACPI_POWER_BUTTON; - ret = 0; - } else if (acpi_MatchHid(h, "ACPI_FPB")) { - device_set_desc(dev, "Power Button (fixed)"); - sc->button_type = ACPI_POWER_BUTTON; - sc->fixed = 1; - ret = 0; - } else if (acpi_MatchHid(h, "PNP0C0E")) { - device_set_desc(dev, "Sleep Button"); - sc->button_type = ACPI_SLEEP_BUTTON; - ret = 0; - } else if (acpi_MatchHid(h, "ACPI_FSB")) { - device_set_desc(dev, "Sleep Button (fixed)"); - sc->button_type = ACPI_SLEEP_BUTTON; - sc->fixed = 1; - ret = 0; - } + if (strcmp(str, "PNP0C0C") == 0) { + device_set_desc(dev, "Power Button"); + sc->button_type = ACPI_POWER_BUTTON; + } else if (strcmp(str, "ACPI_FPB") == 0) { + device_set_desc(dev, "Power Button (fixed)"); + sc->button_type = ACPI_POWER_BUTTON; + sc->fixed = 1; + } else if (strcmp(str, "PNP0C0E") == 0) { + device_set_desc(dev, "Sleep Button"); + sc->button_type = ACPI_SLEEP_BUTTON; + } else if (strcmp(str, "ACPI_FSB") == 0) { + device_set_desc(dev, "Sleep Button (fixed)"); + sc->button_type = ACPI_SLEEP_BUTTON; + sc->fixed = 1; } - return (ret); + + return (0); } static int diff --git a/sys/dev/acpica/acpi_cmbat.c b/sys/dev/acpica/acpi_cmbat.c index 6f81c44..d0f6f03 100644 --- a/sys/dev/acpica/acpi_cmbat.c +++ b/sys/dev/acpica/acpi_cmbat.c @@ -291,13 +291,14 @@ acpi_cmbat_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) static int acpi_cmbat_probe(device_t dev) { - if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("cmbat") - && acpi_MatchHid(acpi_get_handle(dev), "PNP0C0A")) { + static char *cmbat_ids[] = { "PNP0C0A", NULL }; - device_set_desc(dev, "Control Method Battery"); - return (0); - } - return (ENXIO); + if (acpi_disabled("cmbat") || + ACPI_ID_PROBE(device_get_parent(dev), dev, cmbat_ids) == NULL) + return (ENXIO); + + device_set_desc(dev, "Control Method Battery"); + return (0); } static int diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c index 4902eed..e2da71d 100644 --- a/sys/dev/acpica/acpi_ec.c +++ b/sys/dev/acpica/acpi_ec.c @@ -437,6 +437,7 @@ acpi_ec_probe(device_t dev) char desc[64]; int ret; struct acpi_ec_params *params; + static char *ec_ids[] = { "PNP0C09", NULL }; /* Check that this is a device and that EC is not disabled. */ if (acpi_get_type(dev) != ACPI_TYPE_DEVICE || acpi_disabled("ec")) @@ -454,7 +455,8 @@ acpi_ec_probe(device_t dev) if (DEV_ECDT(dev)) { params = acpi_get_private(dev); ret = 0; - } else if (acpi_MatchHid(acpi_get_handle(dev), "PNP0C09")) { + } else if (!acpi_disabled("ec") && + ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids)) { params = malloc(sizeof(struct acpi_ec_params), M_TEMP, M_WAITOK | M_ZERO); h = acpi_get_handle(dev); diff --git a/sys/dev/acpica/acpi_isab.c b/sys/dev/acpica/acpi_isab.c index a7c70c7..d61d6e7 100644 --- a/sys/dev/acpica/acpi_isab.c +++ b/sys/dev/acpica/acpi_isab.c @@ -90,17 +90,15 @@ MODULE_DEPEND(acpi_isab, acpi, 1, 1, 1); static int acpi_isab_probe(device_t dev) { - ACPI_HANDLE h; - - h = acpi_get_handle(dev); - if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && - !acpi_disabled("isa") && - devclass_get_device(isab_devclass, 0) == dev && - (acpi_MatchHid(h, "PNP0A05") || acpi_MatchHid(h, "PNP0A06"))) { - device_set_desc(dev, "ACPI Generic ISA bridge"); - return (0); - } - return (ENXIO); + static char *isa_ids[] = { "PNP0A05", "PNP0A06", NULL }; + + if (acpi_disabled("isab") || + ACPI_ID_PROBE(device_get_parent(dev), dev, isa_ids) == NULL || + devclass_get_device(isab_devclass, 0) != dev) + return (ENXIO); + + device_set_desc(dev, "ACPI Generic ISA bridge"); + return (0); } static int diff --git a/sys/dev/acpica/acpi_lid.c b/sys/dev/acpica/acpi_lid.c index e169237..7bf6431 100644 --- a/sys/dev/acpica/acpi_lid.c +++ b/sys/dev/acpica/acpi_lid.c @@ -81,13 +81,14 @@ MODULE_DEPEND(acpi_lid, acpi, 1, 1, 1); static int acpi_lid_probe(device_t dev) { - if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("lid") && - acpi_MatchHid(acpi_get_handle(dev), "PNP0C0D")) { + static char *lid_ids[] = { "PNP0C0D", NULL }; - device_set_desc(dev, "Control Method Lid Switch"); - return (0); - } - return (ENXIO); + if (acpi_disabled("lid") || + ACPI_ID_PROBE(device_get_parent(dev), dev, lid_ids) == NULL) + return (ENXIO); + + device_set_desc(dev, "Control Method Lid Switch"); + return (0); } static int diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c index cbb9bee..51afe5f 100644 --- a/sys/dev/acpica/acpi_pcib_acpi.c +++ b/sys/dev/acpica/acpi_pcib_acpi.c @@ -115,16 +115,16 @@ MODULE_DEPEND(acpi_pcib, acpi, 1, 1, 1); static int acpi_pcib_acpi_probe(device_t dev) { + static char *pcib_ids[] = { "PNP0A03", NULL }; - if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("pci") && - acpi_MatchHid(acpi_get_handle(dev), "PNP0A03")) { + if (acpi_disabled("pcib") || + ACPI_ID_PROBE(device_get_parent(dev), dev, pcib_ids) == NULL) + return (ENXIO); - if (pci_cfgregopen() == 0) - return (ENXIO); - device_set_desc(dev, "ACPI Host-PCI bridge"); - return (0); - } - return (ENXIO); + if (pci_cfgregopen() == 0) + return (ENXIO); + device_set_desc(dev, "ACPI Host-PCI bridge"); + return (0); } static int diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c index 369e183..60b8bcd 100644 --- a/sys/dev/acpica/acpi_resource.c +++ b/sys/dev/acpica/acpi_resource.c @@ -655,11 +655,10 @@ MODULE_DEPEND(acpi_sysresource, acpi, 1, 1, 1); static int acpi_sysres_probe(device_t dev) { - ACPI_HANDLE h; + static char *sysres_ids[] = { "PNP0C01", "PNP0C02", NULL }; - h = acpi_get_handle(dev); if (acpi_disabled("sysresource") || - (!acpi_MatchHid(h, "PNP0C01") && !acpi_MatchHid(h, "PNP0C02"))) + ACPI_ID_PROBE(device_get_parent(dev), dev, sysres_ids) == NULL) return (ENXIO); device_set_desc(dev, "System Resource"); -- cgit v1.1