rsio.c revision 167802
1105059Scognet/******************************************************************************* 2105059Scognet * 3105059Scognet * Module Name: rsio - IO and DMA resource descriptors 4105059Scognet * $Revision: 1.35 $ 5105059Scognet * 6105059Scognet ******************************************************************************/ 7105059Scognet 8105059Scognet/****************************************************************************** 9105059Scognet * 10105059Scognet * 1. Copyright Notice 11105059Scognet * 12105059Scognet * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. 13105059Scognet * All rights reserved. 14105059Scognet * 15105059Scognet * 2. License 16105059Scognet * 17105059Scognet * 2.1. This is your license from Intel Corp. under its intellectual property 18105059Scognet * rights. You may have additional license terms from the party that provided 19105059Scognet * you this software, covering your right to use that party's intellectual 20105059Scognet * property rights. 21105059Scognet * 22105059Scognet * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23105059Scognet * copy of the source code appearing in this file ("Covered Code") an 24105059Scognet * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25105059Scognet * base code distributed originally by Intel ("Original Intel Code") to copy, 26105059Scognet * make derivatives, distribute, use and display any portion of the Covered 27105059Scognet * Code in any form, with the right to sublicense such rights; and 28105059Scognet * 29105059Scognet * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30105059Scognet * license (with the right to sublicense), under only those claims of Intel 31105059Scognet * patents that are infringed by the Original Intel Code, to make, use, sell, 32105059Scognet * offer to sell, and import the Covered Code and derivative works thereof 33105059Scognet * solely to the minimum extent necessary to exercise the above copyright 34105059Scognet * license, and in no event shall the patent license extend to any additions 35105059Scognet * to or modifications of the Original Intel Code. No other license or right 36105059Scognet * is granted directly or by implication, estoppel or otherwise; 37105059Scognet * 38105059Scognet * The above copyright and patent license is granted only if the following 39105059Scognet * conditions are met: 40105059Scognet * 41105059Scognet * 3. Conditions 42105059Scognet * 43105059Scognet * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44105059Scognet * Redistribution of source code of any substantial portion of the Covered 45105059Scognet * Code or modification with rights to further distribute source must include 46105059Scognet * the above Copyright Notice, the above License, this list of Conditions, 47105059Scognet * and the following Disclaimer and Export Compliance provision. In addition, 48105059Scognet * Licensee must cause all Covered Code to which Licensee contributes to 49105059Scognet * contain a file documenting the changes Licensee made to create that Covered 50105059Scognet * Code and the date of any change. Licensee must include in that file the 51105059Scognet * documentation of any changes made by any predecessor Licensee. Licensee 52105059Scognet * must include a prominent statement that the modification is derived, 53105059Scognet * directly or indirectly, from Original Intel Code. 54105059Scognet * 55105059Scognet * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56105059Scognet * Redistribution of source code of any substantial portion of the Covered 57105059Scognet * Code or modification without rights to further distribute source must 58105059Scognet * include the following Disclaimer and Export Compliance provision in the 59105059Scognet * documentation and/or other materials provided with distribution. In 60105059Scognet * addition, Licensee may not authorize further sublicense of source of any 61105059Scognet * portion of the Covered Code, and must include terms to the effect that the 62105059Scognet * license from Licensee to its licensee is limited to the intellectual 63105059Scognet * property embodied in the software Licensee provides to its licensee, and 64105059Scognet * not to intellectual property embodied in modifications its licensee may 65105059Scognet * make. 66105059Scognet * 67105059Scognet * 3.3. Redistribution of Executable. Redistribution in executable form of any 68105059Scognet * substantial portion of the Covered Code or modification must reproduce the 69105059Scognet * above Copyright Notice, and the following Disclaimer and Export Compliance 70105059Scognet * provision in the documentation and/or other materials provided with the 71105059Scognet * distribution. 72105059Scognet * 73105059Scognet * 3.4. Intel retains all right, title, and interest in and to the Original 74105059Scognet * Intel Code. 75105059Scognet * 76105059Scognet * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77105059Scognet * Intel shall be used in advertising or otherwise to promote the sale, use or 78111158Scognet * other dealings in products derived from or relating to the Covered Code 79111158Scognet * without prior written authorization from Intel. 80105059Scognet * 81105059Scognet * 4. Disclaimer and Export Compliance 82105059Scognet * 83105059Scognet * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84105059Scognet * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85105059Scognet * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86105059Scognet * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87111158Scognet * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88111158Scognet * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89111158Scognet * PARTICULAR PURPOSE. 90111158Scognet * 91111158Scognet * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92111158Scognet * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93111158Scognet * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94111158Scognet * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95105059Scognet * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96105059Scognet * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97105059Scognet * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98105059Scognet * LIMITED REMEDY. 99105059Scognet * 100105059Scognet * 4.3. Licensee shall not export, either directly or indirectly, any of this 101105059Scognet * software or system incorporating such software without first obtaining any 102105059Scognet * required license or other approval from the U. S. Department of Commerce or 103105059Scognet * any other agency or department of the United States Government. In the 104105059Scognet * event Licensee exports any such software from the United States or 105105059Scognet * re-exports any such software from a foreign destination, Licensee shall 106105059Scognet * ensure that the distribution and export/re-export of the software is in 107105059Scognet * compliance with all laws, regulations, orders, or other restrictions of the 108105059Scognet * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109105059Scognet * any of its subsidiaries will export/re-export any technical data, process, 110105059Scognet * software, or service, directly or indirectly, to any country for which the 111105059Scognet * United States government or any agency thereof requires an export license, 112105059Scognet * other governmental approval, or letter of assurance, without first obtaining 113105059Scognet * such license, approval or letter. 114105059Scognet * 115105059Scognet *****************************************************************************/ 116105059Scognet 117105059Scognet#define __RSIO_C__ 118105059Scognet 119105059Scognet#include <contrib/dev/acpica/acpi.h> 120105059Scognet#include <contrib/dev/acpica/acresrc.h> 121105059Scognet 122105059Scognet#define _COMPONENT ACPI_RESOURCES 123105059Scognet ACPI_MODULE_NAME ("rsio") 124105059Scognet 125105059Scognet 126105059Scognet/******************************************************************************* 127105059Scognet * 128105059Scognet * AcpiRsConvertIo 129105059Scognet * 130105059Scognet ******************************************************************************/ 131105059Scognet 132105059ScognetACPI_RSCONVERT_INFO AcpiRsConvertIo[5] = 133105059Scognet{ 134105059Scognet {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IO, 135105059Scognet ACPI_RS_SIZE (ACPI_RESOURCE_IO), 136105059Scognet ACPI_RSC_TABLE_SIZE (AcpiRsConvertIo)}, 137105059Scognet 138105059Scognet {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IO, 139105059Scognet sizeof (AML_RESOURCE_IO), 140105059Scognet 0}, 141105059Scognet 142105059Scognet /* Decode flag */ 143105059Scognet 144105059Scognet {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Io.IoDecode), 145105059Scognet AML_OFFSET (Io.Flags), 146105059Scognet 0}, 147105059Scognet /* 148111158Scognet * These fields are contiguous in both the source and destination: 149111158Scognet * Address Alignment 150111158Scognet * Length 151111158Scognet * Minimum Base Address 152111158Scognet * Maximum Base Address 153111158Scognet */ 154105059Scognet {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Io.Alignment), 155105059Scognet AML_OFFSET (Io.Alignment), 156105059Scognet 2}, 157111158Scognet 158111158Scognet {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Io.Minimum), 159105059Scognet AML_OFFSET (Io.Minimum), 160105059Scognet 2} 161105059Scognet}; 162105059Scognet 163105059Scognet 164105059Scognet/******************************************************************************* 165105059Scognet * 166105059Scognet * AcpiRsConvertFixedIo 167105059Scognet * 168105059Scognet ******************************************************************************/ 169105059Scognet 170105059ScognetACPI_RSCONVERT_INFO AcpiRsConvertFixedIo[4] = 171105059Scognet{ 172105059Scognet {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_IO, 173105059Scognet ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO), 174105059Scognet ACPI_RSC_TABLE_SIZE (AcpiRsConvertFixedIo)}, 175105059Scognet 176105059Scognet {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_IO, 177105059Scognet sizeof (AML_RESOURCE_FIXED_IO), 178105059Scognet 0}, 179105059Scognet /* 180105059Scognet * These fields are contiguous in both the source and destination: 181105059Scognet * Base Address 182105059Scognet * Length 183105059Scognet */ 184105059Scognet {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.FixedIo.AddressLength), 185105059Scognet AML_OFFSET (FixedIo.AddressLength), 186105059Scognet 1}, 187105059Scognet 188105059Scognet {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.FixedIo.Address), 189105059Scognet AML_OFFSET (FixedIo.Address), 190111158Scognet 1} 191105059Scognet}; 192105059Scognet 193105059Scognet 194105059Scognet/******************************************************************************* 195105059Scognet * 196105059Scognet * AcpiRsConvertGenericReg 197105059Scognet * 198111158Scognet ******************************************************************************/ 199105059Scognet 200111158ScognetACPI_RSCONVERT_INFO AcpiRsConvertGenericReg[4] = 201111158Scognet{ 202105059Scognet {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GENERIC_REGISTER, 203105059Scognet ACPI_RS_SIZE (ACPI_RESOURCE_GENERIC_REGISTER), 204105059Scognet ACPI_RSC_TABLE_SIZE (AcpiRsConvertGenericReg)}, 205105059Scognet 206105059Scognet {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GENERIC_REGISTER, 207105059Scognet sizeof (AML_RESOURCE_GENERIC_REGISTER), 208105059Scognet 0}, 209105059Scognet /* 210105059Scognet * These fields are contiguous in both the source and destination: 211105059Scognet * Address Space ID 212105059Scognet * Register Bit Width 213105059Scognet * Register Bit Offset 214111158Scognet * Access Size 215111158Scognet */ 216111158Scognet {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.GenericReg.SpaceId), 217111158Scognet AML_OFFSET (GenericReg.AddressSpaceId), 218105059Scognet 4}, 219105059Scognet 220105059Scognet /* Get the Register Address */ 221105059Scognet 222105059Scognet {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.GenericReg.Address), 223105059Scognet AML_OFFSET (GenericReg.Address), 224105059Scognet 1} 225105059Scognet}; 226105059Scognet 227105059Scognet 228111158Scognet/******************************************************************************* 229111158Scognet * 230105059Scognet * AcpiRsConvertEndDpf 231105059Scognet * 232111158Scognet ******************************************************************************/ 233105059Scognet 234111158ScognetACPI_RSCONVERT_INFO AcpiRsConvertEndDpf[2] = 235111158Scognet{ 236126725Scognet {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_DEPENDENT, 237111158Scognet ACPI_RS_SIZE_MIN, 238111158Scognet ACPI_RSC_TABLE_SIZE (AcpiRsConvertEndDpf)}, 239111158Scognet 240111158Scognet {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_DEPENDENT, 241107928Scognet sizeof (AML_RESOURCE_END_DEPENDENT), 242107928Scognet 0} 243105059Scognet}; 244105059Scognet 245105059Scognet 246105059Scognet/******************************************************************************* 247105059Scognet * 248105059Scognet * AcpiRsConvertEndTag 249111158Scognet * 250111158Scognet ******************************************************************************/ 251105059Scognet 252111158ScognetACPI_RSCONVERT_INFO AcpiRsConvertEndTag[2] = 253111158Scognet{ 254105059Scognet {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_TAG, 255105059Scognet ACPI_RS_SIZE_MIN, 256105059Scognet ACPI_RSC_TABLE_SIZE (AcpiRsConvertEndTag)}, 257105059Scognet 258105059Scognet /* 259105059Scognet * Note: The checksum field is set to zero, meaning that the resource 260105059Scognet * data is treated as if the checksum operation succeeded. 261105059Scognet * (ACPI Spec 1.0b Section 6.4.2.8) 262105059Scognet */ 263105059Scognet {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_TAG, 264105059Scognet sizeof (AML_RESOURCE_END_TAG), 265105059Scognet 0} 266105059Scognet}; 267105059Scognet 268105059Scognet 269105059Scognet/******************************************************************************* 270105059Scognet * 271105059Scognet * AcpiRsGetStartDpf 272105059Scognet * 273105059Scognet ******************************************************************************/ 274111158Scognet 275111158ScognetACPI_RSCONVERT_INFO AcpiRsGetStartDpf[5] = 276105059Scognet{ 277105059Scognet {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT, 278105059Scognet ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT), 279105059Scognet ACPI_RSC_TABLE_SIZE (AcpiRsGetStartDpf)}, 280105059Scognet 281105059Scognet /* Defaults for Compatibility and Performance priorities */ 282105059Scognet 283105059Scognet {ACPI_RSC_SET8, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority), 284105059Scognet ACPI_ACCEPTABLE_CONFIGURATION, 285105059Scognet 2}, 286105059Scognet 287105059Scognet /* All done if there is no flag byte present in the descriptor */ 288105059Scognet 289105059Scognet {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1}, 290105059Scognet 291105059Scognet /* Flag byte is present, get the flags */ 292105059Scognet 293105059Scognet {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority), 294105059Scognet AML_OFFSET (StartDpf.Flags), 295105059Scognet 0}, 296105059Scognet 297105059Scognet {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness), 298105059Scognet AML_OFFSET (StartDpf.Flags), 299105059Scognet 2} 300105059Scognet}; 301105059Scognet 302105059Scognet 303105059Scognet/******************************************************************************* 304105059Scognet * 305105059Scognet * AcpiRsSetStartDpf 306105059Scognet * 307105059Scognet ******************************************************************************/ 308105059Scognet 309105059ScognetACPI_RSCONVERT_INFO AcpiRsSetStartDpf[6] = 310105059Scognet{ 311105059Scognet {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT, 312105059Scognet sizeof (AML_RESOURCE_START_DEPENDENT), 313105059Scognet ACPI_RSC_TABLE_SIZE (AcpiRsSetStartDpf)}, 314105059Scognet 315105059Scognet /* Set the default flag values */ 316105059Scognet 317105059Scognet {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority), 318105059Scognet AML_OFFSET (StartDpf.Flags), 319105059Scognet 0}, 320105059Scognet 321105059Scognet {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness), 322111158Scognet AML_OFFSET (StartDpf.Flags), 323111158Scognet 2}, 324111158Scognet /* 325111158Scognet * All done if flags byte is necessary -- if either priority value 326111158Scognet * is not ACPI_ACCEPTABLE_CONFIGURATION 327105059Scognet */ 328105059Scognet {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, 329105059Scognet ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority), 330105059Scognet ACPI_ACCEPTABLE_CONFIGURATION}, 331105059Scognet 332105059Scognet {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, 333105059Scognet ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness), 334105059Scognet ACPI_ACCEPTABLE_CONFIGURATION}, 335105059Scognet 336105059Scognet /* Flag byte is not necessary */ 337105059Scognet 338105059Scognet {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)} 339105059Scognet}; 340105059Scognet 341105059Scognet 342105059Scognet