1ff879b07SJung-uk Kim /****************************************************************************** 2ff879b07SJung-uk Kim * 3ff879b07SJung-uk Kim * Module Name: dmtbdump2 - Dump ACPI data tables that contain no AML code 4ff879b07SJung-uk Kim * 5ff879b07SJung-uk Kim *****************************************************************************/ 6ff879b07SJung-uk Kim 7ff879b07SJung-uk Kim /****************************************************************************** 8ff879b07SJung-uk Kim * 9ff879b07SJung-uk Kim * 1. Copyright Notice 10ff879b07SJung-uk Kim * 11ff879b07SJung-uk Kim * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. 12ff879b07SJung-uk Kim * All rights reserved. 13ff879b07SJung-uk Kim * 14ff879b07SJung-uk Kim * 2. License 15ff879b07SJung-uk Kim * 16ff879b07SJung-uk Kim * 2.1. This is your license from Intel Corp. under its intellectual property 17ff879b07SJung-uk Kim * rights. You may have additional license terms from the party that provided 18ff879b07SJung-uk Kim * you this software, covering your right to use that party's intellectual 19ff879b07SJung-uk Kim * property rights. 20ff879b07SJung-uk Kim * 21ff879b07SJung-uk Kim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22ff879b07SJung-uk Kim * copy of the source code appearing in this file ("Covered Code") an 23ff879b07SJung-uk Kim * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24ff879b07SJung-uk Kim * base code distributed originally by Intel ("Original Intel Code") to copy, 25ff879b07SJung-uk Kim * make derivatives, distribute, use and display any portion of the Covered 26ff879b07SJung-uk Kim * Code in any form, with the right to sublicense such rights; and 27ff879b07SJung-uk Kim * 28ff879b07SJung-uk Kim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29ff879b07SJung-uk Kim * license (with the right to sublicense), under only those claims of Intel 30ff879b07SJung-uk Kim * patents that are infringed by the Original Intel Code, to make, use, sell, 31ff879b07SJung-uk Kim * offer to sell, and import the Covered Code and derivative works thereof 32ff879b07SJung-uk Kim * solely to the minimum extent necessary to exercise the above copyright 33ff879b07SJung-uk Kim * license, and in no event shall the patent license extend to any additions 34ff879b07SJung-uk Kim * to or modifications of the Original Intel Code. No other license or right 35ff879b07SJung-uk Kim * is granted directly or by implication, estoppel or otherwise; 36ff879b07SJung-uk Kim * 37ff879b07SJung-uk Kim * The above copyright and patent license is granted only if the following 38ff879b07SJung-uk Kim * conditions are met: 39ff879b07SJung-uk Kim * 40ff879b07SJung-uk Kim * 3. Conditions 41ff879b07SJung-uk Kim * 42ff879b07SJung-uk Kim * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43ff879b07SJung-uk Kim * Redistribution of source code of any substantial portion of the Covered 44ff879b07SJung-uk Kim * Code or modification with rights to further distribute source must include 45ff879b07SJung-uk Kim * the above Copyright Notice, the above License, this list of Conditions, 46ff879b07SJung-uk Kim * and the following Disclaimer and Export Compliance provision. In addition, 47ff879b07SJung-uk Kim * Licensee must cause all Covered Code to which Licensee contributes to 48ff879b07SJung-uk Kim * contain a file documenting the changes Licensee made to create that Covered 49ff879b07SJung-uk Kim * Code and the date of any change. Licensee must include in that file the 50ff879b07SJung-uk Kim * documentation of any changes made by any predecessor Licensee. Licensee 51ff879b07SJung-uk Kim * must include a prominent statement that the modification is derived, 52ff879b07SJung-uk Kim * directly or indirectly, from Original Intel Code. 53ff879b07SJung-uk Kim * 54ff879b07SJung-uk Kim * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55ff879b07SJung-uk Kim * Redistribution of source code of any substantial portion of the Covered 56ff879b07SJung-uk Kim * Code or modification without rights to further distribute source must 57ff879b07SJung-uk Kim * include the following Disclaimer and Export Compliance provision in the 58ff879b07SJung-uk Kim * documentation and/or other materials provided with distribution. In 59ff879b07SJung-uk Kim * addition, Licensee may not authorize further sublicense of source of any 60ff879b07SJung-uk Kim * portion of the Covered Code, and must include terms to the effect that the 61ff879b07SJung-uk Kim * license from Licensee to its licensee is limited to the intellectual 62ff879b07SJung-uk Kim * property embodied in the software Licensee provides to its licensee, and 63ff879b07SJung-uk Kim * not to intellectual property embodied in modifications its licensee may 64ff879b07SJung-uk Kim * make. 65ff879b07SJung-uk Kim * 66ff879b07SJung-uk Kim * 3.3. Redistribution of Executable. Redistribution in executable form of any 67ff879b07SJung-uk Kim * substantial portion of the Covered Code or modification must reproduce the 68ff879b07SJung-uk Kim * above Copyright Notice, and the following Disclaimer and Export Compliance 69ff879b07SJung-uk Kim * provision in the documentation and/or other materials provided with the 70ff879b07SJung-uk Kim * distribution. 71ff879b07SJung-uk Kim * 72ff879b07SJung-uk Kim * 3.4. Intel retains all right, title, and interest in and to the Original 73ff879b07SJung-uk Kim * Intel Code. 74ff879b07SJung-uk Kim * 75ff879b07SJung-uk Kim * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76ff879b07SJung-uk Kim * Intel shall be used in advertising or otherwise to promote the sale, use or 77ff879b07SJung-uk Kim * other dealings in products derived from or relating to the Covered Code 78ff879b07SJung-uk Kim * without prior written authorization from Intel. 79ff879b07SJung-uk Kim * 80ff879b07SJung-uk Kim * 4. Disclaimer and Export Compliance 81ff879b07SJung-uk Kim * 82ff879b07SJung-uk Kim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83ff879b07SJung-uk Kim * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84ff879b07SJung-uk Kim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85ff879b07SJung-uk Kim * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86ff879b07SJung-uk Kim * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87ff879b07SJung-uk Kim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88ff879b07SJung-uk Kim * PARTICULAR PURPOSE. 89ff879b07SJung-uk Kim * 90ff879b07SJung-uk Kim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91ff879b07SJung-uk Kim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92ff879b07SJung-uk Kim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93ff879b07SJung-uk Kim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94ff879b07SJung-uk Kim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95ff879b07SJung-uk Kim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96ff879b07SJung-uk Kim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97ff879b07SJung-uk Kim * LIMITED REMEDY. 98ff879b07SJung-uk Kim * 99ff879b07SJung-uk Kim * 4.3. Licensee shall not export, either directly or indirectly, any of this 100ff879b07SJung-uk Kim * software or system incorporating such software without first obtaining any 101ff879b07SJung-uk Kim * required license or other approval from the U. S. Department of Commerce or 102ff879b07SJung-uk Kim * any other agency or department of the United States Government. In the 103ff879b07SJung-uk Kim * event Licensee exports any such software from the United States or 104ff879b07SJung-uk Kim * re-exports any such software from a foreign destination, Licensee shall 105ff879b07SJung-uk Kim * ensure that the distribution and export/re-export of the software is in 106ff879b07SJung-uk Kim * compliance with all laws, regulations, orders, or other restrictions of the 107ff879b07SJung-uk Kim * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108ff879b07SJung-uk Kim * any of its subsidiaries will export/re-export any technical data, process, 109ff879b07SJung-uk Kim * software, or service, directly or indirectly, to any country for which the 110ff879b07SJung-uk Kim * United States government or any agency thereof requires an export license, 111ff879b07SJung-uk Kim * other governmental approval, or letter of assurance, without first obtaining 112ff879b07SJung-uk Kim * such license, approval or letter. 113ff879b07SJung-uk Kim * 114ff879b07SJung-uk Kim ***************************************************************************** 115ff879b07SJung-uk Kim * 116ff879b07SJung-uk Kim * Alternatively, you may choose to be licensed under the terms of the 117ff879b07SJung-uk Kim * following license: 118ff879b07SJung-uk Kim * 119ff879b07SJung-uk Kim * Redistribution and use in source and binary forms, with or without 120ff879b07SJung-uk Kim * modification, are permitted provided that the following conditions 121ff879b07SJung-uk Kim * are met: 122ff879b07SJung-uk Kim * 1. Redistributions of source code must retain the above copyright 123ff879b07SJung-uk Kim * notice, this list of conditions, and the following disclaimer, 124ff879b07SJung-uk Kim * without modification. 125ff879b07SJung-uk Kim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126ff879b07SJung-uk Kim * substantially similar to the "NO WARRANTY" disclaimer below 127ff879b07SJung-uk Kim * ("Disclaimer") and any redistribution must be conditioned upon 128ff879b07SJung-uk Kim * including a substantially similar Disclaimer requirement for further 129ff879b07SJung-uk Kim * binary redistribution. 130ff879b07SJung-uk Kim * 3. Neither the names of the above-listed copyright holders nor the names 131ff879b07SJung-uk Kim * of any contributors may be used to endorse or promote products derived 132ff879b07SJung-uk Kim * from this software without specific prior written permission. 133ff879b07SJung-uk Kim * 134ff879b07SJung-uk Kim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 135ff879b07SJung-uk Kim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 136ff879b07SJung-uk Kim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 137ff879b07SJung-uk Kim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 138ff879b07SJung-uk Kim * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 139ff879b07SJung-uk Kim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 140ff879b07SJung-uk Kim * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 141ff879b07SJung-uk Kim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 142ff879b07SJung-uk Kim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 143ff879b07SJung-uk Kim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 144ff879b07SJung-uk Kim * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 145ff879b07SJung-uk Kim * 146ff879b07SJung-uk Kim * Alternatively, you may choose to be licensed under the terms of the 147ff879b07SJung-uk Kim * GNU General Public License ("GPL") version 2 as published by the Free 148ff879b07SJung-uk Kim * Software Foundation. 149ff879b07SJung-uk Kim * 150ff879b07SJung-uk Kim *****************************************************************************/ 151ff879b07SJung-uk Kim 152ff879b07SJung-uk Kim #include <contrib/dev/acpica/include/acpi.h> 153ff879b07SJung-uk Kim #include <contrib/dev/acpica/include/accommon.h> 154ff879b07SJung-uk Kim #include <contrib/dev/acpica/include/acdisasm.h> 155ff879b07SJung-uk Kim #include <contrib/dev/acpica/include/actables.h> 156ff879b07SJung-uk Kim 157ff879b07SJung-uk Kim /* This module used for application-level code only */ 158ff879b07SJung-uk Kim 159ff879b07SJung-uk Kim #define _COMPONENT ACPI_CA_DISASSEMBLER 160ff879b07SJung-uk Kim ACPI_MODULE_NAME ("dmtbdump2") 161ff879b07SJung-uk Kim 162ff879b07SJung-uk Kim 163ff879b07SJung-uk Kim /******************************************************************************* 164ff879b07SJung-uk Kim * 165ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpIort 166ff879b07SJung-uk Kim * 167ff879b07SJung-uk Kim * PARAMETERS: Table - A IORT table 168ff879b07SJung-uk Kim * 169ff879b07SJung-uk Kim * RETURN: None 170ff879b07SJung-uk Kim * 171ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a IORT 172ff879b07SJung-uk Kim * 173ff879b07SJung-uk Kim ******************************************************************************/ 174ff879b07SJung-uk Kim 175ff879b07SJung-uk Kim void 176ff879b07SJung-uk Kim AcpiDmDumpIort ( 177ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 178ff879b07SJung-uk Kim { 179ff879b07SJung-uk Kim ACPI_STATUS Status; 180ff879b07SJung-uk Kim ACPI_TABLE_IORT *Iort; 181ff879b07SJung-uk Kim ACPI_IORT_NODE *IortNode; 182ff879b07SJung-uk Kim ACPI_IORT_ITS_GROUP *IortItsGroup = NULL; 183ff879b07SJung-uk Kim ACPI_IORT_SMMU *IortSmmu = NULL; 184ff879b07SJung-uk Kim UINT32 Offset; 185ff879b07SJung-uk Kim UINT32 NodeOffset; 186ff879b07SJung-uk Kim UINT32 Length; 187ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable; 188ff879b07SJung-uk Kim char *String; 189ff879b07SJung-uk Kim UINT32 i; 190ff879b07SJung-uk Kim 191ff879b07SJung-uk Kim 192ff879b07SJung-uk Kim /* Main table */ 193ff879b07SJung-uk Kim 194ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort); 195ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 196ff879b07SJung-uk Kim { 197ff879b07SJung-uk Kim return; 198ff879b07SJung-uk Kim } 199ff879b07SJung-uk Kim 200ff879b07SJung-uk Kim Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table); 201ff879b07SJung-uk Kim Offset = sizeof (ACPI_TABLE_IORT); 202ff879b07SJung-uk Kim 203ff879b07SJung-uk Kim /* Dump the OptionalPadding (optional) */ 204ff879b07SJung-uk Kim 205ff879b07SJung-uk Kim if (Iort->NodeOffset > Offset) 206ff879b07SJung-uk Kim { 207ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Table, 208ff879b07SJung-uk Kim Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad); 209ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 210ff879b07SJung-uk Kim { 211ff879b07SJung-uk Kim return; 212ff879b07SJung-uk Kim } 213ff879b07SJung-uk Kim } 214ff879b07SJung-uk Kim 215ff879b07SJung-uk Kim Offset = Iort->NodeOffset; 216ff879b07SJung-uk Kim while (Offset < Table->Length) 217ff879b07SJung-uk Kim { 218ff879b07SJung-uk Kim /* Common subtable header */ 219ff879b07SJung-uk Kim 220ff879b07SJung-uk Kim IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset); 221ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 222ff879b07SJung-uk Kim Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData); 223ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, 224ff879b07SJung-uk Kim IortNode, Length, AcpiDmTableInfoIortHdr); 225ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 226ff879b07SJung-uk Kim { 227ff879b07SJung-uk Kim return; 228ff879b07SJung-uk Kim } 229ff879b07SJung-uk Kim 230ff879b07SJung-uk Kim NodeOffset = Length; 231ff879b07SJung-uk Kim 232ff879b07SJung-uk Kim switch (IortNode->Type) 233ff879b07SJung-uk Kim { 234ff879b07SJung-uk Kim case ACPI_IORT_NODE_ITS_GROUP: 235ff879b07SJung-uk Kim 236ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIort0; 237ff879b07SJung-uk Kim Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers); 238ff879b07SJung-uk Kim IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset); 239ff879b07SJung-uk Kim break; 240ff879b07SJung-uk Kim 241ff879b07SJung-uk Kim case ACPI_IORT_NODE_NAMED_COMPONENT: 242ff879b07SJung-uk Kim 243ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIort1; 244ff879b07SJung-uk Kim Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName); 245ff879b07SJung-uk Kim String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length); 246ff879b07SJung-uk Kim Length += strlen (String) + 1; 247ff879b07SJung-uk Kim break; 248ff879b07SJung-uk Kim 249ff879b07SJung-uk Kim case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: 250ff879b07SJung-uk Kim 251ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIort2; 252ff879b07SJung-uk Kim Length = IortNode->Length - NodeOffset; 253ff879b07SJung-uk Kim break; 254ff879b07SJung-uk Kim 255ff879b07SJung-uk Kim case ACPI_IORT_NODE_SMMU: 256ff879b07SJung-uk Kim 257ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIort3; 258ff879b07SJung-uk Kim Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts); 259ff879b07SJung-uk Kim IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset); 260ff879b07SJung-uk Kim break; 261ff879b07SJung-uk Kim 262ff879b07SJung-uk Kim case ACPI_IORT_NODE_SMMU_V3: 263ff879b07SJung-uk Kim 264ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIort4; 265ff879b07SJung-uk Kim Length = IortNode->Length - NodeOffset; 266ff879b07SJung-uk Kim break; 267ff879b07SJung-uk Kim 268*3d90091dSJung-uk Kim case ACPI_IORT_NODE_PMCG: 269*3d90091dSJung-uk Kim 270*3d90091dSJung-uk Kim InfoTable = AcpiDmTableInfoIort5; 271*3d90091dSJung-uk Kim Length = IortNode->Length - NodeOffset; 272*3d90091dSJung-uk Kim break; 273*3d90091dSJung-uk Kim 274ff879b07SJung-uk Kim default: 275ff879b07SJung-uk Kim 276ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n", 277ff879b07SJung-uk Kim IortNode->Type); 278ff879b07SJung-uk Kim 279ff879b07SJung-uk Kim /* Attempt to continue */ 280ff879b07SJung-uk Kim 281ff879b07SJung-uk Kim if (!IortNode->Length) 282ff879b07SJung-uk Kim { 283ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid zero length IORT node\n"); 284ff879b07SJung-uk Kim return; 285ff879b07SJung-uk Kim } 286ff879b07SJung-uk Kim goto NextSubtable; 287ff879b07SJung-uk Kim } 288ff879b07SJung-uk Kim 289ff879b07SJung-uk Kim /* Dump the node subtable header */ 290ff879b07SJung-uk Kim 291ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 292ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 293ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 294ff879b07SJung-uk Kim Length, InfoTable); 295ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 296ff879b07SJung-uk Kim { 297ff879b07SJung-uk Kim return; 298ff879b07SJung-uk Kim } 299ff879b07SJung-uk Kim 300ff879b07SJung-uk Kim NodeOffset += Length; 301ff879b07SJung-uk Kim 302ff879b07SJung-uk Kim /* Dump the node specific data */ 303ff879b07SJung-uk Kim 304ff879b07SJung-uk Kim switch (IortNode->Type) 305ff879b07SJung-uk Kim { 306ff879b07SJung-uk Kim case ACPI_IORT_NODE_ITS_GROUP: 307ff879b07SJung-uk Kim 308ff879b07SJung-uk Kim /* Validate IortItsGroup to avoid compiler warnings */ 309ff879b07SJung-uk Kim 310ff879b07SJung-uk Kim if (IortItsGroup) 311ff879b07SJung-uk Kim { 312ff879b07SJung-uk Kim for (i = 0; i < IortItsGroup->ItsCount; i++) 313ff879b07SJung-uk Kim { 314ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 315ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 316ff879b07SJung-uk Kim 4, AcpiDmTableInfoIort0a); 317ff879b07SJung-uk Kim NodeOffset += 4; 318ff879b07SJung-uk Kim } 319ff879b07SJung-uk Kim } 320ff879b07SJung-uk Kim break; 321ff879b07SJung-uk Kim 322ff879b07SJung-uk Kim case ACPI_IORT_NODE_NAMED_COMPONENT: 323ff879b07SJung-uk Kim 324ff879b07SJung-uk Kim /* Dump the Padding (optional) */ 325ff879b07SJung-uk Kim 326ff879b07SJung-uk Kim if (IortNode->Length > NodeOffset) 327ff879b07SJung-uk Kim { 328ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 329ff879b07SJung-uk Kim Table, IortNode->Length - NodeOffset, 330ff879b07SJung-uk Kim AcpiDmTableInfoIort1a); 331ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 332ff879b07SJung-uk Kim { 333ff879b07SJung-uk Kim return; 334ff879b07SJung-uk Kim } 335ff879b07SJung-uk Kim } 336ff879b07SJung-uk Kim break; 337ff879b07SJung-uk Kim 338ff879b07SJung-uk Kim case ACPI_IORT_NODE_SMMU: 339ff879b07SJung-uk Kim 340ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 341ff879b07SJung-uk Kim 342ff879b07SJung-uk Kim /* Validate IortSmmu to avoid compiler warnings */ 343ff879b07SJung-uk Kim 344ff879b07SJung-uk Kim if (IortSmmu) 345ff879b07SJung-uk Kim { 346ff879b07SJung-uk Kim Length = 2 * sizeof (UINT64); 347ff879b07SJung-uk Kim NodeOffset = IortSmmu->GlobalInterruptOffset; 348ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 349ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 350ff879b07SJung-uk Kim Length, AcpiDmTableInfoIort3a); 351ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 352ff879b07SJung-uk Kim { 353ff879b07SJung-uk Kim return; 354ff879b07SJung-uk Kim } 355ff879b07SJung-uk Kim 356ff879b07SJung-uk Kim NodeOffset = IortSmmu->ContextInterruptOffset; 357ff879b07SJung-uk Kim for (i = 0; i < IortSmmu->ContextInterruptCount; i++) 358ff879b07SJung-uk Kim { 359ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 360ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 361ff879b07SJung-uk Kim 8, AcpiDmTableInfoIort3b); 362ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 363ff879b07SJung-uk Kim { 364ff879b07SJung-uk Kim return; 365ff879b07SJung-uk Kim } 366ff879b07SJung-uk Kim 367ff879b07SJung-uk Kim NodeOffset += 8; 368ff879b07SJung-uk Kim } 369ff879b07SJung-uk Kim 370ff879b07SJung-uk Kim NodeOffset = IortSmmu->PmuInterruptOffset; 371ff879b07SJung-uk Kim for (i = 0; i < IortSmmu->PmuInterruptCount; i++) 372ff879b07SJung-uk Kim { 373ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 374ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 375ff879b07SJung-uk Kim 8, AcpiDmTableInfoIort3c); 376ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 377ff879b07SJung-uk Kim { 378ff879b07SJung-uk Kim return; 379ff879b07SJung-uk Kim } 380ff879b07SJung-uk Kim 381ff879b07SJung-uk Kim NodeOffset += 8; 382ff879b07SJung-uk Kim } 383ff879b07SJung-uk Kim } 384ff879b07SJung-uk Kim break; 385ff879b07SJung-uk Kim 386ff879b07SJung-uk Kim default: 387ff879b07SJung-uk Kim 388ff879b07SJung-uk Kim break; 389ff879b07SJung-uk Kim } 390ff879b07SJung-uk Kim 391ff879b07SJung-uk Kim /* Dump the ID mappings */ 392ff879b07SJung-uk Kim 393ff879b07SJung-uk Kim NodeOffset = IortNode->MappingOffset; 394ff879b07SJung-uk Kim for (i = 0; i < IortNode->MappingCount; i++) 395ff879b07SJung-uk Kim { 396ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 397ff879b07SJung-uk Kim Length = sizeof (ACPI_IORT_ID_MAPPING); 398ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, 399ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 400ff879b07SJung-uk Kim Length, AcpiDmTableInfoIortMap); 401ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 402ff879b07SJung-uk Kim { 403ff879b07SJung-uk Kim return; 404ff879b07SJung-uk Kim } 405ff879b07SJung-uk Kim 406ff879b07SJung-uk Kim NodeOffset += Length; 407ff879b07SJung-uk Kim } 408ff879b07SJung-uk Kim 409ff879b07SJung-uk Kim NextSubtable: 410ff879b07SJung-uk Kim /* Point to next node subtable */ 411ff879b07SJung-uk Kim 412ff879b07SJung-uk Kim Offset += IortNode->Length; 413ff879b07SJung-uk Kim IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length); 414ff879b07SJung-uk Kim } 415ff879b07SJung-uk Kim } 416ff879b07SJung-uk Kim 417ff879b07SJung-uk Kim 418ff879b07SJung-uk Kim /******************************************************************************* 419ff879b07SJung-uk Kim * 420ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpIvrs 421ff879b07SJung-uk Kim * 422ff879b07SJung-uk Kim * PARAMETERS: Table - A IVRS table 423ff879b07SJung-uk Kim * 424ff879b07SJung-uk Kim * RETURN: None 425ff879b07SJung-uk Kim * 426ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a IVRS 427ff879b07SJung-uk Kim * 428ff879b07SJung-uk Kim ******************************************************************************/ 429ff879b07SJung-uk Kim 430ff879b07SJung-uk Kim static UINT8 EntrySizes[] = {4,8,16,32}; 431ff879b07SJung-uk Kim 432ff879b07SJung-uk Kim void 433ff879b07SJung-uk Kim AcpiDmDumpIvrs ( 434ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 435ff879b07SJung-uk Kim { 436ff879b07SJung-uk Kim ACPI_STATUS Status; 437ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_IVRS); 438ff879b07SJung-uk Kim UINT32 EntryOffset; 439ff879b07SJung-uk Kim UINT32 EntryLength; 440ff879b07SJung-uk Kim UINT32 EntryType; 441ff879b07SJung-uk Kim ACPI_IVRS_DE_HEADER *DeviceEntry; 442ff879b07SJung-uk Kim ACPI_IVRS_HEADER *Subtable; 443ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable; 444ff879b07SJung-uk Kim 445ff879b07SJung-uk Kim 446ff879b07SJung-uk Kim /* Main table */ 447ff879b07SJung-uk Kim 448ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs); 449ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 450ff879b07SJung-uk Kim { 451ff879b07SJung-uk Kim return; 452ff879b07SJung-uk Kim } 453ff879b07SJung-uk Kim 454ff879b07SJung-uk Kim /* Subtables */ 455ff879b07SJung-uk Kim 456ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset); 457ff879b07SJung-uk Kim while (Offset < Table->Length) 458ff879b07SJung-uk Kim { 459ff879b07SJung-uk Kim /* Common subtable header */ 460ff879b07SJung-uk Kim 461ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 462ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 463ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoIvrsHdr); 464ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 465ff879b07SJung-uk Kim { 466ff879b07SJung-uk Kim return; 467ff879b07SJung-uk Kim } 468ff879b07SJung-uk Kim 469ff879b07SJung-uk Kim switch (Subtable->Type) 470ff879b07SJung-uk Kim { 471ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_HARDWARE: 472ff879b07SJung-uk Kim 473ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIvrs0; 474ff879b07SJung-uk Kim break; 475ff879b07SJung-uk Kim 476ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_MEMORY1: 477ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_MEMORY2: 478ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_MEMORY3: 479ff879b07SJung-uk Kim 480ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIvrs1; 481ff879b07SJung-uk Kim break; 482ff879b07SJung-uk Kim 483ff879b07SJung-uk Kim default: 484ff879b07SJung-uk Kim 485ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n", 486ff879b07SJung-uk Kim Subtable->Type); 487ff879b07SJung-uk Kim 488ff879b07SJung-uk Kim /* Attempt to continue */ 489ff879b07SJung-uk Kim 490ff879b07SJung-uk Kim if (!Subtable->Length) 491ff879b07SJung-uk Kim { 492ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid zero length subtable\n"); 493ff879b07SJung-uk Kim return; 494ff879b07SJung-uk Kim } 495ff879b07SJung-uk Kim goto NextSubtable; 496ff879b07SJung-uk Kim } 497ff879b07SJung-uk Kim 498ff879b07SJung-uk Kim /* Dump the subtable */ 499ff879b07SJung-uk Kim 500ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 501ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 502ff879b07SJung-uk Kim Subtable->Length, InfoTable); 503ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 504ff879b07SJung-uk Kim { 505ff879b07SJung-uk Kim return; 506ff879b07SJung-uk Kim } 507ff879b07SJung-uk Kim 508ff879b07SJung-uk Kim /* The hardware subtable can contain multiple device entries */ 509ff879b07SJung-uk Kim 510ff879b07SJung-uk Kim if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE) 511ff879b07SJung-uk Kim { 512ff879b07SJung-uk Kim EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE); 513ff879b07SJung-uk Kim DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable, 514ff879b07SJung-uk Kim sizeof (ACPI_IVRS_HARDWARE)); 515ff879b07SJung-uk Kim 516ff879b07SJung-uk Kim while (EntryOffset < (Offset + Subtable->Length)) 517ff879b07SJung-uk Kim { 518ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 519ff879b07SJung-uk Kim /* 520ff879b07SJung-uk Kim * Upper 2 bits of Type encode the length of the device entry 521ff879b07SJung-uk Kim * 522ff879b07SJung-uk Kim * 00 = 4 byte 523ff879b07SJung-uk Kim * 01 = 8 byte 524ff879b07SJung-uk Kim * 10 = 16 byte - currently no entries defined 525ff879b07SJung-uk Kim * 11 = 32 byte - currently no entries defined 526ff879b07SJung-uk Kim */ 527ff879b07SJung-uk Kim EntryType = DeviceEntry->Type; 528ff879b07SJung-uk Kim EntryLength = EntrySizes [EntryType >> 6]; 529ff879b07SJung-uk Kim 530ff879b07SJung-uk Kim switch (EntryType) 531ff879b07SJung-uk Kim { 532ff879b07SJung-uk Kim /* 4-byte device entries */ 533ff879b07SJung-uk Kim 534ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_PAD4: 535ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_ALL: 536ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_SELECT: 537ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_START: 538ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_END: 539ff879b07SJung-uk Kim 540ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIvrs4; 541ff879b07SJung-uk Kim break; 542ff879b07SJung-uk Kim 543ff879b07SJung-uk Kim /* 8-byte entries, type A */ 544ff879b07SJung-uk Kim 545ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_ALIAS_SELECT: 546ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_ALIAS_START: 547ff879b07SJung-uk Kim 548ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIvrs8a; 549ff879b07SJung-uk Kim break; 550ff879b07SJung-uk Kim 551ff879b07SJung-uk Kim /* 8-byte entries, type B */ 552ff879b07SJung-uk Kim 553ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_PAD8: 554ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_EXT_SELECT: 555ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_EXT_START: 556ff879b07SJung-uk Kim 557ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIvrs8b; 558ff879b07SJung-uk Kim break; 559ff879b07SJung-uk Kim 560ff879b07SJung-uk Kim /* 8-byte entries, type C */ 561ff879b07SJung-uk Kim 562ff879b07SJung-uk Kim case ACPI_IVRS_TYPE_SPECIAL: 563ff879b07SJung-uk Kim 564ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIvrs8c; 565ff879b07SJung-uk Kim break; 566ff879b07SJung-uk Kim 567ff879b07SJung-uk Kim default: 568ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoIvrs4; 569ff879b07SJung-uk Kim AcpiOsPrintf ( 570ff879b07SJung-uk Kim "\n**** Unknown IVRS device entry type/length: " 571ff879b07SJung-uk Kim "0x%.2X/0x%X at offset 0x%.4X: (header below)\n", 572ff879b07SJung-uk Kim EntryType, EntryLength, EntryOffset); 573ff879b07SJung-uk Kim break; 574ff879b07SJung-uk Kim } 575ff879b07SJung-uk Kim 576ff879b07SJung-uk Kim /* Dump the Device Entry */ 577ff879b07SJung-uk Kim 578ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, EntryOffset, 579ff879b07SJung-uk Kim DeviceEntry, EntryLength, InfoTable); 580ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 581ff879b07SJung-uk Kim { 582ff879b07SJung-uk Kim return; 583ff879b07SJung-uk Kim } 584ff879b07SJung-uk Kim 585ff879b07SJung-uk Kim EntryOffset += EntryLength; 586ff879b07SJung-uk Kim DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry, 587ff879b07SJung-uk Kim EntryLength); 588ff879b07SJung-uk Kim } 589ff879b07SJung-uk Kim } 590ff879b07SJung-uk Kim 591ff879b07SJung-uk Kim NextSubtable: 592ff879b07SJung-uk Kim /* Point to next subtable */ 593ff879b07SJung-uk Kim 594ff879b07SJung-uk Kim Offset += Subtable->Length; 595ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length); 596ff879b07SJung-uk Kim } 597ff879b07SJung-uk Kim } 598ff879b07SJung-uk Kim 599ff879b07SJung-uk Kim 600ff879b07SJung-uk Kim /******************************************************************************* 601ff879b07SJung-uk Kim * 602ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpLpit 603ff879b07SJung-uk Kim * 604ff879b07SJung-uk Kim * PARAMETERS: Table - A LPIT table 605ff879b07SJung-uk Kim * 606ff879b07SJung-uk Kim * RETURN: None 607ff879b07SJung-uk Kim * 608ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a LPIT. This table type consists 609ff879b07SJung-uk Kim * of an open-ended number of subtables. Note: There are no 610ff879b07SJung-uk Kim * entries in the main table. An LPIT consists of the table 611ff879b07SJung-uk Kim * header and then subtables only. 612ff879b07SJung-uk Kim * 613ff879b07SJung-uk Kim ******************************************************************************/ 614ff879b07SJung-uk Kim 615ff879b07SJung-uk Kim void 616ff879b07SJung-uk Kim AcpiDmDumpLpit ( 617ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 618ff879b07SJung-uk Kim { 619ff879b07SJung-uk Kim ACPI_STATUS Status; 620ff879b07SJung-uk Kim ACPI_LPIT_HEADER *Subtable; 621ff879b07SJung-uk Kim UINT32 Length = Table->Length; 622ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_LPIT); 623ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable; 624ff879b07SJung-uk Kim UINT32 SubtableLength; 625ff879b07SJung-uk Kim 626ff879b07SJung-uk Kim 627ff879b07SJung-uk Kim /* Subtables */ 628ff879b07SJung-uk Kim 629ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset); 630ff879b07SJung-uk Kim while (Offset < Table->Length) 631ff879b07SJung-uk Kim { 632ff879b07SJung-uk Kim /* Common subtable header */ 633ff879b07SJung-uk Kim 634ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable, 635ff879b07SJung-uk Kim sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr); 636ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 637ff879b07SJung-uk Kim { 638ff879b07SJung-uk Kim return; 639ff879b07SJung-uk Kim } 640ff879b07SJung-uk Kim 641ff879b07SJung-uk Kim switch (Subtable->Type) 642ff879b07SJung-uk Kim { 643ff879b07SJung-uk Kim case ACPI_LPIT_TYPE_NATIVE_CSTATE: 644ff879b07SJung-uk Kim 645ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoLpit0; 646ff879b07SJung-uk Kim SubtableLength = sizeof (ACPI_LPIT_NATIVE); 647ff879b07SJung-uk Kim break; 648ff879b07SJung-uk Kim 649ff879b07SJung-uk Kim default: 650ff879b07SJung-uk Kim 651ff879b07SJung-uk Kim /* Cannot continue on unknown type - no length */ 652ff879b07SJung-uk Kim 653ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n", 654ff879b07SJung-uk Kim Subtable->Type); 655ff879b07SJung-uk Kim return; 656ff879b07SJung-uk Kim } 657ff879b07SJung-uk Kim 658ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable, 659ff879b07SJung-uk Kim SubtableLength, InfoTable); 660ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 661ff879b07SJung-uk Kim { 662ff879b07SJung-uk Kim return; 663ff879b07SJung-uk Kim } 664ff879b07SJung-uk Kim 665ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 666ff879b07SJung-uk Kim 667ff879b07SJung-uk Kim /* Point to next subtable */ 668ff879b07SJung-uk Kim 669ff879b07SJung-uk Kim Offset += SubtableLength; 670ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Subtable, SubtableLength); 671ff879b07SJung-uk Kim } 672ff879b07SJung-uk Kim } 673ff879b07SJung-uk Kim 674ff879b07SJung-uk Kim 675ff879b07SJung-uk Kim /******************************************************************************* 676ff879b07SJung-uk Kim * 677ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpMadt 678ff879b07SJung-uk Kim * 679ff879b07SJung-uk Kim * PARAMETERS: Table - A MADT table 680ff879b07SJung-uk Kim * 681ff879b07SJung-uk Kim * RETURN: None 682ff879b07SJung-uk Kim * 683ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a MADT. This table type consists 684ff879b07SJung-uk Kim * of an open-ended number of subtables. 685ff879b07SJung-uk Kim * 686ff879b07SJung-uk Kim ******************************************************************************/ 687ff879b07SJung-uk Kim 688ff879b07SJung-uk Kim void 689ff879b07SJung-uk Kim AcpiDmDumpMadt ( 690ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 691ff879b07SJung-uk Kim { 692ff879b07SJung-uk Kim ACPI_STATUS Status; 693ff879b07SJung-uk Kim ACPI_SUBTABLE_HEADER *Subtable; 694ff879b07SJung-uk Kim UINT32 Length = Table->Length; 695ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_MADT); 696ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable; 697ff879b07SJung-uk Kim 698ff879b07SJung-uk Kim 699ff879b07SJung-uk Kim /* Main table */ 700ff879b07SJung-uk Kim 701ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt); 702ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 703ff879b07SJung-uk Kim { 704ff879b07SJung-uk Kim return; 705ff879b07SJung-uk Kim } 706ff879b07SJung-uk Kim 707ff879b07SJung-uk Kim /* Subtables */ 708ff879b07SJung-uk Kim 709ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); 710ff879b07SJung-uk Kim while (Offset < Table->Length) 711ff879b07SJung-uk Kim { 712ff879b07SJung-uk Kim /* Common subtable header */ 713ff879b07SJung-uk Kim 714ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 715ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable, 716ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoMadtHdr); 717ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 718ff879b07SJung-uk Kim { 719ff879b07SJung-uk Kim return; 720ff879b07SJung-uk Kim } 721ff879b07SJung-uk Kim 722ff879b07SJung-uk Kim switch (Subtable->Type) 723ff879b07SJung-uk Kim { 724ff879b07SJung-uk Kim case ACPI_MADT_TYPE_LOCAL_APIC: 725ff879b07SJung-uk Kim 726ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt0; 727ff879b07SJung-uk Kim break; 728ff879b07SJung-uk Kim 729ff879b07SJung-uk Kim case ACPI_MADT_TYPE_IO_APIC: 730ff879b07SJung-uk Kim 731ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt1; 732ff879b07SJung-uk Kim break; 733ff879b07SJung-uk Kim 734ff879b07SJung-uk Kim case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE: 735ff879b07SJung-uk Kim 736ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt2; 737ff879b07SJung-uk Kim break; 738ff879b07SJung-uk Kim 739ff879b07SJung-uk Kim case ACPI_MADT_TYPE_NMI_SOURCE: 740ff879b07SJung-uk Kim 741ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt3; 742ff879b07SJung-uk Kim break; 743ff879b07SJung-uk Kim 744ff879b07SJung-uk Kim case ACPI_MADT_TYPE_LOCAL_APIC_NMI: 745ff879b07SJung-uk Kim 746ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt4; 747ff879b07SJung-uk Kim break; 748ff879b07SJung-uk Kim 749ff879b07SJung-uk Kim case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE: 750ff879b07SJung-uk Kim 751ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt5; 752ff879b07SJung-uk Kim break; 753ff879b07SJung-uk Kim 754ff879b07SJung-uk Kim case ACPI_MADT_TYPE_IO_SAPIC: 755ff879b07SJung-uk Kim 756ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt6; 757ff879b07SJung-uk Kim break; 758ff879b07SJung-uk Kim 759ff879b07SJung-uk Kim case ACPI_MADT_TYPE_LOCAL_SAPIC: 760ff879b07SJung-uk Kim 761ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt7; 762ff879b07SJung-uk Kim break; 763ff879b07SJung-uk Kim 764ff879b07SJung-uk Kim case ACPI_MADT_TYPE_INTERRUPT_SOURCE: 765ff879b07SJung-uk Kim 766ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt8; 767ff879b07SJung-uk Kim break; 768ff879b07SJung-uk Kim 769ff879b07SJung-uk Kim case ACPI_MADT_TYPE_LOCAL_X2APIC: 770ff879b07SJung-uk Kim 771ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt9; 772ff879b07SJung-uk Kim break; 773ff879b07SJung-uk Kim 774ff879b07SJung-uk Kim case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: 775ff879b07SJung-uk Kim 776ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt10; 777ff879b07SJung-uk Kim break; 778ff879b07SJung-uk Kim 779ff879b07SJung-uk Kim case ACPI_MADT_TYPE_GENERIC_INTERRUPT: 780ff879b07SJung-uk Kim 781ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt11; 782ff879b07SJung-uk Kim break; 783ff879b07SJung-uk Kim 784ff879b07SJung-uk Kim case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR: 785ff879b07SJung-uk Kim 786ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt12; 787ff879b07SJung-uk Kim break; 788ff879b07SJung-uk Kim 789ff879b07SJung-uk Kim case ACPI_MADT_TYPE_GENERIC_MSI_FRAME: 790ff879b07SJung-uk Kim 791ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt13; 792ff879b07SJung-uk Kim break; 793ff879b07SJung-uk Kim 794ff879b07SJung-uk Kim case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR: 795ff879b07SJung-uk Kim 796ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt14; 797ff879b07SJung-uk Kim break; 798ff879b07SJung-uk Kim 799ff879b07SJung-uk Kim case ACPI_MADT_TYPE_GENERIC_TRANSLATOR: 800ff879b07SJung-uk Kim 801ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoMadt15; 802ff879b07SJung-uk Kim break; 803ff879b07SJung-uk Kim 804ff879b07SJung-uk Kim default: 805ff879b07SJung-uk Kim 806ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n", 807ff879b07SJung-uk Kim Subtable->Type); 808ff879b07SJung-uk Kim 809ff879b07SJung-uk Kim /* Attempt to continue */ 810ff879b07SJung-uk Kim 811ff879b07SJung-uk Kim if (!Subtable->Length) 812ff879b07SJung-uk Kim { 813ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid zero length subtable\n"); 814ff879b07SJung-uk Kim return; 815ff879b07SJung-uk Kim } 816ff879b07SJung-uk Kim 817ff879b07SJung-uk Kim goto NextSubtable; 818ff879b07SJung-uk Kim } 819ff879b07SJung-uk Kim 820ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable, 821ff879b07SJung-uk Kim Subtable->Length, InfoTable); 822ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 823ff879b07SJung-uk Kim { 824ff879b07SJung-uk Kim return; 825ff879b07SJung-uk Kim } 826ff879b07SJung-uk Kim 827ff879b07SJung-uk Kim NextSubtable: 828ff879b07SJung-uk Kim /* Point to next subtable */ 829ff879b07SJung-uk Kim 830ff879b07SJung-uk Kim Offset += Subtable->Length; 831ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, 832ff879b07SJung-uk Kim Subtable->Length); 833ff879b07SJung-uk Kim } 834ff879b07SJung-uk Kim } 835ff879b07SJung-uk Kim 836ff879b07SJung-uk Kim 837ff879b07SJung-uk Kim /******************************************************************************* 838ff879b07SJung-uk Kim * 839ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpMcfg 840ff879b07SJung-uk Kim * 841ff879b07SJung-uk Kim * PARAMETERS: Table - A MCFG Table 842ff879b07SJung-uk Kim * 843ff879b07SJung-uk Kim * RETURN: None 844ff879b07SJung-uk Kim * 845ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a MCFG table 846ff879b07SJung-uk Kim * 847ff879b07SJung-uk Kim ******************************************************************************/ 848ff879b07SJung-uk Kim 849ff879b07SJung-uk Kim void 850ff879b07SJung-uk Kim AcpiDmDumpMcfg ( 851ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 852ff879b07SJung-uk Kim { 853ff879b07SJung-uk Kim ACPI_STATUS Status; 854ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_MCFG); 855ff879b07SJung-uk Kim ACPI_MCFG_ALLOCATION *Subtable; 856ff879b07SJung-uk Kim 857ff879b07SJung-uk Kim 858ff879b07SJung-uk Kim /* Main table */ 859ff879b07SJung-uk Kim 860ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg); 861ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 862ff879b07SJung-uk Kim { 863ff879b07SJung-uk Kim return; 864ff879b07SJung-uk Kim } 865ff879b07SJung-uk Kim 866ff879b07SJung-uk Kim /* Subtables */ 867ff879b07SJung-uk Kim 868ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset); 869ff879b07SJung-uk Kim while (Offset < Table->Length) 870ff879b07SJung-uk Kim { 871ff879b07SJung-uk Kim if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length) 872ff879b07SJung-uk Kim { 873ff879b07SJung-uk Kim AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n", 874ff879b07SJung-uk Kim sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length)); 875ff879b07SJung-uk Kim return; 876ff879b07SJung-uk Kim } 877ff879b07SJung-uk Kim 878ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 879ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 880ff879b07SJung-uk Kim sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0); 881ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 882ff879b07SJung-uk Kim { 883ff879b07SJung-uk Kim return; 884ff879b07SJung-uk Kim } 885ff879b07SJung-uk Kim 886ff879b07SJung-uk Kim /* Point to next subtable (each subtable is of fixed length) */ 887ff879b07SJung-uk Kim 888ff879b07SJung-uk Kim Offset += sizeof (ACPI_MCFG_ALLOCATION); 889ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable, 890ff879b07SJung-uk Kim sizeof (ACPI_MCFG_ALLOCATION)); 891ff879b07SJung-uk Kim } 892ff879b07SJung-uk Kim } 893ff879b07SJung-uk Kim 894ff879b07SJung-uk Kim 895ff879b07SJung-uk Kim /******************************************************************************* 896ff879b07SJung-uk Kim * 897ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpMpst 898ff879b07SJung-uk Kim * 899ff879b07SJung-uk Kim * PARAMETERS: Table - A MPST Table 900ff879b07SJung-uk Kim * 901ff879b07SJung-uk Kim * RETURN: None 902ff879b07SJung-uk Kim * 903ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a MPST table 904ff879b07SJung-uk Kim * 905ff879b07SJung-uk Kim ******************************************************************************/ 906ff879b07SJung-uk Kim 907ff879b07SJung-uk Kim void 908ff879b07SJung-uk Kim AcpiDmDumpMpst ( 909ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 910ff879b07SJung-uk Kim { 911ff879b07SJung-uk Kim ACPI_STATUS Status; 912ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_MPST); 913ff879b07SJung-uk Kim ACPI_MPST_POWER_NODE *Subtable0; 914ff879b07SJung-uk Kim ACPI_MPST_POWER_STATE *Subtable0A; 915ff879b07SJung-uk Kim ACPI_MPST_COMPONENT *Subtable0B; 916ff879b07SJung-uk Kim ACPI_MPST_DATA_HDR *Subtable1; 917ff879b07SJung-uk Kim ACPI_MPST_POWER_DATA *Subtable2; 918ff879b07SJung-uk Kim UINT16 SubtableCount; 919ff879b07SJung-uk Kim UINT32 PowerStateCount; 920ff879b07SJung-uk Kim UINT32 ComponentCount; 921ff879b07SJung-uk Kim 922ff879b07SJung-uk Kim 923ff879b07SJung-uk Kim /* Main table */ 924ff879b07SJung-uk Kim 925ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst); 926ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 927ff879b07SJung-uk Kim { 928ff879b07SJung-uk Kim return; 929ff879b07SJung-uk Kim } 930ff879b07SJung-uk Kim 931ff879b07SJung-uk Kim /* Subtable: Memory Power Node(s) */ 932ff879b07SJung-uk Kim 933ff879b07SJung-uk Kim SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount; 934ff879b07SJung-uk Kim Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset); 935ff879b07SJung-uk Kim 936ff879b07SJung-uk Kim while ((Offset < Table->Length) && SubtableCount) 937ff879b07SJung-uk Kim { 938ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 939ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0, 940ff879b07SJung-uk Kim sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0); 941ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 942ff879b07SJung-uk Kim { 943ff879b07SJung-uk Kim return; 944ff879b07SJung-uk Kim } 945ff879b07SJung-uk Kim 946ff879b07SJung-uk Kim /* Extract the sub-subtable counts */ 947ff879b07SJung-uk Kim 948ff879b07SJung-uk Kim PowerStateCount = Subtable0->NumPowerStates; 949ff879b07SJung-uk Kim ComponentCount = Subtable0->NumPhysicalComponents; 950ff879b07SJung-uk Kim Offset += sizeof (ACPI_MPST_POWER_NODE); 951ff879b07SJung-uk Kim 952ff879b07SJung-uk Kim /* Sub-subtables - Memory Power State Structure(s) */ 953ff879b07SJung-uk Kim 954ff879b07SJung-uk Kim Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0, 955ff879b07SJung-uk Kim sizeof (ACPI_MPST_POWER_NODE)); 956ff879b07SJung-uk Kim 957ff879b07SJung-uk Kim while (PowerStateCount) 958ff879b07SJung-uk Kim { 959ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 960ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A, 961ff879b07SJung-uk Kim sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A); 962ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 963ff879b07SJung-uk Kim { 964ff879b07SJung-uk Kim return; 965ff879b07SJung-uk Kim } 966ff879b07SJung-uk Kim 967ff879b07SJung-uk Kim Subtable0A++; 968ff879b07SJung-uk Kim PowerStateCount--; 969ff879b07SJung-uk Kim Offset += sizeof (ACPI_MPST_POWER_STATE); 970ff879b07SJung-uk Kim } 971ff879b07SJung-uk Kim 972ff879b07SJung-uk Kim /* Sub-subtables - Physical Component ID Structure(s) */ 973ff879b07SJung-uk Kim 974ff879b07SJung-uk Kim Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A); 975ff879b07SJung-uk Kim 976ff879b07SJung-uk Kim if (ComponentCount) 977ff879b07SJung-uk Kim { 978ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 979ff879b07SJung-uk Kim } 980ff879b07SJung-uk Kim 981ff879b07SJung-uk Kim while (ComponentCount) 982ff879b07SJung-uk Kim { 983ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B, 984ff879b07SJung-uk Kim sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B); 985ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 986ff879b07SJung-uk Kim { 987ff879b07SJung-uk Kim return; 988ff879b07SJung-uk Kim } 989ff879b07SJung-uk Kim 990ff879b07SJung-uk Kim Subtable0B++; 991ff879b07SJung-uk Kim ComponentCount--; 992ff879b07SJung-uk Kim Offset += sizeof (ACPI_MPST_COMPONENT); 993ff879b07SJung-uk Kim } 994ff879b07SJung-uk Kim 995ff879b07SJung-uk Kim /* Point to next Memory Power Node subtable */ 996ff879b07SJung-uk Kim 997ff879b07SJung-uk Kim SubtableCount--; 998ff879b07SJung-uk Kim Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0, 999ff879b07SJung-uk Kim sizeof (ACPI_MPST_POWER_NODE) + 1000ff879b07SJung-uk Kim (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) + 1001ff879b07SJung-uk Kim (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents)); 1002ff879b07SJung-uk Kim } 1003ff879b07SJung-uk Kim 1004ff879b07SJung-uk Kim /* Subtable: Count of Memory Power State Characteristic structures */ 1005ff879b07SJung-uk Kim 1006ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1007ff879b07SJung-uk Kim Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0); 1008ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1, 1009ff879b07SJung-uk Kim sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1); 1010ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1011ff879b07SJung-uk Kim { 1012ff879b07SJung-uk Kim return; 1013ff879b07SJung-uk Kim } 1014ff879b07SJung-uk Kim 1015ff879b07SJung-uk Kim SubtableCount = Subtable1->CharacteristicsCount; 1016ff879b07SJung-uk Kim Offset += sizeof (ACPI_MPST_DATA_HDR); 1017ff879b07SJung-uk Kim 1018ff879b07SJung-uk Kim /* Subtable: Memory Power State Characteristics structure(s) */ 1019ff879b07SJung-uk Kim 1020ff879b07SJung-uk Kim Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1, 1021ff879b07SJung-uk Kim sizeof (ACPI_MPST_DATA_HDR)); 1022ff879b07SJung-uk Kim 1023ff879b07SJung-uk Kim while ((Offset < Table->Length) && SubtableCount) 1024ff879b07SJung-uk Kim { 1025ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1026ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2, 1027ff879b07SJung-uk Kim sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2); 1028ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1029ff879b07SJung-uk Kim { 1030ff879b07SJung-uk Kim return; 1031ff879b07SJung-uk Kim } 1032ff879b07SJung-uk Kim 1033ff879b07SJung-uk Kim Subtable2++; 1034ff879b07SJung-uk Kim SubtableCount--; 1035ff879b07SJung-uk Kim Offset += sizeof (ACPI_MPST_POWER_DATA); 1036ff879b07SJung-uk Kim } 1037ff879b07SJung-uk Kim } 1038ff879b07SJung-uk Kim 1039ff879b07SJung-uk Kim 1040ff879b07SJung-uk Kim /******************************************************************************* 1041ff879b07SJung-uk Kim * 1042ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpMsct 1043ff879b07SJung-uk Kim * 1044ff879b07SJung-uk Kim * PARAMETERS: Table - A MSCT table 1045ff879b07SJung-uk Kim * 1046ff879b07SJung-uk Kim * RETURN: None 1047ff879b07SJung-uk Kim * 1048ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a MSCT 1049ff879b07SJung-uk Kim * 1050ff879b07SJung-uk Kim ******************************************************************************/ 1051ff879b07SJung-uk Kim 1052ff879b07SJung-uk Kim void 1053ff879b07SJung-uk Kim AcpiDmDumpMsct ( 1054ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 1055ff879b07SJung-uk Kim { 1056ff879b07SJung-uk Kim ACPI_STATUS Status; 1057ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_MSCT); 1058ff879b07SJung-uk Kim ACPI_MSCT_PROXIMITY *Subtable; 1059ff879b07SJung-uk Kim 1060ff879b07SJung-uk Kim 1061ff879b07SJung-uk Kim /* Main table */ 1062ff879b07SJung-uk Kim 1063ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct); 1064ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1065ff879b07SJung-uk Kim { 1066ff879b07SJung-uk Kim return; 1067ff879b07SJung-uk Kim } 1068ff879b07SJung-uk Kim 1069ff879b07SJung-uk Kim /* Subtables */ 1070ff879b07SJung-uk Kim 1071ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset); 1072ff879b07SJung-uk Kim while (Offset < Table->Length) 1073ff879b07SJung-uk Kim { 1074ff879b07SJung-uk Kim /* Common subtable header */ 1075ff879b07SJung-uk Kim 1076ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1077ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1078ff879b07SJung-uk Kim sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0); 1079ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1080ff879b07SJung-uk Kim { 1081ff879b07SJung-uk Kim return; 1082ff879b07SJung-uk Kim } 1083ff879b07SJung-uk Kim 1084ff879b07SJung-uk Kim /* Point to next subtable */ 1085ff879b07SJung-uk Kim 1086ff879b07SJung-uk Kim Offset += sizeof (ACPI_MSCT_PROXIMITY); 1087ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable, 1088ff879b07SJung-uk Kim sizeof (ACPI_MSCT_PROXIMITY)); 1089ff879b07SJung-uk Kim } 1090ff879b07SJung-uk Kim } 1091ff879b07SJung-uk Kim 1092ff879b07SJung-uk Kim 1093ff879b07SJung-uk Kim /******************************************************************************* 1094ff879b07SJung-uk Kim * 1095ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpMtmr 1096ff879b07SJung-uk Kim * 1097ff879b07SJung-uk Kim * PARAMETERS: Table - A MTMR table 1098ff879b07SJung-uk Kim * 1099ff879b07SJung-uk Kim * RETURN: None 1100ff879b07SJung-uk Kim * 1101ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a MTMR 1102ff879b07SJung-uk Kim * 1103ff879b07SJung-uk Kim ******************************************************************************/ 1104ff879b07SJung-uk Kim 1105ff879b07SJung-uk Kim void 1106ff879b07SJung-uk Kim AcpiDmDumpMtmr ( 1107ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 1108ff879b07SJung-uk Kim { 1109ff879b07SJung-uk Kim ACPI_STATUS Status; 1110ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_MTMR); 1111ff879b07SJung-uk Kim ACPI_MTMR_ENTRY *Subtable; 1112ff879b07SJung-uk Kim 1113ff879b07SJung-uk Kim 1114ff879b07SJung-uk Kim /* Main table */ 1115ff879b07SJung-uk Kim 1116ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr); 1117ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1118ff879b07SJung-uk Kim { 1119ff879b07SJung-uk Kim return; 1120ff879b07SJung-uk Kim } 1121ff879b07SJung-uk Kim 1122ff879b07SJung-uk Kim /* Subtables */ 1123ff879b07SJung-uk Kim 1124ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset); 1125ff879b07SJung-uk Kim while (Offset < Table->Length) 1126ff879b07SJung-uk Kim { 1127ff879b07SJung-uk Kim /* Common subtable header */ 1128ff879b07SJung-uk Kim 1129ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1130ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1131ff879b07SJung-uk Kim sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0); 1132ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1133ff879b07SJung-uk Kim { 1134ff879b07SJung-uk Kim return; 1135ff879b07SJung-uk Kim } 1136ff879b07SJung-uk Kim 1137ff879b07SJung-uk Kim /* Point to next subtable */ 1138ff879b07SJung-uk Kim 1139ff879b07SJung-uk Kim Offset += sizeof (ACPI_MTMR_ENTRY); 1140ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Subtable, 1141ff879b07SJung-uk Kim sizeof (ACPI_MTMR_ENTRY)); 1142ff879b07SJung-uk Kim } 1143ff879b07SJung-uk Kim } 1144ff879b07SJung-uk Kim 1145ff879b07SJung-uk Kim 1146ff879b07SJung-uk Kim /******************************************************************************* 1147ff879b07SJung-uk Kim * 1148ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpNfit 1149ff879b07SJung-uk Kim * 1150ff879b07SJung-uk Kim * PARAMETERS: Table - A NFIT table 1151ff879b07SJung-uk Kim * 1152ff879b07SJung-uk Kim * RETURN: None 1153ff879b07SJung-uk Kim * 1154ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of an NFIT. 1155ff879b07SJung-uk Kim * 1156ff879b07SJung-uk Kim ******************************************************************************/ 1157ff879b07SJung-uk Kim 1158ff879b07SJung-uk Kim void 1159ff879b07SJung-uk Kim AcpiDmDumpNfit ( 1160ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 1161ff879b07SJung-uk Kim { 1162ff879b07SJung-uk Kim ACPI_STATUS Status; 1163ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_NFIT); 1164ff879b07SJung-uk Kim UINT32 FieldOffset = 0; 1165ff879b07SJung-uk Kim UINT32 Length; 1166ff879b07SJung-uk Kim ACPI_NFIT_HEADER *Subtable; 1167ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable; 1168ff879b07SJung-uk Kim ACPI_NFIT_INTERLEAVE *Interleave = NULL; 1169ff879b07SJung-uk Kim ACPI_NFIT_SMBIOS *SmbiosInfo = NULL; 1170ff879b07SJung-uk Kim ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL; 1171ff879b07SJung-uk Kim UINT32 i; 1172ff879b07SJung-uk Kim 1173ff879b07SJung-uk Kim 1174ff879b07SJung-uk Kim /* Main table */ 1175ff879b07SJung-uk Kim 1176ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit); 1177ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1178ff879b07SJung-uk Kim { 1179ff879b07SJung-uk Kim return; 1180ff879b07SJung-uk Kim } 1181ff879b07SJung-uk Kim 1182ff879b07SJung-uk Kim /* Subtables */ 1183ff879b07SJung-uk Kim 1184ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset); 1185ff879b07SJung-uk Kim while (Offset < Table->Length) 1186ff879b07SJung-uk Kim { 1187ff879b07SJung-uk Kim /* NFIT subtable header */ 1188ff879b07SJung-uk Kim 1189ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1190ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1191ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoNfitHdr); 1192ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1193ff879b07SJung-uk Kim { 1194ff879b07SJung-uk Kim return; 1195ff879b07SJung-uk Kim } 1196ff879b07SJung-uk Kim 1197ff879b07SJung-uk Kim switch (Subtable->Type) 1198ff879b07SJung-uk Kim { 1199ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_SYSTEM_ADDRESS: 1200ff879b07SJung-uk Kim 1201ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit0; 1202ff879b07SJung-uk Kim break; 1203ff879b07SJung-uk Kim 1204ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_MEMORY_MAP: 1205ff879b07SJung-uk Kim 1206ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit1; 1207ff879b07SJung-uk Kim break; 1208ff879b07SJung-uk Kim 1209ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_INTERLEAVE: 1210ff879b07SJung-uk Kim 1211ff879b07SJung-uk Kim /* Has a variable number of 32-bit values at the end */ 1212ff879b07SJung-uk Kim 1213ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit2; 1214ff879b07SJung-uk Kim Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable); 1215ff879b07SJung-uk Kim FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE); 1216ff879b07SJung-uk Kim break; 1217ff879b07SJung-uk Kim 1218ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_SMBIOS: 1219ff879b07SJung-uk Kim 1220ff879b07SJung-uk Kim SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable); 1221ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit3; 1222ff879b07SJung-uk Kim break; 1223ff879b07SJung-uk Kim 1224ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_CONTROL_REGION: 1225ff879b07SJung-uk Kim 1226ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit4; 1227ff879b07SJung-uk Kim break; 1228ff879b07SJung-uk Kim 1229ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_DATA_REGION: 1230ff879b07SJung-uk Kim 1231ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit5; 1232ff879b07SJung-uk Kim break; 1233ff879b07SJung-uk Kim 1234ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_FLUSH_ADDRESS: 1235ff879b07SJung-uk Kim 1236ff879b07SJung-uk Kim /* Has a variable number of 64-bit addresses at the end */ 1237ff879b07SJung-uk Kim 1238ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit6; 1239ff879b07SJung-uk Kim Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable); 1240ff879b07SJung-uk Kim FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64); 1241ff879b07SJung-uk Kim break; 1242ff879b07SJung-uk Kim 1243ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_CAPABILITIES: /* ACPI 6.0A */ 1244ff879b07SJung-uk Kim 1245ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoNfit7; 1246ff879b07SJung-uk Kim break; 1247ff879b07SJung-uk Kim 1248ff879b07SJung-uk Kim default: 1249ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n", 1250ff879b07SJung-uk Kim Subtable->Type); 1251ff879b07SJung-uk Kim 1252ff879b07SJung-uk Kim /* Attempt to continue */ 1253ff879b07SJung-uk Kim 1254ff879b07SJung-uk Kim if (!Subtable->Length) 1255ff879b07SJung-uk Kim { 1256ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid zero length subtable\n"); 1257ff879b07SJung-uk Kim return; 1258ff879b07SJung-uk Kim } 1259ff879b07SJung-uk Kim goto NextSubtable; 1260ff879b07SJung-uk Kim } 1261ff879b07SJung-uk Kim 1262ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1263ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1264ff879b07SJung-uk Kim Subtable->Length, InfoTable); 1265ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1266ff879b07SJung-uk Kim { 1267ff879b07SJung-uk Kim return; 1268ff879b07SJung-uk Kim } 1269ff879b07SJung-uk Kim 1270ff879b07SJung-uk Kim /* Per-subtable variable-length fields */ 1271ff879b07SJung-uk Kim 1272ff879b07SJung-uk Kim switch (Subtable->Type) 1273ff879b07SJung-uk Kim { 1274ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_INTERLEAVE: 1275ff879b07SJung-uk Kim 1276ff879b07SJung-uk Kim for (i = 0; i < Interleave->LineCount; i++) 1277ff879b07SJung-uk Kim { 1278ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, 1279ff879b07SJung-uk Kim &Interleave->LineOffset[i], 1280ff879b07SJung-uk Kim sizeof (UINT32), AcpiDmTableInfoNfit2a); 1281ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1282ff879b07SJung-uk Kim { 1283ff879b07SJung-uk Kim return; 1284ff879b07SJung-uk Kim } 1285ff879b07SJung-uk Kim 1286ff879b07SJung-uk Kim FieldOffset += sizeof (UINT32); 1287ff879b07SJung-uk Kim } 1288ff879b07SJung-uk Kim break; 1289ff879b07SJung-uk Kim 1290ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_SMBIOS: 1291ff879b07SJung-uk Kim 1292ff879b07SJung-uk Kim Length = Subtable->Length - 1293ff879b07SJung-uk Kim sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8); 1294ff879b07SJung-uk Kim 1295ff879b07SJung-uk Kim if (Length) 1296ff879b07SJung-uk Kim { 1297ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 1298ff879b07SJung-uk Kim sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8), 1299ff879b07SJung-uk Kim SmbiosInfo, 1300ff879b07SJung-uk Kim Length, AcpiDmTableInfoNfit3a); 1301ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1302ff879b07SJung-uk Kim { 1303ff879b07SJung-uk Kim return; 1304ff879b07SJung-uk Kim } 1305ff879b07SJung-uk Kim } 1306ff879b07SJung-uk Kim 1307ff879b07SJung-uk Kim break; 1308ff879b07SJung-uk Kim 1309ff879b07SJung-uk Kim case ACPI_NFIT_TYPE_FLUSH_ADDRESS: 1310ff879b07SJung-uk Kim 1311ff879b07SJung-uk Kim for (i = 0; i < Hint->HintCount; i++) 1312ff879b07SJung-uk Kim { 1313ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, 1314ff879b07SJung-uk Kim &Hint->HintAddress[i], 1315ff879b07SJung-uk Kim sizeof (UINT64), AcpiDmTableInfoNfit6a); 1316ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1317ff879b07SJung-uk Kim { 1318ff879b07SJung-uk Kim return; 1319ff879b07SJung-uk Kim } 1320ff879b07SJung-uk Kim 1321ff879b07SJung-uk Kim FieldOffset += sizeof (UINT64); 1322ff879b07SJung-uk Kim } 1323ff879b07SJung-uk Kim break; 1324ff879b07SJung-uk Kim 1325ff879b07SJung-uk Kim default: 1326ff879b07SJung-uk Kim break; 1327ff879b07SJung-uk Kim } 1328ff879b07SJung-uk Kim 1329ff879b07SJung-uk Kim NextSubtable: 1330ff879b07SJung-uk Kim /* Point to next subtable */ 1331ff879b07SJung-uk Kim 1332ff879b07SJung-uk Kim Offset += Subtable->Length; 1333ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length); 1334ff879b07SJung-uk Kim } 1335ff879b07SJung-uk Kim } 1336ff879b07SJung-uk Kim 1337ff879b07SJung-uk Kim 1338ff879b07SJung-uk Kim /******************************************************************************* 1339ff879b07SJung-uk Kim * 1340ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpPcct 1341ff879b07SJung-uk Kim * 1342ff879b07SJung-uk Kim * PARAMETERS: Table - A PCCT table 1343ff879b07SJung-uk Kim * 1344ff879b07SJung-uk Kim * RETURN: None 1345ff879b07SJung-uk Kim * 1346ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a PCCT. This table type consists 1347ff879b07SJung-uk Kim * of an open-ended number of subtables. 1348ff879b07SJung-uk Kim * 1349ff879b07SJung-uk Kim ******************************************************************************/ 1350ff879b07SJung-uk Kim 1351ff879b07SJung-uk Kim void 1352ff879b07SJung-uk Kim AcpiDmDumpPcct ( 1353ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 1354ff879b07SJung-uk Kim { 1355ff879b07SJung-uk Kim ACPI_STATUS Status; 1356ff879b07SJung-uk Kim ACPI_PCCT_SUBSPACE *Subtable; 1357ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable; 1358ff879b07SJung-uk Kim UINT32 Length = Table->Length; 1359ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_PCCT); 1360ff879b07SJung-uk Kim 1361ff879b07SJung-uk Kim 1362ff879b07SJung-uk Kim /* Main table */ 1363ff879b07SJung-uk Kim 1364ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct); 1365ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1366ff879b07SJung-uk Kim { 1367ff879b07SJung-uk Kim return; 1368ff879b07SJung-uk Kim } 1369ff879b07SJung-uk Kim 1370ff879b07SJung-uk Kim /* Subtables */ 1371ff879b07SJung-uk Kim 1372ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset); 1373ff879b07SJung-uk Kim while (Offset < Table->Length) 1374ff879b07SJung-uk Kim { 1375ff879b07SJung-uk Kim /* Common subtable header */ 1376ff879b07SJung-uk Kim 1377ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1378ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable, 1379ff879b07SJung-uk Kim Subtable->Header.Length, AcpiDmTableInfoPcctHdr); 1380ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1381ff879b07SJung-uk Kim { 1382ff879b07SJung-uk Kim return; 1383ff879b07SJung-uk Kim } 1384ff879b07SJung-uk Kim 1385ff879b07SJung-uk Kim switch (Subtable->Header.Type) 1386ff879b07SJung-uk Kim { 1387ff879b07SJung-uk Kim case ACPI_PCCT_TYPE_GENERIC_SUBSPACE: 1388ff879b07SJung-uk Kim 1389ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPcct0; 1390ff879b07SJung-uk Kim break; 1391ff879b07SJung-uk Kim 1392ff879b07SJung-uk Kim case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE: 1393ff879b07SJung-uk Kim 1394ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPcct1; 1395ff879b07SJung-uk Kim break; 1396ff879b07SJung-uk Kim 1397ff879b07SJung-uk Kim case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2: 1398ff879b07SJung-uk Kim 1399ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPcct2; 1400ff879b07SJung-uk Kim break; 1401ff879b07SJung-uk Kim 1402ff879b07SJung-uk Kim case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE: 1403ff879b07SJung-uk Kim 1404ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPcct3; 1405ff879b07SJung-uk Kim break; 1406ff879b07SJung-uk Kim 1407ff879b07SJung-uk Kim case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE: 1408ff879b07SJung-uk Kim 1409ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPcct4; 1410ff879b07SJung-uk Kim break; 1411ff879b07SJung-uk Kim 1412ff879b07SJung-uk Kim default: 1413ff879b07SJung-uk Kim 1414ff879b07SJung-uk Kim AcpiOsPrintf ( 1415ff879b07SJung-uk Kim "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n", 1416ff879b07SJung-uk Kim Subtable->Header.Type); 1417ff879b07SJung-uk Kim return; 1418ff879b07SJung-uk Kim } 1419ff879b07SJung-uk Kim 1420ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1421ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable, 1422ff879b07SJung-uk Kim Subtable->Header.Length, InfoTable); 1423ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1424ff879b07SJung-uk Kim { 1425ff879b07SJung-uk Kim return; 1426ff879b07SJung-uk Kim } 1427ff879b07SJung-uk Kim 1428ff879b07SJung-uk Kim /* Point to next subtable */ 1429ff879b07SJung-uk Kim 1430ff879b07SJung-uk Kim Offset += Subtable->Header.Length; 1431ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable, 1432ff879b07SJung-uk Kim Subtable->Header.Length); 1433ff879b07SJung-uk Kim } 1434ff879b07SJung-uk Kim } 1435ff879b07SJung-uk Kim 1436ff879b07SJung-uk Kim 1437ff879b07SJung-uk Kim /******************************************************************************* 1438ff879b07SJung-uk Kim * 1439ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpPdtt 1440ff879b07SJung-uk Kim * 1441ff879b07SJung-uk Kim * PARAMETERS: Table - A PDTT table 1442ff879b07SJung-uk Kim * 1443ff879b07SJung-uk Kim * RETURN: None 1444ff879b07SJung-uk Kim * 1445ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length 1446ff879b07SJung-uk Kim * table that contains an open-ended number of IDs 1447ff879b07SJung-uk Kim * at the end of the table. 1448ff879b07SJung-uk Kim * 1449ff879b07SJung-uk Kim ******************************************************************************/ 1450ff879b07SJung-uk Kim 1451ff879b07SJung-uk Kim void 1452ff879b07SJung-uk Kim AcpiDmDumpPdtt ( 1453ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 1454ff879b07SJung-uk Kim { 1455ff879b07SJung-uk Kim ACPI_STATUS Status; 1456ff879b07SJung-uk Kim ACPI_PDTT_CHANNEL *Subtable; 1457ff879b07SJung-uk Kim UINT32 Length = Table->Length; 1458ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_PDTT); 1459ff879b07SJung-uk Kim 1460ff879b07SJung-uk Kim 1461ff879b07SJung-uk Kim /* Main table */ 1462ff879b07SJung-uk Kim 1463ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt); 1464ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1465ff879b07SJung-uk Kim { 1466ff879b07SJung-uk Kim return; 1467ff879b07SJung-uk Kim } 1468ff879b07SJung-uk Kim 1469ff879b07SJung-uk Kim /* Subtables. Currently there is only one type, but can be multiples */ 1470ff879b07SJung-uk Kim 1471ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset); 1472ff879b07SJung-uk Kim while (Offset < Table->Length) 1473ff879b07SJung-uk Kim { 1474ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1475ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable, 1476ff879b07SJung-uk Kim sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0); 1477ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1478ff879b07SJung-uk Kim { 1479ff879b07SJung-uk Kim return; 1480ff879b07SJung-uk Kim } 1481ff879b07SJung-uk Kim 1482ff879b07SJung-uk Kim /* Point to next subtable */ 1483ff879b07SJung-uk Kim 1484ff879b07SJung-uk Kim Offset += sizeof (ACPI_PDTT_CHANNEL); 1485ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable, 1486ff879b07SJung-uk Kim sizeof (ACPI_PDTT_CHANNEL)); 1487ff879b07SJung-uk Kim } 1488ff879b07SJung-uk Kim } 1489ff879b07SJung-uk Kim 1490ff879b07SJung-uk Kim 1491ff879b07SJung-uk Kim /******************************************************************************* 1492ff879b07SJung-uk Kim * 1493ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpPmtt 1494ff879b07SJung-uk Kim * 1495ff879b07SJung-uk Kim * PARAMETERS: Table - A PMTT table 1496ff879b07SJung-uk Kim * 1497ff879b07SJung-uk Kim * RETURN: None 1498ff879b07SJung-uk Kim * 1499ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a PMTT. This table type consists 1500ff879b07SJung-uk Kim * of an open-ended number of subtables. 1501ff879b07SJung-uk Kim * 1502ff879b07SJung-uk Kim ******************************************************************************/ 1503ff879b07SJung-uk Kim 1504ff879b07SJung-uk Kim void 1505ff879b07SJung-uk Kim AcpiDmDumpPmtt ( 1506ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 1507ff879b07SJung-uk Kim { 1508ff879b07SJung-uk Kim ACPI_STATUS Status; 1509ff879b07SJung-uk Kim ACPI_PMTT_HEADER *Subtable; 1510ff879b07SJung-uk Kim ACPI_PMTT_HEADER *MemSubtable; 1511ff879b07SJung-uk Kim ACPI_PMTT_HEADER *DimmSubtable; 1512ff879b07SJung-uk Kim ACPI_PMTT_DOMAIN *DomainArray; 1513ff879b07SJung-uk Kim UINT32 Length = Table->Length; 1514ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_PMTT); 1515ff879b07SJung-uk Kim UINT32 MemOffset; 1516ff879b07SJung-uk Kim UINT32 DimmOffset; 1517ff879b07SJung-uk Kim UINT32 DomainOffset; 1518ff879b07SJung-uk Kim UINT32 DomainCount; 1519ff879b07SJung-uk Kim 1520ff879b07SJung-uk Kim 1521ff879b07SJung-uk Kim /* Main table */ 1522ff879b07SJung-uk Kim 1523ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt); 1524ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1525ff879b07SJung-uk Kim { 1526ff879b07SJung-uk Kim return; 1527ff879b07SJung-uk Kim } 1528ff879b07SJung-uk Kim 1529ff879b07SJung-uk Kim /* Subtables */ 1530ff879b07SJung-uk Kim 1531ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset); 1532ff879b07SJung-uk Kim while (Offset < Table->Length) 1533ff879b07SJung-uk Kim { 1534ff879b07SJung-uk Kim /* Common subtable header */ 1535ff879b07SJung-uk Kim 1536ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1537ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable, 1538ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoPmttHdr); 1539ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1540ff879b07SJung-uk Kim { 1541ff879b07SJung-uk Kim return; 1542ff879b07SJung-uk Kim } 1543ff879b07SJung-uk Kim 1544ff879b07SJung-uk Kim /* Only Socket subtables are expected at this level */ 1545ff879b07SJung-uk Kim 1546ff879b07SJung-uk Kim if (Subtable->Type != ACPI_PMTT_TYPE_SOCKET) 1547ff879b07SJung-uk Kim { 1548ff879b07SJung-uk Kim AcpiOsPrintf ( 1549ff879b07SJung-uk Kim "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", 1550ff879b07SJung-uk Kim Subtable->Type); 1551ff879b07SJung-uk Kim return; 1552ff879b07SJung-uk Kim } 1553ff879b07SJung-uk Kim 1554ff879b07SJung-uk Kim /* Dump the fixed-length portion of the subtable */ 1555ff879b07SJung-uk Kim 1556ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, Offset, Subtable, 1557ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoPmtt0); 1558ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1559ff879b07SJung-uk Kim { 1560ff879b07SJung-uk Kim return; 1561ff879b07SJung-uk Kim } 1562ff879b07SJung-uk Kim 1563ff879b07SJung-uk Kim /* Walk the memory controller subtables */ 1564ff879b07SJung-uk Kim 1565ff879b07SJung-uk Kim MemOffset = sizeof (ACPI_PMTT_SOCKET); 1566ff879b07SJung-uk Kim MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable, 1567ff879b07SJung-uk Kim sizeof (ACPI_PMTT_SOCKET)); 1568ff879b07SJung-uk Kim 1569ff879b07SJung-uk Kim while (((Offset + MemOffset) < Table->Length) && 1570ff879b07SJung-uk Kim (MemOffset < Subtable->Length)) 1571ff879b07SJung-uk Kim { 1572ff879b07SJung-uk Kim /* Common subtable header */ 1573ff879b07SJung-uk Kim 1574ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1575ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 1576ff879b07SJung-uk Kim Offset + MemOffset, MemSubtable, 1577ff879b07SJung-uk Kim MemSubtable->Length, AcpiDmTableInfoPmttHdr); 1578ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1579ff879b07SJung-uk Kim { 1580ff879b07SJung-uk Kim return; 1581ff879b07SJung-uk Kim } 1582ff879b07SJung-uk Kim 1583ff879b07SJung-uk Kim /* Only memory controller subtables are expected at this level */ 1584ff879b07SJung-uk Kim 1585ff879b07SJung-uk Kim if (MemSubtable->Type != ACPI_PMTT_TYPE_CONTROLLER) 1586ff879b07SJung-uk Kim { 1587ff879b07SJung-uk Kim AcpiOsPrintf ( 1588ff879b07SJung-uk Kim "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", 1589ff879b07SJung-uk Kim MemSubtable->Type); 1590ff879b07SJung-uk Kim return; 1591ff879b07SJung-uk Kim } 1592ff879b07SJung-uk Kim 1593ff879b07SJung-uk Kim /* Dump the fixed-length portion of the controller subtable */ 1594ff879b07SJung-uk Kim 1595ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 1596ff879b07SJung-uk Kim Offset + MemOffset, MemSubtable, 1597ff879b07SJung-uk Kim MemSubtable->Length, AcpiDmTableInfoPmtt1); 1598ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1599ff879b07SJung-uk Kim { 1600ff879b07SJung-uk Kim return; 1601ff879b07SJung-uk Kim } 1602ff879b07SJung-uk Kim 1603ff879b07SJung-uk Kim /* Walk the variable count of proximity domains */ 1604ff879b07SJung-uk Kim 1605ff879b07SJung-uk Kim DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount; 1606ff879b07SJung-uk Kim DomainOffset = sizeof (ACPI_PMTT_CONTROLLER); 1607ff879b07SJung-uk Kim DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubtable, 1608ff879b07SJung-uk Kim sizeof (ACPI_PMTT_CONTROLLER)); 1609ff879b07SJung-uk Kim 1610ff879b07SJung-uk Kim while (((Offset + MemOffset + DomainOffset) < Table->Length) && 1611ff879b07SJung-uk Kim ((MemOffset + DomainOffset) < Subtable->Length) && 1612ff879b07SJung-uk Kim DomainCount) 1613ff879b07SJung-uk Kim { 1614ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 1615ff879b07SJung-uk Kim Offset + MemOffset + DomainOffset, DomainArray, 1616ff879b07SJung-uk Kim sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a); 1617ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1618ff879b07SJung-uk Kim { 1619ff879b07SJung-uk Kim return; 1620ff879b07SJung-uk Kim } 1621ff879b07SJung-uk Kim 1622ff879b07SJung-uk Kim DomainOffset += sizeof (ACPI_PMTT_DOMAIN); 1623ff879b07SJung-uk Kim DomainArray++; 1624ff879b07SJung-uk Kim DomainCount--; 1625ff879b07SJung-uk Kim } 1626ff879b07SJung-uk Kim 1627ff879b07SJung-uk Kim if (DomainCount) 1628ff879b07SJung-uk Kim { 1629ff879b07SJung-uk Kim AcpiOsPrintf ( 1630ff879b07SJung-uk Kim "\n**** DomainCount exceeds subtable length\n\n"); 1631ff879b07SJung-uk Kim } 1632ff879b07SJung-uk Kim 1633ff879b07SJung-uk Kim /* Walk the physical component (DIMM) subtables */ 1634ff879b07SJung-uk Kim 1635ff879b07SJung-uk Kim DimmOffset = DomainOffset; 1636ff879b07SJung-uk Kim DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubtable, 1637ff879b07SJung-uk Kim DomainOffset); 1638ff879b07SJung-uk Kim 1639ff879b07SJung-uk Kim while (((Offset + MemOffset + DimmOffset) < Table->Length) && 1640ff879b07SJung-uk Kim (DimmOffset < MemSubtable->Length)) 1641ff879b07SJung-uk Kim { 1642ff879b07SJung-uk Kim /* Common subtable header */ 1643ff879b07SJung-uk Kim 1644ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1645ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 1646ff879b07SJung-uk Kim Offset + MemOffset + DimmOffset, DimmSubtable, 1647ff879b07SJung-uk Kim DimmSubtable->Length, AcpiDmTableInfoPmttHdr); 1648ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1649ff879b07SJung-uk Kim { 1650ff879b07SJung-uk Kim return; 1651ff879b07SJung-uk Kim } 1652ff879b07SJung-uk Kim 1653ff879b07SJung-uk Kim /* Only DIMM subtables are expected at this level */ 1654ff879b07SJung-uk Kim 1655ff879b07SJung-uk Kim if (DimmSubtable->Type != ACPI_PMTT_TYPE_DIMM) 1656ff879b07SJung-uk Kim { 1657ff879b07SJung-uk Kim AcpiOsPrintf ( 1658ff879b07SJung-uk Kim "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", 1659ff879b07SJung-uk Kim DimmSubtable->Type); 1660ff879b07SJung-uk Kim return; 1661ff879b07SJung-uk Kim } 1662ff879b07SJung-uk Kim 1663ff879b07SJung-uk Kim /* Dump the fixed-length DIMM subtable */ 1664ff879b07SJung-uk Kim 1665ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 1666ff879b07SJung-uk Kim Offset + MemOffset + DimmOffset, DimmSubtable, 1667ff879b07SJung-uk Kim DimmSubtable->Length, AcpiDmTableInfoPmtt2); 1668ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1669ff879b07SJung-uk Kim { 1670ff879b07SJung-uk Kim return; 1671ff879b07SJung-uk Kim } 1672ff879b07SJung-uk Kim 1673ff879b07SJung-uk Kim /* Point to next DIMM subtable */ 1674ff879b07SJung-uk Kim 1675ff879b07SJung-uk Kim DimmOffset += DimmSubtable->Length; 1676ff879b07SJung-uk Kim DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, 1677ff879b07SJung-uk Kim DimmSubtable, DimmSubtable->Length); 1678ff879b07SJung-uk Kim } 1679ff879b07SJung-uk Kim 1680ff879b07SJung-uk Kim /* Point to next Controller subtable */ 1681ff879b07SJung-uk Kim 1682ff879b07SJung-uk Kim MemOffset += MemSubtable->Length; 1683ff879b07SJung-uk Kim MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, 1684ff879b07SJung-uk Kim MemSubtable, MemSubtable->Length); 1685ff879b07SJung-uk Kim } 1686ff879b07SJung-uk Kim 1687ff879b07SJung-uk Kim /* Point to next Socket subtable */ 1688ff879b07SJung-uk Kim 1689ff879b07SJung-uk Kim Offset += Subtable->Length; 1690ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, 1691ff879b07SJung-uk Kim Subtable, Subtable->Length); 1692ff879b07SJung-uk Kim } 1693ff879b07SJung-uk Kim } 1694ff879b07SJung-uk Kim 1695ff879b07SJung-uk Kim 1696ff879b07SJung-uk Kim /******************************************************************************* 1697ff879b07SJung-uk Kim * 1698ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpPptt 1699ff879b07SJung-uk Kim * 1700ff879b07SJung-uk Kim * PARAMETERS: Table - A PMTT table 1701ff879b07SJung-uk Kim * 1702ff879b07SJung-uk Kim * RETURN: None 1703ff879b07SJung-uk Kim * 1704ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a PPTT. This table type consists 1705ff879b07SJung-uk Kim * of an open-ended number of subtables. 1706ff879b07SJung-uk Kim * 1707ff879b07SJung-uk Kim ******************************************************************************/ 1708ff879b07SJung-uk Kim 1709ff879b07SJung-uk Kim void 1710ff879b07SJung-uk Kim AcpiDmDumpPptt ( 1711ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 1712ff879b07SJung-uk Kim { 1713ff879b07SJung-uk Kim ACPI_STATUS Status; 1714ff879b07SJung-uk Kim ACPI_SUBTABLE_HEADER *Subtable; 1715ff879b07SJung-uk Kim ACPI_PPTT_PROCESSOR *PpttProcessor; 1716ff879b07SJung-uk Kim UINT8 Length; 1717ff879b07SJung-uk Kim UINT8 SubtableOffset; 1718ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_FPDT); 1719ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable; 1720ff879b07SJung-uk Kim UINT32 i; 1721ff879b07SJung-uk Kim 1722ff879b07SJung-uk Kim 1723ff879b07SJung-uk Kim /* There is no main table (other than the standard ACPI header) */ 1724ff879b07SJung-uk Kim 1725ff879b07SJung-uk Kim /* Subtables */ 1726ff879b07SJung-uk Kim 1727ff879b07SJung-uk Kim Offset = sizeof (ACPI_TABLE_HEADER); 1728ff879b07SJung-uk Kim while (Offset < Table->Length) 1729ff879b07SJung-uk Kim { 1730ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1731ff879b07SJung-uk Kim 1732ff879b07SJung-uk Kim /* Common subtable header */ 1733ff879b07SJung-uk Kim 1734ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); 1735ff879b07SJung-uk Kim if (Subtable->Length < sizeof (ACPI_SUBTABLE_HEADER)) 1736ff879b07SJung-uk Kim { 1737ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid subtable length\n"); 1738ff879b07SJung-uk Kim return; 1739ff879b07SJung-uk Kim } 1740ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1741ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoPpttHdr); 1742ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1743ff879b07SJung-uk Kim { 1744ff879b07SJung-uk Kim return; 1745ff879b07SJung-uk Kim } 1746ff879b07SJung-uk Kim 1747ff879b07SJung-uk Kim switch (Subtable->Type) 1748ff879b07SJung-uk Kim { 1749ff879b07SJung-uk Kim case ACPI_PPTT_TYPE_PROCESSOR: 1750ff879b07SJung-uk Kim 1751ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPptt0; 1752ff879b07SJung-uk Kim Length = sizeof (ACPI_PPTT_PROCESSOR); 1753ff879b07SJung-uk Kim break; 1754ff879b07SJung-uk Kim 1755ff879b07SJung-uk Kim case ACPI_PPTT_TYPE_CACHE: 1756ff879b07SJung-uk Kim 1757ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPptt1; 1758ff879b07SJung-uk Kim Length = sizeof (ACPI_PPTT_CACHE); 1759ff879b07SJung-uk Kim break; 1760ff879b07SJung-uk Kim 1761ff879b07SJung-uk Kim case ACPI_PPTT_TYPE_ID: 1762ff879b07SJung-uk Kim 1763ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoPptt2; 1764ff879b07SJung-uk Kim Length = sizeof (ACPI_PPTT_ID); 1765ff879b07SJung-uk Kim break; 1766ff879b07SJung-uk Kim 1767ff879b07SJung-uk Kim default: 1768ff879b07SJung-uk Kim 1769ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n", 1770ff879b07SJung-uk Kim Subtable->Type); 1771ff879b07SJung-uk Kim 1772ff879b07SJung-uk Kim /* Attempt to continue */ 1773ff879b07SJung-uk Kim 1774ff879b07SJung-uk Kim goto NextSubtable; 1775ff879b07SJung-uk Kim } 1776ff879b07SJung-uk Kim 1777ff879b07SJung-uk Kim if (Subtable->Length < Length) 1778ff879b07SJung-uk Kim { 1779ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid subtable length\n"); 1780ff879b07SJung-uk Kim return; 1781ff879b07SJung-uk Kim } 1782ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1783ff879b07SJung-uk Kim Subtable->Length, InfoTable); 1784ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1785ff879b07SJung-uk Kim { 1786ff879b07SJung-uk Kim return; 1787ff879b07SJung-uk Kim } 1788ff879b07SJung-uk Kim SubtableOffset = Length; 1789ff879b07SJung-uk Kim 1790ff879b07SJung-uk Kim switch (Subtable->Type) 1791ff879b07SJung-uk Kim { 1792ff879b07SJung-uk Kim case ACPI_PPTT_TYPE_PROCESSOR: 1793ff879b07SJung-uk Kim 1794ff879b07SJung-uk Kim PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable); 1795ff879b07SJung-uk Kim 1796ff879b07SJung-uk Kim /* Dump SMBIOS handles */ 1797ff879b07SJung-uk Kim 1798ff879b07SJung-uk Kim if ((UINT8)(Subtable->Length - SubtableOffset) < 1799ff879b07SJung-uk Kim (UINT8)(PpttProcessor->NumberOfPrivResources * 4)) 1800ff879b07SJung-uk Kim { 1801ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid private resource number\n"); 1802ff879b07SJung-uk Kim return; 1803ff879b07SJung-uk Kim } 1804ff879b07SJung-uk Kim for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++) 1805ff879b07SJung-uk Kim { 1806ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, 1807ff879b07SJung-uk Kim ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset), 1808ff879b07SJung-uk Kim 4, AcpiDmTableInfoPptt0a); 1809ff879b07SJung-uk Kim SubtableOffset += 4; 1810ff879b07SJung-uk Kim } 1811ff879b07SJung-uk Kim break; 1812ff879b07SJung-uk Kim 1813ff879b07SJung-uk Kim default: 1814ff879b07SJung-uk Kim 1815ff879b07SJung-uk Kim break; 1816ff879b07SJung-uk Kim } 1817ff879b07SJung-uk Kim 1818ff879b07SJung-uk Kim NextSubtable: 1819ff879b07SJung-uk Kim /* Point to next subtable */ 1820ff879b07SJung-uk Kim 1821ff879b07SJung-uk Kim Offset += Subtable->Length; 1822ff879b07SJung-uk Kim } 1823ff879b07SJung-uk Kim } 1824ff879b07SJung-uk Kim 1825ff879b07SJung-uk Kim 1826ff879b07SJung-uk Kim /******************************************************************************* 1827ff879b07SJung-uk Kim * 1828ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpS3pt 1829ff879b07SJung-uk Kim * 1830ff879b07SJung-uk Kim * PARAMETERS: Table - A S3PT table 1831ff879b07SJung-uk Kim * 1832ff879b07SJung-uk Kim * RETURN: Length of the table 1833ff879b07SJung-uk Kim * 1834ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a S3PT 1835ff879b07SJung-uk Kim * 1836ff879b07SJung-uk Kim ******************************************************************************/ 1837ff879b07SJung-uk Kim 1838ff879b07SJung-uk Kim UINT32 1839ff879b07SJung-uk Kim AcpiDmDumpS3pt ( 1840ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Tables) 1841ff879b07SJung-uk Kim { 1842ff879b07SJung-uk Kim ACPI_STATUS Status; 1843ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_S3PT); 1844ff879b07SJung-uk Kim ACPI_FPDT_HEADER *Subtable; 1845ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable; 1846ff879b07SJung-uk Kim ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables); 1847ff879b07SJung-uk Kim 1848ff879b07SJung-uk Kim 1849ff879b07SJung-uk Kim /* Main table */ 1850ff879b07SJung-uk Kim 1851ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Offset, 0, S3ptTable, 0, AcpiDmTableInfoS3pt); 1852ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1853ff879b07SJung-uk Kim { 1854ff879b07SJung-uk Kim return 0; 1855ff879b07SJung-uk Kim } 1856ff879b07SJung-uk Kim 1857ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset); 1858ff879b07SJung-uk Kim while (Offset < S3ptTable->Length) 1859ff879b07SJung-uk Kim { 1860ff879b07SJung-uk Kim /* Common subtable header */ 1861ff879b07SJung-uk Kim 1862ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1863ff879b07SJung-uk Kim Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable, 1864ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoS3ptHdr); 1865ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1866ff879b07SJung-uk Kim { 1867ff879b07SJung-uk Kim return 0; 1868ff879b07SJung-uk Kim } 1869ff879b07SJung-uk Kim 1870ff879b07SJung-uk Kim switch (Subtable->Type) 1871ff879b07SJung-uk Kim { 1872ff879b07SJung-uk Kim case ACPI_S3PT_TYPE_RESUME: 1873ff879b07SJung-uk Kim 1874ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoS3pt0; 1875ff879b07SJung-uk Kim break; 1876ff879b07SJung-uk Kim 1877ff879b07SJung-uk Kim case ACPI_S3PT_TYPE_SUSPEND: 1878ff879b07SJung-uk Kim 1879ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoS3pt1; 1880ff879b07SJung-uk Kim break; 1881ff879b07SJung-uk Kim 1882ff879b07SJung-uk Kim default: 1883ff879b07SJung-uk Kim 1884ff879b07SJung-uk Kim AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n", 1885ff879b07SJung-uk Kim Subtable->Type); 1886ff879b07SJung-uk Kim 1887ff879b07SJung-uk Kim /* Attempt to continue */ 1888ff879b07SJung-uk Kim 1889ff879b07SJung-uk Kim if (!Subtable->Length) 1890ff879b07SJung-uk Kim { 1891ff879b07SJung-uk Kim AcpiOsPrintf ("Invalid zero length subtable\n"); 1892ff879b07SJung-uk Kim return 0; 1893ff879b07SJung-uk Kim } 1894ff879b07SJung-uk Kim goto NextSubtable; 1895ff879b07SJung-uk Kim } 1896ff879b07SJung-uk Kim 1897ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1898ff879b07SJung-uk Kim Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable, 1899ff879b07SJung-uk Kim Subtable->Length, InfoTable); 1900ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1901ff879b07SJung-uk Kim { 1902ff879b07SJung-uk Kim return 0; 1903ff879b07SJung-uk Kim } 1904ff879b07SJung-uk Kim 1905ff879b07SJung-uk Kim NextSubtable: 1906ff879b07SJung-uk Kim /* Point to next subtable */ 1907ff879b07SJung-uk Kim 1908ff879b07SJung-uk Kim Offset += Subtable->Length; 1909ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length); 1910ff879b07SJung-uk Kim } 1911ff879b07SJung-uk Kim 1912ff879b07SJung-uk Kim return (S3ptTable->Length); 1913ff879b07SJung-uk Kim } 1914ff879b07SJung-uk Kim 1915ff879b07SJung-uk Kim 1916ff879b07SJung-uk Kim /******************************************************************************* 1917ff879b07SJung-uk Kim * 1918ff879b07SJung-uk Kim * FUNCTION: AcpiDmDumpSdev 1919ff879b07SJung-uk Kim * 1920ff879b07SJung-uk Kim * PARAMETERS: Table - A SDEV table 1921ff879b07SJung-uk Kim * 1922ff879b07SJung-uk Kim * RETURN: None 1923ff879b07SJung-uk Kim * 1924ff879b07SJung-uk Kim * DESCRIPTION: Format the contents of a SDEV. This is a variable-length 1925ff879b07SJung-uk Kim * table that contains variable strings and vendor data. 1926ff879b07SJung-uk Kim * 1927ff879b07SJung-uk Kim ******************************************************************************/ 1928ff879b07SJung-uk Kim 1929ff879b07SJung-uk Kim void 1930ff879b07SJung-uk Kim AcpiDmDumpSdev ( 1931ff879b07SJung-uk Kim ACPI_TABLE_HEADER *Table) 1932ff879b07SJung-uk Kim { 1933ff879b07SJung-uk Kim ACPI_STATUS Status; 1934ff879b07SJung-uk Kim ACPI_SDEV_HEADER *Subtable; 1935ff879b07SJung-uk Kim ACPI_SDEV_PCIE *Pcie; 1936ff879b07SJung-uk Kim ACPI_SDEV_NAMESPACE *Namesp; 1937ff879b07SJung-uk Kim ACPI_DMTABLE_INFO *InfoTable; 1938ff879b07SJung-uk Kim UINT32 Length = Table->Length; 1939ff879b07SJung-uk Kim UINT32 Offset = sizeof (ACPI_TABLE_SDEV); 1940ff879b07SJung-uk Kim UINT16 PathOffset; 1941ff879b07SJung-uk Kim UINT16 PathLength; 1942ff879b07SJung-uk Kim UINT16 VendorDataOffset; 1943ff879b07SJung-uk Kim UINT16 VendorDataLength; 1944ff879b07SJung-uk Kim 1945ff879b07SJung-uk Kim 1946ff879b07SJung-uk Kim /* Main table */ 1947ff879b07SJung-uk Kim 1948ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev); 1949ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1950ff879b07SJung-uk Kim { 1951ff879b07SJung-uk Kim return; 1952ff879b07SJung-uk Kim } 1953ff879b07SJung-uk Kim 1954ff879b07SJung-uk Kim /* Subtables */ 1955ff879b07SJung-uk Kim 1956ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset); 1957ff879b07SJung-uk Kim while (Offset < Table->Length) 1958ff879b07SJung-uk Kim { 1959ff879b07SJung-uk Kim /* Common subtable header */ 1960ff879b07SJung-uk Kim 1961ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1962ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1963ff879b07SJung-uk Kim Subtable->Length, AcpiDmTableInfoSdevHdr); 1964ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1965ff879b07SJung-uk Kim { 1966ff879b07SJung-uk Kim return; 1967ff879b07SJung-uk Kim } 1968ff879b07SJung-uk Kim 1969ff879b07SJung-uk Kim switch (Subtable->Type) 1970ff879b07SJung-uk Kim { 1971ff879b07SJung-uk Kim case ACPI_SDEV_TYPE_NAMESPACE_DEVICE: 1972ff879b07SJung-uk Kim 1973ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoSdev0; 1974ff879b07SJung-uk Kim break; 1975ff879b07SJung-uk Kim 1976ff879b07SJung-uk Kim case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE: 1977ff879b07SJung-uk Kim 1978ff879b07SJung-uk Kim InfoTable = AcpiDmTableInfoSdev1; 1979ff879b07SJung-uk Kim break; 1980ff879b07SJung-uk Kim 1981ff879b07SJung-uk Kim default: 1982ff879b07SJung-uk Kim goto NextSubtable; 1983ff879b07SJung-uk Kim } 1984ff879b07SJung-uk Kim 1985ff879b07SJung-uk Kim AcpiOsPrintf ("\n"); 1986ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, 1987ff879b07SJung-uk Kim Subtable->Length, InfoTable); 1988ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 1989ff879b07SJung-uk Kim { 1990ff879b07SJung-uk Kim return; 1991ff879b07SJung-uk Kim } 1992ff879b07SJung-uk Kim 1993ff879b07SJung-uk Kim switch (Subtable->Type) 1994ff879b07SJung-uk Kim { 1995ff879b07SJung-uk Kim case ACPI_SDEV_TYPE_NAMESPACE_DEVICE: 1996ff879b07SJung-uk Kim 1997ff879b07SJung-uk Kim /* Dump the PCIe device ID(s) */ 1998ff879b07SJung-uk Kim 1999ff879b07SJung-uk Kim Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable); 2000ff879b07SJung-uk Kim PathOffset = Namesp->DeviceIdOffset; 2001ff879b07SJung-uk Kim PathLength = Namesp->DeviceIdLength; 2002ff879b07SJung-uk Kim 2003ff879b07SJung-uk Kim if (PathLength) 2004ff879b07SJung-uk Kim { 2005ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, 2006ff879b07SJung-uk Kim ACPI_ADD_PTR (UINT8, Namesp, PathOffset), 2007ff879b07SJung-uk Kim PathLength, AcpiDmTableInfoSdev0a); 2008ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 2009ff879b07SJung-uk Kim { 2010ff879b07SJung-uk Kim return; 2011ff879b07SJung-uk Kim } 2012ff879b07SJung-uk Kim } 2013ff879b07SJung-uk Kim 2014ff879b07SJung-uk Kim /* Dump the vendor-specific data */ 2015ff879b07SJung-uk Kim 2016ff879b07SJung-uk Kim VendorDataLength = 2017ff879b07SJung-uk Kim Namesp->VendorDataLength; 2018ff879b07SJung-uk Kim VendorDataOffset = 2019ff879b07SJung-uk Kim Namesp->DeviceIdOffset + Namesp->DeviceIdLength; 2020ff879b07SJung-uk Kim 2021ff879b07SJung-uk Kim if (VendorDataLength) 2022ff879b07SJung-uk Kim { 2023ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, 2024ff879b07SJung-uk Kim ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset), 2025ff879b07SJung-uk Kim VendorDataLength, AcpiDmTableInfoSdev1b); 2026ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 2027ff879b07SJung-uk Kim { 2028ff879b07SJung-uk Kim return; 2029ff879b07SJung-uk Kim } 2030ff879b07SJung-uk Kim } 2031ff879b07SJung-uk Kim break; 2032ff879b07SJung-uk Kim 2033ff879b07SJung-uk Kim case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE: 2034ff879b07SJung-uk Kim 2035ff879b07SJung-uk Kim /* PCI path substructures */ 2036ff879b07SJung-uk Kim 2037ff879b07SJung-uk Kim Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable); 2038ff879b07SJung-uk Kim PathOffset = Pcie->PathOffset; 2039ff879b07SJung-uk Kim PathLength = Pcie->PathLength; 2040ff879b07SJung-uk Kim 2041ff879b07SJung-uk Kim while (PathLength) 2042ff879b07SJung-uk Kim { 2043ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 2044ff879b07SJung-uk Kim PathOffset + Offset, 2045ff879b07SJung-uk Kim ACPI_ADD_PTR (UINT8, Pcie, PathOffset), 2046ff879b07SJung-uk Kim sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a); 2047ff879b07SJung-uk Kim if (ACPI_FAILURE (Status)) 2048ff879b07SJung-uk Kim { 2049ff879b07SJung-uk Kim return; 2050ff879b07SJung-uk Kim } 2051ff879b07SJung-uk Kim 2052ff879b07SJung-uk Kim PathOffset += sizeof (ACPI_SDEV_PCIE_PATH); 2053ff879b07SJung-uk Kim PathLength -= sizeof (ACPI_SDEV_PCIE_PATH); 2054ff879b07SJung-uk Kim } 2055ff879b07SJung-uk Kim 2056ff879b07SJung-uk Kim /* VendorData */ 2057ff879b07SJung-uk Kim 2058ff879b07SJung-uk Kim VendorDataLength = Pcie->VendorDataLength; 2059ff879b07SJung-uk Kim VendorDataOffset = Pcie->PathOffset + Pcie->PathLength; 2060ff879b07SJung-uk Kim 2061ff879b07SJung-uk Kim if (VendorDataLength) 2062ff879b07SJung-uk Kim { 2063ff879b07SJung-uk Kim Status = AcpiDmDumpTable (Table->Length, 0, 2064ff879b07SJung-uk Kim ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset), 2065ff879b07SJung-uk Kim VendorDataLength, AcpiDmTableInfoSdev1b); 2066ff879b07SJung-uk Kim } 2067ff879b07SJung-uk Kim break; 2068ff879b07SJung-uk Kim 2069ff879b07SJung-uk Kim default: 2070ff879b07SJung-uk Kim goto NextSubtable; 2071ff879b07SJung-uk Kim } 2072ff879b07SJung-uk Kim 2073ff879b07SJung-uk Kim NextSubtable: 2074ff879b07SJung-uk Kim /* Point to next subtable */ 2075ff879b07SJung-uk Kim 2076ff879b07SJung-uk Kim Offset += Subtable->Length; 2077ff879b07SJung-uk Kim Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable, 2078ff879b07SJung-uk Kim Subtable->Length); 2079ff879b07SJung-uk Kim } 2080ff879b07SJung-uk Kim } 2081