1f8146b88SJung-uk Kim /****************************************************************************** 2f8146b88SJung-uk Kim * 3f8146b88SJung-uk Kim * Module Name: aslpld - Implementation of ASL ToPLD macro 4f8146b88SJung-uk Kim * 5f8146b88SJung-uk Kim *****************************************************************************/ 6f8146b88SJung-uk Kim 70d84335fSJung-uk Kim /****************************************************************************** 80d84335fSJung-uk Kim * 90d84335fSJung-uk Kim * 1. Copyright Notice 100d84335fSJung-uk Kim * 11*804fe266SJung-uk Kim * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp. 12f8146b88SJung-uk Kim * All rights reserved. 13f8146b88SJung-uk Kim * 140d84335fSJung-uk Kim * 2. License 150d84335fSJung-uk Kim * 160d84335fSJung-uk Kim * 2.1. This is your license from Intel Corp. under its intellectual property 170d84335fSJung-uk Kim * rights. You may have additional license terms from the party that provided 180d84335fSJung-uk Kim * you this software, covering your right to use that party's intellectual 190d84335fSJung-uk Kim * property rights. 200d84335fSJung-uk Kim * 210d84335fSJung-uk Kim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 220d84335fSJung-uk Kim * copy of the source code appearing in this file ("Covered Code") an 230d84335fSJung-uk Kim * irrevocable, perpetual, worldwide license under Intel's copyrights in the 240d84335fSJung-uk Kim * base code distributed originally by Intel ("Original Intel Code") to copy, 250d84335fSJung-uk Kim * make derivatives, distribute, use and display any portion of the Covered 260d84335fSJung-uk Kim * Code in any form, with the right to sublicense such rights; and 270d84335fSJung-uk Kim * 280d84335fSJung-uk Kim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 290d84335fSJung-uk Kim * license (with the right to sublicense), under only those claims of Intel 300d84335fSJung-uk Kim * patents that are infringed by the Original Intel Code, to make, use, sell, 310d84335fSJung-uk Kim * offer to sell, and import the Covered Code and derivative works thereof 320d84335fSJung-uk Kim * solely to the minimum extent necessary to exercise the above copyright 330d84335fSJung-uk Kim * license, and in no event shall the patent license extend to any additions 340d84335fSJung-uk Kim * to or modifications of the Original Intel Code. No other license or right 350d84335fSJung-uk Kim * is granted directly or by implication, estoppel or otherwise; 360d84335fSJung-uk Kim * 370d84335fSJung-uk Kim * The above copyright and patent license is granted only if the following 380d84335fSJung-uk Kim * conditions are met: 390d84335fSJung-uk Kim * 400d84335fSJung-uk Kim * 3. Conditions 410d84335fSJung-uk Kim * 420d84335fSJung-uk Kim * 3.1. Redistribution of Source with Rights to Further Distribute Source. 430d84335fSJung-uk Kim * Redistribution of source code of any substantial portion of the Covered 440d84335fSJung-uk Kim * Code or modification with rights to further distribute source must include 450d84335fSJung-uk Kim * the above Copyright Notice, the above License, this list of Conditions, 460d84335fSJung-uk Kim * and the following Disclaimer and Export Compliance provision. In addition, 470d84335fSJung-uk Kim * Licensee must cause all Covered Code to which Licensee contributes to 480d84335fSJung-uk Kim * contain a file documenting the changes Licensee made to create that Covered 490d84335fSJung-uk Kim * Code and the date of any change. Licensee must include in that file the 500d84335fSJung-uk Kim * documentation of any changes made by any predecessor Licensee. Licensee 510d84335fSJung-uk Kim * must include a prominent statement that the modification is derived, 520d84335fSJung-uk Kim * directly or indirectly, from Original Intel Code. 530d84335fSJung-uk Kim * 540d84335fSJung-uk Kim * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 550d84335fSJung-uk Kim * Redistribution of source code of any substantial portion of the Covered 560d84335fSJung-uk Kim * Code or modification without rights to further distribute source must 570d84335fSJung-uk Kim * include the following Disclaimer and Export Compliance provision in the 580d84335fSJung-uk Kim * documentation and/or other materials provided with distribution. In 590d84335fSJung-uk Kim * addition, Licensee may not authorize further sublicense of source of any 600d84335fSJung-uk Kim * portion of the Covered Code, and must include terms to the effect that the 610d84335fSJung-uk Kim * license from Licensee to its licensee is limited to the intellectual 620d84335fSJung-uk Kim * property embodied in the software Licensee provides to its licensee, and 630d84335fSJung-uk Kim * not to intellectual property embodied in modifications its licensee may 640d84335fSJung-uk Kim * make. 650d84335fSJung-uk Kim * 660d84335fSJung-uk Kim * 3.3. Redistribution of Executable. Redistribution in executable form of any 670d84335fSJung-uk Kim * substantial portion of the Covered Code or modification must reproduce the 680d84335fSJung-uk Kim * above Copyright Notice, and the following Disclaimer and Export Compliance 690d84335fSJung-uk Kim * provision in the documentation and/or other materials provided with the 700d84335fSJung-uk Kim * distribution. 710d84335fSJung-uk Kim * 720d84335fSJung-uk Kim * 3.4. Intel retains all right, title, and interest in and to the Original 730d84335fSJung-uk Kim * Intel Code. 740d84335fSJung-uk Kim * 750d84335fSJung-uk Kim * 3.5. Neither the name Intel nor any other trademark owned or controlled by 760d84335fSJung-uk Kim * Intel shall be used in advertising or otherwise to promote the sale, use or 770d84335fSJung-uk Kim * other dealings in products derived from or relating to the Covered Code 780d84335fSJung-uk Kim * without prior written authorization from Intel. 790d84335fSJung-uk Kim * 800d84335fSJung-uk Kim * 4. Disclaimer and Export Compliance 810d84335fSJung-uk Kim * 820d84335fSJung-uk Kim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 830d84335fSJung-uk Kim * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 840d84335fSJung-uk Kim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 850d84335fSJung-uk Kim * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 860d84335fSJung-uk Kim * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 870d84335fSJung-uk Kim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 880d84335fSJung-uk Kim * PARTICULAR PURPOSE. 890d84335fSJung-uk Kim * 900d84335fSJung-uk Kim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 910d84335fSJung-uk Kim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 920d84335fSJung-uk Kim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 930d84335fSJung-uk Kim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 940d84335fSJung-uk Kim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 950d84335fSJung-uk Kim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 960d84335fSJung-uk Kim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 970d84335fSJung-uk Kim * LIMITED REMEDY. 980d84335fSJung-uk Kim * 990d84335fSJung-uk Kim * 4.3. Licensee shall not export, either directly or indirectly, any of this 1000d84335fSJung-uk Kim * software or system incorporating such software without first obtaining any 1010d84335fSJung-uk Kim * required license or other approval from the U. S. Department of Commerce or 1020d84335fSJung-uk Kim * any other agency or department of the United States Government. In the 1030d84335fSJung-uk Kim * event Licensee exports any such software from the United States or 1040d84335fSJung-uk Kim * re-exports any such software from a foreign destination, Licensee shall 1050d84335fSJung-uk Kim * ensure that the distribution and export/re-export of the software is in 1060d84335fSJung-uk Kim * compliance with all laws, regulations, orders, or other restrictions of the 1070d84335fSJung-uk Kim * U.S. Export Administration Regulations. Licensee agrees that neither it nor 1080d84335fSJung-uk Kim * any of its subsidiaries will export/re-export any technical data, process, 1090d84335fSJung-uk Kim * software, or service, directly or indirectly, to any country for which the 1100d84335fSJung-uk Kim * United States government or any agency thereof requires an export license, 1110d84335fSJung-uk Kim * other governmental approval, or letter of assurance, without first obtaining 1120d84335fSJung-uk Kim * such license, approval or letter. 1130d84335fSJung-uk Kim * 1140d84335fSJung-uk Kim ***************************************************************************** 1150d84335fSJung-uk Kim * 1160d84335fSJung-uk Kim * Alternatively, you may choose to be licensed under the terms of the 1170d84335fSJung-uk Kim * following license: 1180d84335fSJung-uk Kim * 119f8146b88SJung-uk Kim * Redistribution and use in source and binary forms, with or without 120f8146b88SJung-uk Kim * modification, are permitted provided that the following conditions 121f8146b88SJung-uk Kim * are met: 122f8146b88SJung-uk Kim * 1. Redistributions of source code must retain the above copyright 123f8146b88SJung-uk Kim * notice, this list of conditions, and the following disclaimer, 124f8146b88SJung-uk Kim * without modification. 125f8146b88SJung-uk Kim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126f8146b88SJung-uk Kim * substantially similar to the "NO WARRANTY" disclaimer below 127f8146b88SJung-uk Kim * ("Disclaimer") and any redistribution must be conditioned upon 128f8146b88SJung-uk Kim * including a substantially similar Disclaimer requirement for further 129f8146b88SJung-uk Kim * binary redistribution. 130f8146b88SJung-uk Kim * 3. Neither the names of the above-listed copyright holders nor the names 131f8146b88SJung-uk Kim * of any contributors may be used to endorse or promote products derived 132f8146b88SJung-uk Kim * from this software without specific prior written permission. 133f8146b88SJung-uk Kim * 1340d84335fSJung-uk Kim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1350d84335fSJung-uk Kim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1360d84335fSJung-uk Kim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1370d84335fSJung-uk Kim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1380d84335fSJung-uk Kim * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1390d84335fSJung-uk Kim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1400d84335fSJung-uk Kim * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1410d84335fSJung-uk Kim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 1420d84335fSJung-uk Kim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1430d84335fSJung-uk Kim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 1440d84335fSJung-uk Kim * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1450d84335fSJung-uk Kim * 1460d84335fSJung-uk Kim * Alternatively, you may choose to be licensed under the terms of the 147f8146b88SJung-uk Kim * GNU General Public License ("GPL") version 2 as published by the Free 148f8146b88SJung-uk Kim * Software Foundation. 149f8146b88SJung-uk Kim * 1500d84335fSJung-uk Kim *****************************************************************************/ 151f8146b88SJung-uk Kim 152f8146b88SJung-uk Kim #include <contrib/dev/acpica/compiler/aslcompiler.h> 153f8146b88SJung-uk Kim #include "aslcompiler.y.h" 154f8146b88SJung-uk Kim #include <contrib/dev/acpica/include/amlcode.h> 155f8146b88SJung-uk Kim 156f8146b88SJung-uk Kim #define _COMPONENT ACPI_COMPILER 157f8146b88SJung-uk Kim ACPI_MODULE_NAME ("aslpld") 158f8146b88SJung-uk Kim 159f8146b88SJung-uk Kim 160f8146b88SJung-uk Kim /* Local prototypes */ 161f8146b88SJung-uk Kim 162f8146b88SJung-uk Kim static UINT8 * 163f8146b88SJung-uk Kim OpcEncodePldBuffer ( 164f8146b88SJung-uk Kim ACPI_PLD_INFO *PldInfo); 165f8146b88SJung-uk Kim 166f8146b88SJung-uk Kim static BOOLEAN 167f8146b88SJung-uk Kim OpcFindName ( 168f8146b88SJung-uk Kim const char **List, 169f8146b88SJung-uk Kim char *Name, 170f8146b88SJung-uk Kim UINT32 *Index); 171f8146b88SJung-uk Kim 172f8146b88SJung-uk Kim 173f8146b88SJung-uk Kim /******************************************************************************* 174f8146b88SJung-uk Kim * 175f8146b88SJung-uk Kim * FUNCTION: OpcDoPld 176f8146b88SJung-uk Kim * 177f8146b88SJung-uk Kim * PARAMETERS: Op - Current parse node 178f8146b88SJung-uk Kim * 179f8146b88SJung-uk Kim * RETURN: None 180f8146b88SJung-uk Kim * 181f8146b88SJung-uk Kim * DESCRIPTION: Convert ToPLD macro to 20-byte buffer 182f8146b88SJung-uk Kim * 183f8146b88SJung-uk Kim * The ToPLD parse tree looks like this: 184f8146b88SJung-uk Kim * 185f8146b88SJung-uk Kim * TOPLD 186f8146b88SJung-uk Kim * PLD_REVISION 187f8146b88SJung-uk Kim * INTEGER 188f8146b88SJung-uk Kim * PLD_IGNORECOLOR 189f8146b88SJung-uk Kim * INTEGER 190f8146b88SJung-uk Kim * ... 191f8146b88SJung-uk Kim * etc. 192f8146b88SJung-uk Kim * 193f8146b88SJung-uk Kim ******************************************************************************/ 194f8146b88SJung-uk Kim 195f8146b88SJung-uk Kim void 196f8146b88SJung-uk Kim OpcDoPld ( 197f8146b88SJung-uk Kim ACPI_PARSE_OBJECT *Op) 198f8146b88SJung-uk Kim { 199f8146b88SJung-uk Kim ACPI_PLD_INFO PldInfo; 200f8146b88SJung-uk Kim UINT8 *Buffer; 201f8146b88SJung-uk Kim ACPI_PARSE_OBJECT *ThisOp; 202f8146b88SJung-uk Kim ACPI_PARSE_OBJECT *NewOp; 203f8146b88SJung-uk Kim UINT16 ParseOpcode; 204f8146b88SJung-uk Kim UINT32 Value; 205f8146b88SJung-uk Kim 206f8146b88SJung-uk Kim 207f8146b88SJung-uk Kim if (!Op) 208f8146b88SJung-uk Kim { 209f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, NULL); 210f8146b88SJung-uk Kim return; 211f8146b88SJung-uk Kim } 212f8146b88SJung-uk Kim 213f8146b88SJung-uk Kim if (Op->Asl.ParseOpcode != PARSEOP_TOPLD) 214f8146b88SJung-uk Kim { 215f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, Op, NULL); 216f8146b88SJung-uk Kim return; 217f8146b88SJung-uk Kim } 218f8146b88SJung-uk Kim 219f8146b88SJung-uk Kim memset (&PldInfo, 0, sizeof (ACPI_PLD_INFO)); 220f8146b88SJung-uk Kim 221f8146b88SJung-uk Kim /* Traverse the list of PLD Ops (one per PLD field) */ 222f8146b88SJung-uk Kim 223f8146b88SJung-uk Kim ThisOp = Op->Asl.Child; 224f8146b88SJung-uk Kim while (ThisOp) 225f8146b88SJung-uk Kim { 226f8146b88SJung-uk Kim /* Get child values */ 227f8146b88SJung-uk Kim 228f8146b88SJung-uk Kim ParseOpcode = ThisOp->Asl.Child->Asl.ParseOpcode; 229f8146b88SJung-uk Kim Value = (UINT32) ThisOp->Asl.Child->Asl.Value.Integer; 230f8146b88SJung-uk Kim 231f8146b88SJung-uk Kim switch (ThisOp->Asl.ParseOpcode) 232f8146b88SJung-uk Kim { 233f8146b88SJung-uk Kim case PARSEOP_PLD_REVISION: 234f8146b88SJung-uk Kim 235f8146b88SJung-uk Kim if (ParseOpcode != PARSEOP_INTEGER) 236f8146b88SJung-uk Kim { 237f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); 238f8146b88SJung-uk Kim break; 239f8146b88SJung-uk Kim } 240f8146b88SJung-uk Kim 241f8146b88SJung-uk Kim if (Value > 127) 242f8146b88SJung-uk Kim { 243f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 244f8146b88SJung-uk Kim break; 245f8146b88SJung-uk Kim } 246f8146b88SJung-uk Kim 247f8146b88SJung-uk Kim PldInfo.Revision = (UINT8) Value; 248f8146b88SJung-uk Kim break; 249f8146b88SJung-uk Kim 250f8146b88SJung-uk Kim case PARSEOP_PLD_IGNORECOLOR: 251f8146b88SJung-uk Kim 252f8146b88SJung-uk Kim if (ParseOpcode != PARSEOP_INTEGER) 253f8146b88SJung-uk Kim { 254f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); 255f8146b88SJung-uk Kim break; 256f8146b88SJung-uk Kim } 257f8146b88SJung-uk Kim 258f8146b88SJung-uk Kim if (Value > 1) 259f8146b88SJung-uk Kim { 260f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 261f8146b88SJung-uk Kim break; 262f8146b88SJung-uk Kim } 263f8146b88SJung-uk Kim 264f8146b88SJung-uk Kim PldInfo.IgnoreColor = (UINT8) Value; 265f8146b88SJung-uk Kim break; 266f8146b88SJung-uk Kim 267f8146b88SJung-uk Kim case PARSEOP_PLD_RED: 268f8146b88SJung-uk Kim case PARSEOP_PLD_GREEN: 269f8146b88SJung-uk Kim case PARSEOP_PLD_BLUE: 270f8146b88SJung-uk Kim 271f8146b88SJung-uk Kim if (ParseOpcode != PARSEOP_INTEGER) 272f8146b88SJung-uk Kim { 273f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 274f8146b88SJung-uk Kim break; 275f8146b88SJung-uk Kim } 276f8146b88SJung-uk Kim 277f8146b88SJung-uk Kim if (Value > 255) 278f8146b88SJung-uk Kim { 279f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 280f8146b88SJung-uk Kim break; 281f8146b88SJung-uk Kim } 282f8146b88SJung-uk Kim 283f8146b88SJung-uk Kim if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_RED) 284f8146b88SJung-uk Kim { 285f8146b88SJung-uk Kim PldInfo.Red = (UINT8) Value; 286f8146b88SJung-uk Kim } 287f8146b88SJung-uk Kim else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_GREEN) 288f8146b88SJung-uk Kim { 289f8146b88SJung-uk Kim PldInfo.Green = (UINT8) Value; 290f8146b88SJung-uk Kim } 291f8146b88SJung-uk Kim else /* PARSEOP_PLD_BLUE */ 292f8146b88SJung-uk Kim { 293f8146b88SJung-uk Kim PldInfo.Blue = (UINT8) Value; 294f8146b88SJung-uk Kim } 295f8146b88SJung-uk Kim break; 296f8146b88SJung-uk Kim 297f8146b88SJung-uk Kim case PARSEOP_PLD_WIDTH: 298f8146b88SJung-uk Kim case PARSEOP_PLD_HEIGHT: 299f8146b88SJung-uk Kim 300f8146b88SJung-uk Kim if (ParseOpcode != PARSEOP_INTEGER) 301f8146b88SJung-uk Kim { 302f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); 303f8146b88SJung-uk Kim break; 304f8146b88SJung-uk Kim } 305f8146b88SJung-uk Kim 306f8146b88SJung-uk Kim if (Value > 65535) 307f8146b88SJung-uk Kim { 308f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 309f8146b88SJung-uk Kim break; 310f8146b88SJung-uk Kim } 311f8146b88SJung-uk Kim 312f8146b88SJung-uk Kim if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_WIDTH) 313f8146b88SJung-uk Kim { 314f8146b88SJung-uk Kim PldInfo.Width = (UINT16) Value; 315f8146b88SJung-uk Kim } 316f8146b88SJung-uk Kim else /* PARSEOP_PLD_HEIGHT */ 317f8146b88SJung-uk Kim { 318f8146b88SJung-uk Kim PldInfo.Height = (UINT16) Value; 319f8146b88SJung-uk Kim } 320f8146b88SJung-uk Kim 321f8146b88SJung-uk Kim break; 322f8146b88SJung-uk Kim 323f8146b88SJung-uk Kim case PARSEOP_PLD_USERVISIBLE: 324f8146b88SJung-uk Kim case PARSEOP_PLD_DOCK: 325f8146b88SJung-uk Kim case PARSEOP_PLD_LID: 326f8146b88SJung-uk Kim 327f8146b88SJung-uk Kim if (ParseOpcode != PARSEOP_INTEGER) 328f8146b88SJung-uk Kim { 329f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); 330f8146b88SJung-uk Kim break; 331f8146b88SJung-uk Kim } 332f8146b88SJung-uk Kim 333f8146b88SJung-uk Kim if (Value > 1) 334f8146b88SJung-uk Kim { 335f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 336f8146b88SJung-uk Kim break; 337f8146b88SJung-uk Kim } 338f8146b88SJung-uk Kim 339f8146b88SJung-uk Kim if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_USERVISIBLE) 340f8146b88SJung-uk Kim { 341f8146b88SJung-uk Kim PldInfo.UserVisible = (UINT8) Value; 342f8146b88SJung-uk Kim } 343f8146b88SJung-uk Kim else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_DOCK) 344f8146b88SJung-uk Kim { 345f8146b88SJung-uk Kim PldInfo.Dock = (UINT8) Value; 346f8146b88SJung-uk Kim } 347f8146b88SJung-uk Kim else 348f8146b88SJung-uk Kim { 349f8146b88SJung-uk Kim PldInfo.Lid = (UINT8) Value; 350f8146b88SJung-uk Kim } 351f8146b88SJung-uk Kim 352f8146b88SJung-uk Kim break; 353f8146b88SJung-uk Kim 354f8146b88SJung-uk Kim case PARSEOP_PLD_PANEL: 355f8146b88SJung-uk Kim 356f8146b88SJung-uk Kim if (ParseOpcode == PARSEOP_INTEGER) 357f8146b88SJung-uk Kim { 358f8146b88SJung-uk Kim if (Value > 6) 359f8146b88SJung-uk Kim { 360f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 361f8146b88SJung-uk Kim break; 362f8146b88SJung-uk Kim } 363f8146b88SJung-uk Kim } 364f8146b88SJung-uk Kim else /* PARSEOP_STRING */ 365f8146b88SJung-uk Kim { 366f8146b88SJung-uk Kim if (!OpcFindName (AcpiGbl_PldPanelList, 367f8146b88SJung-uk Kim ThisOp->Asl.Child->Asl.Value.String, 368f8146b88SJung-uk Kim &Value)) 369f8146b88SJung-uk Kim { 370f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL); 371f8146b88SJung-uk Kim break; 372f8146b88SJung-uk Kim } 373f8146b88SJung-uk Kim } 374f8146b88SJung-uk Kim 375f8146b88SJung-uk Kim PldInfo.Panel = (UINT8) Value; 376f8146b88SJung-uk Kim break; 377f8146b88SJung-uk Kim 378f8146b88SJung-uk Kim case PARSEOP_PLD_VERTICALPOSITION: 379f8146b88SJung-uk Kim 380f8146b88SJung-uk Kim if (ParseOpcode == PARSEOP_INTEGER) 381f8146b88SJung-uk Kim { 382f8146b88SJung-uk Kim if (Value > 2) 383f8146b88SJung-uk Kim { 384f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 385f8146b88SJung-uk Kim break; 386f8146b88SJung-uk Kim } 387f8146b88SJung-uk Kim } 388f8146b88SJung-uk Kim else /* PARSEOP_STRING */ 389f8146b88SJung-uk Kim { 390f8146b88SJung-uk Kim if (!OpcFindName (AcpiGbl_PldVerticalPositionList, 391f8146b88SJung-uk Kim ThisOp->Asl.Child->Asl.Value.String, 392f8146b88SJung-uk Kim &Value)) 393f8146b88SJung-uk Kim { 394f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL); 395f8146b88SJung-uk Kim break; 396f8146b88SJung-uk Kim } 397f8146b88SJung-uk Kim } 398f8146b88SJung-uk Kim 399f8146b88SJung-uk Kim PldInfo.VerticalPosition = (UINT8) Value; 400f8146b88SJung-uk Kim break; 401f8146b88SJung-uk Kim 402f8146b88SJung-uk Kim case PARSEOP_PLD_HORIZONTALPOSITION: 403f8146b88SJung-uk Kim 404f8146b88SJung-uk Kim if (ParseOpcode == PARSEOP_INTEGER) 405f8146b88SJung-uk Kim { 406f8146b88SJung-uk Kim if (Value > 2) 407f8146b88SJung-uk Kim { 408f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 409f8146b88SJung-uk Kim break; 410f8146b88SJung-uk Kim } 411f8146b88SJung-uk Kim } 412f8146b88SJung-uk Kim else /* PARSEOP_STRING */ 413f8146b88SJung-uk Kim { 414f8146b88SJung-uk Kim if (!OpcFindName (AcpiGbl_PldHorizontalPositionList, 415f8146b88SJung-uk Kim ThisOp->Asl.Child->Asl.Value.String, 416f8146b88SJung-uk Kim &Value)) 417f8146b88SJung-uk Kim { 418f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL); 419f8146b88SJung-uk Kim break; 420f8146b88SJung-uk Kim } 421f8146b88SJung-uk Kim } 422f8146b88SJung-uk Kim 423f8146b88SJung-uk Kim PldInfo.HorizontalPosition = (UINT8) Value; 424f8146b88SJung-uk Kim break; 425f8146b88SJung-uk Kim 426f8146b88SJung-uk Kim case PARSEOP_PLD_SHAPE: 427f8146b88SJung-uk Kim 428f8146b88SJung-uk Kim if (ParseOpcode == PARSEOP_INTEGER) 429f8146b88SJung-uk Kim { 430f8146b88SJung-uk Kim if (Value > 8) 431f8146b88SJung-uk Kim { 432f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 433f8146b88SJung-uk Kim break; 434f8146b88SJung-uk Kim } 435f8146b88SJung-uk Kim } 436f8146b88SJung-uk Kim else /* PARSEOP_STRING */ 437f8146b88SJung-uk Kim { 438f8146b88SJung-uk Kim if (!OpcFindName (AcpiGbl_PldShapeList, 439f8146b88SJung-uk Kim ThisOp->Asl.Child->Asl.Value.String, 440f8146b88SJung-uk Kim &Value)) 441f8146b88SJung-uk Kim { 442f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL); 443f8146b88SJung-uk Kim break; 444f8146b88SJung-uk Kim } 445f8146b88SJung-uk Kim } 446f8146b88SJung-uk Kim 447f8146b88SJung-uk Kim PldInfo.Shape = (UINT8) Value; 448f8146b88SJung-uk Kim break; 449f8146b88SJung-uk Kim 450f8146b88SJung-uk Kim case PARSEOP_PLD_GROUPORIENTATION: 451f8146b88SJung-uk Kim 452f8146b88SJung-uk Kim if (ParseOpcode != PARSEOP_INTEGER) 453f8146b88SJung-uk Kim { 454f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); 455f8146b88SJung-uk Kim break; 456f8146b88SJung-uk Kim } 457f8146b88SJung-uk Kim 458f8146b88SJung-uk Kim if (Value > 1) 459f8146b88SJung-uk Kim { 460f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 461f8146b88SJung-uk Kim break; 462f8146b88SJung-uk Kim } 463f8146b88SJung-uk Kim 464f8146b88SJung-uk Kim PldInfo.GroupOrientation = (UINT8) Value; 465f8146b88SJung-uk Kim break; 466f8146b88SJung-uk Kim 467f8146b88SJung-uk Kim case PARSEOP_PLD_GROUPTOKEN: 468f8146b88SJung-uk Kim case PARSEOP_PLD_GROUPPOSITION: 469f8146b88SJung-uk Kim 470f8146b88SJung-uk Kim if (ParseOpcode != PARSEOP_INTEGER) 471f8146b88SJung-uk Kim { 472f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); 473f8146b88SJung-uk Kim break; 474f8146b88SJung-uk Kim } 475f8146b88SJung-uk Kim 476f8146b88SJung-uk Kim if (Value > 255) 477f8146b88SJung-uk Kim { 478f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 479f8146b88SJung-uk Kim break; 480f8146b88SJung-uk Kim } 481f8146b88SJung-uk Kim 482f8146b88SJung-uk Kim if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_GROUPTOKEN) 483f8146b88SJung-uk Kim { 484f8146b88SJung-uk Kim PldInfo.GroupToken = (UINT8) Value; 485f8146b88SJung-uk Kim } 486f8146b88SJung-uk Kim else /* PARSEOP_PLD_GROUPPOSITION */ 487f8146b88SJung-uk Kim { 488f8146b88SJung-uk Kim PldInfo.GroupPosition = (UINT8) Value; 489f8146b88SJung-uk Kim } 490f8146b88SJung-uk Kim 491f8146b88SJung-uk Kim break; 492f8146b88SJung-uk Kim 493f8146b88SJung-uk Kim case PARSEOP_PLD_BAY: 494f8146b88SJung-uk Kim case PARSEOP_PLD_EJECTABLE: 495f8146b88SJung-uk Kim case PARSEOP_PLD_EJECTREQUIRED: 496f8146b88SJung-uk Kim 497f8146b88SJung-uk Kim if (ParseOpcode != PARSEOP_INTEGER) 498f8146b88SJung-uk Kim { 499f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); 500f8146b88SJung-uk Kim break; 501f8146b88SJung-uk Kim } 502f8146b88SJung-uk Kim 503f8146b88SJung-uk Kim if (Value > 1) 504f8146b88SJung-uk Kim { 505f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 506f8146b88SJung-uk Kim break; 507f8146b88SJung-uk Kim } 508f8146b88SJung-uk Kim 509f8146b88SJung-uk Kim if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_BAY) 510f8146b88SJung-uk Kim { 511f8146b88SJung-uk Kim PldInfo.Bay = (UINT8) Value; 512f8146b88SJung-uk Kim } 513f8146b88SJung-uk Kim else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_EJECTABLE) 514f8146b88SJung-uk Kim { 515f8146b88SJung-uk Kim PldInfo.Ejectable = (UINT8) Value; 516f8146b88SJung-uk Kim } 517f8146b88SJung-uk Kim else /* PARSEOP_PLD_EJECTREQUIRED */ 518f8146b88SJung-uk Kim { 519f8146b88SJung-uk Kim PldInfo.OspmEjectRequired = (UINT8) Value; 520f8146b88SJung-uk Kim } 521f8146b88SJung-uk Kim 522f8146b88SJung-uk Kim break; 523f8146b88SJung-uk Kim 524f8146b88SJung-uk Kim case PARSEOP_PLD_CABINETNUMBER: 525f8146b88SJung-uk Kim case PARSEOP_PLD_CARDCAGENUMBER: 526f8146b88SJung-uk Kim 527f8146b88SJung-uk Kim if (ParseOpcode != PARSEOP_INTEGER) 528f8146b88SJung-uk Kim { 529f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); 530f8146b88SJung-uk Kim break; 531f8146b88SJung-uk Kim } 532f8146b88SJung-uk Kim 533f8146b88SJung-uk Kim if (Value > 255) 534f8146b88SJung-uk Kim { 535f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 536f8146b88SJung-uk Kim break; 537f8146b88SJung-uk Kim } 538f8146b88SJung-uk Kim 539f8146b88SJung-uk Kim if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_CABINETNUMBER) 540f8146b88SJung-uk Kim { 541f8146b88SJung-uk Kim PldInfo.CabinetNumber = (UINT8) Value; 542f8146b88SJung-uk Kim } 543f8146b88SJung-uk Kim else /* PARSEOP_PLD_CARDCAGENUMBER */ 544f8146b88SJung-uk Kim { 545f8146b88SJung-uk Kim PldInfo.CardCageNumber = (UINT8) Value; 546f8146b88SJung-uk Kim } 547f8146b88SJung-uk Kim 548f8146b88SJung-uk Kim break; 549f8146b88SJung-uk Kim 550f8146b88SJung-uk Kim case PARSEOP_PLD_REFERENCE: 551f8146b88SJung-uk Kim 552f8146b88SJung-uk Kim if (ParseOpcode != PARSEOP_INTEGER) 553f8146b88SJung-uk Kim { 554f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); 555f8146b88SJung-uk Kim break; 556f8146b88SJung-uk Kim } 557f8146b88SJung-uk Kim 558f8146b88SJung-uk Kim if (Value > 1) 559f8146b88SJung-uk Kim { 560f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 561f8146b88SJung-uk Kim break; 562f8146b88SJung-uk Kim } 563f8146b88SJung-uk Kim 564f8146b88SJung-uk Kim PldInfo.Reference = (UINT8) Value; 565f8146b88SJung-uk Kim break; 566f8146b88SJung-uk Kim 567f8146b88SJung-uk Kim case PARSEOP_PLD_ROTATION: 568f8146b88SJung-uk Kim 569f8146b88SJung-uk Kim if (ParseOpcode != PARSEOP_INTEGER) 570f8146b88SJung-uk Kim { 571f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); 572f8146b88SJung-uk Kim break; 573f8146b88SJung-uk Kim } 574f8146b88SJung-uk Kim 575f8146b88SJung-uk Kim if (Value > 7) 576f8146b88SJung-uk Kim { 577f8146b88SJung-uk Kim switch (Value) 578f8146b88SJung-uk Kim { 579f8146b88SJung-uk Kim case 45: 580f8146b88SJung-uk Kim 581f8146b88SJung-uk Kim Value = 1; 582f8146b88SJung-uk Kim break; 583f8146b88SJung-uk Kim 584f8146b88SJung-uk Kim case 90: 585f8146b88SJung-uk Kim 586f8146b88SJung-uk Kim Value = 2; 587f8146b88SJung-uk Kim break; 588f8146b88SJung-uk Kim 589f8146b88SJung-uk Kim case 135: 590f8146b88SJung-uk Kim 591f8146b88SJung-uk Kim Value = 3; 592f8146b88SJung-uk Kim break; 593f8146b88SJung-uk Kim 594f8146b88SJung-uk Kim case 180: 595f8146b88SJung-uk Kim 596f8146b88SJung-uk Kim Value = 4; 597f8146b88SJung-uk Kim break; 598f8146b88SJung-uk Kim 599f8146b88SJung-uk Kim case 225: 600f8146b88SJung-uk Kim 601f8146b88SJung-uk Kim Value = 5; 602f8146b88SJung-uk Kim break; 603f8146b88SJung-uk Kim 604f8146b88SJung-uk Kim case 270: 605f8146b88SJung-uk Kim 606f8146b88SJung-uk Kim Value = 6; 607f8146b88SJung-uk Kim break; 608f8146b88SJung-uk Kim 609f8146b88SJung-uk Kim case 315: 610f8146b88SJung-uk Kim 611f8146b88SJung-uk Kim Value = 7; 612f8146b88SJung-uk Kim break; 613f8146b88SJung-uk Kim 614f8146b88SJung-uk Kim default: 615f8146b88SJung-uk Kim 616f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 617f8146b88SJung-uk Kim break; 618f8146b88SJung-uk Kim } 619f8146b88SJung-uk Kim } 620f8146b88SJung-uk Kim 621f8146b88SJung-uk Kim PldInfo.Rotation = (UINT8) Value; 622f8146b88SJung-uk Kim break; 623f8146b88SJung-uk Kim 624f8146b88SJung-uk Kim case PARSEOP_PLD_ORDER: 625f8146b88SJung-uk Kim 626f8146b88SJung-uk Kim if (ParseOpcode != PARSEOP_INTEGER) 627f8146b88SJung-uk Kim { 628f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); 629f8146b88SJung-uk Kim break; 630f8146b88SJung-uk Kim } 631f8146b88SJung-uk Kim 632f8146b88SJung-uk Kim if (Value > 31) 633f8146b88SJung-uk Kim { 634f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 635f8146b88SJung-uk Kim break; 636f8146b88SJung-uk Kim } 637f8146b88SJung-uk Kim 638f8146b88SJung-uk Kim PldInfo.Order = (UINT8) Value; 639f8146b88SJung-uk Kim break; 640f8146b88SJung-uk Kim 641f8146b88SJung-uk Kim case PARSEOP_PLD_VERTICALOFFSET: 642f8146b88SJung-uk Kim case PARSEOP_PLD_HORIZONTALOFFSET: 643f8146b88SJung-uk Kim 644f8146b88SJung-uk Kim if (ParseOpcode != PARSEOP_INTEGER) 645f8146b88SJung-uk Kim { 646f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); 647f8146b88SJung-uk Kim break; 648f8146b88SJung-uk Kim } 649f8146b88SJung-uk Kim 650f8146b88SJung-uk Kim if (Value > 65535) 651f8146b88SJung-uk Kim { 652f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL); 653f8146b88SJung-uk Kim break; 654f8146b88SJung-uk Kim } 655f8146b88SJung-uk Kim 656f8146b88SJung-uk Kim if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_VERTICALOFFSET) 657f8146b88SJung-uk Kim { 658f8146b88SJung-uk Kim PldInfo.VerticalOffset = (UINT16) Value; 659f8146b88SJung-uk Kim } 660f8146b88SJung-uk Kim else /* PARSEOP_PLD_HORIZONTALOFFSET */ 661f8146b88SJung-uk Kim { 662f8146b88SJung-uk Kim PldInfo.HorizontalOffset = (UINT16) Value; 663f8146b88SJung-uk Kim } 664f8146b88SJung-uk Kim 665f8146b88SJung-uk Kim break; 666f8146b88SJung-uk Kim 667f8146b88SJung-uk Kim default: 668f8146b88SJung-uk Kim 669f8146b88SJung-uk Kim AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL); 670f8146b88SJung-uk Kim break; 671f8146b88SJung-uk Kim } 672f8146b88SJung-uk Kim 673f8146b88SJung-uk Kim ThisOp = ThisOp->Asl.Next; 674f8146b88SJung-uk Kim } 675f8146b88SJung-uk Kim 676f8146b88SJung-uk Kim Buffer = OpcEncodePldBuffer (&PldInfo); 677f8146b88SJung-uk Kim 678f8146b88SJung-uk Kim /* Change Op to a Buffer */ 679f8146b88SJung-uk Kim 680f8146b88SJung-uk Kim Op->Asl.ParseOpcode = PARSEOP_BUFFER; 681f8146b88SJung-uk Kim Op->Common.AmlOpcode = AML_BUFFER_OP; 682f8146b88SJung-uk Kim 683f8146b88SJung-uk Kim /* Disable further optimization */ 684f8146b88SJung-uk Kim 6855f9b24faSJung-uk Kim Op->Asl.CompileFlags &= ~OP_COMPILE_TIME_CONST; 686f8146b88SJung-uk Kim UtSetParseOpName (Op); 687f8146b88SJung-uk Kim 688f8146b88SJung-uk Kim /* Child node is the buffer length */ 689f8146b88SJung-uk Kim 6905f9b24faSJung-uk Kim NewOp = TrAllocateOp (PARSEOP_INTEGER); 691f8146b88SJung-uk Kim 692f8146b88SJung-uk Kim NewOp->Asl.AmlOpcode = AML_BYTE_OP; 693f8146b88SJung-uk Kim NewOp->Asl.Value.Integer = 20; 694f8146b88SJung-uk Kim NewOp->Asl.Parent = Op; 695f8146b88SJung-uk Kim 696f8146b88SJung-uk Kim Op->Asl.Child = NewOp; 697f8146b88SJung-uk Kim Op = NewOp; 698f8146b88SJung-uk Kim 699f8146b88SJung-uk Kim /* Peer to the child is the raw buffer data */ 700f8146b88SJung-uk Kim 7015f9b24faSJung-uk Kim NewOp = TrAllocateOp (PARSEOP_RAW_DATA); 702f8146b88SJung-uk Kim NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; 703f8146b88SJung-uk Kim NewOp->Asl.AmlLength = 20; 704f8146b88SJung-uk Kim NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer); 705f8146b88SJung-uk Kim NewOp->Asl.Parent = Op->Asl.Parent; 706f8146b88SJung-uk Kim 707f8146b88SJung-uk Kim Op->Asl.Next = NewOp; 708f8146b88SJung-uk Kim } 709f8146b88SJung-uk Kim 710f8146b88SJung-uk Kim 711f8146b88SJung-uk Kim /******************************************************************************* 712f8146b88SJung-uk Kim * 713f8146b88SJung-uk Kim * FUNCTION: OpcEncodePldBuffer 714f8146b88SJung-uk Kim * 715f8146b88SJung-uk Kim * PARAMETERS: PldInfo - _PLD buffer struct (Using local struct) 716f8146b88SJung-uk Kim * 717f8146b88SJung-uk Kim * RETURN: Encode _PLD buffer suitable for return value from _PLD 718f8146b88SJung-uk Kim * 719f8146b88SJung-uk Kim * DESCRIPTION: Bit-packs a _PLD buffer struct. 720f8146b88SJung-uk Kim * 721f8146b88SJung-uk Kim ******************************************************************************/ 722f8146b88SJung-uk Kim 723f8146b88SJung-uk Kim static UINT8 * 724f8146b88SJung-uk Kim OpcEncodePldBuffer ( 725f8146b88SJung-uk Kim ACPI_PLD_INFO *PldInfo) 726f8146b88SJung-uk Kim { 727f8146b88SJung-uk Kim UINT32 *Buffer; 728f8146b88SJung-uk Kim UINT32 Dword; 729f8146b88SJung-uk Kim 730f8146b88SJung-uk Kim 7316f1f1a63SJung-uk Kim Buffer = ACPI_CAST_PTR (UINT32, UtLocalCacheCalloc (ACPI_PLD_BUFFER_SIZE)); 732f8146b88SJung-uk Kim 733f8146b88SJung-uk Kim /* First 32 bits */ 734f8146b88SJung-uk Kim 735f8146b88SJung-uk Kim Dword = 0; 736f8146b88SJung-uk Kim ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision); 737f8146b88SJung-uk Kim ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor); 738f8146b88SJung-uk Kim ACPI_PLD_SET_RED (&Dword, PldInfo->Red); 739f8146b88SJung-uk Kim ACPI_PLD_SET_GREEN (&Dword, PldInfo->Green); 740f8146b88SJung-uk Kim ACPI_PLD_SET_BLUE (&Dword, PldInfo->Blue); 741f8146b88SJung-uk Kim ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword); 742f8146b88SJung-uk Kim 743f8146b88SJung-uk Kim /* Second 32 bits */ 744f8146b88SJung-uk Kim 745f8146b88SJung-uk Kim Dword = 0; 746f8146b88SJung-uk Kim ACPI_PLD_SET_WIDTH (&Dword, PldInfo->Width); 747f8146b88SJung-uk Kim ACPI_PLD_SET_HEIGHT (&Dword, PldInfo->Height); 748f8146b88SJung-uk Kim ACPI_MOVE_32_TO_32 (&Buffer[1], &Dword); 749f8146b88SJung-uk Kim 750f8146b88SJung-uk Kim /* Third 32 bits */ 751f8146b88SJung-uk Kim 752f8146b88SJung-uk Kim Dword = 0; 753f8146b88SJung-uk Kim ACPI_PLD_SET_USER_VISIBLE (&Dword, PldInfo->UserVisible); 754f8146b88SJung-uk Kim ACPI_PLD_SET_DOCK (&Dword, PldInfo->Dock); 755f8146b88SJung-uk Kim ACPI_PLD_SET_LID (&Dword, PldInfo->Lid); 756f8146b88SJung-uk Kim ACPI_PLD_SET_PANEL (&Dword, PldInfo->Panel); 757f8146b88SJung-uk Kim ACPI_PLD_SET_VERTICAL (&Dword, PldInfo->VerticalPosition); 758f8146b88SJung-uk Kim ACPI_PLD_SET_HORIZONTAL (&Dword, PldInfo->HorizontalPosition); 759f8146b88SJung-uk Kim ACPI_PLD_SET_SHAPE (&Dword, PldInfo->Shape); 760f8146b88SJung-uk Kim ACPI_PLD_SET_ORIENTATION (&Dword, PldInfo->GroupOrientation); 761f8146b88SJung-uk Kim ACPI_PLD_SET_TOKEN (&Dword, PldInfo->GroupToken); 762f8146b88SJung-uk Kim ACPI_PLD_SET_POSITION (&Dword, PldInfo->GroupPosition); 763f8146b88SJung-uk Kim ACPI_PLD_SET_BAY (&Dword, PldInfo->Bay); 764f8146b88SJung-uk Kim ACPI_MOVE_32_TO_32 (&Buffer[2], &Dword); 765f8146b88SJung-uk Kim 766f8146b88SJung-uk Kim /* Fourth 32 bits */ 767f8146b88SJung-uk Kim 768f8146b88SJung-uk Kim Dword = 0; 769f8146b88SJung-uk Kim ACPI_PLD_SET_EJECTABLE (&Dword, PldInfo->Ejectable); 770f8146b88SJung-uk Kim ACPI_PLD_SET_OSPM_EJECT (&Dword, PldInfo->OspmEjectRequired); 771f8146b88SJung-uk Kim ACPI_PLD_SET_CABINET (&Dword, PldInfo->CabinetNumber); 772f8146b88SJung-uk Kim ACPI_PLD_SET_CARD_CAGE (&Dword, PldInfo->CardCageNumber); 773f8146b88SJung-uk Kim ACPI_PLD_SET_REFERENCE (&Dword, PldInfo->Reference); 774f8146b88SJung-uk Kim ACPI_PLD_SET_ROTATION (&Dword, PldInfo->Rotation); 775f8146b88SJung-uk Kim ACPI_PLD_SET_ORDER (&Dword, PldInfo->Order); 776f8146b88SJung-uk Kim ACPI_MOVE_32_TO_32 (&Buffer[3], &Dword); 777f8146b88SJung-uk Kim 778f8146b88SJung-uk Kim /* Revision 2 adds an additional DWORD */ 779f8146b88SJung-uk Kim 780f8146b88SJung-uk Kim if (PldInfo->Revision >= 2) 781f8146b88SJung-uk Kim { 782f8146b88SJung-uk Kim /* Fifth 32 bits */ 783f8146b88SJung-uk Kim 784f8146b88SJung-uk Kim Dword = 0; 785f8146b88SJung-uk Kim ACPI_PLD_SET_VERT_OFFSET (&Dword, PldInfo->VerticalOffset); 786f8146b88SJung-uk Kim ACPI_PLD_SET_HORIZ_OFFSET (&Dword, PldInfo->HorizontalOffset); 787f8146b88SJung-uk Kim ACPI_MOVE_32_TO_32 (&Buffer[4], &Dword); 788f8146b88SJung-uk Kim } 789f8146b88SJung-uk Kim 790f8146b88SJung-uk Kim return (ACPI_CAST_PTR (UINT8, Buffer)); 791f8146b88SJung-uk Kim } 792f8146b88SJung-uk Kim 793f8146b88SJung-uk Kim 794f8146b88SJung-uk Kim /******************************************************************************* 795f8146b88SJung-uk Kim * 796f8146b88SJung-uk Kim * FUNCTION: OpcFindName 797f8146b88SJung-uk Kim * 798f8146b88SJung-uk Kim * PARAMETERS: List - Array of char strings to be searched 799f8146b88SJung-uk Kim * Name - Char string to string for 800f8146b88SJung-uk Kim * Index - Index value to set if found 801f8146b88SJung-uk Kim * 802f8146b88SJung-uk Kim * RETURN: TRUE if any names matched, FALSE otherwise 803f8146b88SJung-uk Kim * 804f8146b88SJung-uk Kim * DESCRIPTION: Match PLD name to value in lookup table. Sets Value to 805f8146b88SJung-uk Kim * equivalent parameter value. 806f8146b88SJung-uk Kim * 807f8146b88SJung-uk Kim ******************************************************************************/ 808f8146b88SJung-uk Kim 809f8146b88SJung-uk Kim static BOOLEAN 810f8146b88SJung-uk Kim OpcFindName ( 811f8146b88SJung-uk Kim const char **List, 812f8146b88SJung-uk Kim char *Name, 813f8146b88SJung-uk Kim UINT32 *Index) 814f8146b88SJung-uk Kim { 815f8146b88SJung-uk Kim const char *NameString; 816f8146b88SJung-uk Kim UINT32 i; 817f8146b88SJung-uk Kim 818f8146b88SJung-uk Kim 819f8146b88SJung-uk Kim AcpiUtStrupr (Name); 820f8146b88SJung-uk Kim 821f8146b88SJung-uk Kim for (i = 0, NameString = List[0]; 822f8146b88SJung-uk Kim NameString; 823f8146b88SJung-uk Kim i++, NameString = List[i]) 824f8146b88SJung-uk Kim { 825f8146b88SJung-uk Kim if (!(strncmp (NameString, Name, strlen (Name)))) 826f8146b88SJung-uk Kim { 827f8146b88SJung-uk Kim *Index = i; 828f8146b88SJung-uk Kim return (TRUE); 829f8146b88SJung-uk Kim } 830f8146b88SJung-uk Kim } 831f8146b88SJung-uk Kim 832f8146b88SJung-uk Kim return (FALSE); 833f8146b88SJung-uk Kim } 834