Use the acpi_id_probe() method instead of acpi_MatchHid(), which is now

static.
This commit is contained in:
njl 2004-06-29 19:02:27 +00:00
parent 2a43f50bb0
commit 72ad681e84
8 changed files with 72 additions and 65 deletions

View File

@ -42,6 +42,8 @@
#include "acpi.h" #include "acpi.h"
#include <dev/acpica/acpivar.h> #include <dev/acpica/acpivar.h>
#include <dev/acpica/acpiio.h> #include <dev/acpica/acpiio.h>
#include <isa/isavar.h>
#include <isa/pnpvar.h>
/* Hooks for the ACPI CA debugging infrastructure */ /* Hooks for the ACPI CA debugging infrastructure */
#define _COMPONENT ACPI_AC_ADAPTER #define _COMPONENT ACPI_AC_ADAPTER
@ -136,12 +138,14 @@ acpi_acad_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
static int static int
acpi_acad_probe(device_t dev) acpi_acad_probe(device_t dev)
{ {
if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("acad") && static char *acad_ids[] = { "ACPI0003", NULL };
acpi_MatchHid(acpi_get_handle(dev), "ACPI0003")) {
if (acpi_disabled("acad") ||
ACPI_ID_PROBE(device_get_parent(dev), dev, acad_ids) == NULL)
return (ENXIO);
device_set_desc(dev, "AC Adapter"); device_set_desc(dev, "AC Adapter");
return (0); return (0);
}
return (ENXIO);
} }
static int static int

View File

@ -64,6 +64,11 @@ static ACPI_STATUS
static void acpi_button_notify_sleep(void *arg); static void acpi_button_notify_sleep(void *arg);
static void acpi_button_notify_wakeup(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[] = { static device_method_t acpi_button_methods[] = {
/* Device interface */ /* Device interface */
DEVMETHOD(device_probe, acpi_button_probe), DEVMETHOD(device_probe, acpi_button_probe),
@ -90,33 +95,30 @@ static int
acpi_button_probe(device_t dev) acpi_button_probe(device_t dev)
{ {
struct acpi_button_softc *sc; struct acpi_button_softc *sc;
ACPI_HANDLE h; char *str;
int ret = ENXIO;
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); sc = device_get_softc(dev);
if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("button")) { if (strcmp(str, "PNP0C0C") == 0) {
if (acpi_MatchHid(h, "PNP0C0C")) {
device_set_desc(dev, "Power Button"); device_set_desc(dev, "Power Button");
sc->button_type = ACPI_POWER_BUTTON; sc->button_type = ACPI_POWER_BUTTON;
ret = 0; } else if (strcmp(str, "ACPI_FPB") == 0) {
} else if (acpi_MatchHid(h, "ACPI_FPB")) {
device_set_desc(dev, "Power Button (fixed)"); device_set_desc(dev, "Power Button (fixed)");
sc->button_type = ACPI_POWER_BUTTON; sc->button_type = ACPI_POWER_BUTTON;
sc->fixed = 1; sc->fixed = 1;
ret = 0; } else if (strcmp(str, "PNP0C0E") == 0) {
} else if (acpi_MatchHid(h, "PNP0C0E")) {
device_set_desc(dev, "Sleep Button"); device_set_desc(dev, "Sleep Button");
sc->button_type = ACPI_SLEEP_BUTTON; sc->button_type = ACPI_SLEEP_BUTTON;
ret = 0; } else if (strcmp(str, "ACPI_FSB") == 0) {
} else if (acpi_MatchHid(h, "ACPI_FSB")) {
device_set_desc(dev, "Sleep Button (fixed)"); device_set_desc(dev, "Sleep Button (fixed)");
sc->button_type = ACPI_SLEEP_BUTTON; sc->button_type = ACPI_SLEEP_BUTTON;
sc->fixed = 1; sc->fixed = 1;
ret = 0;
} }
}
return (ret); return (0);
} }
static int static int

View File

@ -291,13 +291,14 @@ acpi_cmbat_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
static int static int
acpi_cmbat_probe(device_t dev) acpi_cmbat_probe(device_t dev)
{ {
if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("cmbat") static char *cmbat_ids[] = { "PNP0C0A", NULL };
&& acpi_MatchHid(acpi_get_handle(dev), "PNP0C0A")) {
if (acpi_disabled("cmbat") ||
ACPI_ID_PROBE(device_get_parent(dev), dev, cmbat_ids) == NULL)
return (ENXIO);
device_set_desc(dev, "Control Method Battery"); device_set_desc(dev, "Control Method Battery");
return (0); return (0);
}
return (ENXIO);
} }
static int static int

View File

@ -437,6 +437,7 @@ acpi_ec_probe(device_t dev)
char desc[64]; char desc[64];
int ret; int ret;
struct acpi_ec_params *params; struct acpi_ec_params *params;
static char *ec_ids[] = { "PNP0C09", NULL };
/* Check that this is a device and that EC is not disabled. */ /* Check that this is a device and that EC is not disabled. */
if (acpi_get_type(dev) != ACPI_TYPE_DEVICE || acpi_disabled("ec")) 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)) { if (DEV_ECDT(dev)) {
params = acpi_get_private(dev); params = acpi_get_private(dev);
ret = 0; 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, params = malloc(sizeof(struct acpi_ec_params), M_TEMP,
M_WAITOK | M_ZERO); M_WAITOK | M_ZERO);
h = acpi_get_handle(dev); h = acpi_get_handle(dev);

View File

@ -90,17 +90,15 @@ MODULE_DEPEND(acpi_isab, acpi, 1, 1, 1);
static int static int
acpi_isab_probe(device_t dev) acpi_isab_probe(device_t dev)
{ {
ACPI_HANDLE h; 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);
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"); device_set_desc(dev, "ACPI Generic ISA bridge");
return (0); return (0);
}
return (ENXIO);
} }
static int static int

View File

@ -81,13 +81,14 @@ MODULE_DEPEND(acpi_lid, acpi, 1, 1, 1);
static int static int
acpi_lid_probe(device_t dev) acpi_lid_probe(device_t dev)
{ {
if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("lid") && static char *lid_ids[] = { "PNP0C0D", NULL };
acpi_MatchHid(acpi_get_handle(dev), "PNP0C0D")) {
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"); device_set_desc(dev, "Control Method Lid Switch");
return (0); return (0);
}
return (ENXIO);
} }
static int static int

View File

@ -115,16 +115,16 @@ MODULE_DEPEND(acpi_pcib, acpi, 1, 1, 1);
static int static int
acpi_pcib_acpi_probe(device_t dev) acpi_pcib_acpi_probe(device_t dev)
{ {
static char *pcib_ids[] = { "PNP0A03", NULL };
if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("pci") && if (acpi_disabled("pcib") ||
acpi_MatchHid(acpi_get_handle(dev), "PNP0A03")) { ACPI_ID_PROBE(device_get_parent(dev), dev, pcib_ids) == NULL)
return (ENXIO);
if (pci_cfgregopen() == 0) if (pci_cfgregopen() == 0)
return (ENXIO); return (ENXIO);
device_set_desc(dev, "ACPI Host-PCI bridge"); device_set_desc(dev, "ACPI Host-PCI bridge");
return (0); return (0);
}
return (ENXIO);
} }
static int static int

View File

@ -655,11 +655,10 @@ MODULE_DEPEND(acpi_sysresource, acpi, 1, 1, 1);
static int static int
acpi_sysres_probe(device_t dev) 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") || 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); return (ENXIO);
device_set_desc(dev, "System Resource"); device_set_desc(dev, "System Resource");