[haiku-commits] Change in haiku[master]: acpi: add walk_namespace bus and device method

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 30 Mar 2020 17:38:45 +0000

From Jérôme Duval <jerome.duval@xxxxxxxxx>:

Jérôme Duval has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/2446 ;)


Change subject: acpi: add walk_namespace bus and device method
......................................................................

acpi: add walk_namespace bus and device method
---
M headers/os/drivers/ACPI.h
M src/add-ons/kernel/bus_managers/acpi/ACPIPrivate.h
M src/add-ons/kernel/bus_managers/acpi/BusManager.cpp
M src/add-ons/kernel/bus_managers/acpi/Device.cpp
4 files changed, 41 insertions(+), 0 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/46/2446/1

diff --git a/headers/os/drivers/ACPI.h b/headers/os/drivers/ACPI.h
index a5f3b7e..d6a958a 100644
--- a/headers/os/drivers/ACPI.h
+++ b/headers/os/drivers/ACPI.h
@@ -174,6 +174,9 @@
 typedef acpi_status (*acpi_walk_resources_callback)(acpi_resource* resource,
        void* context);

+typedef acpi_status (*acpi_walk_callback) (acpi_handle object, uint32 
nestingLevel,
+       void *context, void** returnValue);
+

 struct acpi_module_info {
        module_info info;
@@ -240,6 +243,12 @@
                                        char *result, size_t length, void 
**_counter);
        status_t        (*get_next_object)(uint32 objectType, acpi_handle 
parent,
                                        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,
                                        size_t resultLength);

@@ -337,6 +346,11 @@
        uint32          (*get_object_type)(acpi_device device);
        status_t        (*get_object)(acpi_device device, const char *path,
                                        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 */
        status_t        (*evaluate_method)(acpi_device device, const char 
*method,
diff --git a/src/add-ons/kernel/bus_managers/acpi/ACPIPrivate.h 
b/src/add-ons/kernel/bus_managers/acpi/ACPIPrivate.h
index b4b2e24..6f834f3 100644
--- a/src/add-ons/kernel/bus_managers/acpi/ACPIPrivate.h
+++ b/src/add-ons/kernel/bus_managers/acpi/ACPIPrivate.h
@@ -221,6 +221,10 @@
 status_t get_object_typed(const char* path, acpi_object_type** _returnValue,
        uint32 object_type);
 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,
        acpi_objects* args, acpi_object_type* returnValue, size_t bufferLength);
diff --git a/src/add-ons/kernel/bus_managers/acpi/BusManager.cpp 
b/src/add-ons/kernel/bus_managers/acpi/BusManager.cpp
index 6882862..ebd92bf 100644
--- a/src/add-ons/kernel/bus_managers/acpi/BusManager.cpp
+++ b/src/add-ons/kernel/bus_managers/acpi/BusManager.cpp
@@ -734,6 +734,17 @@


 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
 prepare_sleep_state(uint8 state, void (*wakeFunc)(void), size_t size)
 {
        ACPI_STATUS acpiStatus;
@@ -866,6 +877,7 @@
        remove_fixed_event_handler,
        get_next_entry,
        get_next_object,
+       walk_namespace,
        get_device,
        get_device_info,
        get_object_type,
diff --git a/src/add-ons/kernel/bus_managers/acpi/Device.cpp 
b/src/add-ons/kernel/bus_managers/acpi/Device.cpp
index 3a9dfbb..a818494 100644
--- a/src/add-ons/kernel/bus_managers/acpi/Device.cpp
+++ b/src/add-ons/kernel/bus_managers/acpi/Device.cpp
@@ -85,6 +85,16 @@


 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
 acpi_device_init_driver(device_node *node, void **cookie)
 {
        ACPI_HANDLE handle = NULL;
@@ -162,6 +172,7 @@
        acpi_remove_address_space_handler,
        acpi_get_object_type,
        acpi_get_object,
+       acpi_walk_namespace,
        acpi_evaluate_method,
        acpi_walk_resources
 };

--
To view, visit https://review.haiku-os.org/c/haiku/+/2446
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I03fa43e0ba9b37f6db43f6ff16bbca892684cc49
Gerrit-Change-Number: 2446
Gerrit-PatchSet: 1
Gerrit-Owner: Jérôme Duval <jerome.duval@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: acpi: add walk_namespace bus and device method - Gerrit