ba50d688fef41b7ef900aec5ce1c2f4b5f06da1c
[oweals/u-boot.git] / drivers / core / acpi.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Core driver model support for ACPI table generation
4  *
5  * Copyright 2019 Google LLC
6  * Written by Simon Glass <sjg@chromium.org>
7  */
8
9 #define LOG_CATEOGRY    LOGC_ACPI
10
11 #include <common.h>
12 #include <dm.h>
13 #include <dm/acpi.h>
14 #include <dm/root.h>
15
16 int acpi_copy_name(char *out_name, const char *name)
17 {
18         strncpy(out_name, name, ACPI_NAME_LEN);
19         out_name[ACPI_NAME_LEN] = '\0';
20
21         return 0;
22 }
23
24 int acpi_get_name(const struct udevice *dev, char *out_name)
25 {
26         struct acpi_ops *aops;
27
28         aops = device_get_acpi_ops(dev);
29         if (aops && aops->get_name)
30                 return aops->get_name(dev, out_name);
31
32         return -ENOSYS;
33 }