1#include <acpi/cst.h>
2#include <asm.h>
3#include <console/printf.h>
4#include <mem/vmm.h>
5#include <string.h>
6#include <types/types.h>
7#include <uacpi/acpi.h>
8#include <uacpi/namespace.h>
9#include <uacpi/status.h>
10#include <uacpi/tables.h>
11#include <uacpi/uacpi.h>
12
13static uacpi_iteration_decision
14walk_callback(void *ctx, uacpi_namespace_node *node, uacpi_u32 depth) {
15 cc_ignore(ctx, depth);
16 char name[5] = {0};
17 memcpy(name, uacpi_namespace_node_name(node).text, 4);
18 printf(format: "searching %s\n", name);
19
20 struct uacpi_object *out = NULL;
21 enum uacpi_status ret = uacpi_eval_simple(parent: node, path: "_CST", ret: &out);
22
23 if (ret != UACPI_STATUS_OK) {
24 return UACPI_ITERATION_DECISION_CONTINUE;
25 } else {
26 struct uacpi_data_view dview = {0};
27 printf(format: "Found _CST on %s\n", name);
28 uacpi_object_get_string(out, out: &dview);
29 printf(format: "got %s\n", dview.text);
30 return UACPI_ITERATION_DECISION_CONTINUE;
31 }
32}
33
34void acpi_find_cst(void) {
35 return;
36 uacpi_namespace_node *root = uacpi_namespace_root();
37 uacpi_namespace_for_each_child_simple(parent: root, callback: walk_callback, NULL);
38 cpu_freeze();
39}
40