Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
0002 /******************************************************************************
0003  *
0004  * Module Name: nsdump - table dumping routines for debug
0005  *
0006  * Copyright (C) 2000 - 2022, Intel Corp.
0007  *
0008  *****************************************************************************/
0009 
0010 #include <acpi/acpi.h>
0011 #include "accommon.h"
0012 #include "acnamesp.h"
0013 #include <acpi/acoutput.h>
0014 
0015 #define _COMPONENT          ACPI_NAMESPACE
0016 ACPI_MODULE_NAME("nsdump")
0017 
0018 /* Local prototypes */
0019 #ifdef ACPI_OBSOLETE_FUNCTIONS
0020 void acpi_ns_dump_root_devices(void);
0021 
0022 static acpi_status
0023 acpi_ns_dump_one_device(acpi_handle obj_handle,
0024             u32 level, void *context, void **return_value);
0025 #endif
0026 
0027 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
0028 
0029 static acpi_status
0030 acpi_ns_dump_one_object_path(acpi_handle obj_handle,
0031                  u32 level, void *context, void **return_value);
0032 
0033 static acpi_status
0034 acpi_ns_get_max_depth(acpi_handle obj_handle,
0035               u32 level, void *context, void **return_value);
0036 
0037 /*******************************************************************************
0038  *
0039  * FUNCTION:    acpi_ns_print_pathname
0040  *
0041  * PARAMETERS:  num_segments        - Number of ACPI name segments
0042  *              pathname            - The compressed (internal) path
0043  *
0044  * RETURN:      None
0045  *
0046  * DESCRIPTION: Print an object's full namespace pathname
0047  *
0048  ******************************************************************************/
0049 
0050 void acpi_ns_print_pathname(u32 num_segments, const char *pathname)
0051 {
0052     u32 i;
0053 
0054     ACPI_FUNCTION_NAME(ns_print_pathname);
0055 
0056     /* Check if debug output enabled */
0057 
0058     if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_NAMES, ACPI_NAMESPACE)) {
0059         return;
0060     }
0061 
0062     /* Print the entire name */
0063 
0064     ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "["));
0065 
0066     while (num_segments) {
0067         for (i = 0; i < 4; i++) {
0068             isprint((int)pathname[i]) ?
0069                 acpi_os_printf("%c", pathname[i]) :
0070                 acpi_os_printf("?");
0071         }
0072 
0073         pathname += ACPI_NAMESEG_SIZE;
0074         num_segments--;
0075         if (num_segments) {
0076             acpi_os_printf(".");
0077         }
0078     }
0079 
0080     acpi_os_printf("]\n");
0081 }
0082 
0083 #ifdef ACPI_OBSOLETE_FUNCTIONS
0084 /* Not used at this time, perhaps later */
0085 
0086 /*******************************************************************************
0087  *
0088  * FUNCTION:    acpi_ns_dump_pathname
0089  *
0090  * PARAMETERS:  handle              - Object
0091  *              msg                 - Prefix message
0092  *              level               - Desired debug level
0093  *              component           - Caller's component ID
0094  *
0095  * RETURN:      None
0096  *
0097  * DESCRIPTION: Print an object's full namespace pathname
0098  *              Manages allocation/freeing of a pathname buffer
0099  *
0100  ******************************************************************************/
0101 
0102 void
0103 acpi_ns_dump_pathname(acpi_handle handle,
0104               const char *msg, u32 level, u32 component)
0105 {
0106 
0107     ACPI_FUNCTION_TRACE(ns_dump_pathname);
0108 
0109     /* Do this only if the requested debug level and component are enabled */
0110 
0111     if (!ACPI_IS_DEBUG_ENABLED(level, component)) {
0112         return_VOID;
0113     }
0114 
0115     /* Convert handle to a full pathname and print it (with supplied message) */
0116 
0117     acpi_ns_print_node_pathname(handle, msg);
0118     acpi_os_printf("\n");
0119     return_VOID;
0120 }
0121 #endif
0122 
0123 /*******************************************************************************
0124  *
0125  * FUNCTION:    acpi_ns_dump_one_object
0126  *
0127  * PARAMETERS:  obj_handle          - Node to be dumped
0128  *              level               - Nesting level of the handle
0129  *              context             - Passed into walk_namespace
0130  *              return_value        - Not used
0131  *
0132  * RETURN:      Status
0133  *
0134  * DESCRIPTION: Dump a single Node
0135  *              This procedure is a user_function called by acpi_ns_walk_namespace.
0136  *
0137  ******************************************************************************/
0138 
0139 acpi_status
0140 acpi_ns_dump_one_object(acpi_handle obj_handle,
0141             u32 level, void *context, void **return_value)
0142 {
0143     struct acpi_walk_info *info = (struct acpi_walk_info *)context;
0144     struct acpi_namespace_node *this_node;
0145     union acpi_operand_object *obj_desc = NULL;
0146     acpi_object_type obj_type;
0147     acpi_object_type type;
0148     u32 bytes_to_dump;
0149     u32 dbg_level;
0150     u32 i;
0151 
0152     ACPI_FUNCTION_NAME(ns_dump_one_object);
0153 
0154     /* Is output enabled? */
0155 
0156     if (!(acpi_dbg_level & info->debug_level)) {
0157         return (AE_OK);
0158     }
0159 
0160     if (!obj_handle) {
0161         ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Null object handle\n"));
0162         return (AE_OK);
0163     }
0164 
0165     this_node = acpi_ns_validate_handle(obj_handle);
0166     if (!this_node) {
0167         ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid object handle %p\n",
0168                   obj_handle));
0169         return (AE_OK);
0170     }
0171 
0172     type = this_node->type;
0173     info->count++;
0174 
0175     /* Check if the owner matches */
0176 
0177     if ((info->owner_id != ACPI_OWNER_ID_MAX) &&
0178         (info->owner_id != this_node->owner_id)) {
0179         return (AE_OK);
0180     }
0181 
0182     if (!(info->display_type & ACPI_DISPLAY_SHORT)) {
0183 
0184         /* Indent the object according to the level */
0185 
0186         acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " ");
0187 
0188         /* Check the node type and name */
0189 
0190         if (type > ACPI_TYPE_LOCAL_MAX) {
0191             ACPI_WARNING((AE_INFO,
0192                       "Invalid ACPI Object Type 0x%08X", type));
0193         }
0194 
0195         acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node));
0196     }
0197 
0198     /* Now we can print out the pertinent information */
0199 
0200     acpi_os_printf(" %-12s %p %3.3X ",
0201                acpi_ut_get_type_name(type), this_node,
0202                this_node->owner_id);
0203 
0204     dbg_level = acpi_dbg_level;
0205     acpi_dbg_level = 0;
0206     obj_desc = acpi_ns_get_attached_object(this_node);
0207     acpi_dbg_level = dbg_level;
0208 
0209     /* Temp nodes are those nodes created by a control method */
0210 
0211     if (this_node->flags & ANOBJ_TEMPORARY) {
0212         acpi_os_printf("(T) ");
0213     }
0214 
0215     switch (info->display_type & ACPI_DISPLAY_MASK) {
0216     case ACPI_DISPLAY_SUMMARY:
0217 
0218         if (!obj_desc) {
0219 
0220             /* No attached object. Some types should always have an object */
0221 
0222             switch (type) {
0223             case ACPI_TYPE_INTEGER:
0224             case ACPI_TYPE_PACKAGE:
0225             case ACPI_TYPE_BUFFER:
0226             case ACPI_TYPE_STRING:
0227             case ACPI_TYPE_METHOD:
0228 
0229                 acpi_os_printf("<No attached object>");
0230                 break;
0231 
0232             default:
0233 
0234                 break;
0235             }
0236 
0237             acpi_os_printf("\n");
0238             return (AE_OK);
0239         }
0240 
0241         switch (type) {
0242         case ACPI_TYPE_PROCESSOR:
0243 
0244             acpi_os_printf("ID %02X Len %02X Addr %8.8X%8.8X\n",
0245                        obj_desc->processor.proc_id,
0246                        obj_desc->processor.length,
0247                        ACPI_FORMAT_UINT64(obj_desc->processor.
0248                               address));
0249             break;
0250 
0251         case ACPI_TYPE_DEVICE:
0252 
0253             acpi_os_printf("Notify Object: %p\n", obj_desc);
0254             break;
0255 
0256         case ACPI_TYPE_METHOD:
0257 
0258             acpi_os_printf("Args %X Len %.4X Aml %p\n",
0259                        (u32) obj_desc->method.param_count,
0260                        obj_desc->method.aml_length,
0261                        obj_desc->method.aml_start);
0262             break;
0263 
0264         case ACPI_TYPE_INTEGER:
0265 
0266             acpi_os_printf("= %8.8X%8.8X\n",
0267                        ACPI_FORMAT_UINT64(obj_desc->integer.
0268                               value));
0269             break;
0270 
0271         case ACPI_TYPE_PACKAGE:
0272 
0273             if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
0274                 acpi_os_printf("Elements %.2X\n",
0275                            obj_desc->package.count);
0276             } else {
0277                 acpi_os_printf("[Length not yet evaluated]\n");
0278             }
0279             break;
0280 
0281         case ACPI_TYPE_BUFFER:
0282 
0283             if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
0284                 acpi_os_printf("Len %.2X",
0285                            obj_desc->buffer.length);
0286 
0287                 /* Dump some of the buffer */
0288 
0289                 if (obj_desc->buffer.length > 0) {
0290                     acpi_os_printf(" =");
0291                     for (i = 0;
0292                          (i < obj_desc->buffer.length
0293                           && i < 12); i++) {
0294                         acpi_os_printf(" %2.2X",
0295                                    obj_desc->buffer.
0296                                    pointer[i]);
0297                     }
0298                 }
0299                 acpi_os_printf("\n");
0300             } else {
0301                 acpi_os_printf("[Length not yet evaluated]\n");
0302             }
0303             break;
0304 
0305         case ACPI_TYPE_STRING:
0306 
0307             acpi_os_printf("Len %.2X ", obj_desc->string.length);
0308             acpi_ut_print_string(obj_desc->string.pointer, 80);
0309             acpi_os_printf("\n");
0310             break;
0311 
0312         case ACPI_TYPE_REGION:
0313 
0314             acpi_os_printf("[%s]",
0315                        acpi_ut_get_region_name(obj_desc->region.
0316                                    space_id));
0317             if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
0318                 acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n",
0319                            ACPI_FORMAT_UINT64(obj_desc->
0320                                   region.
0321                                   address),
0322                            obj_desc->region.length);
0323             } else {
0324                 acpi_os_printf
0325                     (" [Address/Length not yet evaluated]\n");
0326             }
0327             break;
0328 
0329         case ACPI_TYPE_LOCAL_REFERENCE:
0330 
0331             acpi_os_printf("[%s]\n",
0332                        acpi_ut_get_reference_name(obj_desc));
0333             break;
0334 
0335         case ACPI_TYPE_BUFFER_FIELD:
0336 
0337             if (obj_desc->buffer_field.buffer_obj &&
0338                 obj_desc->buffer_field.buffer_obj->buffer.node) {
0339                 acpi_os_printf("Buf [%4.4s]",
0340                            acpi_ut_get_node_name(obj_desc->
0341                                      buffer_field.
0342                                      buffer_obj->
0343                                      buffer.
0344                                      node));
0345             }
0346             break;
0347 
0348         case ACPI_TYPE_LOCAL_REGION_FIELD:
0349 
0350             acpi_os_printf("Rgn [%4.4s]",
0351                        acpi_ut_get_node_name(obj_desc->
0352                                  common_field.
0353                                  region_obj->region.
0354                                  node));
0355             break;
0356 
0357         case ACPI_TYPE_LOCAL_BANK_FIELD:
0358 
0359             acpi_os_printf("Rgn [%4.4s] Bnk [%4.4s]",
0360                        acpi_ut_get_node_name(obj_desc->
0361                                  common_field.
0362                                  region_obj->region.
0363                                  node),
0364                        acpi_ut_get_node_name(obj_desc->
0365                                  bank_field.
0366                                  bank_obj->
0367                                  common_field.
0368                                  node));
0369             break;
0370 
0371         case ACPI_TYPE_LOCAL_INDEX_FIELD:
0372 
0373             acpi_os_printf("Idx [%4.4s] Dat [%4.4s]",
0374                        acpi_ut_get_node_name(obj_desc->
0375                                  index_field.
0376                                  index_obj->
0377                                  common_field.node),
0378                        acpi_ut_get_node_name(obj_desc->
0379                                  index_field.
0380                                  data_obj->
0381                                  common_field.
0382                                  node));
0383             break;
0384 
0385         case ACPI_TYPE_LOCAL_ALIAS:
0386         case ACPI_TYPE_LOCAL_METHOD_ALIAS:
0387 
0388             acpi_os_printf("Target %4.4s (%p)\n",
0389                        acpi_ut_get_node_name(obj_desc),
0390                        obj_desc);
0391             break;
0392 
0393         default:
0394 
0395             acpi_os_printf("Object %p\n", obj_desc);
0396             break;
0397         }
0398 
0399         /* Common field handling */
0400 
0401         switch (type) {
0402         case ACPI_TYPE_BUFFER_FIELD:
0403         case ACPI_TYPE_LOCAL_REGION_FIELD:
0404         case ACPI_TYPE_LOCAL_BANK_FIELD:
0405         case ACPI_TYPE_LOCAL_INDEX_FIELD:
0406 
0407             acpi_os_printf(" Off %.3X Len %.2X Acc %.2X\n",
0408                        (obj_desc->common_field.
0409                     base_byte_offset * 8)
0410                        +
0411                        obj_desc->common_field.
0412                        start_field_bit_offset,
0413                        obj_desc->common_field.bit_length,
0414                        obj_desc->common_field.
0415                        access_byte_width);
0416             break;
0417 
0418         default:
0419 
0420             break;
0421         }
0422         break;
0423 
0424     case ACPI_DISPLAY_OBJECTS:
0425 
0426         acpi_os_printf("O:%p", obj_desc);
0427         if (!obj_desc) {
0428 
0429             /* No attached object, we are done */
0430 
0431             acpi_os_printf("\n");
0432             return (AE_OK);
0433         }
0434 
0435         acpi_os_printf("(R%u)", obj_desc->common.reference_count);
0436 
0437         switch (type) {
0438         case ACPI_TYPE_METHOD:
0439 
0440             /* Name is a Method and its AML offset/length are set */
0441 
0442             acpi_os_printf(" M:%p-%X\n", obj_desc->method.aml_start,
0443                        obj_desc->method.aml_length);
0444             break;
0445 
0446         case ACPI_TYPE_INTEGER:
0447 
0448             acpi_os_printf(" I:%8.8X8.8%X\n",
0449                        ACPI_FORMAT_UINT64(obj_desc->integer.
0450                               value));
0451             break;
0452 
0453         case ACPI_TYPE_STRING:
0454 
0455             acpi_os_printf(" S:%p-%X\n", obj_desc->string.pointer,
0456                        obj_desc->string.length);
0457             break;
0458 
0459         case ACPI_TYPE_BUFFER:
0460 
0461             acpi_os_printf(" B:%p-%X\n", obj_desc->buffer.pointer,
0462                        obj_desc->buffer.length);
0463             break;
0464 
0465         default:
0466 
0467             acpi_os_printf("\n");
0468             break;
0469         }
0470         break;
0471 
0472     default:
0473         acpi_os_printf("\n");
0474         break;
0475     }
0476 
0477     /* If debug turned off, done */
0478 
0479     if (!(acpi_dbg_level & ACPI_LV_VALUES)) {
0480         return (AE_OK);
0481     }
0482 
0483     /* If there is an attached object, display it */
0484 
0485     dbg_level = acpi_dbg_level;
0486     acpi_dbg_level = 0;
0487     obj_desc = acpi_ns_get_attached_object(this_node);
0488     acpi_dbg_level = dbg_level;
0489 
0490     /* Dump attached objects */
0491 
0492     while (obj_desc) {
0493         obj_type = ACPI_TYPE_INVALID;
0494         acpi_os_printf("Attached Object %p: ", obj_desc);
0495 
0496         /* Decode the type of attached object and dump the contents */
0497 
0498         switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
0499         case ACPI_DESC_TYPE_NAMED:
0500 
0501             acpi_os_printf("(Ptr to Node)\n");
0502             bytes_to_dump = sizeof(struct acpi_namespace_node);
0503             ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
0504             break;
0505 
0506         case ACPI_DESC_TYPE_OPERAND:
0507 
0508             obj_type = obj_desc->common.type;
0509 
0510             if (obj_type > ACPI_TYPE_LOCAL_MAX) {
0511                 acpi_os_printf
0512                     ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
0513                      obj_type);
0514 
0515                 bytes_to_dump = 32;
0516             } else {
0517                 acpi_os_printf
0518                     ("(Pointer to ACPI Object type %.2X [%s])\n",
0519                      obj_type, acpi_ut_get_type_name(obj_type));
0520 
0521                 bytes_to_dump =
0522                     sizeof(union acpi_operand_object);
0523             }
0524 
0525             ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
0526             break;
0527 
0528         default:
0529 
0530             break;
0531         }
0532 
0533         /* If value is NOT an internal object, we are done */
0534 
0535         if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) !=
0536             ACPI_DESC_TYPE_OPERAND) {
0537             goto cleanup;
0538         }
0539 
0540         /* Valid object, get the pointer to next level, if any */
0541 
0542         switch (obj_type) {
0543         case ACPI_TYPE_BUFFER:
0544         case ACPI_TYPE_STRING:
0545             /*
0546              * NOTE: takes advantage of common fields between string/buffer
0547              */
0548             bytes_to_dump = obj_desc->string.length;
0549             obj_desc = (void *)obj_desc->string.pointer;
0550 
0551             acpi_os_printf("(Buffer/String pointer %p length %X)\n",
0552                        obj_desc, bytes_to_dump);
0553             ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
0554             goto cleanup;
0555 
0556         case ACPI_TYPE_BUFFER_FIELD:
0557 
0558             obj_desc =
0559                 (union acpi_operand_object *)obj_desc->buffer_field.
0560                 buffer_obj;
0561             break;
0562 
0563         case ACPI_TYPE_PACKAGE:
0564 
0565             obj_desc = (void *)obj_desc->package.elements;
0566             break;
0567 
0568         case ACPI_TYPE_METHOD:
0569 
0570             obj_desc = (void *)obj_desc->method.aml_start;
0571             break;
0572 
0573         case ACPI_TYPE_LOCAL_REGION_FIELD:
0574 
0575             obj_desc = (void *)obj_desc->field.region_obj;
0576             break;
0577 
0578         case ACPI_TYPE_LOCAL_BANK_FIELD:
0579 
0580             obj_desc = (void *)obj_desc->bank_field.region_obj;
0581             break;
0582 
0583         case ACPI_TYPE_LOCAL_INDEX_FIELD:
0584 
0585             obj_desc = (void *)obj_desc->index_field.index_obj;
0586             break;
0587 
0588         default:
0589 
0590             goto cleanup;
0591         }
0592     }
0593 
0594 cleanup:
0595     acpi_os_printf("\n");
0596     return (AE_OK);
0597 }
0598 
0599 /*******************************************************************************
0600  *
0601  * FUNCTION:    acpi_ns_dump_objects
0602  *
0603  * PARAMETERS:  type                - Object type to be dumped
0604  *              display_type        - 0 or ACPI_DISPLAY_SUMMARY
0605  *              max_depth           - Maximum depth of dump. Use ACPI_UINT32_MAX
0606  *                                    for an effectively unlimited depth.
0607  *              owner_id            - Dump only objects owned by this ID. Use
0608  *                                    ACPI_UINT32_MAX to match all owners.
0609  *              start_handle        - Where in namespace to start/end search
0610  *
0611  * RETURN:      None
0612  *
0613  * DESCRIPTION: Dump typed objects within the loaded namespace. Uses
0614  *              acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object.
0615  *
0616  ******************************************************************************/
0617 
0618 void
0619 acpi_ns_dump_objects(acpi_object_type type,
0620              u8 display_type,
0621              u32 max_depth,
0622              acpi_owner_id owner_id, acpi_handle start_handle)
0623 {
0624     struct acpi_walk_info info;
0625     acpi_status status;
0626 
0627     ACPI_FUNCTION_ENTRY();
0628 
0629     /*
0630      * Just lock the entire namespace for the duration of the dump.
0631      * We don't want any changes to the namespace during this time,
0632      * especially the temporary nodes since we are going to display
0633      * them also.
0634      */
0635     status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
0636     if (ACPI_FAILURE(status)) {
0637         acpi_os_printf("Could not acquire namespace mutex\n");
0638         return;
0639     }
0640 
0641     info.count = 0;
0642     info.debug_level = ACPI_LV_TABLES;
0643     info.owner_id = owner_id;
0644     info.display_type = display_type;
0645 
0646     (void)acpi_ns_walk_namespace(type, start_handle, max_depth,
0647                      ACPI_NS_WALK_NO_UNLOCK |
0648                      ACPI_NS_WALK_TEMP_NODES,
0649                      acpi_ns_dump_one_object, NULL,
0650                      (void *)&info, NULL);
0651 
0652     acpi_os_printf("\nNamespace node count: %u\n\n", info.count);
0653     (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
0654 }
0655 
0656 /*******************************************************************************
0657  *
0658  * FUNCTION:    acpi_ns_dump_one_object_path, acpi_ns_get_max_depth
0659  *
0660  * PARAMETERS:  obj_handle          - Node to be dumped
0661  *              level               - Nesting level of the handle
0662  *              context             - Passed into walk_namespace
0663  *              return_value        - Not used
0664  *
0665  * RETURN:      Status
0666  *
0667  * DESCRIPTION: Dump the full pathname to a namespace object. acp_ns_get_max_depth
0668  *              computes the maximum nesting depth in the namespace tree, in
0669  *              order to simplify formatting in acpi_ns_dump_one_object_path.
0670  *              These procedures are user_functions called by acpi_ns_walk_namespace.
0671  *
0672  ******************************************************************************/
0673 
0674 static acpi_status
0675 acpi_ns_dump_one_object_path(acpi_handle obj_handle,
0676                  u32 level, void *context, void **return_value)
0677 {
0678     u32 max_level = *((u32 *)context);
0679     char *pathname;
0680     struct acpi_namespace_node *node;
0681     int path_indent;
0682 
0683     if (!obj_handle) {
0684         return (AE_OK);
0685     }
0686 
0687     node = acpi_ns_validate_handle(obj_handle);
0688     if (!node) {
0689 
0690         /* Ignore bad node during namespace walk */
0691 
0692         return (AE_OK);
0693     }
0694 
0695     pathname = acpi_ns_get_normalized_pathname(node, TRUE);
0696 
0697     path_indent = 1;
0698     if (level <= max_level) {
0699         path_indent = max_level - level + 1;
0700     }
0701 
0702     acpi_os_printf("%2d%*s%-12s%*s",
0703                level, level, " ", acpi_ut_get_type_name(node->type),
0704                path_indent, " ");
0705 
0706     acpi_os_printf("%s\n", &pathname[1]);
0707     ACPI_FREE(pathname);
0708     return (AE_OK);
0709 }
0710 
0711 static acpi_status
0712 acpi_ns_get_max_depth(acpi_handle obj_handle,
0713               u32 level, void *context, void **return_value)
0714 {
0715     u32 *max_level = (u32 *)context;
0716 
0717     if (level > *max_level) {
0718         *max_level = level;
0719     }
0720     return (AE_OK);
0721 }
0722 
0723 /*******************************************************************************
0724  *
0725  * FUNCTION:    acpi_ns_dump_object_paths
0726  *
0727  * PARAMETERS:  type                - Object type to be dumped
0728  *              display_type        - 0 or ACPI_DISPLAY_SUMMARY
0729  *              max_depth           - Maximum depth of dump. Use ACPI_UINT32_MAX
0730  *                                    for an effectively unlimited depth.
0731  *              owner_id            - Dump only objects owned by this ID. Use
0732  *                                    ACPI_UINT32_MAX to match all owners.
0733  *              start_handle        - Where in namespace to start/end search
0734  *
0735  * RETURN:      None
0736  *
0737  * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
0738  *              acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object_path.
0739  *
0740  ******************************************************************************/
0741 
0742 void
0743 acpi_ns_dump_object_paths(acpi_object_type type,
0744               u8 display_type,
0745               u32 max_depth,
0746               acpi_owner_id owner_id, acpi_handle start_handle)
0747 {
0748     acpi_status status;
0749     u32 max_level = 0;
0750 
0751     ACPI_FUNCTION_ENTRY();
0752 
0753     /*
0754      * Just lock the entire namespace for the duration of the dump.
0755      * We don't want any changes to the namespace during this time,
0756      * especially the temporary nodes since we are going to display
0757      * them also.
0758      */
0759     status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
0760     if (ACPI_FAILURE(status)) {
0761         acpi_os_printf("Could not acquire namespace mutex\n");
0762         return;
0763     }
0764 
0765     /* Get the max depth of the namespace tree, for formatting later */
0766 
0767     (void)acpi_ns_walk_namespace(type, start_handle, max_depth,
0768                      ACPI_NS_WALK_NO_UNLOCK |
0769                      ACPI_NS_WALK_TEMP_NODES,
0770                      acpi_ns_get_max_depth, NULL,
0771                      (void *)&max_level, NULL);
0772 
0773     /* Now dump the entire namespace */
0774 
0775     (void)acpi_ns_walk_namespace(type, start_handle, max_depth,
0776                      ACPI_NS_WALK_NO_UNLOCK |
0777                      ACPI_NS_WALK_TEMP_NODES,
0778                      acpi_ns_dump_one_object_path, NULL,
0779                      (void *)&max_level, NULL);
0780 
0781     (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
0782 }
0783 
0784 /*******************************************************************************
0785  *
0786  * FUNCTION:    acpi_ns_dump_entry
0787  *
0788  * PARAMETERS:  handle              - Node to be dumped
0789  *              debug_level         - Output level
0790  *
0791  * RETURN:      None
0792  *
0793  * DESCRIPTION: Dump a single Node
0794  *
0795  ******************************************************************************/
0796 
0797 void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level)
0798 {
0799     struct acpi_walk_info info;
0800 
0801     ACPI_FUNCTION_ENTRY();
0802 
0803     info.debug_level = debug_level;
0804     info.owner_id = ACPI_OWNER_ID_MAX;
0805     info.display_type = ACPI_DISPLAY_SUMMARY;
0806 
0807     (void)acpi_ns_dump_one_object(handle, 1, &info, NULL);
0808 }
0809 
0810 #ifdef ACPI_ASL_COMPILER
0811 /*******************************************************************************
0812  *
0813  * FUNCTION:    acpi_ns_dump_tables
0814  *
0815  * PARAMETERS:  search_base         - Root of subtree to be dumped, or
0816  *                                    NS_ALL to dump the entire namespace
0817  *              max_depth           - Maximum depth of dump. Use INT_MAX
0818  *                                    for an effectively unlimited depth.
0819  *
0820  * RETURN:      None
0821  *
0822  * DESCRIPTION: Dump the name space, or a portion of it.
0823  *
0824  ******************************************************************************/
0825 
0826 void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth)
0827 {
0828     acpi_handle search_handle = search_base;
0829 
0830     ACPI_FUNCTION_TRACE(ns_dump_tables);
0831 
0832     if (!acpi_gbl_root_node) {
0833         /*
0834          * If the name space has not been initialized,
0835          * there is nothing to dump.
0836          */
0837         ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
0838                   "namespace not initialized!\n"));
0839         return_VOID;
0840     }
0841 
0842     if (ACPI_NS_ALL == search_base) {
0843 
0844         /* Entire namespace */
0845 
0846         search_handle = acpi_gbl_root_node;
0847         ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "\\\n"));
0848     }
0849 
0850     acpi_ns_dump_objects(ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
0851                  ACPI_OWNER_ID_MAX, search_handle);
0852     return_VOID;
0853 }
0854 #endif
0855 #endif