summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2001-01-31 09:30:57 +0000
committermsmith <msmith@FreeBSD.org>2001-01-31 09:30:57 +0000
commit30a81dd2b20ee1330959af3ebd4f3d887e9ef7ef (patch)
tree55e22fabd089c50a01caab740b38e45ab4bba423 /sys/dev
parentcae1d97ec5ea6cc7dc2af0ab52e477ca4022a3b5 (diff)
downloadFreeBSD-src-30a81dd2b20ee1330959af3ebd4f3d887e9ef7ef.zip
FreeBSD-src-30a81dd2b20ee1330959af3ebd4f3d887e9ef7ef.tar.gz
ACPI_NUMBER becomes ACPI_INTEGER. acpi_EvaluateNumber becomes
acpi_EvaluateInteger. Use acpi_EvaluateInteger instead of doing things the hard way where possible. AcpiSetSystemSleepState (unofficial) becomes AcpiEnterSleepState. Use the AcpiGbl_FADT pointer rather than searching for the FADT.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpica/acpi.c22
-rw-r--r--sys/dev/acpica/acpi_acad.c2
-rw-r--r--sys/dev/acpica/acpi_cmbat.c4
-rw-r--r--sys/dev/acpica/acpi_lid.c15
-rw-r--r--sys/dev/acpica/acpi_pcib.c4
-rw-r--r--sys/dev/acpica/acpi_pcib_acpi.c4
-rw-r--r--sys/dev/acpica/acpi_timer.c17
-rw-r--r--sys/dev/acpica/acpivar.h2
8 files changed, 24 insertions, 46 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 2e627da..77da421 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -672,7 +672,7 @@ acpi_shutdown_final(void *arg, int howto)
if (howto & RB_POWEROFF) {
printf("Power system off using ACPI...\n");
- if ((status = AcpiSetSystemSleepState(ACPI_STATE_S5)) != AE_OK) {
+ if ((status = AcpiEnterSleepState(ACPI_STATE_S5)) != AE_OK) {
printf("ACPI power-off failed - %s\n", acpi_strerror(status));
} else {
DELAY(1000000);
@@ -779,9 +779,9 @@ acpi_SetSleepState(struct acpi_softc *sc, int state)
switch (state) {
case ACPI_STATE_S0: /* XXX only for testing */
- status = AcpiSetSystemSleepState((UINT8)state);
+ status = AcpiEnterSleepState((UINT8)state);
if (status != AE_OK) {
- device_printf(sc->acpi_dev, "AcpiSetSystemSleepState failed - %s\n", acpi_strerror(status));
+ device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", acpi_strerror(status));
}
break;
@@ -801,9 +801,9 @@ acpi_SetSleepState(struct acpi_softc *sc, int state)
return_ACPI_STATUS(AE_ERROR);
}
sc->acpi_sstate = state;
- status = AcpiSetSystemSleepState((UINT8)state);
+ status = AcpiEnterSleepState((UINT8)state);
if (status != AE_OK) {
- device_printf(sc->acpi_dev, "AcpiSetSystemSleepState failed - %s\n", acpi_strerror(status));
+ device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", acpi_strerror(status));
}
DEVICE_RESUME(root_bus);
sc->acpi_sstate = ACPI_STATE_S0;
@@ -887,22 +887,22 @@ acpi_DeviceIsPresent(device_t dev)
}
/*
- * Evaluate a path that should return a number
+ * Evaluate a path that should return an integer.
*/
ACPI_STATUS
-acpi_EvaluateNumber(ACPI_HANDLE handle, char *path, int *number)
+acpi_EvaluateInteger(ACPI_HANDLE handle, char *path, int *number)
{
ACPI_STATUS error;
ACPI_BUFFER buf;
- int param[4];
+ ACPI_OBJECT param;
if (handle == NULL)
handle = ACPI_ROOT_OBJECT;
- buf.Pointer = &param[0];
+ buf.Pointer = &param;
buf.Length = sizeof(param);
if ((error = AcpiEvaluateObject(handle, path, NULL, &buf)) == AE_OK) {
- if (param[0] == ACPI_TYPE_NUMBER) {
- *number = param[1];
+ if (param.Type == ACPI_TYPE_INTEGER) {
+ *number = param.Integer.Value;
} else {
error = AE_TYPE;
}
diff --git a/sys/dev/acpica/acpi_acad.c b/sys/dev/acpica/acpi_acad.c
index 4c61225..a668048 100644
--- a/sys/dev/acpica/acpi_acad.c
+++ b/sys/dev/acpica/acpi_acad.c
@@ -64,7 +64,7 @@ acpi_acad_get_status(void *context)
struct acpi_acad_softc *sc = device_get_softc(dev);
ACPI_HANDLE h = acpi_get_handle(dev);
- if (acpi_EvaluateNumber(h, "_PSR", &sc->status) != AE_OK)
+ if (acpi_EvaluateInteger(h, "_PSR", &sc->status) != AE_OK)
return;
device_printf(dev,"%s\n",(sc->status) ? "On Line" : "Off Line");
}
diff --git a/sys/dev/acpica/acpi_cmbat.c b/sys/dev/acpica/acpi_cmbat.c
index 44d51b7..a0c0feb 100644
--- a/sys/dev/acpica/acpi_cmbat.c
+++ b/sys/dev/acpica/acpi_cmbat.c
@@ -67,9 +67,9 @@ static int acpi_cmbat_units = 0;
#define PKG_GETINT(res, tmp, idx, dest, label) do { \
tmp = &res->Package.Elements[idx]; \
- if (tmp->Type != ACPI_TYPE_NUMBER) \
+ if (tmp->Type != ACPI_TYPE_INTEGER) \
goto label ; \
- dest = tmp->Number.Value; \
+ dest = tmp->Integer.Value; \
} while(0)
#define PKG_GETSTR(res, tmp, idx, dest, size, label) do { \
diff --git a/sys/dev/acpica/acpi_lid.c b/sys/dev/acpica/acpi_lid.c
index c6f8614..f80a04f 100644
--- a/sys/dev/acpica/acpi_lid.c
+++ b/sys/dev/acpica/acpi_lid.c
@@ -108,29 +108,18 @@ acpi_lid_notify_status_changed(void *arg)
{
struct acpi_lid_softc *sc;
struct acpi_softc *acpi_sc;
- ACPI_BUFFER Buffer;
- ACPI_OBJECT Object;
FUNCTION_TRACE(__FUNCTION__);
sc = (struct acpi_lid_softc *)arg;
/*
- * Evaluate _LID and check the return value
+ * Evaluate _LID and check the return value, update lid status.
* Zero: The lid is closed
* Non-zero: The lid is open
*/
- Buffer.Length = sizeof(Object);
- Buffer.Pointer = &Object;
- if (AcpiEvaluateObject(sc->lid_handle, "_LID", NULL, &Buffer) != AE_OK)
+ if (acpi_EvaluateInteger(sc->lid_handle, "_LID", &sc->lid_status) != AE_OK)
return_VOID;
- if (Object.Type != ACPI_TYPE_NUMBER)
- return_VOID;
-
- /*
- * Update lid status
- */
- sc->lid_status = Object.Number.Value;
device_printf(sc->lid_dev, "Lid %s\n", sc->lid_status ? "opened" : "closed");
acpi_sc = acpi_device_get_parent_softc(sc->lid_dev);
diff --git a/sys/dev/acpica/acpi_pcib.c b/sys/dev/acpica/acpi_pcib.c
index 2e2d873..60f1708 100644
--- a/sys/dev/acpica/acpi_pcib.c
+++ b/sys/dev/acpica/acpi_pcib.c
@@ -144,7 +144,7 @@ acpi_pcib_attach(device_t dev)
* Get our segment number by evaluating _SEG
* It's OK for this to not exist.
*/
- if ((status = acpi_EvaluateNumber(sc->ap_handle, "_SEG", &sc->ap_segment)) != AE_OK) {
+ if ((status = acpi_EvaluateInteger(sc->ap_handle, "_SEG", &sc->ap_segment)) != AE_OK) {
if (status != AE_NOT_FOUND) {
device_printf(dev, "could not evaluate _SEG - %s\n", acpi_strerror(status));
return_VALUE(ENXIO);
@@ -166,7 +166,7 @@ acpi_pcib_attach(device_t dev)
* we should attach our own handler.
* XXX invoke _REG on this for the PCI config space address space?
*/
- if ((status = acpi_EvaluateNumber(sc->ap_handle, "_BBN", &sc->ap_bus)) != AE_OK) {
+ if ((status = acpi_EvaluateInteger(sc->ap_handle, "_BBN", &sc->ap_bus)) != AE_OK) {
if (status != AE_NOT_FOUND) {
device_printf(dev, "could not evaluate _BBN - %s\n", acpi_strerror(status));
return_VALUE(ENXIO);
diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c
index 2e2d873..60f1708 100644
--- a/sys/dev/acpica/acpi_pcib_acpi.c
+++ b/sys/dev/acpica/acpi_pcib_acpi.c
@@ -144,7 +144,7 @@ acpi_pcib_attach(device_t dev)
* Get our segment number by evaluating _SEG
* It's OK for this to not exist.
*/
- if ((status = acpi_EvaluateNumber(sc->ap_handle, "_SEG", &sc->ap_segment)) != AE_OK) {
+ if ((status = acpi_EvaluateInteger(sc->ap_handle, "_SEG", &sc->ap_segment)) != AE_OK) {
if (status != AE_NOT_FOUND) {
device_printf(dev, "could not evaluate _SEG - %s\n", acpi_strerror(status));
return_VALUE(ENXIO);
@@ -166,7 +166,7 @@ acpi_pcib_attach(device_t dev)
* we should attach our own handler.
* XXX invoke _REG on this for the PCI config space address space?
*/
- if ((status = acpi_EvaluateNumber(sc->ap_handle, "_BBN", &sc->ap_bus)) != AE_OK) {
+ if ((status = acpi_EvaluateInteger(sc->ap_handle, "_BBN", &sc->ap_bus)) != AE_OK) {
if (status != AE_NOT_FOUND) {
device_printf(dev, "could not evaluate _BBN - %s\n", acpi_strerror(status));
return_VALUE(ENXIO);
diff --git a/sys/dev/acpica/acpi_timer.c b/sys/dev/acpica/acpi_timer.c
index 19ebcc0..5efae58 100644
--- a/sys/dev/acpica/acpi_timer.c
+++ b/sys/dev/acpica/acpi_timer.c
@@ -73,9 +73,6 @@ DRIVER_MODULE(acpi_timer, acpi, acpi_timer_driver, acpi_timer_devclass, 0, 0);
static void
acpi_timer_identify(driver_t *driver, device_t parent)
{
- static FADT_DESCRIPTOR_REV1 fadt;
- ACPI_BUFFER buf;
- ACPI_STATUS status;
device_t dev;
char desc[40];
@@ -84,17 +81,9 @@ acpi_timer_identify(driver_t *driver, device_t parent)
if (acpi_disabled("timer"))
return_VOID;
- buf.Pointer = &fadt;
- buf.Length = sizeof(fadt);
- if ((status = AcpiGetTable(ACPI_TABLE_FADT, 1, &buf)) != AE_OK) {
- device_printf(parent, "can't locate FADT - %s\n", acpi_strerror(status));
+ if (AcpiGbl_FADT == NULL)
return_VOID;
- }
- if (buf.Length != sizeof(fadt)) {
- device_printf(parent, "invalid FADT\n");
- return_VOID;
- }
-
+
if ((dev = BUS_ADD_CHILD(parent, 0, "acpi_timer", 0)) == NULL) {
device_printf(parent, "could not add acpi_timer0\n");
return_VOID;
@@ -104,7 +93,7 @@ acpi_timer_identify(driver_t *driver, device_t parent)
return_VOID;
}
- sprintf(desc, "%d-bit timer at 3.579545MHz", fadt.TmrValExt ? 32 : 24);
+ sprintf(desc, "%d-bit timer at 3.579545MHz", AcpiGbl_FADT->TmrValExt ? 32 : 24);
device_set_desc_copy(dev, desc);
return_VOID;
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index 1b27e83..6bc6cbe 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -163,7 +163,7 @@ extern ACPI_STATUS acpi_SetSleepState(struct acpi_softc *sc, int state);
extern ACPI_STATUS acpi_Enable(struct acpi_softc *sc);
extern ACPI_STATUS acpi_Disable(struct acpi_softc *sc);
extern BOOLEAN acpi_DeviceIsPresent(device_t dev);
-extern ACPI_STATUS acpi_EvaluateNumber(ACPI_HANDLE handle, char *path, int *number);
+extern ACPI_STATUS acpi_EvaluateInteger(ACPI_HANDLE handle, char *path, int *number);
struct acpi_parse_resource_set {
void (* set_init)(device_t dev, void **context);
OpenPOWER on IntegriCloud