1227896Sjkim/******************************************************************************* 2227896Sjkim * 3227896Sjkim * Module Name: dmresrcl2.c - "Large" Resource Descriptor disassembly (#2) 4227896Sjkim * 5227896Sjkim ******************************************************************************/ 6227896Sjkim 7227896Sjkim/* 8306536Sjkim * Copyright (C) 2000 - 2016, Intel Corp. 9227896Sjkim * All rights reserved. 10227896Sjkim * 11227896Sjkim * Redistribution and use in source and binary forms, with or without 12227896Sjkim * modification, are permitted provided that the following conditions 13227896Sjkim * are met: 14227896Sjkim * 1. Redistributions of source code must retain the above copyright 15227896Sjkim * notice, this list of conditions, and the following disclaimer, 16227896Sjkim * without modification. 17227896Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18227896Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 19227896Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 20227896Sjkim * including a substantially similar Disclaimer requirement for further 21227896Sjkim * binary redistribution. 22227896Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 23227896Sjkim * of any contributors may be used to endorse or promote products derived 24227896Sjkim * from this software without specific prior written permission. 25227896Sjkim * 26227896Sjkim * Alternatively, this software may be distributed under the terms of the 27227896Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 28227896Sjkim * Software Foundation. 29227896Sjkim * 30227896Sjkim * NO WARRANTY 31227896Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32227896Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33227896Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34227896Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35227896Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36227896Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37227896Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38227896Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39227896Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40227896Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41227896Sjkim * POSSIBILITY OF SUCH DAMAGES. 42227896Sjkim */ 43227896Sjkim 44228110Sjkim#include <contrib/dev/acpica/include/acpi.h> 45228110Sjkim#include <contrib/dev/acpica/include/accommon.h> 46228110Sjkim#include <contrib/dev/acpica/include/acdisasm.h> 47227896Sjkim 48227896Sjkim 49227896Sjkim#define _COMPONENT ACPI_CA_DEBUGGER 50227896Sjkim ACPI_MODULE_NAME ("dbresrcl2") 51227896Sjkim 52227896Sjkim/* Local prototypes */ 53227896Sjkim 54227896Sjkimstatic void 55227896SjkimAcpiDmI2cSerialBusDescriptor ( 56281075Sdim ACPI_OP_WALK_INFO *Info, 57227896Sjkim AML_RESOURCE *Resource, 58227896Sjkim UINT32 Length, 59227896Sjkim UINT32 Level); 60227896Sjkim 61227896Sjkimstatic void 62227896SjkimAcpiDmSpiSerialBusDescriptor ( 63281075Sdim ACPI_OP_WALK_INFO *Info, 64227896Sjkim AML_RESOURCE *Resource, 65227896Sjkim UINT32 Length, 66227896Sjkim UINT32 Level); 67227896Sjkim 68227896Sjkimstatic void 69227896SjkimAcpiDmUartSerialBusDescriptor ( 70281075Sdim ACPI_OP_WALK_INFO *Info, 71227896Sjkim AML_RESOURCE *Resource, 72227896Sjkim UINT32 Length, 73227896Sjkim UINT32 Level); 74227896Sjkim 75227896Sjkimstatic void 76227896SjkimAcpiDmGpioCommon ( 77281075Sdim ACPI_OP_WALK_INFO *Info, 78227896Sjkim AML_RESOURCE *Resource, 79227896Sjkim UINT32 Level); 80227896Sjkim 81227896Sjkimstatic void 82227896SjkimAcpiDmDumpRawDataBuffer ( 83227896Sjkim UINT8 *Buffer, 84227896Sjkim UINT32 Length, 85227896Sjkim UINT32 Level); 86227896Sjkim 87227896Sjkim 88227896Sjkim/* Dispatch table for the serial bus descriptors */ 89227896Sjkim 90227896Sjkimstatic ACPI_RESOURCE_HANDLER SerialBusResourceDispatch [] = 91227896Sjkim{ 92227896Sjkim NULL, 93227896Sjkim AcpiDmI2cSerialBusDescriptor, 94227896Sjkim AcpiDmSpiSerialBusDescriptor, 95227896Sjkim AcpiDmUartSerialBusDescriptor 96227896Sjkim}; 97227896Sjkim 98227896Sjkim 99227896Sjkim/******************************************************************************* 100227896Sjkim * 101227896Sjkim * FUNCTION: AcpiDmDumpRawDataBuffer 102227896Sjkim * 103227896Sjkim * PARAMETERS: Buffer - Pointer to the data bytes 104227896Sjkim * Length - Length of the descriptor in bytes 105227896Sjkim * Level - Current source code indentation level 106227896Sjkim * 107227896Sjkim * RETURN: None 108227896Sjkim * 109227896Sjkim * DESCRIPTION: Dump a data buffer as a RawDataBuffer() object. Used for 110227896Sjkim * vendor data bytes. 111227896Sjkim * 112227896Sjkim ******************************************************************************/ 113227896Sjkim 114227896Sjkimstatic void 115227896SjkimAcpiDmDumpRawDataBuffer ( 116227896Sjkim UINT8 *Buffer, 117227896Sjkim UINT32 Length, 118227896Sjkim UINT32 Level) 119227896Sjkim{ 120227896Sjkim UINT32 Index; 121227896Sjkim UINT32 i; 122227896Sjkim UINT32 j; 123227896Sjkim 124227896Sjkim 125227896Sjkim if (!Length) 126227896Sjkim { 127227896Sjkim return; 128227896Sjkim } 129227896Sjkim 130227896Sjkim AcpiOsPrintf ("RawDataBuffer (0x%.2X) // Vendor Data", Length); 131227896Sjkim 132227896Sjkim AcpiOsPrintf ("\n"); 133227896Sjkim AcpiDmIndent (Level + 1); 134227896Sjkim AcpiOsPrintf ("{\n"); 135227896Sjkim AcpiDmIndent (Level + 2); 136227896Sjkim 137227896Sjkim for (i = 0; i < Length;) 138227896Sjkim { 139227896Sjkim for (j = 0; j < 8; j++) 140227896Sjkim { 141227896Sjkim Index = i + j; 142227896Sjkim if (Index >= Length) 143227896Sjkim { 144227896Sjkim goto Finish; 145227896Sjkim } 146227896Sjkim 147227896Sjkim AcpiOsPrintf ("0x%2.2X", Buffer[Index]); 148227896Sjkim if ((Index + 1) >= Length) 149227896Sjkim { 150227896Sjkim goto Finish; 151227896Sjkim } 152227896Sjkim 153227896Sjkim AcpiOsPrintf (", "); 154227896Sjkim } 155306536Sjkim 156227896Sjkim AcpiOsPrintf ("\n"); 157227896Sjkim AcpiDmIndent (Level + 2); 158227896Sjkim 159227896Sjkim i += 8; 160227896Sjkim } 161227896Sjkim 162227896SjkimFinish: 163227896Sjkim AcpiOsPrintf ("\n"); 164227896Sjkim AcpiDmIndent (Level + 1); 165227896Sjkim AcpiOsPrintf ("}"); 166227896Sjkim} 167227896Sjkim 168227896Sjkim 169227896Sjkim/******************************************************************************* 170227896Sjkim * 171227896Sjkim * FUNCTION: AcpiDmGpioCommon 172227896Sjkim * 173281075Sdim * PARAMETERS: Info - Extra resource info 174281075Sdim * Resource - Pointer to the resource descriptor 175227896Sjkim * Level - Current source code indentation level 176227896Sjkim * 177227896Sjkim * RETURN: None 178227896Sjkim * 179227896Sjkim * DESCRIPTION: Decode common parts of a GPIO Interrupt descriptor 180227896Sjkim * 181227896Sjkim ******************************************************************************/ 182227896Sjkim 183227896Sjkimstatic void 184227896SjkimAcpiDmGpioCommon ( 185281075Sdim ACPI_OP_WALK_INFO *Info, 186227896Sjkim AML_RESOURCE *Resource, 187227896Sjkim UINT32 Level) 188227896Sjkim{ 189227896Sjkim UINT16 *PinList; 190227896Sjkim UINT8 *VendorData; 191281075Sdim char *DeviceName = NULL; 192281075Sdim UINT32 PinCount; 193227896Sjkim UINT32 i; 194227896Sjkim 195227896Sjkim 196227896Sjkim /* ResourceSource, ResourceSourceIndex, ResourceType */ 197227896Sjkim 198227896Sjkim AcpiDmIndent (Level + 1); 199227896Sjkim if (Resource->Gpio.ResSourceOffset) 200227896Sjkim { 201306536Sjkim DeviceName = ACPI_ADD_PTR (char, 202306536Sjkim Resource, Resource->Gpio.ResSourceOffset), 203281075Sdim AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); 204227896Sjkim } 205227896Sjkim 206227896Sjkim AcpiOsPrintf (", "); 207227896Sjkim AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex); 208227896Sjkim AcpiOsPrintf ("%s, ", 209243347Sjkim AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]); 210227896Sjkim 211227896Sjkim /* Insert a descriptor name */ 212227896Sjkim 213227896Sjkim AcpiDmDescriptorName (); 214227896Sjkim AcpiOsPrintf (","); 215227896Sjkim 216227896Sjkim /* Dump the vendor data */ 217227896Sjkim 218227896Sjkim if (Resource->Gpio.VendorOffset) 219227896Sjkim { 220227896Sjkim AcpiOsPrintf ("\n"); 221227896Sjkim AcpiDmIndent (Level + 1); 222227896Sjkim VendorData = ACPI_ADD_PTR (UINT8, Resource, 223227896Sjkim Resource->Gpio.VendorOffset); 224227896Sjkim 225227896Sjkim AcpiDmDumpRawDataBuffer (VendorData, 226227896Sjkim Resource->Gpio.VendorLength, Level); 227227896Sjkim } 228227896Sjkim 229227896Sjkim AcpiOsPrintf (")\n"); 230227896Sjkim 231227896Sjkim /* Dump the interrupt list */ 232227896Sjkim 233227896Sjkim AcpiDmIndent (Level + 1); 234227896Sjkim AcpiOsPrintf ("{ // Pin list\n"); 235227896Sjkim 236227896Sjkim PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset - 237227896Sjkim Resource->Gpio.PinTableOffset)) / 238227896Sjkim sizeof (UINT16); 239227896Sjkim 240227896Sjkim PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, 241227896Sjkim Resource->Gpio.PinTableOffset); 242227896Sjkim 243227896Sjkim for (i = 0; i < PinCount; i++) 244227896Sjkim { 245227896Sjkim AcpiDmIndent (Level + 2); 246306536Sjkim AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], 247306536Sjkim ((i + 1) < PinCount) ? "," : ""); 248227896Sjkim } 249227896Sjkim 250227896Sjkim AcpiDmIndent (Level + 1); 251227896Sjkim AcpiOsPrintf ("}\n"); 252281075Sdim 253281075Sdim#ifndef _KERNEL 254306536Sjkim MpSaveGpioInfo (Info->MappingOp, Resource, 255306536Sjkim PinCount, PinList, DeviceName); 256281075Sdim#endif 257227896Sjkim} 258227896Sjkim 259227896Sjkim 260227896Sjkim/******************************************************************************* 261227896Sjkim * 262227896Sjkim * FUNCTION: AcpiDmGpioIntDescriptor 263227896Sjkim * 264281075Sdim * PARAMETERS: Info - Extra resource info 265281075Sdim * Resource - Pointer to the resource descriptor 266227896Sjkim * Length - Length of the descriptor in bytes 267227896Sjkim * Level - Current source code indentation level 268227896Sjkim * 269227896Sjkim * RETURN: None 270227896Sjkim * 271227896Sjkim * DESCRIPTION: Decode a GPIO Interrupt descriptor 272227896Sjkim * 273227896Sjkim ******************************************************************************/ 274227896Sjkim 275227896Sjkimstatic void 276227896SjkimAcpiDmGpioIntDescriptor ( 277281075Sdim ACPI_OP_WALK_INFO *Info, 278227896Sjkim AML_RESOURCE *Resource, 279227896Sjkim UINT32 Length, 280227896Sjkim UINT32 Level) 281227896Sjkim{ 282227896Sjkim 283227896Sjkim /* Dump the GpioInt-specific portion of the descriptor */ 284227896Sjkim 285227896Sjkim /* EdgeLevel, ActiveLevel, Shared */ 286227896Sjkim 287227896Sjkim AcpiDmIndent (Level); 288227896Sjkim AcpiOsPrintf ("GpioInt (%s, %s, %s, ", 289243347Sjkim AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)], 290281075Sdim AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)], 291243347Sjkim AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]); 292227896Sjkim 293227896Sjkim /* PinConfig, DebounceTimeout */ 294227896Sjkim 295227896Sjkim if (Resource->Gpio.PinConfig <= 3) 296227896Sjkim { 297227896Sjkim AcpiOsPrintf ("%s, ", 298227896Sjkim AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]); 299227896Sjkim } 300227896Sjkim else 301227896Sjkim { 302227896Sjkim AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig); 303227896Sjkim } 304227896Sjkim AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout); 305227896Sjkim 306227896Sjkim /* Dump the GpioInt/GpioIo common portion of the descriptor */ 307227896Sjkim 308281075Sdim AcpiDmGpioCommon (Info, Resource, Level); 309227896Sjkim} 310227896Sjkim 311227896Sjkim 312227896Sjkim/******************************************************************************* 313227896Sjkim * 314227896Sjkim * FUNCTION: AcpiDmGpioIoDescriptor 315227896Sjkim * 316281075Sdim * PARAMETERS: Info - Extra resource info 317281075Sdim * Resource - Pointer to the resource descriptor 318227896Sjkim * Length - Length of the descriptor in bytes 319227896Sjkim * Level - Current source code indentation level 320227896Sjkim * 321227896Sjkim * RETURN: None 322227896Sjkim * 323243347Sjkim * DESCRIPTION: Decode a GPIO I/O descriptor 324227896Sjkim * 325227896Sjkim ******************************************************************************/ 326227896Sjkim 327227896Sjkimstatic void 328227896SjkimAcpiDmGpioIoDescriptor ( 329281075Sdim ACPI_OP_WALK_INFO *Info, 330227896Sjkim AML_RESOURCE *Resource, 331227896Sjkim UINT32 Length, 332227896Sjkim UINT32 Level) 333227896Sjkim{ 334227896Sjkim 335227896Sjkim /* Dump the GpioIo-specific portion of the descriptor */ 336227896Sjkim 337227896Sjkim /* Shared, PinConfig */ 338227896Sjkim 339227896Sjkim AcpiDmIndent (Level); 340227896Sjkim AcpiOsPrintf ("GpioIo (%s, ", 341243347Sjkim AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]); 342227896Sjkim 343227896Sjkim if (Resource->Gpio.PinConfig <= 3) 344227896Sjkim { 345227896Sjkim AcpiOsPrintf ("%s, ", 346227896Sjkim AcpiGbl_PpcDecode[Resource->Gpio.PinConfig]); 347227896Sjkim } 348227896Sjkim else 349227896Sjkim { 350227896Sjkim AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig); 351227896Sjkim } 352227896Sjkim 353227896Sjkim /* DebounceTimeout, DriveStrength, IoRestriction */ 354227896Sjkim 355227896Sjkim AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout); 356227896Sjkim AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength); 357227896Sjkim AcpiOsPrintf ("%s,\n", 358243347Sjkim AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]); 359227896Sjkim 360227896Sjkim /* Dump the GpioInt/GpioIo common portion of the descriptor */ 361227896Sjkim 362281075Sdim AcpiDmGpioCommon (Info, Resource, Level); 363227896Sjkim} 364227896Sjkim 365227896Sjkim 366227896Sjkim/******************************************************************************* 367227896Sjkim * 368227896Sjkim * FUNCTION: AcpiDmGpioDescriptor 369227896Sjkim * 370281075Sdim * PARAMETERS: Info - Extra resource info 371281075Sdim * Resource - Pointer to the resource descriptor 372227896Sjkim * Length - Length of the descriptor in bytes 373227896Sjkim * Level - Current source code indentation level 374227896Sjkim * 375227896Sjkim * RETURN: None 376227896Sjkim * 377227896Sjkim * DESCRIPTION: Decode a GpioInt/GpioIo GPIO Interrupt/IO descriptor 378227896Sjkim * 379227896Sjkim ******************************************************************************/ 380227896Sjkim 381227896Sjkimvoid 382227896SjkimAcpiDmGpioDescriptor ( 383281075Sdim ACPI_OP_WALK_INFO *Info, 384227896Sjkim AML_RESOURCE *Resource, 385227896Sjkim UINT32 Length, 386227896Sjkim UINT32 Level) 387227896Sjkim{ 388227896Sjkim UINT8 ConnectionType; 389227896Sjkim 390227896Sjkim 391227896Sjkim ConnectionType = Resource->Gpio.ConnectionType; 392227896Sjkim 393227896Sjkim switch (ConnectionType) 394227896Sjkim { 395227896Sjkim case AML_RESOURCE_GPIO_TYPE_INT: 396250838Sjkim 397281075Sdim AcpiDmGpioIntDescriptor (Info, Resource, Length, Level); 398227896Sjkim break; 399227896Sjkim 400227896Sjkim case AML_RESOURCE_GPIO_TYPE_IO: 401250838Sjkim 402281075Sdim AcpiDmGpioIoDescriptor (Info, Resource, Length, Level); 403227896Sjkim break; 404227896Sjkim 405227896Sjkim default: 406250838Sjkim 407227896Sjkim AcpiOsPrintf ("Unknown GPIO type\n"); 408227896Sjkim break; 409227896Sjkim } 410227896Sjkim} 411227896Sjkim 412227896Sjkim 413227896Sjkim/******************************************************************************* 414227896Sjkim * 415227896Sjkim * FUNCTION: AcpiDmDumpSerialBusVendorData 416227896Sjkim * 417227896Sjkim * PARAMETERS: Resource - Pointer to the resource descriptor 418227896Sjkim * 419227896Sjkim * RETURN: None 420227896Sjkim * 421227896Sjkim * DESCRIPTION: Dump optional serial bus vendor data 422227896Sjkim * 423227896Sjkim ******************************************************************************/ 424227896Sjkim 425227896Sjkimstatic void 426227896SjkimAcpiDmDumpSerialBusVendorData ( 427227896Sjkim AML_RESOURCE *Resource, 428227896Sjkim UINT32 Level) 429227896Sjkim{ 430227896Sjkim UINT8 *VendorData; 431227896Sjkim UINT32 VendorLength; 432227896Sjkim 433227896Sjkim 434227896Sjkim /* Get the (optional) vendor data and length */ 435227896Sjkim 436227896Sjkim switch (Resource->CommonSerialBus.Type) 437227896Sjkim { 438227896Sjkim case AML_RESOURCE_I2C_SERIALBUSTYPE: 439227896Sjkim 440227896Sjkim VendorLength = Resource->CommonSerialBus.TypeDataLength - 441227896Sjkim AML_RESOURCE_I2C_MIN_DATA_LEN; 442227896Sjkim 443227896Sjkim VendorData = ACPI_ADD_PTR (UINT8, Resource, 444227896Sjkim sizeof (AML_RESOURCE_I2C_SERIALBUS)); 445227896Sjkim break; 446227896Sjkim 447227896Sjkim case AML_RESOURCE_SPI_SERIALBUSTYPE: 448227896Sjkim 449227896Sjkim VendorLength = Resource->CommonSerialBus.TypeDataLength - 450227896Sjkim AML_RESOURCE_SPI_MIN_DATA_LEN; 451227896Sjkim 452227896Sjkim VendorData = ACPI_ADD_PTR (UINT8, Resource, 453227896Sjkim sizeof (AML_RESOURCE_SPI_SERIALBUS)); 454227896Sjkim break; 455227896Sjkim 456227896Sjkim case AML_RESOURCE_UART_SERIALBUSTYPE: 457227896Sjkim 458227896Sjkim VendorLength = Resource->CommonSerialBus.TypeDataLength - 459227896Sjkim AML_RESOURCE_UART_MIN_DATA_LEN; 460227896Sjkim 461227896Sjkim VendorData = ACPI_ADD_PTR (UINT8, Resource, 462227896Sjkim sizeof (AML_RESOURCE_UART_SERIALBUS)); 463227896Sjkim break; 464227896Sjkim 465227896Sjkim default: 466250838Sjkim 467227896Sjkim return; 468227896Sjkim } 469227896Sjkim 470227896Sjkim /* Dump the vendor bytes as a RawDataBuffer object */ 471227896Sjkim 472227896Sjkim AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level); 473227896Sjkim} 474227896Sjkim 475227896Sjkim 476227896Sjkim/******************************************************************************* 477227896Sjkim * 478227896Sjkim * FUNCTION: AcpiDmI2cSerialBusDescriptor 479227896Sjkim * 480281075Sdim * PARAMETERS: Info - Extra resource info 481281075Sdim * Resource - Pointer to the resource descriptor 482227896Sjkim * Length - Length of the descriptor in bytes 483227896Sjkim * Level - Current source code indentation level 484227896Sjkim * 485227896Sjkim * RETURN: None 486227896Sjkim * 487227896Sjkim * DESCRIPTION: Decode a I2C serial bus descriptor 488227896Sjkim * 489227896Sjkim ******************************************************************************/ 490227896Sjkim 491227896Sjkimstatic void 492227896SjkimAcpiDmI2cSerialBusDescriptor ( 493281075Sdim ACPI_OP_WALK_INFO *Info, 494227896Sjkim AML_RESOURCE *Resource, 495227896Sjkim UINT32 Length, 496227896Sjkim UINT32 Level) 497227896Sjkim{ 498227896Sjkim UINT32 ResourceSourceOffset; 499281075Sdim char *DeviceName; 500227896Sjkim 501227896Sjkim 502227896Sjkim /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */ 503227896Sjkim 504227896Sjkim AcpiDmIndent (Level); 505306536Sjkim AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n", 506227896Sjkim Resource->I2cSerialBus.SlaveAddress, 507243347Sjkim AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)], 508227896Sjkim Resource->I2cSerialBus.ConnectionSpeed); 509227896Sjkim 510227896Sjkim AcpiDmIndent (Level + 1); 511227896Sjkim AcpiOsPrintf ("%s, ", 512243347Sjkim AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]); 513227896Sjkim 514227896Sjkim /* ResourceSource is a required field */ 515227896Sjkim 516227896Sjkim ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + 517227896Sjkim Resource->CommonSerialBus.TypeDataLength; 518227896Sjkim 519281075Sdim DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), 520281075Sdim AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); 521227896Sjkim 522227896Sjkim /* ResourceSourceIndex, ResourceUsage */ 523227896Sjkim 524227896Sjkim AcpiOsPrintf (",\n"); 525227896Sjkim AcpiDmIndent (Level + 1); 526227896Sjkim AcpiOsPrintf ("0x%2.2X, ", Resource->I2cSerialBus.ResSourceIndex); 527227896Sjkim 528227896Sjkim AcpiOsPrintf ("%s, ", 529243347Sjkim AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 1)]); 530227896Sjkim 531227896Sjkim /* Insert a descriptor name */ 532227896Sjkim 533227896Sjkim AcpiDmDescriptorName (); 534227896Sjkim 535306536Sjkim /* Share */ 536306536Sjkim 537306536Sjkim AcpiOsPrintf (", %s,\n", 538306536Sjkim AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->I2cSerialBus.Flags, 2)]); 539306536Sjkim 540227896Sjkim /* Dump the vendor data */ 541227896Sjkim 542227896Sjkim AcpiDmIndent (Level + 1); 543227896Sjkim AcpiDmDumpSerialBusVendorData (Resource, Level); 544227896Sjkim AcpiOsPrintf (")\n"); 545281075Sdim 546281075Sdim#ifndef _KERNEL 547281075Sdim MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName); 548281075Sdim#endif 549227896Sjkim} 550227896Sjkim 551227896Sjkim 552227896Sjkim/******************************************************************************* 553227896Sjkim * 554227896Sjkim * FUNCTION: AcpiDmSpiSerialBusDescriptor 555227896Sjkim * 556281075Sdim * PARAMETERS: Info - Extra resource info 557281075Sdim * Resource - Pointer to the resource descriptor 558227896Sjkim * Length - Length of the descriptor in bytes 559227896Sjkim * Level - Current source code indentation level 560227896Sjkim * 561227896Sjkim * RETURN: None 562227896Sjkim * 563227896Sjkim * DESCRIPTION: Decode a SPI serial bus descriptor 564227896Sjkim * 565227896Sjkim ******************************************************************************/ 566227896Sjkim 567227896Sjkimstatic void 568227896SjkimAcpiDmSpiSerialBusDescriptor ( 569281075Sdim ACPI_OP_WALK_INFO *Info, 570227896Sjkim AML_RESOURCE *Resource, 571227896Sjkim UINT32 Length, 572227896Sjkim UINT32 Level) 573227896Sjkim{ 574227896Sjkim UINT32 ResourceSourceOffset; 575281075Sdim char *DeviceName; 576227896Sjkim 577227896Sjkim 578227896Sjkim /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */ 579227896Sjkim 580227896Sjkim AcpiDmIndent (Level); 581306536Sjkim AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n", 582227896Sjkim Resource->SpiSerialBus.DeviceSelection, 583243347Sjkim AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)], 584243347Sjkim AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)], 585227896Sjkim Resource->SpiSerialBus.DataBitLength); 586227896Sjkim 587227896Sjkim /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */ 588227896Sjkim 589227896Sjkim AcpiDmIndent (Level + 1); 590227896Sjkim AcpiOsPrintf ("%s, 0x%8.8X, %s,\n", 591243347Sjkim AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)], 592227896Sjkim Resource->SpiSerialBus.ConnectionSpeed, 593243347Sjkim AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]); 594227896Sjkim 595227896Sjkim AcpiDmIndent (Level + 1); 596227896Sjkim AcpiOsPrintf ("%s, ", 597243347Sjkim AcpiGbl_CphDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPhase)]); 598227896Sjkim 599227896Sjkim /* ResourceSource is a required field */ 600227896Sjkim 601227896Sjkim ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + 602227896Sjkim Resource->CommonSerialBus.TypeDataLength; 603227896Sjkim 604281075Sdim DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), 605281075Sdim AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); 606227896Sjkim 607227896Sjkim /* ResourceSourceIndex, ResourceUsage */ 608227896Sjkim 609227896Sjkim AcpiOsPrintf (",\n"); 610227896Sjkim AcpiDmIndent (Level + 1); 611227896Sjkim AcpiOsPrintf ("0x%2.2X, ", Resource->SpiSerialBus.ResSourceIndex); 612227896Sjkim 613227896Sjkim AcpiOsPrintf ("%s, ", 614243347Sjkim AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 1)]); 615227896Sjkim 616227896Sjkim /* Insert a descriptor name */ 617227896Sjkim 618227896Sjkim AcpiDmDescriptorName (); 619227896Sjkim 620306536Sjkim /* Share */ 621306536Sjkim 622306536Sjkim AcpiOsPrintf (", %s,\n", 623306536Sjkim AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.Flags, 2)]); 624306536Sjkim 625227896Sjkim /* Dump the vendor data */ 626227896Sjkim 627227896Sjkim AcpiDmIndent (Level + 1); 628227896Sjkim AcpiDmDumpSerialBusVendorData (Resource, Level); 629227896Sjkim AcpiOsPrintf (")\n"); 630281075Sdim 631281075Sdim#ifndef _KERNEL 632281075Sdim MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName); 633281075Sdim#endif 634227896Sjkim} 635227896Sjkim 636227896Sjkim 637227896Sjkim/******************************************************************************* 638227896Sjkim * 639227896Sjkim * FUNCTION: AcpiDmUartSerialBusDescriptor 640227896Sjkim * 641281075Sdim * PARAMETERS: Info - Extra resource info 642281075Sdim * Resource - Pointer to the resource descriptor 643227896Sjkim * Length - Length of the descriptor in bytes 644227896Sjkim * Level - Current source code indentation level 645227896Sjkim * 646227896Sjkim * RETURN: None 647227896Sjkim * 648227896Sjkim * DESCRIPTION: Decode a UART serial bus descriptor 649227896Sjkim * 650227896Sjkim ******************************************************************************/ 651227896Sjkim 652227896Sjkimstatic void 653227896SjkimAcpiDmUartSerialBusDescriptor ( 654281075Sdim ACPI_OP_WALK_INFO *Info, 655227896Sjkim AML_RESOURCE *Resource, 656227896Sjkim UINT32 Length, 657227896Sjkim UINT32 Level) 658227896Sjkim{ 659227896Sjkim UINT32 ResourceSourceOffset; 660281075Sdim char *DeviceName; 661227896Sjkim 662227896Sjkim 663227896Sjkim /* ConnectionSpeed, BitsPerByte, StopBits */ 664227896Sjkim 665227896Sjkim AcpiDmIndent (Level); 666306536Sjkim AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n", 667227896Sjkim Resource->UartSerialBus.DefaultBaudRate, 668243347Sjkim AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)], 669243347Sjkim AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]); 670227896Sjkim 671227896Sjkim /* LinesInUse, IsBigEndian, Parity, FlowControl */ 672227896Sjkim 673227896Sjkim AcpiDmIndent (Level + 1); 674227896Sjkim AcpiOsPrintf ("0x%2.2X, %s, %s, %s,\n", 675227896Sjkim Resource->UartSerialBus.LinesEnabled, 676243347Sjkim AcpiGbl_EdDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 7)], 677243347Sjkim AcpiGbl_PtDecode [ACPI_GET_3BIT_FLAG (Resource->UartSerialBus.Parity)], 678243347Sjkim AcpiGbl_FcDecode [ACPI_GET_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags)]); 679227896Sjkim 680227896Sjkim /* ReceiveBufferSize, TransmitBufferSize */ 681227896Sjkim 682227896Sjkim AcpiDmIndent (Level + 1); 683227896Sjkim AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ", 684227896Sjkim Resource->UartSerialBus.RxFifoSize, 685227896Sjkim Resource->UartSerialBus.TxFifoSize); 686227896Sjkim 687227896Sjkim /* ResourceSource is a required field */ 688227896Sjkim 689227896Sjkim ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + 690227896Sjkim Resource->CommonSerialBus.TypeDataLength; 691227896Sjkim 692281075Sdim DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset), 693281075Sdim AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); 694227896Sjkim 695227896Sjkim /* ResourceSourceIndex, ResourceUsage */ 696227896Sjkim 697227896Sjkim AcpiOsPrintf (",\n"); 698227896Sjkim AcpiDmIndent (Level + 1); 699227896Sjkim AcpiOsPrintf ("0x%2.2X, ", Resource->UartSerialBus.ResSourceIndex); 700227896Sjkim 701227896Sjkim AcpiOsPrintf ("%s, ", 702243347Sjkim AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 1)]); 703227896Sjkim 704227896Sjkim /* Insert a descriptor name */ 705227896Sjkim 706227896Sjkim AcpiDmDescriptorName (); 707227896Sjkim 708306536Sjkim /* Share */ 709306536Sjkim 710306536Sjkim AcpiOsPrintf (", %s,\n", 711306536Sjkim AcpiGbl_ShrDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->UartSerialBus.Flags, 2)]); 712306536Sjkim 713227896Sjkim /* Dump the vendor data */ 714227896Sjkim 715227896Sjkim AcpiDmIndent (Level + 1); 716227896Sjkim AcpiDmDumpSerialBusVendorData (Resource, Level); 717227896Sjkim AcpiOsPrintf (")\n"); 718281075Sdim 719281075Sdim#ifndef _KERNEL 720281075Sdim MpSaveSerialInfo (Info->MappingOp, Resource, DeviceName); 721281075Sdim#endif 722227896Sjkim} 723227896Sjkim 724227896Sjkim 725227896Sjkim/******************************************************************************* 726227896Sjkim * 727227896Sjkim * FUNCTION: AcpiDmSerialBusDescriptor 728227896Sjkim * 729281075Sdim * PARAMETERS: Info - Extra resource info 730281075Sdim * Resource - Pointer to the resource descriptor 731227896Sjkim * Length - Length of the descriptor in bytes 732227896Sjkim * Level - Current source code indentation level 733227896Sjkim * 734227896Sjkim * RETURN: None 735227896Sjkim * 736227896Sjkim * DESCRIPTION: Decode a I2C/SPI/UART serial bus descriptor 737227896Sjkim * 738227896Sjkim ******************************************************************************/ 739227896Sjkim 740227896Sjkimvoid 741227896SjkimAcpiDmSerialBusDescriptor ( 742281075Sdim ACPI_OP_WALK_INFO *Info, 743227896Sjkim AML_RESOURCE *Resource, 744227896Sjkim UINT32 Length, 745227896Sjkim UINT32 Level) 746227896Sjkim{ 747227896Sjkim 748227896Sjkim SerialBusResourceDispatch [Resource->CommonSerialBus.Type] ( 749281075Sdim Info, Resource, Length, Level); 750227896Sjkim} 751