summaryrefslogtreecommitdiff
path: root/include/acpi
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-07-07 22:11:40 +0300
committerBin Meng <bmeng.cn@gmail.com>2020-07-17 09:32:24 +0300
commit2715b3623c08bf1ad2dfe6076ad86c24e3138016 (patch)
tree9b94a2499392579322f5c250e83b1a82b131c1f8 /include/acpi
parent1361a53c1ae1f0534825e12ed41fb44aefd2c224 (diff)
downloadu-boot-2715b3623c08bf1ad2dfe6076ad86c24e3138016.tar.xz
acpi: Add a way to check device status
At present U-Boot does not support the different ACPI status values, but it is best to put this logic in a central place. Add a function to get the device status. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/acpi')
-rw-r--r--include/acpi/acpi_device.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/acpi/acpi_device.h b/include/acpi/acpi_device.h
index 37a675f101..09c227489a 100644
--- a/include/acpi/acpi_device.h
+++ b/include/acpi/acpi_device.h
@@ -9,11 +9,28 @@
#ifndef __ACPI_DEVICE_H
#define __ACPI_DEVICE_H
+#include <linux/bitops.h>
+
struct udevice;
/* Length of a full path to an ACPI device */
#define ACPI_PATH_MAX 30
+/* Values that can be returned for ACPI device _STA method */
+enum acpi_dev_status {
+ ACPI_DSTATUS_PRESENT = BIT(0),
+ ACPI_DSTATUS_ENABLED = BIT(1),
+ ACPI_DSTATUS_SHOW_IN_UI = BIT(2),
+ ACPI_DSTATUS_OK = BIT(3),
+ ACPI_DSTATUS_HAS_BATTERY = BIT(4),
+
+ ACPI_DSTATUS_ALL_OFF = 0,
+ ACPI_DSTATUS_HIDDEN_ON = ACPI_DSTATUS_PRESENT | ACPI_DSTATUS_ENABLED |
+ ACPI_DSTATUS_OK,
+ ACPI_DSTATUS_ALL_ON = ACPI_DSTATUS_HIDDEN_ON |
+ ACPI_DSTATUS_SHOW_IN_UI,
+};
+
/**
* acpi_device_path() - Get the full path to an ACPI device
*
@@ -41,4 +58,15 @@ int acpi_device_path(const struct udevice *dev, char *buf, int maxlen);
*/
int acpi_device_scope(const struct udevice *dev, char *scope, int maxlen);
+/**
+ * acpi_device_status() - Get the status of a device
+ *
+ * This currently just returns ACPI_DSTATUS_ALL_ON. It does not support
+ * inactive or hidden devices.
+ *
+ * @dev: Device to check
+ * @return device status, as ACPI_DSTATUS_...
+ */
+enum acpi_dev_status acpi_device_status(const struct udevice *dev);
+
#endif