diff options
author | njl <njl@FreeBSD.org> | 2004-08-06 00:38:50 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2004-08-06 00:38:50 +0000 |
commit | 9b4d7989dc75d938565d34f07026d0ce2ee59f59 (patch) | |
tree | c2e980906fe8511082d3d93d6ce2a7963dff5925 /sys | |
parent | 854b82db1476ffcc39ab35c2b2769c29bb153aa6 (diff) | |
download | FreeBSD-src-9b4d7989dc75d938565d34f07026d0ce2ee59f59.zip FreeBSD-src-9b4d7989dc75d938565d34f07026d0ce2ee59f59.tar.gz |
Add flags for _STA (status) methods and convenience macros for checking
the presence of batteries and devices.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/acpica/acpi.c | 6 | ||||
-rw-r--r-- | sys/dev/acpica/acpivar.h | 16 |
2 files changed, 18 insertions, 4 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index c546a76..933bde6 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -1339,7 +1339,7 @@ acpi_DeviceIsPresent(device_t dev) ret = TRUE; /* Return true for 'present' and 'functioning' */ - if ((devinfo->CurrentStatus & 0x9) == 0x9) + if (ACPI_DEVICE_PRESENT(devinfo->CurrentStatus)) ret = TRUE; AcpiOsFree(buf.Pointer); @@ -1372,8 +1372,8 @@ acpi_BatteryIsPresent(device_t dev) if ((devinfo->Valid & ACPI_VALID_STA) == 0) ret = TRUE; - /* Return true for 'present' and 'functioning' */ - if ((devinfo->CurrentStatus & 0x19) == 0x19) + /* Return true for 'present', 'battery present', and 'functioning' */ + if (ACPI_BATTERY_PRESENT(devinfo->CurrentStatus)) ret = TRUE; AcpiOsFree(buf.Pointer); diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 251a09d..2129217 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -222,7 +222,21 @@ void acpi_EnterDebugger(void); device_printf(dev, x); \ } while (0) -#define ACPI_DEVINFO_PRESENT(x) (((x) & 0x9) == 9) +/* Values for the device _STA (status) method. */ +#define ACPI_STA_PRESENT (1 << 0) +#define ACPI_STA_ENABLED (1 << 1) +#define ACPI_STA_SHOW_IN_UI (1 << 2) +#define ACPI_STA_FUNCTIONAL (1 << 3) +#define ACPI_STA_BATT_PRESENT (1 << 4) + +#define ACPI_DEVINFO_PRESENT(x, flags) \ + (((x) & (flags)) == (flags)) +#define ACPI_DEVICE_PRESENT(x) \ + ACPI_DEVINFO_PRESENT(x, ACPI_STA_PRESENT | ACPI_STA_FUNCTIONAL) +#define ACPI_BATTERY_PRESENT(x) \ + ACPI_DEVINFO_PRESENT(x, ACPI_STA_PRESENT | ACPI_STA_FUNCTIONAL | \ + ACPI_STA_BATT_PRESENT) + BOOLEAN acpi_DeviceIsPresent(device_t dev); BOOLEAN acpi_BatteryIsPresent(device_t dev); ACPI_STATUS acpi_GetHandleInScope(ACPI_HANDLE parent, char *path, |