acpi: add walk_namespace bus and device method
Change-Id: I03fa43e0ba9b37f6db43f6ff16bbca892684cc49 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2446 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
@@ -174,6 +174,9 @@ typedef void (*acpi_notify_handler)(acpi_handle device, uint32 value,
|
|||||||
typedef acpi_status (*acpi_walk_resources_callback)(acpi_resource* resource,
|
typedef acpi_status (*acpi_walk_resources_callback)(acpi_resource* resource,
|
||||||
void* context);
|
void* context);
|
||||||
|
|
||||||
|
typedef acpi_status (*acpi_walk_callback) (acpi_handle object, uint32 nestingLevel,
|
||||||
|
void *context, void** returnValue);
|
||||||
|
|
||||||
|
|
||||||
struct acpi_module_info {
|
struct acpi_module_info {
|
||||||
module_info info;
|
module_info info;
|
||||||
@@ -240,6 +243,12 @@ struct acpi_module_info {
|
|||||||
char *result, size_t length, void **_counter);
|
char *result, size_t length, void **_counter);
|
||||||
status_t (*get_next_object)(uint32 objectType, acpi_handle parent,
|
status_t (*get_next_object)(uint32 objectType, acpi_handle parent,
|
||||||
acpi_handle* currentChild);
|
acpi_handle* currentChild);
|
||||||
|
status_t (*walk_namespace)(acpi_handle busDeviceHandle,
|
||||||
|
uint32 objectType, uint32 maxDepth,
|
||||||
|
acpi_walk_callback descendingCallback,
|
||||||
|
acpi_walk_callback ascendingCallback, void* context,
|
||||||
|
void** returnValue);
|
||||||
|
|
||||||
status_t (*get_device)(const char *hid, uint32 index, char *result,
|
status_t (*get_device)(const char *hid, uint32 index, char *result,
|
||||||
size_t resultLength);
|
size_t resultLength);
|
||||||
|
|
||||||
@@ -337,6 +346,11 @@ typedef struct acpi_device_module_info {
|
|||||||
uint32 (*get_object_type)(acpi_device device);
|
uint32 (*get_object_type)(acpi_device device);
|
||||||
status_t (*get_object)(acpi_device device, const char *path,
|
status_t (*get_object)(acpi_device device, const char *path,
|
||||||
acpi_object_type **_returnValue);
|
acpi_object_type **_returnValue);
|
||||||
|
status_t (*walk_namespace)(acpi_device device,
|
||||||
|
uint32 objectType, uint32 maxDepth,
|
||||||
|
acpi_walk_callback descendingCallback,
|
||||||
|
acpi_walk_callback ascendingCallback,
|
||||||
|
void* context, void** returnValue);
|
||||||
|
|
||||||
/* Control method execution and data acquisition */
|
/* Control method execution and data acquisition */
|
||||||
status_t (*evaluate_method)(acpi_device device, const char *method,
|
status_t (*evaluate_method)(acpi_device device, const char *method,
|
||||||
|
|||||||
@@ -221,6 +221,10 @@ status_t get_object(const char* path, acpi_object_type** _returnValue);
|
|||||||
status_t get_object_typed(const char* path, acpi_object_type** _returnValue,
|
status_t get_object_typed(const char* path, acpi_object_type** _returnValue,
|
||||||
uint32 object_type);
|
uint32 object_type);
|
||||||
status_t ns_handle_to_pathname(acpi_handle targetHandle, acpi_data* buffer);
|
status_t ns_handle_to_pathname(acpi_handle targetHandle, acpi_data* buffer);
|
||||||
|
status_t walk_namespace(acpi_handle busDeviceHandle, uint32 objectType,
|
||||||
|
uint32 maxDepth, acpi_walk_callback descendingCallback,
|
||||||
|
acpi_walk_callback ascendingCallback, void* context, void** returnValue);
|
||||||
|
|
||||||
|
|
||||||
status_t evaluate_object(acpi_handle handle, const char* object,
|
status_t evaluate_object(acpi_handle handle, const char* object,
|
||||||
acpi_objects* args, acpi_object_type* returnValue, size_t bufferLength);
|
acpi_objects* args, acpi_object_type* returnValue, size_t bufferLength);
|
||||||
|
|||||||
@@ -733,6 +733,17 @@ walk_resources(acpi_handle busDeviceHandle, char* method,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
walk_namespace(acpi_handle busDeviceHandle, uint32 objectType,
|
||||||
|
uint32 maxDepth, acpi_walk_callback descendingCallback,
|
||||||
|
acpi_walk_callback ascendingCallback, void* context, void** returnValue)
|
||||||
|
{
|
||||||
|
return AcpiWalkNamespace(objectType, busDeviceHandle, maxDepth,
|
||||||
|
(ACPI_WALK_CALLBACK)descendingCallback,
|
||||||
|
(ACPI_WALK_CALLBACK)ascendingCallback, context, returnValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
prepare_sleep_state(uint8 state, void (*wakeFunc)(void), size_t size)
|
prepare_sleep_state(uint8 state, void (*wakeFunc)(void), size_t size)
|
||||||
{
|
{
|
||||||
@@ -866,6 +877,7 @@ struct acpi_module_info gACPIModule = {
|
|||||||
remove_fixed_event_handler,
|
remove_fixed_event_handler,
|
||||||
get_next_entry,
|
get_next_entry,
|
||||||
get_next_object,
|
get_next_object,
|
||||||
|
walk_namespace,
|
||||||
get_device,
|
get_device,
|
||||||
get_device_info,
|
get_device_info,
|
||||||
get_object_type,
|
get_object_type,
|
||||||
|
|||||||
@@ -84,6 +84,16 @@ acpi_walk_resources(acpi_device device, char *method,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static status_t
|
||||||
|
acpi_walk_namespace(acpi_device device, uint32 objectType, uint32 maxDepth,
|
||||||
|
acpi_walk_callback descendingCallback,
|
||||||
|
acpi_walk_callback ascendingCallback, void* context, void** returnValue)
|
||||||
|
{
|
||||||
|
return walk_namespace(device->handle, objectType, maxDepth,
|
||||||
|
descendingCallback, ascendingCallback, context, returnValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
acpi_device_init_driver(device_node *node, void **cookie)
|
acpi_device_init_driver(device_node *node, void **cookie)
|
||||||
{
|
{
|
||||||
@@ -162,6 +172,7 @@ acpi_device_module_info gACPIDeviceModule = {
|
|||||||
acpi_remove_address_space_handler,
|
acpi_remove_address_space_handler,
|
||||||
acpi_get_object_type,
|
acpi_get_object_type,
|
||||||
acpi_get_object,
|
acpi_get_object,
|
||||||
|
acpi_walk_namespace,
|
||||||
acpi_evaluate_method,
|
acpi_evaluate_method,
|
||||||
acpi_walk_resources
|
acpi_walk_resources
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user