![]() |
|
|||
File indexing completed on 2025-05-11 08:24:02
0001 /****************************************************************************** 0002 * 0003 * Module Name: exfield - AML execution - FieldUnit read/write 0004 * 0005 *****************************************************************************/ 0006 0007 /****************************************************************************** 0008 * 0009 * 1. Copyright Notice 0010 * 0011 * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp. 0012 * All rights reserved. 0013 * 0014 * 2. License 0015 * 0016 * 2.1. This is your license from Intel Corp. under its intellectual property 0017 * rights. You may have additional license terms from the party that provided 0018 * you this software, covering your right to use that party's intellectual 0019 * property rights. 0020 * 0021 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 0022 * copy of the source code appearing in this file ("Covered Code") an 0023 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 0024 * base code distributed originally by Intel ("Original Intel Code") to copy, 0025 * make derivatives, distribute, use and display any portion of the Covered 0026 * Code in any form, with the right to sublicense such rights; and 0027 * 0028 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 0029 * license (with the right to sublicense), under only those claims of Intel 0030 * patents that are infringed by the Original Intel Code, to make, use, sell, 0031 * offer to sell, and import the Covered Code and derivative works thereof 0032 * solely to the minimum extent necessary to exercise the above copyright 0033 * license, and in no event shall the patent license extend to any additions 0034 * to or modifications of the Original Intel Code. No other license or right 0035 * is granted directly or by implication, estoppel or otherwise; 0036 * 0037 * The above copyright and patent license is granted only if the following 0038 * conditions are met: 0039 * 0040 * 3. Conditions 0041 * 0042 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 0043 * Redistribution of source code of any substantial portion of the Covered 0044 * Code or modification with rights to further distribute source must include 0045 * the above Copyright Notice, the above License, this list of Conditions, 0046 * and the following Disclaimer and Export Compliance provision. In addition, 0047 * Licensee must cause all Covered Code to which Licensee contributes to 0048 * contain a file documenting the changes Licensee made to create that Covered 0049 * Code and the date of any change. Licensee must include in that file the 0050 * documentation of any changes made by any predecessor Licensee. Licensee 0051 * must include a prominent statement that the modification is derived, 0052 * directly or indirectly, from Original Intel Code. 0053 * 0054 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 0055 * Redistribution of source code of any substantial portion of the Covered 0056 * Code or modification without rights to further distribute source must 0057 * include the following Disclaimer and Export Compliance provision in the 0058 * documentation and/or other materials provided with distribution. In 0059 * addition, Licensee may not authorize further sublicense of source of any 0060 * portion of the Covered Code, and must include terms to the effect that the 0061 * license from Licensee to its licensee is limited to the intellectual 0062 * property embodied in the software Licensee provides to its licensee, and 0063 * not to intellectual property embodied in modifications its licensee may 0064 * make. 0065 * 0066 * 3.3. Redistribution of Executable. Redistribution in executable form of any 0067 * substantial portion of the Covered Code or modification must reproduce the 0068 * above Copyright Notice, and the following Disclaimer and Export Compliance 0069 * provision in the documentation and/or other materials provided with the 0070 * distribution. 0071 * 0072 * 3.4. Intel retains all right, title, and interest in and to the Original 0073 * Intel Code. 0074 * 0075 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 0076 * Intel shall be used in advertising or otherwise to promote the sale, use or 0077 * other dealings in products derived from or relating to the Covered Code 0078 * without prior written authorization from Intel. 0079 * 0080 * 4. Disclaimer and Export Compliance 0081 * 0082 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 0083 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 0084 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 0085 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 0086 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 0087 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 0088 * PARTICULAR PURPOSE. 0089 * 0090 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 0091 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 0092 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 0093 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 0094 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 0095 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 0096 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 0097 * LIMITED REMEDY. 0098 * 0099 * 4.3. Licensee shall not export, either directly or indirectly, any of this 0100 * software or system incorporating such software without first obtaining any 0101 * required license or other approval from the U. S. Department of Commerce or 0102 * any other agency or department of the United States Government. In the 0103 * event Licensee exports any such software from the United States or 0104 * re-exports any such software from a foreign destination, Licensee shall 0105 * ensure that the distribution and export/re-export of the software is in 0106 * compliance with all laws, regulations, orders, or other restrictions of the 0107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 0108 * any of its subsidiaries will export/re-export any technical data, process, 0109 * software, or service, directly or indirectly, to any country for which the 0110 * United States government or any agency thereof requires an export license, 0111 * other governmental approval, or letter of assurance, without first obtaining 0112 * such license, approval or letter. 0113 * 0114 ***************************************************************************** 0115 * 0116 * Alternatively, you may choose to be licensed under the terms of the 0117 * following license: 0118 * 0119 * Redistribution and use in source and binary forms, with or without 0120 * modification, are permitted provided that the following conditions 0121 * are met: 0122 * 1. Redistributions of source code must retain the above copyright 0123 * notice, this list of conditions, and the following disclaimer, 0124 * without modification. 0125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 0126 * substantially similar to the "NO WARRANTY" disclaimer below 0127 * ("Disclaimer") and any redistribution must be conditioned upon 0128 * including a substantially similar Disclaimer requirement for further 0129 * binary redistribution. 0130 * 3. Neither the names of the above-listed copyright holders nor the names 0131 * of any contributors may be used to endorse or promote products derived 0132 * from this software without specific prior written permission. 0133 * 0134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 0135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 0136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 0137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 0138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 0139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 0140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 0144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0145 * 0146 * Alternatively, you may choose to be licensed under the terms of the 0147 * GNU General Public License ("GPL") version 2 as published by the Free 0148 * Software Foundation. 0149 * 0150 *****************************************************************************/ 0151 0152 #include "acpi.h" 0153 #include "accommon.h" 0154 #include "acdispat.h" 0155 #include "acinterp.h" 0156 #include "amlcode.h" 0157 0158 0159 #define _COMPONENT ACPI_EXECUTER 0160 ACPI_MODULE_NAME ("exfield") 0161 0162 0163 /* 0164 * This table maps the various Attrib protocols to the byte transfer 0165 * length. Used for the generic serial bus. 0166 */ 0167 #define ACPI_INVALID_PROTOCOL_ID 0x80 0168 #define ACPI_MAX_PROTOCOL_ID 0x0F 0169 0170 static const UINT8 AcpiProtocolLengths[] = 0171 { 0172 ACPI_INVALID_PROTOCOL_ID, /* 0 - reserved */ 0173 ACPI_INVALID_PROTOCOL_ID, /* 1 - reserved */ 0174 0x00, /* 2 - ATTRIB_QUICK */ 0175 ACPI_INVALID_PROTOCOL_ID, /* 3 - reserved */ 0176 0x01, /* 4 - ATTRIB_SEND_RECEIVE */ 0177 ACPI_INVALID_PROTOCOL_ID, /* 5 - reserved */ 0178 0x01, /* 6 - ATTRIB_BYTE */ 0179 ACPI_INVALID_PROTOCOL_ID, /* 7 - reserved */ 0180 0x02, /* 8 - ATTRIB_WORD */ 0181 ACPI_INVALID_PROTOCOL_ID, /* 9 - reserved */ 0182 0xFF, /* A - ATTRIB_BLOCK */ 0183 0xFF, /* B - ATTRIB_BYTES */ 0184 0x02, /* C - ATTRIB_PROCESS_CALL */ 0185 0xFF, /* D - ATTRIB_BLOCK_PROCESS_CALL */ 0186 0xFF, /* E - ATTRIB_RAW_BYTES */ 0187 0xFF /* F - ATTRIB_RAW_PROCESS_BYTES */ 0188 }; 0189 0190 #define PCC_MASTER_SUBSPACE 3 0191 0192 /* 0193 * The following macros determine a given offset is a COMD field. 0194 * According to the specification, generic subspaces (types 0-2) contains a 0195 * 2-byte COMD field at offset 4 and master subspaces (type 3) contains a 4-byte 0196 * COMD field starting at offset 12. 0197 */ 0198 #define GENERIC_SUBSPACE_COMMAND(a) (4 == a || a == 5) 0199 #define MASTER_SUBSPACE_COMMAND(a) (12 <= a && a <= 15) 0200 0201 0202 /******************************************************************************* 0203 * 0204 * FUNCTION: AcpiExGetProtocolBufferLength 0205 * 0206 * PARAMETERS: ProtocolId - The type of the protocol indicated by region 0207 * field access attributes 0208 * ReturnLength - Where the protocol byte transfer length is 0209 * returned 0210 * 0211 * RETURN: Status and decoded byte transfer length 0212 * 0213 * DESCRIPTION: This routine returns the length of the GenericSerialBus 0214 * protocol bytes 0215 * 0216 ******************************************************************************/ 0217 0218 ACPI_STATUS 0219 AcpiExGetProtocolBufferLength ( 0220 UINT32 ProtocolId, 0221 UINT32 *ReturnLength) 0222 { 0223 0224 if ((ProtocolId > ACPI_MAX_PROTOCOL_ID) || 0225 (AcpiProtocolLengths[ProtocolId] == ACPI_INVALID_PROTOCOL_ID)) 0226 { 0227 ACPI_ERROR ((AE_INFO, 0228 "Invalid Field/AccessAs protocol ID: 0x%4.4X", ProtocolId)); 0229 0230 return (AE_AML_PROTOCOL); 0231 } 0232 0233 *ReturnLength = AcpiProtocolLengths[ProtocolId]; 0234 return (AE_OK); 0235 } 0236 0237 0238 /******************************************************************************* 0239 * 0240 * FUNCTION: AcpiExReadDataFromField 0241 * 0242 * PARAMETERS: WalkState - Current execution state 0243 * ObjDesc - The named field 0244 * RetBufferDesc - Where the return data object is stored 0245 * 0246 * RETURN: Status 0247 * 0248 * DESCRIPTION: Read from a named field. Returns either an Integer or a 0249 * Buffer, depending on the size of the field and whether if a 0250 * field is created by the CreateField() operator. 0251 * 0252 ******************************************************************************/ 0253 0254 ACPI_STATUS 0255 AcpiExReadDataFromField ( 0256 ACPI_WALK_STATE *WalkState, 0257 ACPI_OPERAND_OBJECT *ObjDesc, 0258 ACPI_OPERAND_OBJECT **RetBufferDesc) 0259 { 0260 ACPI_STATUS Status; 0261 ACPI_OPERAND_OBJECT *BufferDesc; 0262 void *Buffer; 0263 UINT32 BufferLength; 0264 0265 0266 ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc); 0267 0268 0269 /* Parameter validation */ 0270 0271 if (!ObjDesc) 0272 { 0273 return_ACPI_STATUS (AE_AML_NO_OPERAND); 0274 } 0275 if (!RetBufferDesc) 0276 { 0277 return_ACPI_STATUS (AE_BAD_PARAMETER); 0278 } 0279 0280 if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) 0281 { 0282 /* 0283 * If the BufferField arguments have not been previously evaluated, 0284 * evaluate them now and save the results. 0285 */ 0286 if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) 0287 { 0288 Status = AcpiDsGetBufferFieldArguments (ObjDesc); 0289 if (ACPI_FAILURE (Status)) 0290 { 0291 return_ACPI_STATUS (Status); 0292 } 0293 } 0294 } 0295 else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && 0296 (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || 0297 ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS || 0298 ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI || 0299 ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_RT || 0300 ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE)) 0301 { 0302 /* SMBus, GSBus, IPMI serial */ 0303 0304 Status = AcpiExReadSerialBus (ObjDesc, RetBufferDesc); 0305 return_ACPI_STATUS (Status); 0306 } 0307 0308 /* 0309 * Allocate a buffer for the contents of the field. 0310 * 0311 * If the field is larger than the current integer width, create 0312 * a BUFFER to hold it. Otherwise, use an INTEGER. This allows 0313 * the use of arithmetic operators on the returned value if the 0314 * field size is equal or smaller than an Integer. 0315 * 0316 * However, all buffer fields created by CreateField operator needs to 0317 * remain as a buffer to match other AML interpreter implementations. 0318 * 0319 * Note: Field.length is in bits. 0320 */ 0321 BufferLength = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES ( 0322 ObjDesc->Field.BitLength); 0323 0324 if (BufferLength > AcpiGbl_IntegerByteWidth || 0325 (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD && 0326 ObjDesc->BufferField.IsCreateField)) 0327 { 0328 /* Field is too large for an Integer, create a Buffer instead */ 0329 0330 BufferDesc = AcpiUtCreateBufferObject (BufferLength); 0331 if (!BufferDesc) 0332 { 0333 return_ACPI_STATUS (AE_NO_MEMORY); 0334 } 0335 Buffer = BufferDesc->Buffer.Pointer; 0336 } 0337 else 0338 { 0339 /* Field will fit within an Integer (normal case) */ 0340 0341 BufferDesc = AcpiUtCreateIntegerObject ((UINT64) 0); 0342 if (!BufferDesc) 0343 { 0344 return_ACPI_STATUS (AE_NO_MEMORY); 0345 } 0346 0347 BufferLength = AcpiGbl_IntegerByteWidth; 0348 Buffer = &BufferDesc->Integer.Value; 0349 } 0350 0351 if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && 0352 (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) 0353 { 0354 /* General Purpose I/O */ 0355 0356 Status = AcpiExReadGpio (ObjDesc, Buffer); 0357 goto Exit; 0358 } 0359 else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && 0360 (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM)) 0361 { 0362 /* 0363 * Reading from a PCC field unit does not require the handler because 0364 * it only requires reading from the InternalPccBuffer. 0365 */ 0366 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 0367 "PCC FieldRead bits %u\n", ObjDesc->Field.BitLength)); 0368 0369 memcpy (Buffer, ObjDesc->Field.RegionObj->Field.InternalPccBuffer + 0370 ObjDesc->Field.BaseByteOffset, (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES ( 0371 ObjDesc->Field.BitLength)); 0372 0373 *RetBufferDesc = BufferDesc; 0374 return AE_OK; 0375 } 0376 0377 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 0378 "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", 0379 ObjDesc, ObjDesc->Common.Type, Buffer, BufferLength)); 0380 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 0381 "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n", 0382 ObjDesc->CommonField.BitLength, 0383 ObjDesc->CommonField.StartFieldBitOffset, 0384 ObjDesc->CommonField.BaseByteOffset)); 0385 0386 /* Lock entire transaction if requested */ 0387 0388 AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); 0389 0390 /* Read from the field */ 0391 0392 Status = AcpiExExtractFromField (ObjDesc, Buffer, BufferLength); 0393 AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); 0394 0395 0396 Exit: 0397 if (ACPI_FAILURE (Status)) 0398 { 0399 AcpiUtRemoveReference (BufferDesc); 0400 } 0401 else 0402 { 0403 *RetBufferDesc = BufferDesc; 0404 } 0405 0406 return_ACPI_STATUS (Status); 0407 } 0408 0409 0410 /******************************************************************************* 0411 * 0412 * FUNCTION: AcpiExWriteDataToField 0413 * 0414 * PARAMETERS: SourceDesc - Contains data to write 0415 * ObjDesc - The named field 0416 * ResultDesc - Where the return value is returned, if any 0417 * 0418 * RETURN: Status 0419 * 0420 * DESCRIPTION: Write to a named field 0421 * 0422 ******************************************************************************/ 0423 0424 ACPI_STATUS 0425 AcpiExWriteDataToField ( 0426 ACPI_OPERAND_OBJECT *SourceDesc, 0427 ACPI_OPERAND_OBJECT *ObjDesc, 0428 ACPI_OPERAND_OBJECT **ResultDesc) 0429 { 0430 ACPI_STATUS Status; 0431 UINT32 BufferLength; 0432 UINT32 DataLength; 0433 void *Buffer; 0434 0435 0436 ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc); 0437 0438 0439 /* Parameter validation */ 0440 0441 if (!SourceDesc || !ObjDesc) 0442 { 0443 return_ACPI_STATUS (AE_AML_NO_OPERAND); 0444 } 0445 0446 if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) 0447 { 0448 /* 0449 * If the BufferField arguments have not been previously evaluated, 0450 * evaluate them now and save the results. 0451 */ 0452 if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) 0453 { 0454 Status = AcpiDsGetBufferFieldArguments (ObjDesc); 0455 if (ACPI_FAILURE (Status)) 0456 { 0457 return_ACPI_STATUS (Status); 0458 } 0459 } 0460 } 0461 else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && 0462 (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GPIO)) 0463 { 0464 /* General Purpose I/O */ 0465 0466 Status = AcpiExWriteGpio (SourceDesc, ObjDesc, ResultDesc); 0467 return_ACPI_STATUS (Status); 0468 } 0469 else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && 0470 (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || 0471 ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS || 0472 ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI || 0473 ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_RT || 0474 ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE)) 0475 { 0476 /* SMBus, GSBus, IPMI serial */ 0477 0478 Status = AcpiExWriteSerialBus (SourceDesc, ObjDesc, ResultDesc); 0479 return_ACPI_STATUS (Status); 0480 } 0481 else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && 0482 (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM)) 0483 { 0484 /* 0485 * According to the spec a write to the COMD field will invoke the 0486 * region handler. Otherwise, write to the PccInternal buffer. This 0487 * implementation will use the offsets specified rather than the name 0488 * of the field. This is considered safer because some firmware tools 0489 * are known to obfiscate named objects. 0490 */ 0491 DataLength = (ACPI_SIZE) ACPI_ROUND_BITS_UP_TO_BYTES ( 0492 ObjDesc->Field.BitLength); 0493 memcpy (ObjDesc->Field.RegionObj->Field.InternalPccBuffer + 0494 ObjDesc->Field.BaseByteOffset, 0495 SourceDesc->Buffer.Pointer, DataLength); 0496 0497 if (MASTER_SUBSPACE_COMMAND (ObjDesc->Field.BaseByteOffset)) 0498 { 0499 /* Perform the write */ 0500 0501 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 0502 "PCC COMD field has been written. Invoking PCC handler now.\n")); 0503 0504 Status = AcpiExAccessRegion ( 0505 ObjDesc, 0, (UINT64 *) ObjDesc->Field.RegionObj->Field.InternalPccBuffer, 0506 ACPI_WRITE); 0507 return_ACPI_STATUS (Status); 0508 } 0509 return (AE_OK); 0510 } 0511 0512 0513 /* Get a pointer to the data to be written */ 0514 0515 switch (SourceDesc->Common.Type) 0516 { 0517 case ACPI_TYPE_INTEGER: 0518 0519 Buffer = &SourceDesc->Integer.Value; 0520 BufferLength = sizeof (SourceDesc->Integer.Value); 0521 break; 0522 0523 case ACPI_TYPE_BUFFER: 0524 0525 Buffer = SourceDesc->Buffer.Pointer; 0526 BufferLength = SourceDesc->Buffer.Length; 0527 break; 0528 0529 case ACPI_TYPE_STRING: 0530 0531 Buffer = SourceDesc->String.Pointer; 0532 BufferLength = SourceDesc->String.Length; 0533 break; 0534 0535 default: 0536 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 0537 } 0538 0539 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 0540 "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", 0541 SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type), 0542 SourceDesc->Common.Type, Buffer, BufferLength)); 0543 0544 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 0545 "FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n", 0546 ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type), 0547 ObjDesc->Common.Type, 0548 ObjDesc->CommonField.BitLength, 0549 ObjDesc->CommonField.StartFieldBitOffset, 0550 ObjDesc->CommonField.BaseByteOffset)); 0551 0552 /* Lock entire transaction if requested */ 0553 0554 AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); 0555 0556 /* Write to the field */ 0557 0558 Status = AcpiExInsertIntoField (ObjDesc, Buffer, BufferLength); 0559 AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); 0560 return_ACPI_STATUS (Status); 0561 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |