diff mbox series

[v2,01/35] dm: core: Add an ACPI name for the root node

Message ID 20200510143320.v2.1.I3fc26919ac73d55741c6ee8098cc0d6df70bb23c@changeid
State Accepted
Commit 4b724a13770c39ee3806dd30d349b6f8d03cfbc6
Headers show
Series dm: Add programmatic generation of ACPI tables (part B) | expand

Commit Message

Simon Glass May 10, 2020, 8:33 p.m. UTC
This always has a fixed ACPI name so add it as a driver function.

Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner at br-automation.com>
---

Changes in v2: None
Changes in v1:
- Capitalise ACPI_OPS_PTR

 drivers/core/root.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Bin Meng May 17, 2020, 2:40 p.m. UTC | #1
On Mon, May 11, 2020 at 4:34 AM Simon Glass <sjg at chromium.org> wrote:
>
> This always has a fixed ACPI name so add it as a driver function.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> Reviewed-by: Wolfgang Wallner <wolfgang.wallner at br-automation.com>
> ---
>
> Changes in v2: None
> Changes in v1:
> - Capitalise ACPI_OPS_PTR
>
>  drivers/core/root.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
diff mbox series

Patch

diff --git a/drivers/core/root.c b/drivers/core/root.c
index 7d257ea887..14ae8a953b 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -12,6 +12,7 @@ 
 #include <log.h>
 #include <malloc.h>
 #include <linux/libfdt.h>
+#include <dm/acpi.h>
 #include <dm/device.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
@@ -373,10 +374,22 @@  int dm_init_and_scan(bool pre_reloc_only)
 	return 0;
 }
 
+#ifdef CONFIG_ACPIGEN
+static int root_acpi_get_name(const struct udevice *dev, char *out_name)
+{
+	return acpi_copy_name(out_name, "\\_SB");
+}
+
+struct acpi_ops root_acpi_ops = {
+	.get_name	= root_acpi_get_name,
+};
+#endif
+
 /* This is the root driver - all drivers are children of this */
 U_BOOT_DRIVER(root_driver) = {
 	.name	= "root_driver",
 	.id	= UCLASS_ROOT,
+	ACPI_OPS_PTR(&root_acpi_ops)
 };
 
 /* This is the root uclass */