Print this page
acpica-unix2-20130823
PANKOVs restructure

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/disassembler/dmresrcl.c
          +++ new/usr/src/common/acpica/components/disassembler/dmresrcl.c
   1    1  /*******************************************************************************
   2    2   *
   3    3   * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
   4    4   *
   5    5   ******************************************************************************/
   6    6  
   7    7  /*
   8      - * Copyright (C) 2000 - 2011, Intel Corp.
        8 + * Copyright (C) 2000 - 2013, Intel Corp.
   9    9   * All rights reserved.
  10   10   *
  11   11   * Redistribution and use in source and binary forms, with or without
  12   12   * modification, are permitted provided that the following conditions
  13   13   * are met:
  14   14   * 1. Redistributions of source code must retain the above copyright
  15   15   *    notice, this list of conditions, and the following disclaimer,
  16   16   *    without modification.
  17   17   * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18   18   *    substantially similar to the "NO WARRANTY" disclaimer below
↓ open down ↓ 127 lines elided ↑ open up ↑
 146  146      UINT32                  i;
 147  147  
 148  148  
 149  149      for (i = 0; i < 4; i++)
 150  150      {
 151  151          AcpiDmIndent (Level + 1);
 152  152  
 153  153          switch (Type)
 154  154          {
 155  155          case 16:
      156 +
 156  157              AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
 157  158                  AcpiDmMemoryNames[i]);
 158  159              break;
 159  160  
 160  161          case 32:
      162 +
 161  163              AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
 162  164                  AcpiDmMemoryNames[i]);
 163  165              break;
 164  166  
 165  167          default:
      168 +
 166  169              return;
 167  170          }
 168  171      }
 169  172  }
 170  173  
 171  174  
 172  175  /*******************************************************************************
 173  176   *
 174  177   * FUNCTION:    AcpiDmAddressFields
 175  178   *
↓ open down ↓ 18 lines elided ↑ open up ↑
 194  197  
 195  198      AcpiOsPrintf ("\n");
 196  199  
 197  200      for (i = 0; i < 5; i++)
 198  201      {
 199  202          AcpiDmIndent (Level + 1);
 200  203  
 201  204          switch (Type)
 202  205          {
 203  206          case 16:
      207 +
 204  208              AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
 205  209                  AcpiDmAddressNames[i]);
 206  210              break;
 207  211  
 208  212          case 32:
      213 +
 209  214              AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
 210  215                  AcpiDmAddressNames[i]);
 211  216              break;
 212  217  
 213  218          case 64:
      219 +
 214  220              AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
 215  221                  AcpiDmAddressNames[i]);
 216  222              break;
 217  223  
 218  224          default:
      225 +
 219  226              return;
 220  227          }
 221  228      }
 222  229  }
 223  230  
 224  231  
 225  232  /*******************************************************************************
 226  233   *
 227  234   * FUNCTION:    AcpiDmAddressPrefix
 228  235   *
↓ open down ↓ 6 lines elided ↑ open up ↑
 235  242   ******************************************************************************/
 236  243  
 237  244  static void
 238  245  AcpiDmAddressPrefix (
 239  246      UINT8                   Type)
 240  247  {
 241  248  
 242  249      switch (Type)
 243  250      {
 244  251      case ACPI_RESOURCE_TYPE_ADDRESS16:
      252 +
 245  253          AcpiOsPrintf ("Word");
 246  254          break;
 247  255  
 248  256      case ACPI_RESOURCE_TYPE_ADDRESS32:
      257 +
 249  258          AcpiOsPrintf ("DWord");
 250  259          break;
 251  260  
 252  261      case ACPI_RESOURCE_TYPE_ADDRESS64:
      262 +
 253  263          AcpiOsPrintf ("QWord");
 254  264          break;
 255  265  
 256  266      case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
      267 +
 257  268          AcpiOsPrintf ("Extended");
 258  269          break;
 259  270  
 260  271      default:
      272 +
 261  273          return;
 262  274      }
 263  275  }
 264  276  
 265  277  
 266  278  /*******************************************************************************
 267  279   *
 268  280   * FUNCTION:    AcpiDmAddressCommon
 269  281   *
 270  282   * PARAMETERS:  Resource            - Raw AML descriptor
↓ open down ↓ 40 lines elided ↑ open up ↑
 311  323      if (ResourceType > 2)
 312  324      {
 313  325          AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType);
 314  326          AcpiDmSpaceFlags (Flags);
 315  327          AcpiOsPrintf (" 0x%2.2X,", SpecificFlags);
 316  328          return;
 317  329      }
 318  330  
 319  331      /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
 320  332  
 321      -    AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ResourceType & 0x3]);
      333 +    AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]);
 322  334  
 323  335      /* Decode the general and type-specific flags */
 324  336  
 325  337      if (ResourceType == ACPI_MEMORY_RANGE)
 326  338      {
 327  339          AcpiDmMemoryFlags (Flags, SpecificFlags);
 328  340      }
 329  341      else /* IO range or BusNumberRange */
 330  342      {
 331  343          AcpiDmIoFlags (Flags);
 332  344          if (ResourceType == ACPI_IO_RANGE)
 333  345          {
 334      -            AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [SpecificFlags & 0x3]);
      346 +            AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]);
 335  347          }
 336  348      }
 337  349  }
 338  350  
 339  351  
 340  352  /*******************************************************************************
 341  353   *
 342  354   * FUNCTION:    AcpiDmAddressFlags
 343  355   *
 344  356   * PARAMETERS:  Resource        - Raw AML descriptor
↓ open down ↓ 31 lines elided ↑ open up ↑
 376  388   * DESCRIPTION: Decode the flags specific to Space Address space descriptors
 377  389   *
 378  390   ******************************************************************************/
 379  391  
 380  392  static void
 381  393  AcpiDmSpaceFlags (
 382  394      UINT8                   Flags)
 383  395  {
 384  396  
 385  397      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]);
      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)]);
 390  402  }
 391  403  
 392  404  
 393  405  /*******************************************************************************
 394  406   *
 395  407   * FUNCTION:    AcpiDmIoFlags
 396  408   *
 397  409   * PARAMETERS:  Flags               - Flag byte to be decoded
 398  410   *
 399  411   * RETURN:      None
 400  412   *
 401  413   * DESCRIPTION: Decode the flags specific to IO Address space descriptors
 402  414   *
 403  415   ******************************************************************************/
 404  416  
 405  417  static void
 406  418  AcpiDmIoFlags (
 407  419          UINT8               Flags)
 408  420  {
 409  421      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]);
      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)]);
 414  426  }
 415  427  
 416  428  
 417  429  /*******************************************************************************
 418  430   *
 419  431   * FUNCTION:    AcpiDmIoFlags2
 420  432   *
 421  433   * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
 422  434   *
 423  435   * RETURN:      None
↓ open down ↓ 1 lines elided ↑ open up ↑
 425  437   * DESCRIPTION: Decode the flags specific to IO Address space descriptors
 426  438   *
 427  439   ******************************************************************************/
 428  440  
 429  441  static void
 430  442  AcpiDmIoFlags2 (
 431  443          UINT8               SpecificFlags)
 432  444  {
 433  445  
 434  446      AcpiOsPrintf (", %s",
 435      -        AcpiGbl_TtpDecode [(SpecificFlags & 0x10) >> 4]);
      447 +        AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 4)]);
 436  448  
 437  449      /* TRS is only used if TTP is TypeTranslation */
 438  450  
 439  451      if (SpecificFlags & 0x10)
 440  452      {
 441  453          AcpiOsPrintf (", %s",
 442      -            AcpiGbl_TrsDecode [(SpecificFlags & 0x20) >> 5]);
      454 +            AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
 443  455      }
 444  456  }
 445  457  
 446  458  
 447  459  /*******************************************************************************
 448  460   *
 449  461   * FUNCTION:    AcpiDmMemoryFlags
 450  462   *
 451  463   * PARAMETERS:  Flags               - Flag byte to be decoded
 452  464   *              SpecificFlags       - "Specific" flag byte to be decoded
↓ open down ↓ 4 lines elided ↑ open up ↑
 457  469   *
 458  470   ******************************************************************************/
 459  471  
 460  472  static void
 461  473  AcpiDmMemoryFlags (
 462  474      UINT8                   Flags,
 463  475      UINT8                   SpecificFlags)
 464  476  {
 465  477  
 466  478      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)]);
      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)]);
 473  485  }
 474  486  
 475  487  
 476  488  /*******************************************************************************
 477  489   *
 478  490   * FUNCTION:    AcpiDmMemoryFlags2
 479  491   *
 480  492   * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
 481  493   *
 482  494   * RETURN:      None
↓ open down ↓ 1 lines elided ↑ open up ↑
 484  496   * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
 485  497   *
 486  498   ******************************************************************************/
 487  499  
 488  500  static void
 489  501  AcpiDmMemoryFlags2 (
 490  502      UINT8                   SpecificFlags)
 491  503  {
 492  504  
 493  505      AcpiOsPrintf (", %s, %s",
 494      -        AcpiGbl_MtpDecode [(SpecificFlags & 0x18) >> 3],
 495      -        AcpiGbl_TtpDecode [(SpecificFlags & 0x20) >> 5]);
      506 +        AcpiGbl_MtpDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 3)],
      507 +        AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
 496  508  }
 497  509  
 498  510  
 499  511  /*******************************************************************************
 500  512   *
 501  513   * FUNCTION:    AcpiDmResourceSource
 502  514   *
 503  515   * PARAMETERS:  Resource        - Raw AML descriptor
 504  516   *              MinimumLength   - descriptor length without optional fields
 505  517   *              ResourceLength
↓ open down ↓ 40 lines elided ↑ open up ↑
 546  558       * indexes into the resource template buffer that are compiled to absolute
 547  559       * offsets, and these will be broken if the AML length is changed.
 548  560       */
 549  561      AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]);
 550  562  
 551  563      /* Make sure that the ResourceSource string exists before dumping it */
 552  564  
 553  565      if (TotalLength > (MinimumTotalLength + 1))
 554  566      {
 555  567          AcpiOsPrintf (" ");
 556      -        AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT8_MAX);
      568 +        AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT16_MAX);
 557  569      }
 558  570  
 559  571      AcpiOsPrintf (", ");
 560  572  }
 561  573  
 562  574  
 563  575  /*******************************************************************************
 564  576   *
 565  577   * FUNCTION:    AcpiDmWordDescriptor
 566  578   *
↓ open down ↓ 193 lines elided ↑ open up ↑
 760  772  AcpiDmMemory24Descriptor (
 761  773      AML_RESOURCE            *Resource,
 762  774      UINT32                  Length,
 763  775      UINT32                  Level)
 764  776  {
 765  777  
 766  778      /* Dump name and read/write flag */
 767  779  
 768  780      AcpiDmIndent (Level);
 769  781      AcpiOsPrintf ("Memory24 (%s,\n",
 770      -        AcpiGbl_RwDecode [Resource->Memory24.Flags & 1]);
      782 +        AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory24.Flags)]);
 771  783  
 772  784      /* Dump the 4 contiguous WORD values */
 773  785  
 774  786      AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level);
 775  787  
 776  788      /* Insert a descriptor name */
 777  789  
 778  790      AcpiDmIndent (Level + 1);
 779  791      AcpiDmDescriptorName ();
 780  792      AcpiOsPrintf (")\n");
↓ open down ↓ 18 lines elided ↑ open up ↑
 799  811  AcpiDmMemory32Descriptor (
 800  812      AML_RESOURCE            *Resource,
 801  813      UINT32                  Length,
 802  814      UINT32                  Level)
 803  815  {
 804  816  
 805  817      /* Dump name and read/write flag */
 806  818  
 807  819      AcpiDmIndent (Level);
 808  820      AcpiOsPrintf ("Memory32 (%s,\n",
 809      -        AcpiGbl_RwDecode [Resource->Memory32.Flags & 1]);
      821 +        AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory32.Flags)]);
 810  822  
 811  823      /* Dump the 4 contiguous DWORD values */
 812  824  
 813  825      AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level);
 814  826  
 815  827      /* Insert a descriptor name */
 816  828  
 817  829      AcpiDmIndent (Level + 1);
 818  830      AcpiDmDescriptorName ();
 819  831      AcpiOsPrintf (")\n");
↓ open down ↓ 18 lines elided ↑ open up ↑
 838  850  AcpiDmFixedMemory32Descriptor (
 839  851      AML_RESOURCE            *Resource,
 840  852      UINT32                  Length,
 841  853      UINT32                  Level)
 842  854  {
 843  855  
 844  856      /* Dump name and read/write flag */
 845  857  
 846  858      AcpiDmIndent (Level);
 847  859      AcpiOsPrintf ("Memory32Fixed (%s,\n",
 848      -        AcpiGbl_RwDecode [Resource->FixedMemory32.Flags & 1]);
      860 +        AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
 849  861  
 850  862      AcpiDmIndent (Level + 1);
 851  863      AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base");
 852  864  
 853  865      AcpiDmIndent (Level + 1);
 854  866      AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, "Address Length");
 855  867  
 856  868      /* Insert a descriptor name */
 857  869  
 858  870      AcpiDmIndent (Level + 1);
↓ open down ↓ 76 lines elided ↑ open up ↑
 935  947  AcpiDmInterruptDescriptor (
 936  948      AML_RESOURCE            *Resource,
 937  949      UINT32                  Length,
 938  950      UINT32                  Level)
 939  951  {
 940  952      UINT32                  i;
 941  953  
 942  954  
 943  955      AcpiDmIndent (Level);
 944  956      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]);
      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)]);
 949  961  
 950  962      /*
 951  963       * The ResourceSource fields are optional and appear after the interrupt
 952  964       * list. Must compute length based on length of the list. First xrupt
 953  965       * is included in the struct (reason for -1 below)
 954  966       */
 955  967      AcpiDmResourceSource (Resource,
 956  968          sizeof (AML_RESOURCE_EXTENDED_IRQ) +
 957  969              ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
 958  970          Resource->ExtendedIrq.ResourceLength);
↓ open down ↓ 84 lines elided ↑ open up ↑
1043 1055      UINT32                  Length,
1044 1056      UINT32                  Level)
1045 1057  {
1046 1058  
1047 1059      AcpiDmVendorCommon ("Long ",
1048 1060          ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),
1049 1061          Length, Level);
1050 1062  }
1051 1063  
1052 1064  #endif
1053      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX