ACPI: ACPICA 20060421
[deliverable/linux.git] / drivers / acpi / events / evregion.c
index 84fad082d80d22205b2c559313ddb6f02e690e00..eb29e96f053c99203b1fdf4d348bfdc376783fba 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -83,7 +83,7 @@ acpi_status acpi_ev_install_region_handlers(void)
        acpi_status status;
        acpi_native_uint i;
 
-       ACPI_FUNCTION_TRACE("ev_install_region_handlers");
+       ACPI_FUNCTION_TRACE(ev_install_region_handlers);
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
        if (ACPI_FAILURE(status)) {
@@ -153,7 +153,7 @@ acpi_status acpi_ev_initialize_op_regions(void)
        acpi_status status;
        acpi_native_uint i;
 
-       ACPI_FUNCTION_TRACE("ev_initialize_op_regions");
+       ACPI_FUNCTION_TRACE(ev_initialize_op_regions);
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
        if (ACPI_FAILURE(status)) {
@@ -164,6 +164,7 @@ acpi_status acpi_ev_initialize_op_regions(void)
         * Run the _REG methods for op_regions in each default address space
         */
        for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
+
                /* TBD: Make sure handler is the DEFAULT handler, otherwise
                 * _REG will have already been run.
                 */
@@ -197,7 +198,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
        union acpi_operand_object *region_obj2;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_execute_reg_method");
+       ACPI_FUNCTION_TRACE(ev_execute_reg_method);
 
        region_obj2 = acpi_ns_get_secondary_object(region_obj);
        if (!region_obj2) {
@@ -249,7 +250,6 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
 
       cleanup:
        acpi_ut_remove_reference(params[0]);
-
        return_ACPI_STATUS(status);
 }
 
@@ -284,7 +284,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
        union acpi_operand_object *region_obj2;
        void *region_context = NULL;
 
-       ACPI_FUNCTION_TRACE("ev_address_space_dispatch");
+       ACPI_FUNCTION_TRACE(ev_address_space_dispatch);
 
        region_obj2 = acpi_ns_get_secondary_object(region_obj);
        if (!region_obj2) {
@@ -295,12 +295,12 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
 
        handler_desc = region_obj->region.handler;
        if (!handler_desc) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "No handler for Region [%4.4s] (%p) [%s]\n",
-                                 acpi_ut_get_node_name(region_obj->region.
-                                                       node), region_obj,
-                                 acpi_ut_get_region_name(region_obj->region.
-                                                         space_id)));
+               ACPI_ERROR((AE_INFO,
+                           "No handler for Region [%4.4s] (%p) [%s]",
+                           acpi_ut_get_node_name(region_obj->region.node),
+                           region_obj,
+                           acpi_ut_get_region_name(region_obj->region.
+                                                   space_id)));
 
                return_ACPI_STATUS(AE_NOT_EXIST);
        }
@@ -315,14 +315,14 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                 */
                region_setup = handler_desc->address_space.setup;
                if (!region_setup) {
+
                        /* No initialization routine, exit with error */
 
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "No init routine for region(%p) [%s]\n",
-                                         region_obj,
-                                         acpi_ut_get_region_name(region_obj->
-                                                                 region.
-                                                                 space_id)));
+                       ACPI_ERROR((AE_INFO,
+                                   "No init routine for region(%p) [%s]",
+                                   region_obj,
+                                   acpi_ut_get_region_name(region_obj->region.
+                                                           space_id)));
                        return_ACPI_STATUS(AE_NOT_EXIST);
                }
 
@@ -347,12 +347,11 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                /* Check for failure of the Region Setup */
 
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Region Init: %s [%s]\n",
-                                         acpi_format_exception(status),
-                                         acpi_ut_get_region_name(region_obj->
-                                                                 region.
-                                                                 space_id)));
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "During region initialization: [%s]",
+                                       acpi_ut_get_region_name(region_obj->
+                                                               region.
+                                                               space_id)));
                        return_ACPI_STATUS(status);
                }
 
@@ -363,9 +362,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                        region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE;
 
                        if (region_obj2->extra.region_context) {
+
                                /* The handler for this region was already installed */
 
-                               ACPI_MEM_FREE(region_context);
+                               ACPI_FREE(region_context);
                        } else {
                                /*
                                 * Save the returned context for use in all accesses to
@@ -388,9 +388,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                          acpi_ut_get_region_name(region_obj->region.
                                                  space_id)));
 
-       if (!
-           (handler_desc->address_space.
-            hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
+       if (!(handler_desc->address_space.handler_flags &
+             ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
                /*
                 * For handlers other than the default (supplied) handlers, we must
                 * exit the interpreter because the handler *might* block -- we don't
@@ -406,15 +405,13 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                         region_obj2->extra.region_context);
 
        if (ACPI_FAILURE(status)) {
-               ACPI_REPORT_ERROR(("Handler for [%s] returned %s\n",
-                                  acpi_ut_get_region_name(region_obj->region.
-                                                          space_id),
-                                  acpi_format_exception(status)));
+               ACPI_EXCEPTION((AE_INFO, status, "Returned by Handler for [%s]",
+                               acpi_ut_get_region_name(region_obj->region.
+                                                       space_id)));
        }
 
-       if (!
-           (handler_desc->address_space.
-            hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
+       if (!(handler_desc->address_space.handler_flags &
+             ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
                /*
                 * We just returned from a non-default handler, we must re-enter the
                 * interpreter
@@ -454,7 +451,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
        union acpi_operand_object *region_obj2;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_detach_region");
+       ACPI_FUNCTION_TRACE(ev_detach_region);
 
        region_obj2 = acpi_ns_get_secondary_object(region_obj);
        if (!region_obj2) {
@@ -466,6 +463,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
 
        handler_obj = region_obj->region.handler;
        if (!handler_obj) {
+
                /* This region has no handler, all done */
 
                return_VOID;
@@ -477,6 +475,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
        last_obj_ptr = &handler_obj->address_space.region_list;
 
        while (obj_desc) {
+
                /* Is this the correct Region? */
 
                if (obj_desc == region_obj) {
@@ -501,12 +500,10 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
 
                        status = acpi_ev_execute_reg_method(region_obj, 0);
                        if (ACPI_FAILURE(status)) {
-                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                                 "%s from region _REG, [%s]\n",
-                                                 acpi_format_exception(status),
-                                                 acpi_ut_get_region_name
-                                                 (region_obj->region.
-                                                  space_id)));
+                               ACPI_EXCEPTION((AE_INFO, status,
+                                               "from region _REG, [%s]",
+                                               acpi_ut_get_region_name
+                                               (region_obj->region.space_id)));
                        }
 
                        if (acpi_ns_is_locked) {
@@ -528,12 +525,10 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
                        /* Init routine may fail, Just ignore errors */
 
                        if (ACPI_FAILURE(status)) {
-                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                                 "%s from region init, [%s]\n",
-                                                 acpi_format_exception(status),
-                                                 acpi_ut_get_region_name
-                                                 (region_obj->region.
-                                                  space_id)));
+                               ACPI_EXCEPTION((AE_INFO, status,
+                                               "from region init, [%s]",
+                                               acpi_ut_get_region_name
+                                               (region_obj->region.space_id)));
                        }
 
                        region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE);
@@ -590,7 +585,7 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj,
                      u8 acpi_ns_is_locked)
 {
 
-       ACPI_FUNCTION_TRACE("ev_attach_region");
+       ACPI_FUNCTION_TRACE(ev_attach_region);
 
        ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
                          "Adding Region [%4.4s] %p to address handler %p [%s]\n",
@@ -643,7 +638,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,
        struct acpi_namespace_node *node;
        acpi_status status;
 
-       ACPI_FUNCTION_NAME("ev_install_handler");
+       ACPI_FUNCTION_NAME(ev_install_handler);
 
        handler_obj = (union acpi_operand_object *)context;
 
@@ -673,6 +668,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,
 
        obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
+
                /* No object, just exit */
 
                return (AE_OK);
@@ -681,10 +677,12 @@ acpi_ev_install_handler(acpi_handle obj_handle,
        /* Devices are handled different than regions */
 
        if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) {
+
                /* Check if this Device already has a handler for this address space */
 
                next_handler_obj = obj_desc->device.handler;
                while (next_handler_obj) {
+
                        /* Found a handler, is it for the same address space? */
 
                        if (next_handler_obj->address_space.space_id ==
@@ -771,9 +769,9 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
        union acpi_operand_object *handler_obj;
        acpi_status status;
        acpi_object_type type;
-       u16 flags = 0;
+       u8 flags = 0;
 
-       ACPI_FUNCTION_TRACE("ev_install_space_handler");
+       ACPI_FUNCTION_TRACE(ev_install_space_handler);
 
        /*
         * This registration is valid for only the types below
@@ -846,6 +844,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
                /* Walk the handler list for this device */
 
                while (handler_obj) {
+
                        /* Same space_id indicates a handler already installed */
 
                        if (handler_obj->address_space.space_id == space_id) {
@@ -928,7 +927,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
        /* Init handler obj */
 
        handler_obj->address_space.space_id = (u8) space_id;
-       handler_obj->address_space.hflags = flags;
+       handler_obj->address_space.handler_flags = flags;
        handler_obj->address_space.region_list = NULL;
        handler_obj->address_space.node = node;
        handler_obj->address_space.handler = handler;
@@ -986,7 +985,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_execute_reg_methods");
+       ACPI_FUNCTION_TRACE(ev_execute_reg_methods);
 
        /*
         * Run all _REG methods for all Operation Regions for this
@@ -1042,6 +1041,7 @@ acpi_ev_reg_run(acpi_handle obj_handle,
 
        obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
+
                /* No object, just exit */
 
                return (AE_OK);
This page took 0.07125 seconds and 5 git commands to generate.