dmresrcs.c revision 229989
1100966Siwasaki/******************************************************************************* 2100966Siwasaki * 3100966Siwasaki * Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly 4100966Siwasaki * 5100966Siwasaki ******************************************************************************/ 6100966Siwasaki 7217365Sjkim/* 8229989Sjkim * Copyright (C) 2000 - 2012, Intel Corp. 9100966Siwasaki * All rights reserved. 10100966Siwasaki * 11217365Sjkim * Redistribution and use in source and binary forms, with or without 12217365Sjkim * modification, are permitted provided that the following conditions 13217365Sjkim * are met: 14217365Sjkim * 1. Redistributions of source code must retain the above copyright 15217365Sjkim * notice, this list of conditions, and the following disclaimer, 16217365Sjkim * without modification. 17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18217365Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 19217365Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 20217365Sjkim * including a substantially similar Disclaimer requirement for further 21217365Sjkim * binary redistribution. 22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 23217365Sjkim * of any contributors may be used to endorse or promote products derived 24217365Sjkim * from this software without specific prior written permission. 25100966Siwasaki * 26217365Sjkim * Alternatively, this software may be distributed under the terms of the 27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 28217365Sjkim * Software Foundation. 29100966Siwasaki * 30217365Sjkim * NO WARRANTY 31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41217365Sjkim * POSSIBILITY OF SUCH DAMAGES. 42217365Sjkim */ 43100966Siwasaki 44100966Siwasaki 45193341Sjkim#include <contrib/dev/acpica/include/acpi.h> 46193341Sjkim#include <contrib/dev/acpica/include/accommon.h> 47193341Sjkim#include <contrib/dev/acpica/include/acdisasm.h> 48100966Siwasaki 49100966Siwasaki 50100966Siwasaki#ifdef ACPI_DISASSEMBLER 51100966Siwasaki 52102550Siwasaki#define _COMPONENT ACPI_CA_DEBUGGER 53100966Siwasaki ACPI_MODULE_NAME ("dbresrcs") 54100966Siwasaki 55100966Siwasaki 56100966Siwasaki/******************************************************************************* 57100966Siwasaki * 58100966Siwasaki * FUNCTION: AcpiDmIrqDescriptor 59100966Siwasaki * 60100966Siwasaki * PARAMETERS: Resource - Pointer to the resource descriptor 61100966Siwasaki * Length - Length of the descriptor in bytes 62100966Siwasaki * Level - Current source code indentation level 63100966Siwasaki * 64100966Siwasaki * RETURN: None 65100966Siwasaki * 66151937Sjkim * DESCRIPTION: Decode a IRQ descriptor, either Irq() or IrqNoFlags() 67100966Siwasaki * 68100966Siwasaki ******************************************************************************/ 69100966Siwasaki 70100966Siwasakivoid 71100966SiwasakiAcpiDmIrqDescriptor ( 72151937Sjkim AML_RESOURCE *Resource, 73100966Siwasaki UINT32 Length, 74100966Siwasaki UINT32 Level) 75100966Siwasaki{ 76100966Siwasaki 77100966Siwasaki AcpiDmIndent (Level); 78100966Siwasaki AcpiOsPrintf ("%s (", 79100966Siwasaki AcpiGbl_IrqDecode [Length & 1]); 80100966Siwasaki 81151937Sjkim /* Decode flags byte if present */ 82151937Sjkim 83100966Siwasaki if (Length & 1) 84100966Siwasaki { 85167802Sjkim AcpiOsPrintf ("%s, %s, %s, ", 86167802Sjkim AcpiGbl_HeDecode [Resource->Irq.Flags & 1], 87167802Sjkim AcpiGbl_LlDecode [(Resource->Irq.Flags >> 3) & 1], 88167802Sjkim AcpiGbl_ShrDecode [(Resource->Irq.Flags >> 4) & 1]); 89100966Siwasaki } 90167802Sjkim 91167802Sjkim /* Insert a descriptor name */ 92167802Sjkim 93167802Sjkim AcpiDmDescriptorName (); 94151937Sjkim AcpiOsPrintf (")\n"); 95100966Siwasaki 96151937Sjkim AcpiDmIndent (Level + 1); 97151937Sjkim AcpiDmBitList (Resource->Irq.IrqMask); 98100966Siwasaki} 99100966Siwasaki 100100966Siwasaki 101100966Siwasaki/******************************************************************************* 102100966Siwasaki * 103100966Siwasaki * FUNCTION: AcpiDmDmaDescriptor 104100966Siwasaki * 105100966Siwasaki * PARAMETERS: Resource - Pointer to the resource descriptor 106100966Siwasaki * Length - Length of the descriptor in bytes 107100966Siwasaki * Level - Current source code indentation level 108100966Siwasaki * 109100966Siwasaki * RETURN: None 110100966Siwasaki * 111100966Siwasaki * DESCRIPTION: Decode a DMA descriptor 112100966Siwasaki * 113100966Siwasaki ******************************************************************************/ 114100966Siwasaki 115100966Siwasakivoid 116100966SiwasakiAcpiDmDmaDescriptor ( 117151937Sjkim AML_RESOURCE *Resource, 118100966Siwasaki UINT32 Length, 119100966Siwasaki UINT32 Level) 120100966Siwasaki{ 121100966Siwasaki 122100966Siwasaki AcpiDmIndent (Level); 123167802Sjkim AcpiOsPrintf ("DMA (%s, %s, %s, ", 124228110Sjkim AcpiGbl_TypDecode [(Resource->Dma.Flags >> 5) & 3], 125228110Sjkim AcpiGbl_BmDecode [(Resource->Dma.Flags >> 2) & 1], 126228110Sjkim AcpiGbl_SizDecode [(Resource->Dma.Flags >> 0) & 3]); 127100966Siwasaki 128167802Sjkim /* Insert a descriptor name */ 129167802Sjkim 130167802Sjkim AcpiDmDescriptorName (); 131167802Sjkim AcpiOsPrintf (")\n"); 132167802Sjkim 133151937Sjkim AcpiDmIndent (Level + 1); 134151937Sjkim AcpiDmBitList (Resource->Dma.DmaChannelMask); 135100966Siwasaki} 136100966Siwasaki 137100966Siwasaki 138100966Siwasaki/******************************************************************************* 139100966Siwasaki * 140228110Sjkim * FUNCTION: AcpiDmFixedDmaDescriptor 141228110Sjkim * 142228110Sjkim * PARAMETERS: Resource - Pointer to the resource descriptor 143228110Sjkim * Length - Length of the descriptor in bytes 144228110Sjkim * Level - Current source code indentation level 145228110Sjkim * 146228110Sjkim * RETURN: None 147228110Sjkim * 148228110Sjkim * DESCRIPTION: Decode a FixedDMA descriptor 149228110Sjkim * 150228110Sjkim ******************************************************************************/ 151228110Sjkim 152228110Sjkimvoid 153228110SjkimAcpiDmFixedDmaDescriptor ( 154228110Sjkim AML_RESOURCE *Resource, 155228110Sjkim UINT32 Length, 156228110Sjkim UINT32 Level) 157228110Sjkim{ 158228110Sjkim 159228110Sjkim AcpiDmIndent (Level); 160228110Sjkim AcpiOsPrintf ("FixedDMA (0x%4.4X, 0x%4.4X, ", 161228110Sjkim Resource->FixedDma.RequestLines, 162228110Sjkim Resource->FixedDma.Channels); 163228110Sjkim 164228110Sjkim if (Resource->FixedDma.Width <= 5) 165228110Sjkim { 166228110Sjkim AcpiOsPrintf ("%s, ", 167228110Sjkim AcpiGbl_DtsDecode [Resource->FixedDma.Width]); 168228110Sjkim } 169228110Sjkim else 170228110Sjkim { 171228110Sjkim AcpiOsPrintf ("%X /* INVALID DMA WIDTH */, ", Resource->FixedDma.Width); 172228110Sjkim } 173228110Sjkim 174228110Sjkim /* Insert a descriptor name */ 175228110Sjkim 176228110Sjkim AcpiDmDescriptorName (); 177228110Sjkim AcpiOsPrintf (")\n"); 178228110Sjkim} 179228110Sjkim 180228110Sjkim 181228110Sjkim/******************************************************************************* 182228110Sjkim * 183100966Siwasaki * FUNCTION: AcpiDmIoDescriptor 184100966Siwasaki * 185100966Siwasaki * PARAMETERS: Resource - Pointer to the resource descriptor 186100966Siwasaki * Length - Length of the descriptor in bytes 187100966Siwasaki * Level - Current source code indentation level 188100966Siwasaki * 189100966Siwasaki * RETURN: None 190100966Siwasaki * 191100966Siwasaki * DESCRIPTION: Decode an IO descriptor 192100966Siwasaki * 193100966Siwasaki ******************************************************************************/ 194100966Siwasaki 195100966Siwasakivoid 196100966SiwasakiAcpiDmIoDescriptor ( 197151937Sjkim AML_RESOURCE *Resource, 198100966Siwasaki UINT32 Length, 199100966Siwasaki UINT32 Level) 200100966Siwasaki{ 201100966Siwasaki 202100966Siwasaki AcpiDmIndent (Level); 203151937Sjkim AcpiOsPrintf ("IO (%s,\n", 204151937Sjkim AcpiGbl_IoDecode [(Resource->Io.Flags & 1)]); 205151937Sjkim 206151937Sjkim AcpiDmIndent (Level + 1); 207167802Sjkim AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum"); 208151937Sjkim 209151937Sjkim AcpiDmIndent (Level + 1); 210167802Sjkim AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum"); 211151937Sjkim 212151937Sjkim AcpiDmIndent (Level + 1); 213167802Sjkim AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment"); 214151937Sjkim 215151937Sjkim AcpiDmIndent (Level + 1); 216167802Sjkim AcpiDmDumpInteger8 (Resource->Io.AddressLength, "Length"); 217151937Sjkim 218167802Sjkim /* Insert a descriptor name */ 219167802Sjkim 220151937Sjkim AcpiDmIndent (Level + 1); 221167802Sjkim AcpiDmDescriptorName (); 222151937Sjkim AcpiOsPrintf (")\n"); 223100966Siwasaki} 224100966Siwasaki 225100966Siwasaki 226100966Siwasaki/******************************************************************************* 227100966Siwasaki * 228100966Siwasaki * FUNCTION: AcpiDmFixedIoDescriptor 229100966Siwasaki * 230100966Siwasaki * PARAMETERS: Resource - Pointer to the resource descriptor 231100966Siwasaki * Length - Length of the descriptor in bytes 232100966Siwasaki * Level - Current source code indentation level 233100966Siwasaki * 234100966Siwasaki * RETURN: None 235100966Siwasaki * 236100966Siwasaki * DESCRIPTION: Decode a Fixed IO descriptor 237100966Siwasaki * 238100966Siwasaki ******************************************************************************/ 239100966Siwasaki 240100966Siwasakivoid 241100966SiwasakiAcpiDmFixedIoDescriptor ( 242151937Sjkim AML_RESOURCE *Resource, 243100966Siwasaki UINT32 Length, 244100966Siwasaki UINT32 Level) 245100966Siwasaki{ 246100966Siwasaki 247100966Siwasaki AcpiDmIndent (Level); 248151937Sjkim AcpiOsPrintf ("FixedIO (\n"); 249151937Sjkim 250151937Sjkim AcpiDmIndent (Level + 1); 251167802Sjkim AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address"); 252151937Sjkim 253151937Sjkim AcpiDmIndent (Level + 1); 254167802Sjkim AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length"); 255151937Sjkim 256167802Sjkim /* Insert a descriptor name */ 257167802Sjkim 258151937Sjkim AcpiDmIndent (Level + 1); 259167802Sjkim AcpiDmDescriptorName (); 260151937Sjkim AcpiOsPrintf (")\n"); 261100966Siwasaki} 262100966Siwasaki 263100966Siwasaki 264100966Siwasaki/******************************************************************************* 265100966Siwasaki * 266100966Siwasaki * FUNCTION: AcpiDmStartDependentDescriptor 267100966Siwasaki * 268100966Siwasaki * PARAMETERS: Resource - Pointer to the resource descriptor 269100966Siwasaki * Length - Length of the descriptor in bytes 270100966Siwasaki * Level - Current source code indentation level 271100966Siwasaki * 272100966Siwasaki * RETURN: None 273100966Siwasaki * 274100966Siwasaki * DESCRIPTION: Decode a Start Dependendent functions descriptor 275100966Siwasaki * 276100966Siwasaki ******************************************************************************/ 277100966Siwasaki 278100966Siwasakivoid 279100966SiwasakiAcpiDmStartDependentDescriptor ( 280151937Sjkim AML_RESOURCE *Resource, 281100966Siwasaki UINT32 Length, 282100966Siwasaki UINT32 Level) 283100966Siwasaki{ 284100966Siwasaki 285100966Siwasaki AcpiDmIndent (Level); 286100966Siwasaki 287100966Siwasaki if (Length & 1) 288100966Siwasaki { 289100966Siwasaki AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n", 290151937Sjkim (UINT32) Resource->StartDpf.Flags & 3, 291151937Sjkim (UINT32) (Resource->StartDpf.Flags >> 2) & 3); 292100966Siwasaki } 293100966Siwasaki else 294100966Siwasaki { 295100966Siwasaki AcpiOsPrintf ("StartDependentFnNoPri ()\n"); 296100966Siwasaki } 297100966Siwasaki 298100966Siwasaki AcpiDmIndent (Level); 299100966Siwasaki AcpiOsPrintf ("{\n"); 300100966Siwasaki} 301100966Siwasaki 302100966Siwasaki 303100966Siwasaki/******************************************************************************* 304100966Siwasaki * 305100966Siwasaki * FUNCTION: AcpiDmEndDependentDescriptor 306100966Siwasaki * 307100966Siwasaki * PARAMETERS: Resource - Pointer to the resource descriptor 308100966Siwasaki * Length - Length of the descriptor in bytes 309100966Siwasaki * Level - Current source code indentation level 310100966Siwasaki * 311100966Siwasaki * RETURN: None 312100966Siwasaki * 313100966Siwasaki * DESCRIPTION: Decode an End Dependent functions descriptor 314100966Siwasaki * 315100966Siwasaki ******************************************************************************/ 316100966Siwasaki 317100966Siwasakivoid 318100966SiwasakiAcpiDmEndDependentDescriptor ( 319151937Sjkim AML_RESOURCE *Resource, 320100966Siwasaki UINT32 Length, 321100966Siwasaki UINT32 Level) 322100966Siwasaki{ 323100966Siwasaki 324100966Siwasaki AcpiDmIndent (Level); 325100966Siwasaki AcpiOsPrintf ("}\n"); 326100966Siwasaki AcpiDmIndent (Level); 327100966Siwasaki AcpiOsPrintf ("EndDependentFn ()\n"); 328100966Siwasaki} 329100966Siwasaki 330100966Siwasaki 331100966Siwasaki/******************************************************************************* 332100966Siwasaki * 333100966Siwasaki * FUNCTION: AcpiDmVendorSmallDescriptor 334100966Siwasaki * 335100966Siwasaki * PARAMETERS: Resource - Pointer to the resource descriptor 336100966Siwasaki * Length - Length of the descriptor in bytes 337100966Siwasaki * Level - Current source code indentation level 338100966Siwasaki * 339100966Siwasaki * RETURN: None 340100966Siwasaki * 341100966Siwasaki * DESCRIPTION: Decode a Vendor Small Descriptor 342100966Siwasaki * 343100966Siwasaki ******************************************************************************/ 344100966Siwasaki 345100966Siwasakivoid 346100966SiwasakiAcpiDmVendorSmallDescriptor ( 347151937Sjkim AML_RESOURCE *Resource, 348100966Siwasaki UINT32 Length, 349100966Siwasaki UINT32 Level) 350100966Siwasaki{ 351100966Siwasaki 352167802Sjkim AcpiDmVendorCommon ("Short", 353167802Sjkim ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)), 354151937Sjkim Length, Level); 355100966Siwasaki} 356100966Siwasaki 357100966Siwasaki#endif 358100966Siwasaki 359