Path: blob/main/sys/contrib/dev/acpica/compiler/aslpld.c
48373 views
/******************************************************************************1*2* Module Name: aslpld - Implementation of ASL ToPLD macro3*4*****************************************************************************/56/******************************************************************************7*8* 1. Copyright Notice9*10* Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.11* All rights reserved.12*13* 2. License14*15* 2.1. This is your license from Intel Corp. under its intellectual property16* rights. You may have additional license terms from the party that provided17* you this software, covering your right to use that party's intellectual18* property rights.19*20* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a21* copy of the source code appearing in this file ("Covered Code") an22* irrevocable, perpetual, worldwide license under Intel's copyrights in the23* base code distributed originally by Intel ("Original Intel Code") to copy,24* make derivatives, distribute, use and display any portion of the Covered25* Code in any form, with the right to sublicense such rights; and26*27* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent28* license (with the right to sublicense), under only those claims of Intel29* patents that are infringed by the Original Intel Code, to make, use, sell,30* offer to sell, and import the Covered Code and derivative works thereof31* solely to the minimum extent necessary to exercise the above copyright32* license, and in no event shall the patent license extend to any additions33* to or modifications of the Original Intel Code. No other license or right34* is granted directly or by implication, estoppel or otherwise;35*36* The above copyright and patent license is granted only if the following37* conditions are met:38*39* 3. Conditions40*41* 3.1. Redistribution of Source with Rights to Further Distribute Source.42* Redistribution of source code of any substantial portion of the Covered43* Code or modification with rights to further distribute source must include44* the above Copyright Notice, the above License, this list of Conditions,45* and the following Disclaimer and Export Compliance provision. In addition,46* Licensee must cause all Covered Code to which Licensee contributes to47* contain a file documenting the changes Licensee made to create that Covered48* Code and the date of any change. Licensee must include in that file the49* documentation of any changes made by any predecessor Licensee. Licensee50* must include a prominent statement that the modification is derived,51* directly or indirectly, from Original Intel Code.52*53* 3.2. Redistribution of Source with no Rights to Further Distribute Source.54* Redistribution of source code of any substantial portion of the Covered55* Code or modification without rights to further distribute source must56* include the following Disclaimer and Export Compliance provision in the57* documentation and/or other materials provided with distribution. In58* addition, Licensee may not authorize further sublicense of source of any59* portion of the Covered Code, and must include terms to the effect that the60* license from Licensee to its licensee is limited to the intellectual61* property embodied in the software Licensee provides to its licensee, and62* not to intellectual property embodied in modifications its licensee may63* make.64*65* 3.3. Redistribution of Executable. Redistribution in executable form of any66* substantial portion of the Covered Code or modification must reproduce the67* above Copyright Notice, and the following Disclaimer and Export Compliance68* provision in the documentation and/or other materials provided with the69* distribution.70*71* 3.4. Intel retains all right, title, and interest in and to the Original72* Intel Code.73*74* 3.5. Neither the name Intel nor any other trademark owned or controlled by75* Intel shall be used in advertising or otherwise to promote the sale, use or76* other dealings in products derived from or relating to the Covered Code77* without prior written authorization from Intel.78*79* 4. Disclaimer and Export Compliance80*81* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED82* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE83* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,84* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY85* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY86* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A87* PARTICULAR PURPOSE.88*89* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES90* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR91* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,92* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY93* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL94* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS95* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY96* LIMITED REMEDY.97*98* 4.3. Licensee shall not export, either directly or indirectly, any of this99* software or system incorporating such software without first obtaining any100* required license or other approval from the U. S. Department of Commerce or101* any other agency or department of the United States Government. In the102* event Licensee exports any such software from the United States or103* re-exports any such software from a foreign destination, Licensee shall104* ensure that the distribution and export/re-export of the software is in105* compliance with all laws, regulations, orders, or other restrictions of the106* U.S. Export Administration Regulations. Licensee agrees that neither it nor107* any of its subsidiaries will export/re-export any technical data, process,108* software, or service, directly or indirectly, to any country for which the109* United States government or any agency thereof requires an export license,110* other governmental approval, or letter of assurance, without first obtaining111* such license, approval or letter.112*113*****************************************************************************114*115* Alternatively, you may choose to be licensed under the terms of the116* following license:117*118* Redistribution and use in source and binary forms, with or without119* modification, are permitted provided that the following conditions120* are met:121* 1. Redistributions of source code must retain the above copyright122* notice, this list of conditions, and the following disclaimer,123* without modification.124* 2. Redistributions in binary form must reproduce at minimum a disclaimer125* substantially similar to the "NO WARRANTY" disclaimer below126* ("Disclaimer") and any redistribution must be conditioned upon127* including a substantially similar Disclaimer requirement for further128* binary redistribution.129* 3. Neither the names of the above-listed copyright holders nor the names130* of any contributors may be used to endorse or promote products derived131* from this software without specific prior written permission.132*133* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS134* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT135* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR136* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT137* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,138* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT139* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,140* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY141* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT142* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE143* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.144*145* Alternatively, you may choose to be licensed under the terms of the146* GNU General Public License ("GPL") version 2 as published by the Free147* Software Foundation.148*149*****************************************************************************/150151#include <contrib/dev/acpica/compiler/aslcompiler.h>152#include "aslcompiler.y.h"153#include <contrib/dev/acpica/include/amlcode.h>154155#define _COMPONENT ACPI_COMPILER156ACPI_MODULE_NAME ("aslpld")157158159/* Local prototypes */160161static UINT8 *162OpcEncodePldBuffer (163ACPI_PLD_INFO *PldInfo);164165static BOOLEAN166OpcFindName (167const char **List,168char *Name,169UINT32 *Index);170171172/*******************************************************************************173*174* FUNCTION: OpcDoPld175*176* PARAMETERS: Op - Current parse node177*178* RETURN: None179*180* DESCRIPTION: Convert ToPLD macro to 20-byte buffer181*182* The ToPLD parse tree looks like this:183*184* TOPLD185* PLD_REVISION186* INTEGER187* PLD_IGNORECOLOR188* INTEGER189* ...190* etc.191*192******************************************************************************/193194void195OpcDoPld (196ACPI_PARSE_OBJECT *Op)197{198ACPI_PLD_INFO PldInfo;199UINT8 *Buffer;200ACPI_PARSE_OBJECT *ThisOp;201ACPI_PARSE_OBJECT *NewOp;202UINT16 ParseOpcode;203UINT32 Value;204205206if (!Op)207{208AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, NULL);209return;210}211212if (Op->Asl.ParseOpcode != PARSEOP_TOPLD)213{214AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, Op, NULL);215return;216}217218memset (&PldInfo, 0, sizeof (ACPI_PLD_INFO));219220/* Traverse the list of PLD Ops (one per PLD field) */221222ThisOp = Op->Asl.Child;223while (ThisOp)224{225/* Get child values */226227ParseOpcode = ThisOp->Asl.Child->Asl.ParseOpcode;228Value = (UINT32) ThisOp->Asl.Child->Asl.Value.Integer;229230switch (ThisOp->Asl.ParseOpcode)231{232case PARSEOP_PLD_REVISION:233234if (ParseOpcode != PARSEOP_INTEGER)235{236AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);237break;238}239240if (Value > 127)241{242AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);243break;244}245246PldInfo.Revision = (UINT8) Value;247break;248249case PARSEOP_PLD_IGNORECOLOR:250251if (ParseOpcode != PARSEOP_INTEGER)252{253AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);254break;255}256257if (Value > 1)258{259AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);260break;261}262263PldInfo.IgnoreColor = (UINT8) Value;264break;265266case PARSEOP_PLD_RED:267case PARSEOP_PLD_GREEN:268case PARSEOP_PLD_BLUE:269270if (ParseOpcode != PARSEOP_INTEGER)271{272AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);273break;274}275276if (Value > 255)277{278AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);279break;280}281282if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_RED)283{284PldInfo.Red = (UINT8) Value;285}286else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_GREEN)287{288PldInfo.Green = (UINT8) Value;289}290else /* PARSEOP_PLD_BLUE */291{292PldInfo.Blue = (UINT8) Value;293}294break;295296case PARSEOP_PLD_WIDTH:297case PARSEOP_PLD_HEIGHT:298299if (ParseOpcode != PARSEOP_INTEGER)300{301AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);302break;303}304305if (Value > 65535)306{307AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);308break;309}310311if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_WIDTH)312{313PldInfo.Width = (UINT16) Value;314}315else /* PARSEOP_PLD_HEIGHT */316{317PldInfo.Height = (UINT16) Value;318}319320break;321322case PARSEOP_PLD_USERVISIBLE:323case PARSEOP_PLD_DOCK:324case PARSEOP_PLD_LID:325326if (ParseOpcode != PARSEOP_INTEGER)327{328AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);329break;330}331332if (Value > 1)333{334AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);335break;336}337338if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_USERVISIBLE)339{340PldInfo.UserVisible = (UINT8) Value;341}342else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_DOCK)343{344PldInfo.Dock = (UINT8) Value;345}346else347{348PldInfo.Lid = (UINT8) Value;349}350351break;352353case PARSEOP_PLD_PANEL:354355if (ParseOpcode == PARSEOP_INTEGER)356{357if (Value > 6)358{359AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);360break;361}362}363else /* PARSEOP_STRING */364{365if (!OpcFindName (AcpiGbl_PldPanelList,366ThisOp->Asl.Child->Asl.Value.String,367&Value))368{369AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL);370break;371}372}373374PldInfo.Panel = (UINT8) Value;375break;376377case PARSEOP_PLD_VERTICALPOSITION:378379if (ParseOpcode == PARSEOP_INTEGER)380{381if (Value > 2)382{383AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);384break;385}386}387else /* PARSEOP_STRING */388{389if (!OpcFindName (AcpiGbl_PldVerticalPositionList,390ThisOp->Asl.Child->Asl.Value.String,391&Value))392{393AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL);394break;395}396}397398PldInfo.VerticalPosition = (UINT8) Value;399break;400401case PARSEOP_PLD_HORIZONTALPOSITION:402403if (ParseOpcode == PARSEOP_INTEGER)404{405if (Value > 2)406{407AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);408break;409}410}411else /* PARSEOP_STRING */412{413if (!OpcFindName (AcpiGbl_PldHorizontalPositionList,414ThisOp->Asl.Child->Asl.Value.String,415&Value))416{417AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL);418break;419}420}421422PldInfo.HorizontalPosition = (UINT8) Value;423break;424425case PARSEOP_PLD_SHAPE:426427if (ParseOpcode == PARSEOP_INTEGER)428{429if (Value > 8)430{431AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);432break;433}434}435else /* PARSEOP_STRING */436{437if (!OpcFindName (AcpiGbl_PldShapeList,438ThisOp->Asl.Child->Asl.Value.String,439&Value))440{441AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL);442break;443}444}445446PldInfo.Shape = (UINT8) Value;447break;448449case PARSEOP_PLD_GROUPORIENTATION:450451if (ParseOpcode != PARSEOP_INTEGER)452{453AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);454break;455}456457if (Value > 1)458{459AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);460break;461}462463PldInfo.GroupOrientation = (UINT8) Value;464break;465466case PARSEOP_PLD_GROUPTOKEN:467case PARSEOP_PLD_GROUPPOSITION:468469if (ParseOpcode != PARSEOP_INTEGER)470{471AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);472break;473}474475if (Value > 255)476{477AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);478break;479}480481if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_GROUPTOKEN)482{483PldInfo.GroupToken = (UINT8) Value;484}485else /* PARSEOP_PLD_GROUPPOSITION */486{487PldInfo.GroupPosition = (UINT8) Value;488}489490break;491492case PARSEOP_PLD_BAY:493case PARSEOP_PLD_EJECTABLE:494case PARSEOP_PLD_EJECTREQUIRED:495496if (ParseOpcode != PARSEOP_INTEGER)497{498AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);499break;500}501502if (Value > 1)503{504AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);505break;506}507508if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_BAY)509{510PldInfo.Bay = (UINT8) Value;511}512else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_EJECTABLE)513{514PldInfo.Ejectable = (UINT8) Value;515}516else /* PARSEOP_PLD_EJECTREQUIRED */517{518PldInfo.OspmEjectRequired = (UINT8) Value;519}520521break;522523case PARSEOP_PLD_CABINETNUMBER:524case PARSEOP_PLD_CARDCAGENUMBER:525526if (ParseOpcode != PARSEOP_INTEGER)527{528AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);529break;530}531532if (Value > 255)533{534AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);535break;536}537538if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_CABINETNUMBER)539{540PldInfo.CabinetNumber = (UINT8) Value;541}542else /* PARSEOP_PLD_CARDCAGENUMBER */543{544PldInfo.CardCageNumber = (UINT8) Value;545}546547break;548549case PARSEOP_PLD_REFERENCE:550551if (ParseOpcode != PARSEOP_INTEGER)552{553AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);554break;555}556557if (Value > 1)558{559AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);560break;561}562563PldInfo.Reference = (UINT8) Value;564break;565566case PARSEOP_PLD_ROTATION:567568if (ParseOpcode != PARSEOP_INTEGER)569{570AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);571break;572}573574if (Value > 7)575{576switch (Value)577{578case 45:579580Value = 1;581break;582583case 90:584585Value = 2;586break;587588case 135:589590Value = 3;591break;592593case 180:594595Value = 4;596break;597598case 225:599600Value = 5;601break;602603case 270:604605Value = 6;606break;607608case 315:609610Value = 7;611break;612613default:614615AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);616break;617}618}619620PldInfo.Rotation = (UINT8) Value;621break;622623case PARSEOP_PLD_ORDER:624625if (ParseOpcode != PARSEOP_INTEGER)626{627AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);628break;629}630631if (Value > 31)632{633AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);634break;635}636637PldInfo.Order = (UINT8) Value;638break;639640case PARSEOP_PLD_VERTICALOFFSET:641case PARSEOP_PLD_HORIZONTALOFFSET:642643if (ParseOpcode != PARSEOP_INTEGER)644{645AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);646break;647}648649if (Value > 65535)650{651AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);652break;653}654655if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_VERTICALOFFSET)656{657PldInfo.VerticalOffset = (UINT16) Value;658}659else /* PARSEOP_PLD_HORIZONTALOFFSET */660{661PldInfo.HorizontalOffset = (UINT16) Value;662}663664break;665666default:667668AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);669break;670}671672ThisOp = ThisOp->Asl.Next;673}674675Buffer = OpcEncodePldBuffer (&PldInfo);676677/* Change Op to a Buffer */678679Op->Asl.ParseOpcode = PARSEOP_BUFFER;680Op->Common.AmlOpcode = AML_BUFFER_OP;681682/* Disable further optimization */683684Op->Asl.CompileFlags &= ~OP_COMPILE_TIME_CONST;685UtSetParseOpName (Op);686687/* Child node is the buffer length */688689NewOp = TrAllocateOp (PARSEOP_INTEGER);690691NewOp->Asl.AmlOpcode = AML_BYTE_OP;692NewOp->Asl.Value.Integer = 20;693NewOp->Asl.Parent = Op;694695Op->Asl.Child = NewOp;696Op = NewOp;697698/* Peer to the child is the raw buffer data */699700NewOp = TrAllocateOp (PARSEOP_RAW_DATA);701NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;702NewOp->Asl.AmlLength = 20;703NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer);704NewOp->Asl.Parent = Op->Asl.Parent;705706Op->Asl.Next = NewOp;707}708709710/*******************************************************************************711*712* FUNCTION: OpcEncodePldBuffer713*714* PARAMETERS: PldInfo - _PLD buffer struct (Using local struct)715*716* RETURN: Encode _PLD buffer suitable for return value from _PLD717*718* DESCRIPTION: Bit-packs a _PLD buffer struct.719*720******************************************************************************/721722static UINT8 *723OpcEncodePldBuffer (724ACPI_PLD_INFO *PldInfo)725{726UINT32 *Buffer;727UINT32 Dword;728729730Buffer = ACPI_CAST_PTR (UINT32, UtLocalCacheCalloc (ACPI_PLD_BUFFER_SIZE));731732/* First 32 bits */733734Dword = 0;735ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision);736ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor);737ACPI_PLD_SET_RED (&Dword, PldInfo->Red);738ACPI_PLD_SET_GREEN (&Dword, PldInfo->Green);739ACPI_PLD_SET_BLUE (&Dword, PldInfo->Blue);740ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword);741742/* Second 32 bits */743744Dword = 0;745ACPI_PLD_SET_WIDTH (&Dword, PldInfo->Width);746ACPI_PLD_SET_HEIGHT (&Dword, PldInfo->Height);747ACPI_MOVE_32_TO_32 (&Buffer[1], &Dword);748749/* Third 32 bits */750751Dword = 0;752ACPI_PLD_SET_USER_VISIBLE (&Dword, PldInfo->UserVisible);753ACPI_PLD_SET_DOCK (&Dword, PldInfo->Dock);754ACPI_PLD_SET_LID (&Dword, PldInfo->Lid);755ACPI_PLD_SET_PANEL (&Dword, PldInfo->Panel);756ACPI_PLD_SET_VERTICAL (&Dword, PldInfo->VerticalPosition);757ACPI_PLD_SET_HORIZONTAL (&Dword, PldInfo->HorizontalPosition);758ACPI_PLD_SET_SHAPE (&Dword, PldInfo->Shape);759ACPI_PLD_SET_ORIENTATION (&Dword, PldInfo->GroupOrientation);760ACPI_PLD_SET_TOKEN (&Dword, PldInfo->GroupToken);761ACPI_PLD_SET_POSITION (&Dword, PldInfo->GroupPosition);762ACPI_PLD_SET_BAY (&Dword, PldInfo->Bay);763ACPI_MOVE_32_TO_32 (&Buffer[2], &Dword);764765/* Fourth 32 bits */766767Dword = 0;768ACPI_PLD_SET_EJECTABLE (&Dword, PldInfo->Ejectable);769ACPI_PLD_SET_OSPM_EJECT (&Dword, PldInfo->OspmEjectRequired);770ACPI_PLD_SET_CABINET (&Dword, PldInfo->CabinetNumber);771ACPI_PLD_SET_CARD_CAGE (&Dword, PldInfo->CardCageNumber);772ACPI_PLD_SET_REFERENCE (&Dword, PldInfo->Reference);773ACPI_PLD_SET_ROTATION (&Dword, PldInfo->Rotation);774ACPI_PLD_SET_ORDER (&Dword, PldInfo->Order);775ACPI_MOVE_32_TO_32 (&Buffer[3], &Dword);776777/* Revision 2 adds an additional DWORD */778779if (PldInfo->Revision >= 2)780{781/* Fifth 32 bits */782783Dword = 0;784ACPI_PLD_SET_VERT_OFFSET (&Dword, PldInfo->VerticalOffset);785ACPI_PLD_SET_HORIZ_OFFSET (&Dword, PldInfo->HorizontalOffset);786ACPI_MOVE_32_TO_32 (&Buffer[4], &Dword);787}788789return (ACPI_CAST_PTR (UINT8, Buffer));790}791792793/*******************************************************************************794*795* FUNCTION: OpcFindName796*797* PARAMETERS: List - Array of char strings to be searched798* Name - Char string to string for799* Index - Index value to set if found800*801* RETURN: TRUE if any names matched, FALSE otherwise802*803* DESCRIPTION: Match PLD name to value in lookup table. Sets Value to804* equivalent parameter value.805*806******************************************************************************/807808static BOOLEAN809OpcFindName (810const char **List,811char *Name,812UINT32 *Index)813{814const char *NameString;815UINT32 i;816817818AcpiUtStrupr (Name);819820for (i = 0, NameString = List[0];821NameString;822i++, NameString = List[i])823{824if (!(strncmp (NameString, Name, strlen (Name))))825{826*Index = i;827return (TRUE);828}829}830831return (FALSE);832}833834835