Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
   1 /*******************************************************************************
   2  *
   3  * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.


 136  * DESCRIPTION: Decode fields common to Memory24 and Memory32 descriptors
 137  *
 138  ******************************************************************************/
 139 
 140 static void
 141 AcpiDmMemoryFields (
 142     void                    *Source,
 143     UINT8                   Type,
 144     UINT32                  Level)
 145 {
 146     UINT32                  i;
 147 
 148 
 149     for (i = 0; i < 4; i++)
 150     {
 151         AcpiDmIndent (Level + 1);
 152 
 153         switch (Type)
 154         {
 155         case 16:

 156             AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
 157                 AcpiDmMemoryNames[i]);
 158             break;
 159 
 160         case 32:

 161             AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
 162                 AcpiDmMemoryNames[i]);
 163             break;
 164 
 165         default:

 166             return;
 167         }
 168     }
 169 }
 170 
 171 
 172 /*******************************************************************************
 173  *
 174  * FUNCTION:    AcpiDmAddressFields
 175  *
 176  * PARAMETERS:  Source              - Pointer to the contiguous data fields
 177  *              Type                - 16, 32, or 64 (bit)
 178  *              Level               - Current source code indentation level
 179  *
 180  * RETURN:      None
 181  *
 182  * DESCRIPTION: Decode fields common to address descriptors
 183  *
 184  ******************************************************************************/
 185 
 186 static void
 187 AcpiDmAddressFields (
 188     void                    *Source,
 189     UINT8                   Type,
 190     UINT32                  Level)
 191 {
 192     UINT32                  i;
 193 
 194 
 195     AcpiOsPrintf ("\n");
 196 
 197     for (i = 0; i < 5; i++)
 198     {
 199         AcpiDmIndent (Level + 1);
 200 
 201         switch (Type)
 202         {
 203         case 16:

 204             AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
 205                 AcpiDmAddressNames[i]);
 206             break;
 207 
 208         case 32:

 209             AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
 210                 AcpiDmAddressNames[i]);
 211             break;
 212 
 213         case 64:

 214             AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
 215                 AcpiDmAddressNames[i]);
 216             break;
 217 
 218         default:

 219             return;
 220         }
 221     }
 222 }
 223 
 224 
 225 /*******************************************************************************
 226  *
 227  * FUNCTION:    AcpiDmAddressPrefix
 228  *
 229  * PARAMETERS:  Type                - Descriptor type
 230  *
 231  * RETURN:      None
 232  *
 233  * DESCRIPTION: Emit name prefix representing the address descriptor type
 234  *
 235  ******************************************************************************/
 236 
 237 static void
 238 AcpiDmAddressPrefix (
 239     UINT8                   Type)
 240 {
 241 
 242     switch (Type)
 243     {
 244     case ACPI_RESOURCE_TYPE_ADDRESS16:

 245         AcpiOsPrintf ("Word");
 246         break;
 247 
 248     case ACPI_RESOURCE_TYPE_ADDRESS32:

 249         AcpiOsPrintf ("DWord");
 250         break;
 251 
 252     case ACPI_RESOURCE_TYPE_ADDRESS64:

 253         AcpiOsPrintf ("QWord");
 254         break;
 255 
 256     case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:

 257         AcpiOsPrintf ("Extended");
 258         break;
 259 
 260     default:

 261         return;
 262     }
 263 }
 264 
 265 
 266 /*******************************************************************************
 267  *
 268  * FUNCTION:    AcpiDmAddressCommon
 269  *
 270  * PARAMETERS:  Resource            - Raw AML descriptor
 271  *              Type                - Descriptor type
 272  *              Level               - Current source code indentation level
 273  *
 274  * RETURN:      None
 275  *
 276  * DESCRIPTION: Emit common name and flag fields common to address descriptors
 277  *
 278  ******************************************************************************/
 279 
 280 static void


 301         AcpiOsPrintf ("/**** Invalid Resource Type: 0x%X ****/", ResourceType);
 302         return;
 303     }
 304 
 305     /* Prefix is either Word, DWord, QWord, or Extended */
 306 
 307     AcpiDmAddressPrefix (Type);
 308 
 309     /* Resource Types above 0xC0 are vendor-defined */
 310 
 311     if (ResourceType > 2)
 312     {
 313         AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType);
 314         AcpiDmSpaceFlags (Flags);
 315         AcpiOsPrintf (" 0x%2.2X,", SpecificFlags);
 316         return;
 317     }
 318 
 319     /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
 320 
 321     AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ResourceType & 0x3]);
 322 
 323     /* Decode the general and type-specific flags */
 324 
 325     if (ResourceType == ACPI_MEMORY_RANGE)
 326     {
 327         AcpiDmMemoryFlags (Flags, SpecificFlags);
 328     }
 329     else /* IO range or BusNumberRange */
 330     {
 331         AcpiDmIoFlags (Flags);
 332         if (ResourceType == ACPI_IO_RANGE)
 333         {
 334             AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [SpecificFlags & 0x3]);
 335         }
 336     }
 337 }
 338 
 339 
 340 /*******************************************************************************
 341  *
 342  * FUNCTION:    AcpiDmAddressFlags
 343  *
 344  * PARAMETERS:  Resource        - Raw AML descriptor
 345  *
 346  * RETURN:      None
 347  *
 348  * DESCRIPTION: Emit flags common to address descriptors
 349  *
 350  ******************************************************************************/
 351 
 352 static void
 353 AcpiDmAddressFlags (
 354     AML_RESOURCE            *Resource)


 366 
 367 
 368 /*******************************************************************************
 369  *
 370  * FUNCTION:    AcpiDmSpaceFlags
 371  *
 372  * PARAMETERS:  Flags               - Flag byte to be decoded
 373  *
 374  * RETURN:      None
 375  *
 376  * DESCRIPTION: Decode the flags specific to Space Address space descriptors
 377  *
 378  ******************************************************************************/
 379 
 380 static void
 381 AcpiDmSpaceFlags (
 382     UINT8                   Flags)
 383 {
 384 
 385     AcpiOsPrintf ("%s, %s, %s, %s,",
 386         AcpiGbl_ConsumeDecode [(Flags & 1)],
 387         AcpiGbl_DecDecode [(Flags & 0x2) >> 1],
 388         AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
 389         AcpiGbl_MaxDecode [(Flags & 0x8) >> 3]);
 390 }
 391 
 392 
 393 /*******************************************************************************
 394  *
 395  * FUNCTION:    AcpiDmIoFlags
 396  *
 397  * PARAMETERS:  Flags               - Flag byte to be decoded
 398  *
 399  * RETURN:      None
 400  *
 401  * DESCRIPTION: Decode the flags specific to IO Address space descriptors
 402  *
 403  ******************************************************************************/
 404 
 405 static void
 406 AcpiDmIoFlags (
 407         UINT8               Flags)
 408 {
 409     AcpiOsPrintf ("%s, %s, %s, %s,",
 410         AcpiGbl_ConsumeDecode [(Flags & 1)],
 411         AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
 412         AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
 413         AcpiGbl_DecDecode [(Flags & 0x2) >> 1]);
 414 }
 415 
 416 
 417 /*******************************************************************************
 418  *
 419  * FUNCTION:    AcpiDmIoFlags2
 420  *
 421  * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
 422  *
 423  * RETURN:      None
 424  *
 425  * DESCRIPTION: Decode the flags specific to IO Address space descriptors
 426  *
 427  ******************************************************************************/
 428 
 429 static void
 430 AcpiDmIoFlags2 (
 431         UINT8               SpecificFlags)
 432 {
 433 
 434     AcpiOsPrintf (", %s",
 435         AcpiGbl_TtpDecode [(SpecificFlags & 0x10) >> 4]);
 436 
 437     /* TRS is only used if TTP is TypeTranslation */
 438 
 439     if (SpecificFlags & 0x10)
 440     {
 441         AcpiOsPrintf (", %s",
 442             AcpiGbl_TrsDecode [(SpecificFlags & 0x20) >> 5]);
 443     }
 444 }
 445 
 446 
 447 /*******************************************************************************
 448  *
 449  * FUNCTION:    AcpiDmMemoryFlags
 450  *
 451  * PARAMETERS:  Flags               - Flag byte to be decoded
 452  *              SpecificFlags       - "Specific" flag byte to be decoded
 453  *
 454  * RETURN:      None
 455  *
 456  * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
 457  *
 458  ******************************************************************************/
 459 
 460 static void
 461 AcpiDmMemoryFlags (
 462     UINT8                   Flags,
 463     UINT8                   SpecificFlags)
 464 {
 465 
 466     AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
 467         AcpiGbl_ConsumeDecode [(Flags & 1)],
 468         AcpiGbl_DecDecode [(Flags & 0x2) >> 1],
 469         AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
 470         AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
 471         AcpiGbl_MemDecode [(SpecificFlags & 0x6) >> 1],
 472         AcpiGbl_RwDecode [(SpecificFlags & 0x1)]);
 473 }
 474 
 475 
 476 /*******************************************************************************
 477  *
 478  * FUNCTION:    AcpiDmMemoryFlags2
 479  *
 480  * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
 481  *
 482  * RETURN:      None
 483  *
 484  * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
 485  *
 486  ******************************************************************************/
 487 
 488 static void
 489 AcpiDmMemoryFlags2 (
 490     UINT8                   SpecificFlags)
 491 {
 492 
 493     AcpiOsPrintf (", %s, %s",
 494         AcpiGbl_MtpDecode [(SpecificFlags & 0x18) >> 3],
 495         AcpiGbl_TtpDecode [(SpecificFlags & 0x20) >> 5]);
 496 }
 497 
 498 
 499 /*******************************************************************************
 500  *
 501  * FUNCTION:    AcpiDmResourceSource
 502  *
 503  * PARAMETERS:  Resource        - Raw AML descriptor
 504  *              MinimumLength   - descriptor length without optional fields
 505  *              ResourceLength
 506  *
 507  * RETURN:      None
 508  *
 509  * DESCRIPTION: Dump optional ResourceSource fields of an address descriptor
 510  *
 511  ******************************************************************************/
 512 
 513 static void
 514 AcpiDmResourceSource (
 515     AML_RESOURCE            *Resource,


 536 
 537     AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength);
 538 
 539     /*
 540      * Always emit the ResourceSourceIndex (Byte)
 541      *
 542      * NOTE: Some ASL compilers always create a 0 byte (in the AML) for the
 543      * Index even if the String does not exist. Although this is in violation
 544      * of the ACPI specification, it is very important to emit ASL code that
 545      * can be compiled back to the identical AML. There may be fields and/or
 546      * indexes into the resource template buffer that are compiled to absolute
 547      * offsets, and these will be broken if the AML length is changed.
 548      */
 549     AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]);
 550 
 551     /* Make sure that the ResourceSource string exists before dumping it */
 552 
 553     if (TotalLength > (MinimumTotalLength + 1))
 554     {
 555         AcpiOsPrintf (" ");
 556         AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT8_MAX);
 557     }
 558 
 559     AcpiOsPrintf (", ");
 560 }
 561 
 562 
 563 /*******************************************************************************
 564  *
 565  * FUNCTION:    AcpiDmWordDescriptor
 566  *
 567  * PARAMETERS:  Resource            - Pointer to the resource descriptor
 568  *              Length              - Length of the descriptor in bytes
 569  *              Level               - Current source code indentation level
 570  *
 571  * RETURN:      None
 572  *
 573  * DESCRIPTION: Decode a Word Address Space descriptor
 574  *
 575  ******************************************************************************/
 576 


 750  *              Length              - Length of the descriptor in bytes
 751  *              Level               - Current source code indentation level
 752  *
 753  * RETURN:      None
 754  *
 755  * DESCRIPTION: Decode a Memory24 descriptor
 756  *
 757  ******************************************************************************/
 758 
 759 void
 760 AcpiDmMemory24Descriptor (
 761     AML_RESOURCE            *Resource,
 762     UINT32                  Length,
 763     UINT32                  Level)
 764 {
 765 
 766     /* Dump name and read/write flag */
 767 
 768     AcpiDmIndent (Level);
 769     AcpiOsPrintf ("Memory24 (%s,\n",
 770         AcpiGbl_RwDecode [Resource->Memory24.Flags & 1]);
 771 
 772     /* Dump the 4 contiguous WORD values */
 773 
 774     AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level);
 775 
 776     /* Insert a descriptor name */
 777 
 778     AcpiDmIndent (Level + 1);
 779     AcpiDmDescriptorName ();
 780     AcpiOsPrintf (")\n");
 781 }
 782 
 783 
 784 /*******************************************************************************
 785  *
 786  * FUNCTION:    AcpiDmMemory32Descriptor
 787  *
 788  * PARAMETERS:  Resource            - Pointer to the resource descriptor
 789  *              Length              - Length of the descriptor in bytes
 790  *              Level               - Current source code indentation level
 791  *
 792  * RETURN:      None
 793  *
 794  * DESCRIPTION: Decode a Memory32 descriptor
 795  *
 796  ******************************************************************************/
 797 
 798 void
 799 AcpiDmMemory32Descriptor (
 800     AML_RESOURCE            *Resource,
 801     UINT32                  Length,
 802     UINT32                  Level)
 803 {
 804 
 805     /* Dump name and read/write flag */
 806 
 807     AcpiDmIndent (Level);
 808     AcpiOsPrintf ("Memory32 (%s,\n",
 809         AcpiGbl_RwDecode [Resource->Memory32.Flags & 1]);
 810 
 811     /* Dump the 4 contiguous DWORD values */
 812 
 813     AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level);
 814 
 815     /* Insert a descriptor name */
 816 
 817     AcpiDmIndent (Level + 1);
 818     AcpiDmDescriptorName ();
 819     AcpiOsPrintf (")\n");
 820 }
 821 
 822 
 823 /*******************************************************************************
 824  *
 825  * FUNCTION:    AcpiDmFixedMemory32Descriptor
 826  *
 827  * PARAMETERS:  Resource            - Pointer to the resource descriptor
 828  *              Length              - Length of the descriptor in bytes
 829  *              Level               - Current source code indentation level
 830  *
 831  * RETURN:      None
 832  *
 833  * DESCRIPTION: Decode a Fixed Memory32 descriptor
 834  *
 835  ******************************************************************************/
 836 
 837 void
 838 AcpiDmFixedMemory32Descriptor (
 839     AML_RESOURCE            *Resource,
 840     UINT32                  Length,
 841     UINT32                  Level)
 842 {
 843 
 844     /* Dump name and read/write flag */
 845 
 846     AcpiDmIndent (Level);
 847     AcpiOsPrintf ("Memory32Fixed (%s,\n",
 848         AcpiGbl_RwDecode [Resource->FixedMemory32.Flags & 1]);
 849 
 850     AcpiDmIndent (Level + 1);
 851     AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base");
 852 
 853     AcpiDmIndent (Level + 1);
 854     AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, "Address Length");
 855 
 856     /* Insert a descriptor name */
 857 
 858     AcpiDmIndent (Level + 1);
 859     AcpiDmDescriptorName ();
 860     AcpiOsPrintf (")\n");
 861 }
 862 
 863 
 864 /*******************************************************************************
 865  *
 866  * FUNCTION:    AcpiDmGenericRegisterDescriptor
 867  *
 868  * PARAMETERS:  Resource            - Pointer to the resource descriptor


 925  *              Length              - Length of the descriptor in bytes
 926  *              Level               - Current source code indentation level
 927  *
 928  * RETURN:      None
 929  *
 930  * DESCRIPTION: Decode a extended Interrupt descriptor
 931  *
 932  ******************************************************************************/
 933 
 934 void
 935 AcpiDmInterruptDescriptor (
 936     AML_RESOURCE            *Resource,
 937     UINT32                  Length,
 938     UINT32                  Level)
 939 {
 940     UINT32                  i;
 941 
 942 
 943     AcpiDmIndent (Level);
 944     AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
 945         AcpiGbl_ConsumeDecode [(Resource->ExtendedIrq.Flags & 1)],
 946         AcpiGbl_HeDecode [(Resource->ExtendedIrq.Flags >> 1) & 1],
 947         AcpiGbl_LlDecode [(Resource->ExtendedIrq.Flags >> 2) & 1],
 948         AcpiGbl_ShrDecode [(Resource->ExtendedIrq.Flags >> 3) & 1]);
 949 
 950     /*
 951      * The ResourceSource fields are optional and appear after the interrupt
 952      * list. Must compute length based on length of the list. First xrupt
 953      * is included in the struct (reason for -1 below)
 954      */
 955     AcpiDmResourceSource (Resource,
 956         sizeof (AML_RESOURCE_EXTENDED_IRQ) +
 957             ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
 958         Resource->ExtendedIrq.ResourceLength);
 959 
 960     /* Insert a descriptor name */
 961 
 962     AcpiDmDescriptorName ();
 963     AcpiOsPrintf (")\n");
 964 
 965     /* Dump the interrupt list */
 966 
 967     AcpiDmIndent (Level);
 968     AcpiOsPrintf ("{\n");


