Use the acpi_id_probe() method instead of acpi_MatchHid(), which is now
static.
This commit is contained in:
parent
ec88e6b9d0
commit
ff7583584e
@ -42,6 +42,8 @@
|
||||
#include "acpi.h"
|
||||
#include <dev/acpica/acpivar.h>
|
||||
#include <dev/acpica/acpiio.h>
|
||||
#include <isa/isavar.h>
|
||||
#include <isa/pnpvar.h>
|
||||
|
||||
/* 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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -90,17 +90,15 @@ MODULE_DEPEND(acpi_isab, acpi, 1, 1, 1);
|
||||
static int
|
||||
acpi_isab_probe(device_t dev)
|
||||
{
|
||||
ACPI_HANDLE h;
|
||||
static char *isa_ids[] = { "PNP0A05", "PNP0A06", NULL };
|
||||
|
||||
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);
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user