Simon Glass | ebb2e83 | 2020-07-07 13:11:39 -0600 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
| 3 | * Generation of tables for particular device types |
| 4 | * |
| 5 | * Copyright 2019 Google LLC |
| 6 | * Mostly taken from coreboot file of the same name |
| 7 | */ |
| 8 | |
| 9 | #ifndef __ACPI_DEVICE_H |
| 10 | #define __ACPI_DEVICE_H |
| 11 | |
| 12 | struct udevice; |
| 13 | |
| 14 | /* Length of a full path to an ACPI device */ |
| 15 | #define ACPI_PATH_MAX 30 |
| 16 | |
| 17 | /** |
| 18 | * acpi_device_path() - Get the full path to an ACPI device |
| 19 | * |
| 20 | * This gets the full path in the form XXXX.YYYY.ZZZZ where XXXX is the root |
| 21 | * and ZZZZ is the device. All parent devices are added to the path. |
| 22 | * |
| 23 | * @dev: Device to check |
| 24 | * @buf: Buffer to place the path in (should be ACPI_PATH_MAX long) |
| 25 | * @maxlen: Size of buffer (typically ACPI_PATH_MAX) |
| 26 | * @return 0 if OK, -ve on error |
| 27 | */ |
| 28 | int acpi_device_path(const struct udevice *dev, char *buf, int maxlen); |
| 29 | |
| 30 | /** |
| 31 | * acpi_device_scope() - Get the scope of an ACPI device |
| 32 | * |
| 33 | * This gets the scope which is the full path of the parent device, as per |
| 34 | * acpi_device_path(). |
| 35 | * |
| 36 | * @dev: Device to check |
| 37 | * @buf: Buffer to place the path in (should be ACPI_PATH_MAX long) |
| 38 | * @maxlen: Size of buffer (typically ACPI_PATH_MAX) |
| 39 | * @return 0 if OK, -EINVAL if the device has no parent, other -ve on other |
| 40 | * error |
| 41 | */ |
| 42 | int acpi_device_scope(const struct udevice *dev, char *scope, int maxlen); |
| 43 | |
| 44 | #endif |