Simon Glass | 9fb9e9b | 2020-04-09 10:27:38 -0600 | [diff] [blame] | 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> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 13 | #include <log.h> |
Simon Glass | 0964239 | 2020-07-07 13:12:11 -0600 | [diff] [blame] | 14 | #include <malloc.h> |
Simon Glass | 884dcfa | 2021-12-01 09:03:05 -0700 | [diff] [blame] | 15 | #include <mapmem.h> |
Simon Glass | 0964239 | 2020-07-07 13:12:11 -0600 | [diff] [blame] | 16 | #include <acpi/acpi_device.h> |
Simon Glass | 9fb9e9b | 2020-04-09 10:27:38 -0600 | [diff] [blame] | 17 | #include <dm/acpi.h> |
Simon Glass | 17968c3 | 2020-04-26 09:19:46 -0600 | [diff] [blame] | 18 | #include <dm/device-internal.h> |
Simon Glass | 9fb9e9b | 2020-04-09 10:27:38 -0600 | [diff] [blame] | 19 | #include <dm/root.h> |
| 20 | |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 21 | #define MAX_ACPI_ITEMS 100 |
| 22 | |
Simon Glass | 877205e | 2021-12-01 09:03:04 -0700 | [diff] [blame] | 23 | /** |
| 24 | * Type of table that we collected |
| 25 | * |
| 26 | * @TYPE_NONE: Not yet known |
| 27 | * @TYPE_SSDT: Items in the Secondary System Description Table |
| 28 | * @TYPE_DSDT: Items in the Differentiated System Description Table |
| 29 | * @TYPE_OTHER: Other (whole) |
| 30 | */ |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 31 | enum gen_type_t { |
| 32 | TYPE_NONE, |
| 33 | TYPE_SSDT, |
Simon Glass | 990cd5b | 2020-07-07 13:12:08 -0600 | [diff] [blame] | 34 | TYPE_DSDT, |
Simon Glass | 877205e | 2021-12-01 09:03:04 -0700 | [diff] [blame] | 35 | TYPE_OTHER, |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 36 | }; |
| 37 | |
Simon Glass | 884dcfa | 2021-12-01 09:03:05 -0700 | [diff] [blame] | 38 | const char *gen_type_str[] = { |
| 39 | "-", |
| 40 | "ssdt", |
| 41 | "dsdt", |
| 42 | "other", |
| 43 | }; |
| 44 | |
Simon Glass | 17968c3 | 2020-04-26 09:19:46 -0600 | [diff] [blame] | 45 | /* Type of method to call */ |
| 46 | enum method_t { |
| 47 | METHOD_WRITE_TABLES, |
Simon Glass | d43e0ba | 2020-07-07 13:12:03 -0600 | [diff] [blame] | 48 | METHOD_FILL_SSDT, |
Simon Glass | 990cd5b | 2020-07-07 13:12:08 -0600 | [diff] [blame] | 49 | METHOD_INJECT_DSDT, |
Simon Glass | cd9667b | 2020-07-07 21:32:08 -0600 | [diff] [blame] | 50 | METHOD_SETUP_NHLT, |
Simon Glass | 17968c3 | 2020-04-26 09:19:46 -0600 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | /* Prototype for all methods */ |
| 54 | typedef int (*acpi_method)(const struct udevice *dev, struct acpi_ctx *ctx); |
| 55 | |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 56 | /** |
| 57 | * struct acpi_item - Holds info about ACPI data generated by a driver method |
| 58 | * |
| 59 | * @dev: Device that generated this data |
| 60 | * @type: Table type it refers to |
Simon Glass | 877205e | 2021-12-01 09:03:04 -0700 | [diff] [blame] | 61 | * @writer: Writer that wrote this table |
Simon Glass | 884dcfa | 2021-12-01 09:03:05 -0700 | [diff] [blame] | 62 | * @base: Pointer to base of table in its original location |
| 63 | * @buf: Buffer allocated to contain the data (NULL if not allocated) |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 64 | * @size: Size of the data in bytes |
| 65 | */ |
| 66 | struct acpi_item { |
| 67 | struct udevice *dev; |
Simon Glass | 877205e | 2021-12-01 09:03:04 -0700 | [diff] [blame] | 68 | const struct acpi_writer *writer; |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 69 | enum gen_type_t type; |
Simon Glass | 884dcfa | 2021-12-01 09:03:05 -0700 | [diff] [blame] | 70 | const char *base; |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 71 | char *buf; |
| 72 | int size; |
| 73 | }; |
| 74 | |
| 75 | /* List of ACPI items collected */ |
| 76 | static struct acpi_item acpi_item[MAX_ACPI_ITEMS]; |
| 77 | static int item_count; |
| 78 | |
Simon Glass | 9fb9e9b | 2020-04-09 10:27:38 -0600 | [diff] [blame] | 79 | int acpi_copy_name(char *out_name, const char *name) |
| 80 | { |
| 81 | strncpy(out_name, name, ACPI_NAME_LEN); |
| 82 | out_name[ACPI_NAME_LEN] = '\0'; |
| 83 | |
| 84 | return 0; |
| 85 | } |
| 86 | |
| 87 | int acpi_get_name(const struct udevice *dev, char *out_name) |
| 88 | { |
| 89 | struct acpi_ops *aops; |
Simon Glass | 0964239 | 2020-07-07 13:12:11 -0600 | [diff] [blame] | 90 | const char *name; |
| 91 | int ret; |
Simon Glass | 9fb9e9b | 2020-04-09 10:27:38 -0600 | [diff] [blame] | 92 | |
| 93 | aops = device_get_acpi_ops(dev); |
| 94 | if (aops && aops->get_name) |
| 95 | return aops->get_name(dev, out_name); |
Simon Glass | 0964239 | 2020-07-07 13:12:11 -0600 | [diff] [blame] | 96 | name = dev_read_string(dev, "acpi,name"); |
| 97 | if (name) |
| 98 | return acpi_copy_name(out_name, name); |
| 99 | ret = acpi_device_infer_name(dev, out_name); |
| 100 | if (ret) |
| 101 | return log_msg_ret("dev", ret); |
Simon Glass | 9fb9e9b | 2020-04-09 10:27:38 -0600 | [diff] [blame] | 102 | |
Simon Glass | 0964239 | 2020-07-07 13:12:11 -0600 | [diff] [blame] | 103 | return 0; |
Simon Glass | 9fb9e9b | 2020-04-09 10:27:38 -0600 | [diff] [blame] | 104 | } |
Simon Glass | 17968c3 | 2020-04-26 09:19:46 -0600 | [diff] [blame] | 105 | |
Simon Glass | 0123233 | 2020-07-07 21:32:07 -0600 | [diff] [blame] | 106 | int acpi_get_path(const struct udevice *dev, char *out_path, int maxlen) |
| 107 | { |
| 108 | const char *path; |
| 109 | int ret; |
| 110 | |
| 111 | path = dev_read_string(dev, "acpi,path"); |
| 112 | if (path) { |
| 113 | if (strlen(path) >= maxlen) |
Simon Glass | e74f8f8 | 2021-03-25 10:26:04 +1300 | [diff] [blame] | 114 | return -ENOSPC; |
Simon Glass | 0123233 | 2020-07-07 21:32:07 -0600 | [diff] [blame] | 115 | strcpy(out_path, path); |
| 116 | return 0; |
| 117 | } |
| 118 | ret = acpi_device_path(dev, out_path, maxlen); |
| 119 | if (ret) |
| 120 | return log_msg_ret("dev", ret); |
| 121 | |
| 122 | return 0; |
| 123 | } |
| 124 | |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 125 | /** |
Simon Glass | 877205e | 2021-12-01 09:03:04 -0700 | [diff] [blame] | 126 | * add_item() - Add a new item to the list of data collected |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 127 | * |
| 128 | * @ctx: ACPI context |
Simon Glass | 877205e | 2021-12-01 09:03:04 -0700 | [diff] [blame] | 129 | * @dev: Device that generated the data, if type != TYPE_OTHER |
| 130 | * @writer: Writer entry that generated the data, if type == TYPE_OTHER |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 131 | * @type: Table type it refers to |
| 132 | * @start: The start of the data (the end is obtained from ctx->current) |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 133 | * Return: 0 if OK, -ENOSPC if too many items, -ENOMEM if out of memory |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 134 | */ |
Simon Glass | 877205e | 2021-12-01 09:03:04 -0700 | [diff] [blame] | 135 | static int add_item(struct acpi_ctx *ctx, struct udevice *dev, |
| 136 | const struct acpi_writer *writer, enum gen_type_t type, |
| 137 | void *start) |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 138 | { |
| 139 | struct acpi_item *item; |
| 140 | void *end = ctx->current; |
| 141 | |
| 142 | if (item_count == MAX_ACPI_ITEMS) { |
| 143 | log_err("Too many items\n"); |
| 144 | return log_msg_ret("mem", -ENOSPC); |
| 145 | } |
| 146 | |
| 147 | item = &acpi_item[item_count]; |
| 148 | item->dev = dev; |
Simon Glass | 877205e | 2021-12-01 09:03:04 -0700 | [diff] [blame] | 149 | item->writer = writer; |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 150 | item->type = type; |
| 151 | item->size = end - start; |
Simon Glass | 884dcfa | 2021-12-01 09:03:05 -0700 | [diff] [blame] | 152 | item->base = start; |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 153 | if (!item->size) |
| 154 | return 0; |
Simon Glass | 877205e | 2021-12-01 09:03:04 -0700 | [diff] [blame] | 155 | if (type != TYPE_OTHER) { |
| 156 | item->buf = malloc(item->size); |
| 157 | if (!item->buf) |
| 158 | return log_msg_ret("mem", -ENOMEM); |
| 159 | memcpy(item->buf, start, item->size); |
| 160 | } |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 161 | item_count++; |
| 162 | log_debug("* %s: Added type %d, %p, size %x\n", dev->name, type, start, |
| 163 | item->size); |
| 164 | |
| 165 | return 0; |
| 166 | } |
| 167 | |
Simon Glass | 877205e | 2021-12-01 09:03:04 -0700 | [diff] [blame] | 168 | int acpi_add_other_item(struct acpi_ctx *ctx, const struct acpi_writer *writer, |
| 169 | void *start) |
| 170 | { |
| 171 | return add_item(ctx, NULL, writer, TYPE_OTHER, start); |
| 172 | } |
| 173 | |
Simon Glass | 64bbc0d | 2020-07-07 13:12:12 -0600 | [diff] [blame] | 174 | void acpi_dump_items(enum acpi_dump_option option) |
| 175 | { |
| 176 | int i; |
| 177 | |
Simon Glass | 884dcfa | 2021-12-01 09:03:05 -0700 | [diff] [blame] | 178 | printf("Seq Type Base Size Device/Writer\n"); |
| 179 | printf("--- ----- -------- ---- -------------\n"); |
Simon Glass | 64bbc0d | 2020-07-07 13:12:12 -0600 | [diff] [blame] | 180 | for (i = 0; i < item_count; i++) { |
| 181 | struct acpi_item *item = &acpi_item[i]; |
| 182 | |
Simon Glass | 884dcfa | 2021-12-01 09:03:05 -0700 | [diff] [blame] | 183 | printf("%3x %-5s %8lx %5x %s\n", i, |
| 184 | gen_type_str[item->type], |
| 185 | (ulong)map_to_sysmem(item->base), item->size, |
| 186 | item->dev ? item->dev->name : item->writer->name); |
Simon Glass | 64bbc0d | 2020-07-07 13:12:12 -0600 | [diff] [blame] | 187 | if (option == ACPI_DUMP_CONTENTS) { |
Simon Glass | 884dcfa | 2021-12-01 09:03:05 -0700 | [diff] [blame] | 188 | print_buffer(0, item->buf ? item->buf : item->base, 1, |
| 189 | item->size, 0); |
Simon Glass | 64bbc0d | 2020-07-07 13:12:12 -0600 | [diff] [blame] | 190 | printf("\n"); |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | |
Simon Glass | 3c601b1 | 2020-07-07 13:12:06 -0600 | [diff] [blame] | 195 | static struct acpi_item *find_acpi_item(const char *devname) |
| 196 | { |
| 197 | int i; |
| 198 | |
| 199 | for (i = 0; i < item_count; i++) { |
| 200 | struct acpi_item *item = &acpi_item[i]; |
| 201 | |
Simon Glass | 877205e | 2021-12-01 09:03:04 -0700 | [diff] [blame] | 202 | if (item->dev && !strcmp(devname, item->dev->name)) |
Simon Glass | 3c601b1 | 2020-07-07 13:12:06 -0600 | [diff] [blame] | 203 | return item; |
| 204 | } |
| 205 | |
| 206 | return NULL; |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * sort_acpi_item_type - Sort the ACPI items into the desired order |
| 211 | * |
| 212 | * This looks up the ordering in the device tree and then adds each item one by |
| 213 | * one into the supplied buffer |
| 214 | * |
| 215 | * @ctx: ACPI context |
| 216 | * @start: Start position to put the sorted items. The items will follow each |
| 217 | * other in sorted order |
| 218 | * @type: Type of items to sort |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 219 | * Return: 0 if OK, -ve on error |
Simon Glass | 3c601b1 | 2020-07-07 13:12:06 -0600 | [diff] [blame] | 220 | */ |
| 221 | static int sort_acpi_item_type(struct acpi_ctx *ctx, void *start, |
| 222 | enum gen_type_t type) |
| 223 | { |
| 224 | const u32 *order; |
| 225 | int size; |
| 226 | int count; |
| 227 | void *ptr; |
| 228 | void *end = ctx->current; |
| 229 | |
| 230 | ptr = start; |
Simon Glass | 990cd5b | 2020-07-07 13:12:08 -0600 | [diff] [blame] | 231 | order = ofnode_read_chosen_prop(type == TYPE_DSDT ? |
| 232 | "u-boot,acpi-dsdt-order" : |
| 233 | "u-boot,acpi-ssdt-order", &size); |
Simon Glass | 3c601b1 | 2020-07-07 13:12:06 -0600 | [diff] [blame] | 234 | if (!order) { |
Simon Glass | 92136c1 | 2020-07-17 08:49:25 -0600 | [diff] [blame] | 235 | log_debug("Failed to find ordering, leaving as is\n"); |
Simon Glass | 3c601b1 | 2020-07-07 13:12:06 -0600 | [diff] [blame] | 236 | return 0; |
| 237 | } |
| 238 | |
| 239 | /* |
| 240 | * This algorithm rewrites the context buffer without changing its |
| 241 | * length. So there is no need to update ctx-current |
| 242 | */ |
| 243 | count = size / sizeof(u32); |
| 244 | while (count--) { |
| 245 | struct acpi_item *item; |
| 246 | const char *name; |
| 247 | ofnode node; |
| 248 | |
| 249 | node = ofnode_get_by_phandle(fdt32_to_cpu(*order++)); |
| 250 | name = ofnode_get_name(node); |
| 251 | item = find_acpi_item(name); |
| 252 | if (!item) { |
| 253 | log_err("Failed to find item '%s'\n", name); |
| 254 | return log_msg_ret("find", -ENOENT); |
| 255 | } |
| 256 | if (item->type == type) { |
| 257 | log_debug(" - add %s\n", item->dev->name); |
| 258 | memcpy(ptr, item->buf, item->size); |
| 259 | ptr += item->size; |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | /* |
| 264 | * If the sort order is missing an item then the output will be too |
| 265 | * small. Report this error since the item needs to be added to the |
| 266 | * ordering for the ACPI tables to be complete. |
| 267 | */ |
| 268 | if (ptr != end) { |
| 269 | log_warning("*** Missing bytes: ptr=%p, end=%p\n", ptr, end); |
| 270 | return -ENXIO; |
| 271 | } |
| 272 | |
| 273 | return 0; |
| 274 | } |
| 275 | |
Simon Glass | 17968c3 | 2020-04-26 09:19:46 -0600 | [diff] [blame] | 276 | acpi_method acpi_get_method(struct udevice *dev, enum method_t method) |
| 277 | { |
| 278 | struct acpi_ops *aops; |
| 279 | |
| 280 | aops = device_get_acpi_ops(dev); |
| 281 | if (aops) { |
| 282 | switch (method) { |
| 283 | case METHOD_WRITE_TABLES: |
| 284 | return aops->write_tables; |
Simon Glass | d43e0ba | 2020-07-07 13:12:03 -0600 | [diff] [blame] | 285 | case METHOD_FILL_SSDT: |
| 286 | return aops->fill_ssdt; |
Simon Glass | 990cd5b | 2020-07-07 13:12:08 -0600 | [diff] [blame] | 287 | case METHOD_INJECT_DSDT: |
| 288 | return aops->inject_dsdt; |
Simon Glass | cd9667b | 2020-07-07 21:32:08 -0600 | [diff] [blame] | 289 | case METHOD_SETUP_NHLT: |
| 290 | return aops->setup_nhlt; |
Simon Glass | 17968c3 | 2020-04-26 09:19:46 -0600 | [diff] [blame] | 291 | } |
| 292 | } |
| 293 | |
| 294 | return NULL; |
| 295 | } |
| 296 | |
| 297 | int acpi_recurse_method(struct acpi_ctx *ctx, struct udevice *parent, |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 298 | enum method_t method, enum gen_type_t type) |
Simon Glass | 17968c3 | 2020-04-26 09:19:46 -0600 | [diff] [blame] | 299 | { |
| 300 | struct udevice *dev; |
| 301 | acpi_method func; |
| 302 | int ret; |
| 303 | |
| 304 | func = acpi_get_method(parent, method); |
| 305 | if (func) { |
Simon Glass | a385d49 | 2020-11-04 09:57:33 -0700 | [diff] [blame] | 306 | log_debug("- method %d, %s %p\n", method, parent->name, func); |
Simon Glass | aad29ae | 2020-12-03 16:55:21 -0700 | [diff] [blame] | 307 | ret = device_of_to_plat(parent); |
Simon Glass | 17968c3 | 2020-04-26 09:19:46 -0600 | [diff] [blame] | 308 | if (ret) |
| 309 | return log_msg_ret("ofdata", ret); |
Simon Glass | f93b904 | 2021-12-01 09:02:46 -0700 | [diff] [blame] | 310 | ctx->tab_start = ctx->current; |
Simon Glass | 17968c3 | 2020-04-26 09:19:46 -0600 | [diff] [blame] | 311 | ret = func(parent, ctx); |
| 312 | if (ret) |
| 313 | return log_msg_ret("func", ret); |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 314 | |
| 315 | /* Add the item to the internal list */ |
| 316 | if (type != TYPE_NONE) { |
Simon Glass | 877205e | 2021-12-01 09:03:04 -0700 | [diff] [blame] | 317 | ret = add_item(ctx, parent, NULL, type, ctx->tab_start); |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 318 | if (ret) |
| 319 | return log_msg_ret("add", ret); |
| 320 | } |
Simon Glass | 17968c3 | 2020-04-26 09:19:46 -0600 | [diff] [blame] | 321 | } |
| 322 | device_foreach_child(dev, parent) { |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 323 | ret = acpi_recurse_method(ctx, dev, method, type); |
Simon Glass | 17968c3 | 2020-04-26 09:19:46 -0600 | [diff] [blame] | 324 | if (ret) |
| 325 | return log_msg_ret("recurse", ret); |
| 326 | } |
| 327 | |
| 328 | return 0; |
| 329 | } |
| 330 | |
Simon Glass | d43e0ba | 2020-07-07 13:12:03 -0600 | [diff] [blame] | 331 | int acpi_fill_ssdt(struct acpi_ctx *ctx) |
| 332 | { |
Simon Glass | 3c601b1 | 2020-07-07 13:12:06 -0600 | [diff] [blame] | 333 | void *start = ctx->current; |
Simon Glass | d43e0ba | 2020-07-07 13:12:03 -0600 | [diff] [blame] | 334 | int ret; |
| 335 | |
| 336 | log_debug("Writing SSDT tables\n"); |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 337 | ret = acpi_recurse_method(ctx, dm_root(), METHOD_FILL_SSDT, TYPE_SSDT); |
Simon Glass | d43e0ba | 2020-07-07 13:12:03 -0600 | [diff] [blame] | 338 | log_debug("Writing SSDT finished, err=%d\n", ret); |
Simon Glass | 3c601b1 | 2020-07-07 13:12:06 -0600 | [diff] [blame] | 339 | ret = sort_acpi_item_type(ctx, start, TYPE_SSDT); |
| 340 | if (ret) |
| 341 | return log_msg_ret("build", ret); |
Simon Glass | d43e0ba | 2020-07-07 13:12:03 -0600 | [diff] [blame] | 342 | |
| 343 | return ret; |
| 344 | } |
| 345 | |
Simon Glass | 990cd5b | 2020-07-07 13:12:08 -0600 | [diff] [blame] | 346 | int acpi_inject_dsdt(struct acpi_ctx *ctx) |
| 347 | { |
| 348 | void *start = ctx->current; |
| 349 | int ret; |
| 350 | |
| 351 | log_debug("Writing DSDT tables\n"); |
Simon Glass | 990cd5b | 2020-07-07 13:12:08 -0600 | [diff] [blame] | 352 | ret = acpi_recurse_method(ctx, dm_root(), METHOD_INJECT_DSDT, |
| 353 | TYPE_DSDT); |
| 354 | log_debug("Writing DSDT finished, err=%d\n", ret); |
| 355 | ret = sort_acpi_item_type(ctx, start, TYPE_DSDT); |
| 356 | if (ret) |
| 357 | return log_msg_ret("build", ret); |
| 358 | |
| 359 | return ret; |
| 360 | } |
| 361 | |
Simon Glass | a385d49 | 2020-11-04 09:57:33 -0700 | [diff] [blame] | 362 | void acpi_reset_items(void) |
| 363 | { |
| 364 | item_count = 0; |
| 365 | } |
| 366 | |
Simon Glass | 17968c3 | 2020-04-26 09:19:46 -0600 | [diff] [blame] | 367 | int acpi_write_dev_tables(struct acpi_ctx *ctx) |
| 368 | { |
| 369 | int ret; |
| 370 | |
| 371 | log_debug("Writing device tables\n"); |
Simon Glass | ee61e60 | 2020-07-07 13:12:05 -0600 | [diff] [blame] | 372 | ret = acpi_recurse_method(ctx, dm_root(), METHOD_WRITE_TABLES, |
| 373 | TYPE_NONE); |
Simon Glass | 17968c3 | 2020-04-26 09:19:46 -0600 | [diff] [blame] | 374 | log_debug("Writing finished, err=%d\n", ret); |
| 375 | |
| 376 | return ret; |
| 377 | } |
Simon Glass | cd9667b | 2020-07-07 21:32:08 -0600 | [diff] [blame] | 378 | |
| 379 | int acpi_setup_nhlt(struct acpi_ctx *ctx, struct nhlt *nhlt) |
| 380 | { |
| 381 | int ret; |
| 382 | |
| 383 | log_debug("Setup NHLT\n"); |
| 384 | ctx->nhlt = nhlt; |
| 385 | ret = acpi_recurse_method(ctx, dm_root(), METHOD_SETUP_NHLT, TYPE_NONE); |
| 386 | log_debug("Setup finished, err=%d\n", ret); |
| 387 | |
| 388 | return ret; |
| 389 | } |