1033  *
1034  * RETURN:      None
1035  *
1036  * DESCRIPTION: Decode a Vendor Large descriptor
1037  *
1038  ******************************************************************************/
1039 
1040 void
1041 AcpiDmVendorLargeDescriptor (
1042     AML_RESOURCE            *Resource,
1043     UINT32                  Length,
1044     UINT32                  Level)
1045 {
1046 
1047     AcpiDmVendorCommon ("Long ",
1048         ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),
1049         Length, Level);
1050 }
1051 
1052 #endif
1053 
   1 /*******************************************************************************
   2  *
   3  * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2014, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.


 136  * DESCRIPTION: Decode fields common to Memory24 and Memory32 descriptors
 137  *
 138  ******************************************************************************/
 139 
 140 static void
 141 AcpiDmMemoryFields (
 142     void                    *Source,
 143     UINT8                   Type,
 144     UINT32                  Level)
 145 {
 146     UINT32                  i;
 147 
 148 
 149     for (i = 0; i < 4; i++)
 150     {
 151         AcpiDmIndent (Level + 1);
 152 
 153         switch (Type)
 154         {
 155         case 16:
 156 
 157             AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
 158                 AcpiDmMemoryNames[i]);
 159             break;
 160 
 161         case 32:
 162 
 163             AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
 164                 AcpiDmMemoryNames[i]);
 165             break;
 166 
 167         default:
 168 
 169             return;
 170         }
 171     }
 172 }
 173 
 174 
 175 /*******************************************************************************
 176  *
 177  * FUNCTION:    AcpiDmAddressFields
 178  *
 179  * PARAMETERS:  Source              - Pointer to the contiguous data fields
 180  *              Type                - 16, 32, or 64 (bit)
 181  *              Level               - Current source code indentation level
 182  *
 183  * RETURN:      None
 184  *
 185  * DESCRIPTION: Decode fields common to address descriptors
 186  *
 187  ******************************************************************************/
 188 
 189 static void
 190 AcpiDmAddressFields (
 191     void                    *Source,
 192     UINT8                   Type,
 193     UINT32                  Level)
 194 {
 195     UINT32                  i;
 196 
 197 
 198     AcpiOsPrintf ("\n");
 199 
 200     for (i = 0; i < 5; i++)
 201     {
 202         AcpiDmIndent (Level + 1);
 203 
 204         switch (Type)
 205         {
 206         case 16:
 207 
 208             AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
 209                 AcpiDmAddressNames[i]);
 210             break;
 211 
 212         case 32:
 213 
 214             AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
 215                 AcpiDmAddressNames[i]);
 216             break;
 217 
 218         case 64:
 219 
 220             AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
 221                 AcpiDmAddressNames[i]);
 222             break;
 223 
 224         default:
 225 
 226             return;
 227         }
 228     }
 229 }
 230 
 231 
 232 /*******************************************************************************
 233  *
 234  * FUNCTION:    AcpiDmAddressPrefix
 235  *
 236  * PARAMETERS:  Type                - Descriptor type
 237  *
 238  * RETURN:      None
 239  *
 240  * DESCRIPTION: Emit name prefix representing the address descriptor type
 241  *
 242  ******************************************************************************/
 243 
 244 static void
 245 AcpiDmAddressPrefix (
 246     UINT8                   Type)
 247 {
 248 
 249     switch (Type)
 250     {
 251     case ACPI_RESOURCE_TYPE_ADDRESS16:
 252 
 253         AcpiOsPrintf ("Word");
 254         break;
 255 
 256     case ACPI_RESOURCE_TYPE_ADDRESS32:
 257 
 258         AcpiOsPrintf ("DWord");
 259         break;
 260 
 261     case ACPI_RESOURCE_TYPE_ADDRESS64:
 262 
 263         AcpiOsPrintf ("QWord");
 264         break;
 265 
 266     case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
 267 
 268         AcpiOsPrintf ("Extended");
 269         break;
 270 
 271     default:
 272 
 273         return;
 274     }
 275 }
 276 
 277 
 278 /*******************************************************************************
 279  *
 280  * FUNCTION:    AcpiDmAddressCommon
 281  *
 282  * PARAMETERS:  Resource            - Raw AML descriptor
 283  *              Type                - Descriptor type
 284  *              Level               - Current source code indentation level
 285  *
 286  * RETURN:      None
 287  *
 288  * DESCRIPTION: Emit common name and flag fields common to address descriptors
 289  *
 290  ******************************************************************************/
 291 
 292 static void


 313         AcpiOsPrintf ("/**** Invalid Resource Type: 0x%X ****/", ResourceType);
 314         return;
 315     }
 316 
 317     /* Prefix is either Word, DWord, QWord, or Extended */
 318 
 319     AcpiDmAddressPrefix (Type);
 320 
 321     /* Resource Types above 0xC0 are vendor-defined */
 322 
 323     if (ResourceType > 2)
 324     {
 325         AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType);
 326         AcpiDmSpaceFlags (Flags);
 327         AcpiOsPrintf (" 0x%2.2X,", SpecificFlags);
 328         return;
 329     }
 330 
 331     /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
 332 
 333     AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]);
 334 
 335     /* Decode the general and type-specific flags */
 336 
 337     if (ResourceType == ACPI_MEMORY_RANGE)
 338     {
 339         AcpiDmMemoryFlags (Flags, SpecificFlags);
 340     }
 341     else /* IO range or BusNumberRange */
 342     {
 343         AcpiDmIoFlags (Flags);
 344         if (ResourceType == ACPI_IO_RANGE)
 345         {
 346             AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]);
 347         }
 348     }
 349 }
 350 
 351 
 352 /*******************************************************************************
 353  *
 354  * FUNCTION:    AcpiDmAddressFlags
 355  *
 356  * PARAMETERS:  Resource        - Raw AML descriptor
 357  *
 358  * RETURN:      None
 359  *
 360  * DESCRIPTION: Emit flags common to address descriptors
 361  *
 362  ******************************************************************************/
 363 
 364 static void
 365 AcpiDmAddressFlags (
 366     AML_RESOURCE            *Resource)


 378 
 379 
 380 /*******************************************************************************
 381  *
 382  * FUNCTION:    AcpiDmSpaceFlags
 383  *
 384  * PARAMETERS:  Flags               - Flag byte to be decoded
 385  *
 386  * RETURN:      None
 387  *
 388  * DESCRIPTION: Decode the flags specific to Space Address space descriptors
 389  *
 390  ******************************************************************************/
 391 
 392 static void
 393 AcpiDmSpaceFlags (
 394     UINT8                   Flags)
 395 {
 396 
 397     AcpiOsPrintf ("%s, %s, %s, %s,",
 398         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
 399         AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],
 400         AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
 401         AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)]);
 402 }
 403 
 404 
 405 /*******************************************************************************
 406  *
 407  * FUNCTION:    AcpiDmIoFlags
 408  *
 409  * PARAMETERS:  Flags               - Flag byte to be decoded
 410  *
 411  * RETURN:      None
 412  *
 413  * DESCRIPTION: Decode the flags specific to IO Address space descriptors
 414  *
 415  ******************************************************************************/
 416 
 417 static void
 418 AcpiDmIoFlags (
 419         UINT8               Flags)
 420 {
 421     AcpiOsPrintf ("%s, %s, %s, %s,",
 422         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
 423         AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
 424         AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],
 425         AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)]);
 426 }
 427 
 428 
 429 /*******************************************************************************
 430  *
 431  * FUNCTION:    AcpiDmIoFlags2
 432  *
 433  * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
 434  *
 435  * RETURN:      None
 436  *
 437  * DESCRIPTION: Decode the flags specific to IO Address space descriptors
 438  *
 439  ******************************************************************************/
 440 
 441 static void
 442 AcpiDmIoFlags2 (
 443         UINT8               SpecificFlags)
 444 {
 445 
 446     AcpiOsPrintf (", %s",
 447         AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 4)]);
 448 
 449     /* TRS is only used if TTP is TypeTranslation */
 450 
 451     if (SpecificFlags & 0x10)
 452     {
 453         AcpiOsPrintf (", %s",
 454             AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
 455     }
 456 }
 457 
 458 
 459 /*******************************************************************************
 460  *
 461  * FUNCTION:    AcpiDmMemoryFlags
 462  *
 463  * PARAMETERS:  Flags               - Flag byte to be decoded
 464  *              SpecificFlags       - "Specific" flag byte to be decoded
 465  *
 466  * RETURN:      None
 467  *
 468  * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
 469  *
 470  ******************************************************************************/
 471 
 472 static void
 473 AcpiDmMemoryFlags (
 474     UINT8                   Flags,
 475     UINT8                   SpecificFlags)
 476 {
 477 
 478     AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
 479         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
 480         AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],
 481         AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
 482         AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],
 483         AcpiGbl_MemDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 1)],
 484         AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (SpecificFlags)]);
 485 }
 486 
 487 
 488 /*******************************************************************************
 489  *
 490  * FUNCTION:    AcpiDmMemoryFlags2
 491  *
 492  * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
 493  *
 494  * RETURN:      None
 495  *
 496  * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
 497  *
 498  ******************************************************************************/
 499 
 500 static void
 501 AcpiDmMemoryFlags2 (
 502     UINT8                   SpecificFlags)
 503 {
 504 
 505     AcpiOsPrintf (", %s, %s",
 506         AcpiGbl_MtpDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 3)],
 507         AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
 508 }
 509 
 510 
 511 /*******************************************************************************
 512  *
 513  * FUNCTION:    AcpiDmResourceSource
 514  *
 515  * PARAMETERS:  Resource        - Raw AML descriptor
 516  *              MinimumLength   - descriptor length without optional fields
 517  *              ResourceLength
 518  *
 519  * RETURN:      None
 520  *
 521  * DESCRIPTION: Dump optional ResourceSource fields of an address descriptor
 522  *
 523  ******************************************************************************/
 524 
 525 static void
 526 AcpiDmResourceSource (
 527     AML_RESOURCE            *Resource,


 548 
 549     AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength);
 550 
 551     /*
 552      * Always emit the ResourceSourceIndex (Byte)
 553      *
 554      * NOTE: Some ASL compilers always create a 0 byte (in the AML) for the
 555      * Index even if the String does not exist. Although this is in violation
 556      * of the ACPI specification, it is very important to emit ASL code that
 557      * can be compiled back to the identical AML. There may be fields and/or
 558      * indexes into the resource template buffer that are compiled to absolute
 559      * offsets, and these will be broken if the AML length is changed.
 560      */
 561     AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]);
 562 
 563     /* Make sure that the ResourceSource string exists before dumping it */
 564 
 565     if (TotalLength > (MinimumTotalLength + 1))
 566     {
 567         AcpiOsPrintf (" ");
 568         AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT16_MAX);
 569     }
 570 
 571     AcpiOsPrintf (", ");
 572 }
 573 
 574 
 575 /*******************************************************************************
 576  *
 577  * FUNCTION:    AcpiDmWordDescriptor
 578  *
 579  * PARAMETERS:  Resource            - Pointer to the resource descriptor
 580  *              Length              - Length of the descriptor in bytes
 581  *              Level               - Current source code indentation level
 582  *
 583  * RETURN:      None
 584  *
 585  * DESCRIPTION: Decode a Word Address Space descriptor
 586  *
 587  ******************************************************************************/
 588 


 762  *              Length              - Length of the descriptor in bytes
 763  *              Level               - Current source code indentation level
 764  *
 765  * RETURN:      None
 766  *
 767  * DESCRIPTION: Decode a Memory24 descriptor
 768  *
 769  ******************************************************************************/
 770 
 771 void
 772 AcpiDmMemory24Descriptor (
 773     AML_RESOURCE            *Resource,
 774     UINT32                  Length,
 775     UINT32                  Level)
 776 {
 777 
 778     /* Dump name and read/write flag */
 779 
 780     AcpiDmIndent (Level);
 781     AcpiOsPrintf ("Memory24 (%s,\n",
 782         AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory24.Flags)]);
 783 
 784     /* Dump the 4 contiguous WORD values */
 785 
 786     AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level);
 787 
 788     /* Insert a descriptor name */
 789 
 790     AcpiDmIndent (Level + 1);
 791     AcpiDmDescriptorName ();
 792     AcpiOsPrintf (")\n");
 793 }
 794 
 795 
 796 /*******************************************************************************
 797  *
 798  * FUNCTION:    AcpiDmMemory32Descriptor
 799  *
 800  * PARAMETERS:  Resource            - Pointer to the resource descriptor
 801  *              Length              - Length of the descriptor in bytes
 802  *              Level               - Current source code indentation level
 803  *
 804  * RETURN:      None
 805  *
 806  * DESCRIPTION: Decode a Memory32 descriptor
 807  *
 808  ******************************************************************************/
 809 
 810 void
 811 AcpiDmMemory32Descriptor (
 812     AML_RESOURCE            *Resource,
 813     UINT32                  Length,
 814     UINT32                  Level)
 815 {
 816 
 817     /* Dump name and read/write flag */
 818 
 819     AcpiDmIndent (Level);
 820     AcpiOsPrintf ("Memory32 (%s,\n",
 821         AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory32.Flags)]);
 822 
 823     /* Dump the 4 contiguous DWORD values */
 824 
 825     AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level);
 826 
 827     /* Insert a descriptor name */
 828 
 829     AcpiDmIndent (Level + 1);
 830     AcpiDmDescriptorName ();
 831     AcpiOsPrintf (")\n");
 832 }
 833 
 834 
 835 /*******************************************************************************
 836  *
 837  * FUNCTION:    AcpiDmFixedMemory32Descriptor
 838  *
 839  * PARAMETERS:  Resource            - Pointer to the resource descriptor
 840  *              Length              - Length of the descriptor in bytes
 841  *              Level               - Current source code indentation level
 842  *
 843  * RETURN:      None
 844  *
 845  * DESCRIPTION: Decode a Fixed Memory32 descriptor
 846  *
 847  ******************************************************************************/
 848 
 849 void
 850 AcpiDmFixedMemory32Descriptor (
 851     AML_RESOURCE            *Resource,
 852     UINT32                  Length,
 853     UINT32                  Level)
 854 {
 855 
 856     /* Dump name and read/write flag */
 857 
 858     AcpiDmIndent (Level);
 859     AcpiOsPrintf ("Memory32Fixed (%s,\n",
 860         AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
 861 
 862     AcpiDmIndent (Level + 1);
 863     AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base");
 864 
 865     AcpiDmIndent (Level + 1);
 866     AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, "Address Length");
 867 
 868     /* Insert a descriptor name */
 869 
 870     AcpiDmIndent (Level + 1);
 871     AcpiDmDescriptorName ();
 872     AcpiOsPrintf (")\n");
 873 }
 874 
 875 
 876 /*******************************************************************************
 877  *
 878  * FUNCTION:    AcpiDmGenericRegisterDescriptor
 879  *
 880  * PARAMETERS:  Resource            - Pointer to the resource descriptor


 937  *              Length              - Length of the descriptor in bytes
 938  *              Level               - Current source code indentation level
 939  *
 940  * RETURN:      None
 941  *
 942  * DESCRIPTION: Decode a extended Interrupt descriptor
 943  *
 944  ******************************************************************************/
 945 
 946 void
 947 AcpiDmInterruptDescriptor (
 948     AML_RESOURCE            *Resource,
 949     UINT32                  Length,
 950     UINT32                  Level)
 951 {
 952     UINT32                  i;
 953 
 954 
 955     AcpiDmIndent (Level);
 956     AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
 957         AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->ExtendedIrq.Flags)],
 958         AcpiGbl_HeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 1)],
 959         AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 2)],
 960         AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->ExtendedIrq.Flags, 3)]);
 961 
 962     /*
 963      * The ResourceSource fields are optional and appear after the interrupt
 964      * list. Must compute length based on length of the list. First xrupt
 965      * is included in the struct (reason for -1 below)
 966      */
 967     AcpiDmResourceSource (Resource,
 968         sizeof (AML_RESOURCE_EXTENDED_IRQ) +
 969             ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
 970         Resource->ExtendedIrq.ResourceLength);
 971 
 972     /* Insert a descriptor name */
 973 
 974     AcpiDmDescriptorName ();
 975     AcpiOsPrintf (")\n");
 976 
 977     /* Dump the interrupt list */
 978 
 979     AcpiDmIndent (Level);
 980     AcpiOsPrintf ("{\n");


1045  *
1046  * RETURN:      None
1047  *
1048  * DESCRIPTION: Decode a Vendor Large descriptor
1049  *
1050  ******************************************************************************/
1051 
1052 void
1053 AcpiDmVendorLargeDescriptor (
1054     AML_RESOURCE            *Resource,
1055     UINT32                  Length,
1056     UINT32                  Level)
1057 {
1058 
1059     AcpiDmVendorCommon ("Long ",
1060         ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),
1061         Length, Level);
1062 }
1063 
1064 #endif