PatchworkOS
Loading...
Searching...
No Matches
namespace.h
Go to the documentation of this file.
1#pragma once
2
4#include <kernel/utils/map.h>
5
6#include <kernel/defs.h>
7#include <stdint.h>
8#include <sys/list.h>
9
86typedef struct aml_namespace_overlay
87{
90 struct aml_namespace_overlay* parent;
92
102
112#define AML_NAME(a, b, c, d) \
113 ((aml_name_t)((((aml_name_t)(a) & 0xFF)) | (((aml_name_t)(b) & 0xFF) << 8) | (((aml_name_t)(c) & 0xFF) << 16) | \
114 (((aml_name_t)(d) & 0xFF) << 24)))
115
121#define AML_NAME_UNDEFINED AML_NAME('x', 'x', 'x', 'x')
122
129#define AML_NAME_TO_STRING(name) \
130 (char[]){((name)) & 0xFF, ((name) >> 8) & 0xFF, ((name) >> 16) & 0xFF, ((name) >> 24) & 0xFF, '\0'}
131
139
146
153
165
187
211 const aml_name_string_t* nameString);
212
236
247 aml_object_t* object);
248
260 const aml_name_string_t* nameString, aml_object_t* object);
261
272
282
292
299
307
316 aml_object_t* object);
317
aml_object_t * aml_namespace_find(aml_namespace_overlay_t *overlay, aml_object_t *start, uint64_t nameCount,...)
Find an object in the namespace heirarchy by name segments.
Definition namespace.c:129
aml_object_t * aml_namespace_find_by_name_string(aml_namespace_overlay_t *overlay, aml_object_t *start, const aml_name_string_t *nameString)
Find an object in the namespace heirarchy by a name string.
Definition namespace.c:174
uint64_t aml_namespace_commit(aml_namespace_overlay_t *overlay)
Commit all names in a namespace overlay to the global namespace heirarchy.
Definition namespace.c:443
uint64_t aml_namespace_init(aml_object_t *root)
Initialize the namespace heirarchy.
Definition namespace.c:68
uint64_t aml_namespace_add_child(aml_namespace_overlay_t *overlay, aml_object_t *parent, aml_name_t name, aml_object_t *object)
Add an child to a parent in the namespace heirarchy.
Definition namespace.c:332
void aml_namespace_overlay_set_parent(aml_namespace_overlay_t *overlay, aml_namespace_overlay_t *parent)
Set the parent of a namespace overlay.
Definition namespace.c:509
aml_object_t * aml_namespace_find_child(aml_namespace_overlay_t *overlay, aml_object_t *parent, aml_name_t name)
Find a child object directly under a parent object in the namespace heirarchy.
Definition namespace.c:91
uint64_t aml_namespace_expose(void)
Expose the entire namespace heirarchy to sysfs.
Definition namespace.c:80
aml_object_t * aml_namespace_find_by_path(aml_namespace_overlay_t *overlay, aml_object_t *start, const char *path)
Find an object in the namespace heirarchy by a path string.
Definition namespace.c:225
aml_namespace_overlay_t * aml_namespace_overlay_get_highest_that_contains(aml_namespace_overlay_t *overlay, aml_object_t *object)
Search a overlay and its parents for the first overlay that contains the given object.
Definition namespace.c:519
uint64_t aml_namespace_overlay_init(aml_namespace_overlay_t *overlay)
Initialize a namespace overlay.
Definition namespace.c:476
void aml_namespace_remove(aml_object_t *object)
Remove an object from the namespace heirarchy it was added to.
Definition namespace.c:421
void aml_namespace_overlay_deinit(aml_namespace_overlay_t *overlay)
Deinitialize a namespace overlay.
Definition namespace.c:493
uint64_t aml_namespace_add_by_name_string(aml_namespace_overlay_t *overlay, aml_object_t *start, const aml_name_string_t *nameString, aml_object_t *object)
Add an object to the namespace heirarchy using a name string.
Definition namespace.c:381
uint32_t aml_name_t
Name type.
Definition namespace.h:101
aml_object_t * aml_namespace_get_root(void)
Get the root object of the namespace heirarchy.
Definition namespace.c:86
static void start()
Definition main.c:542
__UINT32_TYPE__ uint32_t
Definition stdint.h:15
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
A NameString structure.
Definition name.h:87
Namespace overlay.
Definition namespace.h:87
struct aml_namespace_overlay * parent
The parent overlay, or NULL if none.
Definition namespace.h:90
map_t map
Used to find the children of namespaces using their id and the name of the child.
Definition namespace.h:88
list_t objects
List of all objects in this namespace. Used for fast iteration.
Definition namespace.h:89
ACPI object.
Definition object.h:425
A doubly linked list.
Definition list.h:51
Hash map structure.
Definition map.h:76