![]() |
|
|||
File indexing completed on 2025-05-11 08:24:02
0001 /****************************************************************************** 0002 * 0003 * Module Name: exregion - ACPI default OpRegion (address space) handlers 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 "acinterp.h" 0155 0156 0157 #define _COMPONENT ACPI_EXECUTER 0158 ACPI_MODULE_NAME ("exregion") 0159 0160 0161 /******************************************************************************* 0162 * 0163 * FUNCTION: AcpiExSystemMemorySpaceHandler 0164 * 0165 * PARAMETERS: Function - Read or Write operation 0166 * Address - Where in the space to read or write 0167 * BitWidth - Field width in bits (8, 16, or 32) 0168 * Value - Pointer to in or out value 0169 * HandlerContext - Pointer to Handler's context 0170 * RegionContext - Pointer to context specific to the 0171 * accessed region 0172 * 0173 * RETURN: Status 0174 * 0175 * DESCRIPTION: Handler for the System Memory address space (Op Region) 0176 * 0177 ******************************************************************************/ 0178 0179 ACPI_STATUS 0180 AcpiExSystemMemorySpaceHandler ( 0181 UINT32 Function, 0182 ACPI_PHYSICAL_ADDRESS Address, 0183 UINT32 BitWidth, 0184 UINT64 *Value, 0185 void *HandlerContext, 0186 void *RegionContext) 0187 { 0188 ACPI_STATUS Status = AE_OK; 0189 void *LogicalAddrPtr = NULL; 0190 ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext; 0191 ACPI_MEM_MAPPING *Mm = MemInfo->CurMm; 0192 UINT32 Length; 0193 ACPI_SIZE MapLength; 0194 #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED 0195 UINT32 Remainder; 0196 #endif 0197 0198 0199 ACPI_FUNCTION_TRACE (ExSystemMemorySpaceHandler); 0200 0201 0202 /* Validate and translate the bit width */ 0203 0204 switch (BitWidth) 0205 { 0206 case 8: 0207 0208 Length = 1; 0209 break; 0210 0211 case 16: 0212 0213 Length = 2; 0214 break; 0215 0216 case 32: 0217 0218 Length = 4; 0219 break; 0220 0221 case 64: 0222 0223 Length = 8; 0224 break; 0225 0226 default: 0227 0228 ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %u", 0229 BitWidth)); 0230 return_ACPI_STATUS (AE_AML_OPERAND_VALUE); 0231 } 0232 0233 #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED 0234 /* 0235 * Hardware does not support non-aligned data transfers, we must verify 0236 * the request. 0237 */ 0238 (void) AcpiUtShortDivide ((UINT64) Address, Length, NULL, &Remainder); 0239 if (Remainder != 0) 0240 { 0241 return_ACPI_STATUS (AE_AML_ALIGNMENT); 0242 } 0243 #endif 0244 0245 /* 0246 * Does the request fit into the cached memory mapping? 0247 * Is 1) Address below the current mapping? OR 0248 * 2) Address beyond the current mapping? 0249 */ 0250 if (!Mm || (Address < Mm->PhysicalAddress) || 0251 ((UINT64) Address + Length > (UINT64) Mm->PhysicalAddress + Mm->Length)) 0252 { 0253 /* 0254 * The request cannot be resolved by the current memory mapping. 0255 * 0256 * Look for an existing saved mapping covering the address range 0257 * at hand. If found, save it as the current one and carry out 0258 * the access. 0259 */ 0260 for (Mm = MemInfo->FirstMm; Mm; Mm = Mm->NextMm) 0261 { 0262 if (Mm == MemInfo->CurMm) 0263 { 0264 continue; 0265 } 0266 0267 if (Address < Mm->PhysicalAddress) 0268 { 0269 continue; 0270 } 0271 0272 if ((UINT64) Address + Length > (UINT64) Mm->PhysicalAddress + Mm->Length) 0273 { 0274 continue; 0275 } 0276 0277 MemInfo->CurMm = Mm; 0278 goto access; 0279 } 0280 0281 /* Create a new mappings list entry */ 0282 0283 Mm = ACPI_ALLOCATE_ZEROED(sizeof(*Mm)); 0284 if (!Mm) 0285 { 0286 ACPI_ERROR((AE_INFO, 0287 "Unable to save memory mapping at 0x%8.8X%8.8X, size %u", 0288 ACPI_FORMAT_UINT64(Address), Length)); 0289 return_ACPI_STATUS(AE_NO_MEMORY); 0290 } 0291 0292 /* 0293 * October 2009: Attempt to map from the requested address to the 0294 * end of the region. However, we will never map more than one 0295 * page, nor will we cross a page boundary. 0296 */ 0297 MapLength = (ACPI_SIZE) 0298 ((MemInfo->Address + MemInfo->Length) - Address); 0299 0300 if (MapLength > ACPI_DEFAULT_PAGE_SIZE) 0301 { 0302 MapLength = ACPI_DEFAULT_PAGE_SIZE; 0303 } 0304 0305 /* Create a new mapping starting at the address given */ 0306 0307 LogicalAddrPtr = AcpiOsMapMemory(Address, MapLength); 0308 if (!LogicalAddrPtr) 0309 { 0310 ACPI_ERROR ((AE_INFO, 0311 "Could not map memory at 0x%8.8X%8.8X, size %u", 0312 ACPI_FORMAT_UINT64 (Address), (UINT32) MapLength)); 0313 ACPI_FREE(Mm); 0314 return_ACPI_STATUS (AE_NO_MEMORY); 0315 } 0316 0317 /* Save the physical address and mapping size */ 0318 0319 Mm->LogicalAddress = LogicalAddrPtr; 0320 Mm->PhysicalAddress = Address; 0321 Mm->Length = MapLength; 0322 0323 /* 0324 * Add the new entry to the mappigs list and save it as the 0325 * current mapping. 0326 */ 0327 Mm->NextMm = MemInfo->FirstMm; 0328 MemInfo->FirstMm = Mm; 0329 MemInfo->CurMm = Mm; 0330 } 0331 0332 access: 0333 /* 0334 * Generate a logical pointer corresponding to the address we want to 0335 * access 0336 */ 0337 LogicalAddrPtr = Mm->LogicalAddress + 0338 ((UINT64) Address - (UINT64) Mm->PhysicalAddress); 0339 0340 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 0341 "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n", 0342 BitWidth, Function, ACPI_FORMAT_UINT64 (Address))); 0343 0344 /* 0345 * Perform the memory read or write 0346 * 0347 * Note: For machines that do not support non-aligned transfers, the target 0348 * address was checked for alignment above. We do not attempt to break the 0349 * transfer up into smaller (byte-size) chunks because the AML specifically 0350 * asked for a transfer width that the hardware may require. 0351 */ 0352 switch (Function) 0353 { 0354 case ACPI_READ: 0355 0356 *Value = 0; 0357 switch (BitWidth) 0358 { 0359 case 8: 0360 0361 *Value = (UINT64) ACPI_GET8 (LogicalAddrPtr); 0362 break; 0363 0364 case 16: 0365 0366 *Value = (UINT64) ACPI_GET16 (LogicalAddrPtr); 0367 break; 0368 0369 case 32: 0370 0371 *Value = (UINT64) ACPI_GET32 (LogicalAddrPtr); 0372 break; 0373 0374 case 64: 0375 0376 *Value = (UINT64) ACPI_GET64 (LogicalAddrPtr); 0377 break; 0378 0379 default: 0380 0381 /* BitWidth was already validated */ 0382 0383 break; 0384 } 0385 break; 0386 0387 case ACPI_WRITE: 0388 0389 switch (BitWidth) 0390 { 0391 case 8: 0392 0393 ACPI_SET8 (LogicalAddrPtr, *Value); 0394 break; 0395 0396 case 16: 0397 0398 ACPI_SET16 (LogicalAddrPtr, *Value); 0399 break; 0400 0401 case 32: 0402 0403 ACPI_SET32 (LogicalAddrPtr, *Value); 0404 break; 0405 0406 case 64: 0407 0408 ACPI_SET64 (LogicalAddrPtr, *Value); 0409 break; 0410 0411 default: 0412 0413 /* BitWidth was already validated */ 0414 0415 break; 0416 } 0417 break; 0418 0419 default: 0420 0421 Status = AE_BAD_PARAMETER; 0422 break; 0423 } 0424 0425 return_ACPI_STATUS (Status); 0426 } 0427 0428 0429 /******************************************************************************* 0430 * 0431 * FUNCTION: AcpiExSystemIoSpaceHandler 0432 * 0433 * PARAMETERS: Function - Read or Write operation 0434 * Address - Where in the space to read or write 0435 * BitWidth - Field width in bits (8, 16, or 32) 0436 * Value - Pointer to in or out value 0437 * HandlerContext - Pointer to Handler's context 0438 * RegionContext - Pointer to context specific to the 0439 * accessed region 0440 * 0441 * RETURN: Status 0442 * 0443 * DESCRIPTION: Handler for the System IO address space (Op Region) 0444 * 0445 ******************************************************************************/ 0446 0447 ACPI_STATUS 0448 AcpiExSystemIoSpaceHandler ( 0449 UINT32 Function, 0450 ACPI_PHYSICAL_ADDRESS Address, 0451 UINT32 BitWidth, 0452 UINT64 *Value, 0453 void *HandlerContext, 0454 void *RegionContext) 0455 { 0456 ACPI_STATUS Status = AE_OK; 0457 UINT32 Value32; 0458 0459 0460 ACPI_FUNCTION_TRACE (ExSystemIoSpaceHandler); 0461 0462 0463 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 0464 "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n", 0465 BitWidth, Function, ACPI_FORMAT_UINT64 (Address))); 0466 0467 /* Decode the function parameter */ 0468 0469 switch (Function) 0470 { 0471 case ACPI_READ: 0472 0473 Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address, 0474 &Value32, BitWidth); 0475 *Value = Value32; 0476 break; 0477 0478 case ACPI_WRITE: 0479 0480 Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address, 0481 (UINT32) *Value, BitWidth); 0482 break; 0483 0484 default: 0485 0486 Status = AE_BAD_PARAMETER; 0487 break; 0488 } 0489 0490 return_ACPI_STATUS (Status); 0491 } 0492 0493 0494 /******************************************************************************* 0495 * 0496 * FUNCTION: AcpiExPciConfigSpaceHandler 0497 * 0498 * PARAMETERS: Function - Read or Write operation 0499 * Address - Where in the space to read or write 0500 * BitWidth - Field width in bits (8, 16, or 32) 0501 * Value - Pointer to in or out value 0502 * HandlerContext - Pointer to Handler's context 0503 * RegionContext - Pointer to context specific to the 0504 * accessed region 0505 * 0506 * RETURN: Status 0507 * 0508 * DESCRIPTION: Handler for the PCI Config address space (Op Region) 0509 * 0510 ******************************************************************************/ 0511 0512 ACPI_STATUS 0513 AcpiExPciConfigSpaceHandler ( 0514 UINT32 Function, 0515 ACPI_PHYSICAL_ADDRESS Address, 0516 UINT32 BitWidth, 0517 UINT64 *Value, 0518 void *HandlerContext, 0519 void *RegionContext) 0520 { 0521 ACPI_STATUS Status = AE_OK; 0522 ACPI_PCI_ID *PciId; 0523 UINT16 PciRegister; 0524 0525 0526 ACPI_FUNCTION_TRACE (ExPciConfigSpaceHandler); 0527 0528 0529 /* 0530 * The arguments to AcpiOs(Read|Write)PciConfiguration are: 0531 * 0532 * PciSegment is the PCI bus segment range 0-31 0533 * PciBus is the PCI bus number range 0-255 0534 * PciDevice is the PCI device number range 0-31 0535 * PciFunction is the PCI device function number 0536 * PciRegister is the Config space register range 0-255 bytes 0537 * 0538 * Value - input value for write, output address for read 0539 * 0540 */ 0541 PciId = (ACPI_PCI_ID *) RegionContext; 0542 PciRegister = (UINT16) (UINT32) Address; 0543 0544 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 0545 "Pci-Config %u (%u) Seg(%04x) Bus(%04x) " 0546 "Dev(%04x) Func(%04x) Reg(%04x)\n", 0547 Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device, 0548 PciId->Function, PciRegister)); 0549 0550 switch (Function) 0551 { 0552 case ACPI_READ: 0553 0554 *Value = 0; 0555 Status = AcpiOsReadPciConfiguration ( 0556 PciId, PciRegister, Value, BitWidth); 0557 break; 0558 0559 case ACPI_WRITE: 0560 0561 Status = AcpiOsWritePciConfiguration ( 0562 PciId, PciRegister, *Value, BitWidth); 0563 break; 0564 0565 default: 0566 0567 Status = AE_BAD_PARAMETER; 0568 break; 0569 } 0570 0571 return_ACPI_STATUS (Status); 0572 } 0573 0574 0575 /******************************************************************************* 0576 * 0577 * FUNCTION: AcpiExCmosSpaceHandler 0578 * 0579 * PARAMETERS: Function - Read or Write operation 0580 * Address - Where in the space to read or write 0581 * BitWidth - Field width in bits (8, 16, or 32) 0582 * Value - Pointer to in or out value 0583 * HandlerContext - Pointer to Handler's context 0584 * RegionContext - Pointer to context specific to the 0585 * accessed region 0586 * 0587 * RETURN: Status 0588 * 0589 * DESCRIPTION: Handler for the CMOS address space (Op Region) 0590 * 0591 ******************************************************************************/ 0592 0593 ACPI_STATUS 0594 AcpiExCmosSpaceHandler ( 0595 UINT32 Function, 0596 ACPI_PHYSICAL_ADDRESS Address, 0597 UINT32 BitWidth, 0598 UINT64 *Value, 0599 void *HandlerContext, 0600 void *RegionContext) 0601 { 0602 ACPI_STATUS Status = AE_OK; 0603 0604 0605 ACPI_FUNCTION_TRACE (ExCmosSpaceHandler); 0606 0607 0608 return_ACPI_STATUS (Status); 0609 } 0610 0611 0612 /******************************************************************************* 0613 * 0614 * FUNCTION: AcpiExPciBarSpaceHandler 0615 * 0616 * PARAMETERS: Function - Read or Write operation 0617 * Address - Where in the space to read or write 0618 * BitWidth - Field width in bits (8, 16, or 32) 0619 * Value - Pointer to in or out value 0620 * HandlerContext - Pointer to Handler's context 0621 * RegionContext - Pointer to context specific to the 0622 * accessed region 0623 * 0624 * RETURN: Status 0625 * 0626 * DESCRIPTION: Handler for the PCI BarTarget address space (Op Region) 0627 * 0628 ******************************************************************************/ 0629 0630 ACPI_STATUS 0631 AcpiExPciBarSpaceHandler ( 0632 UINT32 Function, 0633 ACPI_PHYSICAL_ADDRESS Address, 0634 UINT32 BitWidth, 0635 UINT64 *Value, 0636 void *HandlerContext, 0637 void *RegionContext) 0638 { 0639 ACPI_STATUS Status = AE_OK; 0640 0641 0642 ACPI_FUNCTION_TRACE (ExPciBarSpaceHandler); 0643 0644 0645 return_ACPI_STATUS (Status); 0646 } 0647 0648 0649 /******************************************************************************* 0650 * 0651 * FUNCTION: AcpiExDataTableSpaceHandler 0652 * 0653 * PARAMETERS: Function - Read or Write operation 0654 * Address - Where in the space to read or write 0655 * BitWidth - Field width in bits (8, 16, or 32) 0656 * Value - Pointer to in or out value 0657 * HandlerContext - Pointer to Handler's context 0658 * RegionContext - Pointer to context specific to the 0659 * accessed region 0660 * 0661 * RETURN: Status 0662 * 0663 * DESCRIPTION: Handler for the Data Table address space (Op Region) 0664 * 0665 ******************************************************************************/ 0666 0667 ACPI_STATUS 0668 AcpiExDataTableSpaceHandler ( 0669 UINT32 Function, 0670 ACPI_PHYSICAL_ADDRESS Address, 0671 UINT32 BitWidth, 0672 UINT64 *Value, 0673 void *HandlerContext, 0674 void *RegionContext) 0675 { 0676 ACPI_DATA_TABLE_MAPPING *Mapping; 0677 char *Pointer; 0678 0679 0680 ACPI_FUNCTION_TRACE (ExDataTableSpaceHandler); 0681 0682 0683 Mapping = (ACPI_DATA_TABLE_MAPPING *) RegionContext; 0684 Pointer = ACPI_CAST_PTR (char, Mapping->Pointer) + 0685 (Address - ACPI_PTR_TO_PHYSADDR (Mapping->Pointer)); 0686 0687 /* 0688 * Perform the memory read or write. The BitWidth was already 0689 * validated. 0690 */ 0691 switch (Function) 0692 { 0693 case ACPI_READ: 0694 0695 memcpy (ACPI_CAST_PTR (char, Value), Pointer, ACPI_DIV_8 (BitWidth)); 0696 break; 0697 0698 case ACPI_WRITE: 0699 0700 memcpy (Pointer, ACPI_CAST_PTR (char, Value), ACPI_DIV_8 (BitWidth)); 0701 break; 0702 0703 default: 0704 0705 return_ACPI_STATUS (AE_BAD_PARAMETER); 0706 } 0707 0708 return_ACPI_STATUS (AE_OK); 0709 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |