Rev 1498 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1498 | Rev 2216 | ||
---|---|---|---|
1 | /****************************************************************************** |
1 | /****************************************************************************** |
2 | * |
2 | * |
3 | * Module Name: exregion - ACPI default OpRegion (address space) handlers |
3 | * Module Name: exregion - ACPI default OpRegion (address space) handlers |
4 | * |
4 | * |
5 | *****************************************************************************/ |
5 | *****************************************************************************/ |
6 | 6 | ||
7 | /****************************************************************************** |
7 | /****************************************************************************** |
8 | * |
8 | * |
9 | * 1. Copyright Notice |
9 | * 1. Copyright Notice |
10 | * |
10 | * |
11 | * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. |
11 | * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. |
12 | * All rights reserved. |
12 | * All rights reserved. |
13 | * |
13 | * |
14 | * 2. License |
14 | * 2. License |
15 | * |
15 | * |
16 | * 2.1. This is your license from Intel Corp. under its intellectual property |
16 | * 2.1. This is your license from Intel Corp. under its intellectual property |
17 | * rights. You may have additional license terms from the party that provided |
17 | * rights. You may have additional license terms from the party that provided |
18 | * you this software, covering your right to use that party's intellectual |
18 | * you this software, covering your right to use that party's intellectual |
19 | * property rights. |
19 | * property rights. |
20 | * |
20 | * |
21 | * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a |
21 | * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a |
22 | * copy of the source code appearing in this file ("Covered Code") an |
22 | * copy of the source code appearing in this file ("Covered Code") an |
23 | * irrevocable, perpetual, worldwide license under Intel's copyrights in the |
23 | * irrevocable, perpetual, worldwide license under Intel's copyrights in the |
24 | * base code distributed originally by Intel ("Original Intel Code") to copy, |
24 | * base code distributed originally by Intel ("Original Intel Code") to copy, |
25 | * make derivatives, distribute, use and display any portion of the Covered |
25 | * make derivatives, distribute, use and display any portion of the Covered |
26 | * Code in any form, with the right to sublicense such rights; and |
26 | * Code in any form, with the right to sublicense such rights; and |
27 | * |
27 | * |
28 | * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent |
28 | * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent |
29 | * license (with the right to sublicense), under only those claims of Intel |
29 | * license (with the right to sublicense), under only those claims of Intel |
30 | * patents that are infringed by the Original Intel Code, to make, use, sell, |
30 | * patents that are infringed by the Original Intel Code, to make, use, sell, |
31 | * offer to sell, and import the Covered Code and derivative works thereof |
31 | * offer to sell, and import the Covered Code and derivative works thereof |
32 | * solely to the minimum extent necessary to exercise the above copyright |
32 | * solely to the minimum extent necessary to exercise the above copyright |
33 | * license, and in no event shall the patent license extend to any additions |
33 | * license, and in no event shall the patent license extend to any additions |
34 | * to or modifications of the Original Intel Code. No other license or right |
34 | * to or modifications of the Original Intel Code. No other license or right |
35 | * is granted directly or by implication, estoppel or otherwise; |
35 | * is granted directly or by implication, estoppel or otherwise; |
36 | * |
36 | * |
37 | * The above copyright and patent license is granted only if the following |
37 | * The above copyright and patent license is granted only if the following |
38 | * conditions are met: |
38 | * conditions are met: |
39 | * |
39 | * |
40 | * 3. Conditions |
40 | * 3. Conditions |
41 | * |
41 | * |
42 | * 3.1. Redistribution of Source with Rights to Further Distribute Source. |
42 | * 3.1. Redistribution of Source with Rights to Further Distribute Source. |
43 | * Redistribution of source code of any substantial portion of the Covered |
43 | * Redistribution of source code of any substantial portion of the Covered |
44 | * Code or modification with rights to further distribute source must include |
44 | * Code or modification with rights to further distribute source must include |
45 | * the above Copyright Notice, the above License, this list of Conditions, |
45 | * the above Copyright Notice, the above License, this list of Conditions, |
46 | * and the following Disclaimer and Export Compliance provision. In addition, |
46 | * and the following Disclaimer and Export Compliance provision. In addition, |
47 | * Licensee must cause all Covered Code to which Licensee contributes to |
47 | * Licensee must cause all Covered Code to which Licensee contributes to |
48 | * contain a file documenting the changes Licensee made to create that Covered |
48 | * contain a file documenting the changes Licensee made to create that Covered |
49 | * Code and the date of any change. Licensee must include in that file the |
49 | * Code and the date of any change. Licensee must include in that file the |
50 | * documentation of any changes made by any predecessor Licensee. Licensee |
50 | * documentation of any changes made by any predecessor Licensee. Licensee |
51 | * must include a prominent statement that the modification is derived, |
51 | * must include a prominent statement that the modification is derived, |
52 | * directly or indirectly, from Original Intel Code. |
52 | * directly or indirectly, from Original Intel Code. |
53 | * |
53 | * |
54 | * 3.2. Redistribution of Source with no Rights to Further Distribute Source. |
54 | * 3.2. Redistribution of Source with no Rights to Further Distribute Source. |
55 | * Redistribution of source code of any substantial portion of the Covered |
55 | * Redistribution of source code of any substantial portion of the Covered |
56 | * Code or modification without rights to further distribute source must |
56 | * Code or modification without rights to further distribute source must |
57 | * include the following Disclaimer and Export Compliance provision in the |
57 | * include the following Disclaimer and Export Compliance provision in the |
58 | * documentation and/or other materials provided with distribution. In |
58 | * documentation and/or other materials provided with distribution. In |
59 | * addition, Licensee may not authorize further sublicense of source of any |
59 | * addition, Licensee may not authorize further sublicense of source of any |
60 | * portion of the Covered Code, and must include terms to the effect that the |
60 | * portion of the Covered Code, and must include terms to the effect that the |
61 | * license from Licensee to its licensee is limited to the intellectual |
61 | * license from Licensee to its licensee is limited to the intellectual |
62 | * property embodied in the software Licensee provides to its licensee, and |
62 | * property embodied in the software Licensee provides to its licensee, and |
63 | * not to intellectual property embodied in modifications its licensee may |
63 | * not to intellectual property embodied in modifications its licensee may |
64 | * make. |
64 | * make. |
65 | * |
65 | * |
66 | * 3.3. Redistribution of Executable. Redistribution in executable form of any |
66 | * 3.3. Redistribution of Executable. Redistribution in executable form of any |
67 | * substantial portion of the Covered Code or modification must reproduce the |
67 | * substantial portion of the Covered Code or modification must reproduce the |
68 | * above Copyright Notice, and the following Disclaimer and Export Compliance |
68 | * above Copyright Notice, and the following Disclaimer and Export Compliance |
69 | * provision in the documentation and/or other materials provided with the |
69 | * provision in the documentation and/or other materials provided with the |
70 | * distribution. |
70 | * distribution. |
71 | * |
71 | * |
72 | * 3.4. Intel retains all right, title, and interest in and to the Original |
72 | * 3.4. Intel retains all right, title, and interest in and to the Original |
73 | * Intel Code. |
73 | * Intel Code. |
74 | * |
74 | * |
75 | * 3.5. Neither the name Intel nor any other trademark owned or controlled by |
75 | * 3.5. Neither the name Intel nor any other trademark owned or controlled by |
76 | * Intel shall be used in advertising or otherwise to promote the sale, use or |
76 | * Intel shall be used in advertising or otherwise to promote the sale, use or |
77 | * other dealings in products derived from or relating to the Covered Code |
77 | * other dealings in products derived from or relating to the Covered Code |
78 | * without prior written authorization from Intel. |
78 | * without prior written authorization from Intel. |
79 | * |
79 | * |
80 | * 4. Disclaimer and Export Compliance |
80 | * 4. Disclaimer and Export Compliance |
81 | * |
81 | * |
82 | * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED |
82 | * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED |
83 | * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE |
83 | * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE |
84 | * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, |
84 | * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, |
85 | * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY |
85 | * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY |
86 | * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY |
86 | * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY |
87 | * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A |
87 | * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A |
88 | * PARTICULAR PURPOSE. |
88 | * PARTICULAR PURPOSE. |
89 | * |
89 | * |
90 | * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES |
90 | * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES |
91 | * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR |
91 | * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR |
92 | * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, |
92 | * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, |
93 | * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY |
93 | * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY |
94 | * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL |
94 | * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL |
95 | * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS |
95 | * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS |
96 | * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY |
96 | * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY |
97 | * LIMITED REMEDY. |
97 | * LIMITED REMEDY. |
98 | * |
98 | * |
99 | * 4.3. Licensee shall not export, either directly or indirectly, any of this |
99 | * 4.3. Licensee shall not export, either directly or indirectly, any of this |
100 | * software or system incorporating such software without first obtaining any |
100 | * software or system incorporating such software without first obtaining any |
101 | * required license or other approval from the U. S. Department of Commerce or |
101 | * required license or other approval from the U. S. Department of Commerce or |
102 | * any other agency or department of the United States Government. In the |
102 | * any other agency or department of the United States Government. In the |
103 | * event Licensee exports any such software from the United States or |
103 | * event Licensee exports any such software from the United States or |
104 | * re-exports any such software from a foreign destination, Licensee shall |
104 | * re-exports any such software from a foreign destination, Licensee shall |
105 | * ensure that the distribution and export/re-export of the software is in |
105 | * ensure that the distribution and export/re-export of the software is in |
106 | * compliance with all laws, regulations, orders, or other restrictions of the |
106 | * compliance with all laws, regulations, orders, or other restrictions of the |
107 | * U.S. Export Administration Regulations. Licensee agrees that neither it nor |
107 | * U.S. Export Administration Regulations. Licensee agrees that neither it nor |
108 | * any of its subsidiaries will export/re-export any technical data, process, |
108 | * any of its subsidiaries will export/re-export any technical data, process, |
109 | * software, or service, directly or indirectly, to any country for which the |
109 | * software, or service, directly or indirectly, to any country for which the |
110 | * United States government or any agency thereof requires an export license, |
110 | * United States government or any agency thereof requires an export license, |
111 | * other governmental approval, or letter of assurance, without first obtaining |
111 | * other governmental approval, or letter of assurance, without first obtaining |
112 | * such license, approval or letter. |
112 | * such license, approval or letter. |
113 | * |
113 | * |
114 | *****************************************************************************/ |
114 | *****************************************************************************/ |
115 | 115 | ||
116 | 116 | ||
117 | #define __EXREGION_C__ |
117 | #define __EXREGION_C__ |
118 | 118 | ||
119 | #include "acpi.h" |
119 | #include "acpi.h" |
120 | #include "accommon.h" |
120 | #include "accommon.h" |
121 | #include "acinterp.h" |
121 | #include "acinterp.h" |
122 | 122 | ||
123 | 123 | ||
124 | #define _COMPONENT ACPI_EXECUTER |
124 | #define _COMPONENT ACPI_EXECUTER |
125 | ACPI_MODULE_NAME ("exregion") |
125 | ACPI_MODULE_NAME ("exregion") |
126 | 126 | ||
127 | 127 | ||
128 | /******************************************************************************* |
128 | /******************************************************************************* |
129 | * |
129 | * |
130 | * FUNCTION: AcpiExSystemMemorySpaceHandler |
130 | * FUNCTION: AcpiExSystemMemorySpaceHandler |
131 | * |
131 | * |
132 | * PARAMETERS: Function - Read or Write operation |
132 | * PARAMETERS: Function - Read or Write operation |
133 | * Address - Where in the space to read or write |
133 | * Address - Where in the space to read or write |
134 | * BitWidth - Field width in bits (8, 16, or 32) |
134 | * BitWidth - Field width in bits (8, 16, or 32) |
135 | * Value - Pointer to in or out value |
135 | * Value - Pointer to in or out value |
136 | * HandlerContext - Pointer to Handler's context |
136 | * HandlerContext - Pointer to Handler's context |
137 | * RegionContext - Pointer to context specific to the |
137 | * RegionContext - Pointer to context specific to the |
138 | * accessed region |
138 | * accessed region |
139 | * |
139 | * |
140 | * RETURN: Status |
140 | * RETURN: Status |
141 | * |
141 | * |
142 | * DESCRIPTION: Handler for the System Memory address space (Op Region) |
142 | * DESCRIPTION: Handler for the System Memory address space (Op Region) |
143 | * |
143 | * |
144 | ******************************************************************************/ |
144 | ******************************************************************************/ |
145 | 145 | ||
146 | ACPI_STATUS |
146 | ACPI_STATUS |
147 | AcpiExSystemMemorySpaceHandler ( |
147 | AcpiExSystemMemorySpaceHandler ( |
148 | UINT32 Function, |
148 | UINT32 Function, |
149 | ACPI_PHYSICAL_ADDRESS Address, |
149 | ACPI_PHYSICAL_ADDRESS Address, |
150 | UINT32 BitWidth, |
150 | UINT32 BitWidth, |
151 | UINT64 *Value, |
151 | UINT64 *Value, |
152 | void *HandlerContext, |
152 | void *HandlerContext, |
153 | void *RegionContext) |
153 | void *RegionContext) |
154 | { |
154 | { |
155 | ACPI_STATUS Status = AE_OK; |
155 | ACPI_STATUS Status = AE_OK; |
156 | void *LogicalAddrPtr = NULL; |
156 | void *LogicalAddrPtr = NULL; |
157 | ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext; |
157 | ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext; |
158 | UINT32 Length; |
158 | UINT32 Length; |
159 | ACPI_SIZE MapLength; |
159 | ACPI_SIZE MapLength; |
160 | ACPI_SIZE PageBoundaryMapLength; |
160 | ACPI_SIZE PageBoundaryMapLength; |
161 | #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED |
161 | #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED |
162 | UINT32 Remainder; |
162 | UINT32 Remainder; |
163 | #endif |
163 | #endif |
164 | 164 | ||
165 | 165 | ||
166 | ACPI_FUNCTION_TRACE (ExSystemMemorySpaceHandler); |
166 | ACPI_FUNCTION_TRACE (ExSystemMemorySpaceHandler); |
167 | 167 | ||
168 | 168 | ||
169 | /* Validate and translate the bit width */ |
169 | /* Validate and translate the bit width */ |
170 | 170 | ||
171 | switch (BitWidth) |
171 | switch (BitWidth) |
172 | { |
172 | { |
173 | case 8: |
173 | case 8: |
174 | Length = 1; |
174 | Length = 1; |
175 | break; |
175 | break; |
176 | 176 | ||
177 | case 16: |
177 | case 16: |
178 | Length = 2; |
178 | Length = 2; |
179 | break; |
179 | break; |
180 | 180 | ||
181 | case 32: |
181 | case 32: |
182 | Length = 4; |
182 | Length = 4; |
183 | break; |
183 | break; |
184 | 184 | ||
185 | case 64: |
185 | case 64: |
186 | Length = 8; |
186 | Length = 8; |
187 | break; |
187 | break; |
188 | 188 | ||
189 | default: |
189 | default: |
190 | ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %u", |
190 | ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %u", |
191 | BitWidth)); |
191 | BitWidth)); |
192 | return_ACPI_STATUS (AE_AML_OPERAND_VALUE); |
192 | return_ACPI_STATUS (AE_AML_OPERAND_VALUE); |
193 | } |
193 | } |
194 | 194 | ||
195 | #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED |
195 | #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED |
196 | /* |
196 | /* |
197 | * Hardware does not support non-aligned data transfers, we must verify |
197 | * Hardware does not support non-aligned data transfers, we must verify |
198 | * the request. |
198 | * the request. |
199 | */ |
199 | */ |
200 | (void) AcpiUtShortDivide ((UINT64) Address, Length, NULL, &Remainder); |
200 | (void) AcpiUtShortDivide ((UINT64) Address, Length, NULL, &Remainder); |
201 | if (Remainder != 0) |
201 | if (Remainder != 0) |
202 | { |
202 | { |
203 | return_ACPI_STATUS (AE_AML_ALIGNMENT); |
203 | return_ACPI_STATUS (AE_AML_ALIGNMENT); |
204 | } |
204 | } |
205 | #endif |
205 | #endif |
206 | 206 | ||
207 | /* |
207 | /* |
208 | * Does the request fit into the cached memory mapping? |
208 | * Does the request fit into the cached memory mapping? |
209 | * Is 1) Address below the current mapping? OR |
209 | * Is 1) Address below the current mapping? OR |
210 | * 2) Address beyond the current mapping? |
210 | * 2) Address beyond the current mapping? |
211 | */ |
211 | */ |
212 | if ((Address < MemInfo->MappedPhysicalAddress) || |
212 | if ((Address < MemInfo->MappedPhysicalAddress) || |
213 | (((UINT64) Address + Length) > |
213 | (((UINT64) Address + Length) > |
214 | ((UINT64) |
214 | ((UINT64) |
215 | MemInfo->MappedPhysicalAddress + MemInfo->MappedLength))) |
215 | MemInfo->MappedPhysicalAddress + MemInfo->MappedLength))) |
216 | { |
216 | { |
217 | /* |
217 | /* |
218 | * The request cannot be resolved by the current memory mapping; |
218 | * The request cannot be resolved by the current memory mapping; |
219 | * Delete the existing mapping and create a new one. |
219 | * Delete the existing mapping and create a new one. |
220 | */ |
220 | */ |
221 | if (MemInfo->MappedLength) |
221 | if (MemInfo->MappedLength) |
222 | { |
222 | { |
223 | /* Valid mapping, delete it */ |
223 | /* Valid mapping, delete it */ |
224 | 224 | ||
225 | AcpiOsUnmapMemory (MemInfo->MappedLogicalAddress, |
225 | AcpiOsUnmapMemory (MemInfo->MappedLogicalAddress, |
226 | MemInfo->MappedLength); |
226 | MemInfo->MappedLength); |
227 | } |
227 | } |
228 | 228 | ||
229 | /* |
229 | /* |
230 | * October 2009: Attempt to map from the requested address to the |
230 | * October 2009: Attempt to map from the requested address to the |
231 | * end of the region. However, we will never map more than one |
231 | * end of the region. However, we will never map more than one |
232 | * page, nor will we cross a page boundary. |
232 | * page, nor will we cross a page boundary. |
233 | */ |
233 | */ |
234 | MapLength = (ACPI_SIZE) |
234 | MapLength = (ACPI_SIZE) |
235 | ((MemInfo->Address + MemInfo->Length) - Address); |
235 | ((MemInfo->Address + MemInfo->Length) - Address); |
236 | 236 | ||
237 | /* |
237 | /* |
238 | * If mapping the entire remaining portion of the region will cross |
238 | * If mapping the entire remaining portion of the region will cross |
239 | * a page boundary, just map up to the page boundary, do not cross. |
239 | * a page boundary, just map up to the page boundary, do not cross. |
240 | * On some systems, crossing a page boundary while mapping regions |
240 | * On some systems, crossing a page boundary while mapping regions |
241 | * can cause warnings if the pages have different attributes |
241 | * can cause warnings if the pages have different attributes |
242 | * due to resource management. |
242 | * due to resource management. |
243 | * |
243 | * |
244 | * This has the added benefit of constraining a single mapping to |
244 | * This has the added benefit of constraining a single mapping to |
245 | * one page, which is similar to the original code that used a 4k |
245 | * one page, which is similar to the original code that used a 4k |
246 | * maximum window. |
246 | * maximum window. |
247 | */ |
247 | */ |
248 | PageBoundaryMapLength = |
248 | PageBoundaryMapLength = |
249 | ACPI_ROUND_UP (Address, ACPI_DEFAULT_PAGE_SIZE) - Address; |
249 | ACPI_ROUND_UP (Address, ACPI_DEFAULT_PAGE_SIZE) - Address; |
250 | if (PageBoundaryMapLength == 0) |
250 | if (PageBoundaryMapLength == 0) |
251 | { |
251 | { |
252 | PageBoundaryMapLength = ACPI_DEFAULT_PAGE_SIZE; |
252 | PageBoundaryMapLength = ACPI_DEFAULT_PAGE_SIZE; |
253 | } |
253 | } |
254 | 254 | ||
255 | if (MapLength > PageBoundaryMapLength) |
255 | if (MapLength > PageBoundaryMapLength) |
256 | { |
256 | { |
257 | MapLength = PageBoundaryMapLength; |
257 | MapLength = PageBoundaryMapLength; |
258 | } |
258 | } |
259 | 259 | ||
260 | /* Create a new mapping starting at the address given */ |
260 | /* Create a new mapping starting at the address given */ |
261 | 261 | ||
262 | MemInfo->MappedLogicalAddress = AcpiOsMapMemory ( |
262 | MemInfo->MappedLogicalAddress = AcpiOsMapMemory ( |
263 | (ACPI_PHYSICAL_ADDRESS) Address, MapLength); |
263 | (ACPI_PHYSICAL_ADDRESS) Address, MapLength); |
264 | if (!MemInfo->MappedLogicalAddress) |
264 | if (!MemInfo->MappedLogicalAddress) |
265 | { |
265 | { |
266 | ACPI_ERROR ((AE_INFO, |
266 | ACPI_ERROR ((AE_INFO, |
267 | "Could not map memory at 0x%8.8X%8.8X, size %u", |
267 | "Could not map memory at 0x%8.8X%8.8X, size %u", |
268 | ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) MapLength)); |
268 | ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) MapLength)); |
269 | MemInfo->MappedLength = 0; |
269 | MemInfo->MappedLength = 0; |
270 | return_ACPI_STATUS (AE_NO_MEMORY); |
270 | return_ACPI_STATUS (AE_NO_MEMORY); |
271 | } |
271 | } |
272 | 272 | ||
273 | /* Save the physical address and mapping size */ |
273 | /* Save the physical address and mapping size */ |
274 | 274 | ||
275 | MemInfo->MappedPhysicalAddress = Address; |
275 | MemInfo->MappedPhysicalAddress = Address; |
276 | MemInfo->MappedLength = MapLength; |
276 | MemInfo->MappedLength = MapLength; |
277 | } |
277 | } |
278 | 278 | ||
279 | /* |
279 | /* |
280 | * Generate a logical pointer corresponding to the address we want to |
280 | * Generate a logical pointer corresponding to the address we want to |
281 | * access |
281 | * access |
282 | */ |
282 | */ |
283 | LogicalAddrPtr = MemInfo->MappedLogicalAddress + |
283 | LogicalAddrPtr = MemInfo->MappedLogicalAddress + |
284 | ((UINT64) Address - (UINT64) MemInfo->MappedPhysicalAddress); |
284 | ((UINT64) Address - (UINT64) MemInfo->MappedPhysicalAddress); |
285 | 285 | ||
286 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
286 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
287 | "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n", |
287 | "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n", |
288 | BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); |
288 | BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); |
289 | 289 | ||
290 | /* |
290 | /* |
291 | * Perform the memory read or write |
291 | * Perform the memory read or write |
292 | * |
292 | * |
293 | * Note: For machines that do not support non-aligned transfers, the target |
293 | * Note: For machines that do not support non-aligned transfers, the target |
294 | * address was checked for alignment above. We do not attempt to break the |
294 | * address was checked for alignment above. We do not attempt to break the |
295 | * transfer up into smaller (byte-size) chunks because the AML specifically |
295 | * transfer up into smaller (byte-size) chunks because the AML specifically |
296 | * asked for a transfer width that the hardware may require. |
296 | * asked for a transfer width that the hardware may require. |
297 | */ |
297 | */ |
298 | switch (Function) |
298 | switch (Function) |
299 | { |
299 | { |
300 | case ACPI_READ: |
300 | case ACPI_READ: |
301 | 301 | ||
302 | *Value = 0; |
302 | *Value = 0; |
303 | switch (BitWidth) |
303 | switch (BitWidth) |
304 | { |
304 | { |
305 | case 8: |
305 | case 8: |
306 | *Value = (UINT64) ACPI_GET8 (LogicalAddrPtr); |
306 | *Value = (UINT64) ACPI_GET8 (LogicalAddrPtr); |
307 | break; |
307 | break; |
308 | 308 | ||
309 | case 16: |
309 | case 16: |
310 | *Value = (UINT64) ACPI_GET16 (LogicalAddrPtr); |
310 | *Value = (UINT64) ACPI_GET16 (LogicalAddrPtr); |
311 | break; |
311 | break; |
312 | 312 | ||
313 | case 32: |
313 | case 32: |
314 | *Value = (UINT64) ACPI_GET32 (LogicalAddrPtr); |
314 | *Value = (UINT64) ACPI_GET32 (LogicalAddrPtr); |
315 | break; |
315 | break; |
316 | 316 | ||
317 | case 64: |
317 | case 64: |
318 | *Value = (UINT64) ACPI_GET64 (LogicalAddrPtr); |
318 | *Value = (UINT64) ACPI_GET64 (LogicalAddrPtr); |
319 | break; |
319 | break; |
320 | 320 | ||
321 | default: |
321 | default: |
322 | /* BitWidth was already validated */ |
322 | /* BitWidth was already validated */ |
323 | break; |
323 | break; |
324 | } |
324 | } |
325 | break; |
325 | break; |
326 | 326 | ||
327 | case ACPI_WRITE: |
327 | case ACPI_WRITE: |
328 | 328 | ||
329 | switch (BitWidth) |
329 | switch (BitWidth) |
330 | { |
330 | { |
331 | case 8: |
331 | case 8: |
332 | ACPI_SET8 (LogicalAddrPtr) = (UINT8) *Value; |
332 | ACPI_SET8 (LogicalAddrPtr) = (UINT8) *Value; |
333 | break; |
333 | break; |
334 | 334 | ||
335 | case 16: |
335 | case 16: |
336 | ACPI_SET16 (LogicalAddrPtr) = (UINT16) *Value; |
336 | ACPI_SET16 (LogicalAddrPtr) = (UINT16) *Value; |
337 | break; |
337 | break; |
338 | 338 | ||
339 | case 32: |
339 | case 32: |
340 | ACPI_SET32 ( LogicalAddrPtr) = (UINT32) *Value; |
340 | ACPI_SET32 ( LogicalAddrPtr) = (UINT32) *Value; |
341 | break; |
341 | break; |
342 | 342 | ||
343 | case 64: |
343 | case 64: |
344 | ACPI_SET64 (LogicalAddrPtr) = (UINT64) *Value; |
344 | ACPI_SET64 (LogicalAddrPtr) = (UINT64) *Value; |
345 | break; |
345 | break; |
346 | 346 | ||
347 | default: |
347 | default: |
348 | /* BitWidth was already validated */ |
348 | /* BitWidth was already validated */ |
349 | break; |
349 | break; |
350 | } |
350 | } |
351 | break; |
351 | break; |
352 | 352 | ||
353 | default: |
353 | default: |
354 | Status = AE_BAD_PARAMETER; |
354 | Status = AE_BAD_PARAMETER; |
355 | break; |
355 | break; |
356 | } |
356 | } |
357 | 357 | ||
358 | return_ACPI_STATUS (Status); |
358 | return_ACPI_STATUS (Status); |
359 | } |
359 | } |
360 | 360 | ||
361 | 361 | ||
362 | /******************************************************************************* |
362 | /******************************************************************************* |
363 | * |
363 | * |
364 | * FUNCTION: AcpiExSystemIoSpaceHandler |
364 | * FUNCTION: AcpiExSystemIoSpaceHandler |
365 | * |
365 | * |
366 | * PARAMETERS: Function - Read or Write operation |
366 | * PARAMETERS: Function - Read or Write operation |
367 | * Address - Where in the space to read or write |
367 | * Address - Where in the space to read or write |
368 | * BitWidth - Field width in bits (8, 16, or 32) |
368 | * BitWidth - Field width in bits (8, 16, or 32) |
369 | * Value - Pointer to in or out value |
369 | * Value - Pointer to in or out value |
370 | * HandlerContext - Pointer to Handler's context |
370 | * HandlerContext - Pointer to Handler's context |
371 | * RegionContext - Pointer to context specific to the |
371 | * RegionContext - Pointer to context specific to the |
372 | * accessed region |
372 | * accessed region |
373 | * |
373 | * |
374 | * RETURN: Status |
374 | * RETURN: Status |
375 | * |
375 | * |
376 | * DESCRIPTION: Handler for the System IO address space (Op Region) |
376 | * DESCRIPTION: Handler for the System IO address space (Op Region) |
377 | * |
377 | * |
378 | ******************************************************************************/ |
378 | ******************************************************************************/ |
379 | 379 | ||
380 | ACPI_STATUS |
380 | ACPI_STATUS |
381 | AcpiExSystemIoSpaceHandler ( |
381 | AcpiExSystemIoSpaceHandler ( |
382 | UINT32 Function, |
382 | UINT32 Function, |
383 | ACPI_PHYSICAL_ADDRESS Address, |
383 | ACPI_PHYSICAL_ADDRESS Address, |
384 | UINT32 BitWidth, |
384 | UINT32 BitWidth, |
385 | UINT64 *Value, |
385 | UINT64 *Value, |
386 | void *HandlerContext, |
386 | void *HandlerContext, |
387 | void *RegionContext) |
387 | void *RegionContext) |
388 | { |
388 | { |
389 | ACPI_STATUS Status = AE_OK; |
389 | ACPI_STATUS Status = AE_OK; |
390 | UINT32 Value32; |
390 | UINT32 Value32; |
391 | 391 | ||
392 | 392 | ||
393 | ACPI_FUNCTION_TRACE (ExSystemIoSpaceHandler); |
393 | ACPI_FUNCTION_TRACE (ExSystemIoSpaceHandler); |
394 | 394 | ||
395 | 395 | ||
396 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
396 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
397 | "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n", |
397 | "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n", |
398 | BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); |
398 | BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); |
399 | 399 | ||
400 | /* Decode the function parameter */ |
400 | /* Decode the function parameter */ |
401 | 401 | ||
402 | switch (Function) |
402 | switch (Function) |
403 | { |
403 | { |
404 | case ACPI_READ: |
404 | case ACPI_READ: |
405 | 405 | ||
406 | Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address, |
406 | Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address, |
407 | &Value32, BitWidth); |
407 | &Value32, BitWidth); |
408 | *Value = Value32; |
408 | *Value = Value32; |
409 | break; |
409 | break; |
410 | 410 | ||
411 | case ACPI_WRITE: |
411 | case ACPI_WRITE: |
412 | 412 | ||
413 | Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address, |
413 | Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address, |
414 | (UINT32) *Value, BitWidth); |
414 | (UINT32) *Value, BitWidth); |
415 | break; |
415 | break; |
416 | 416 | ||
417 | default: |
417 | default: |
418 | Status = AE_BAD_PARAMETER; |
418 | Status = AE_BAD_PARAMETER; |
419 | break; |
419 | break; |
420 | } |
420 | } |
421 | 421 | ||
422 | return_ACPI_STATUS (Status); |
422 | return_ACPI_STATUS (Status); |
423 | } |
423 | } |
424 | 424 | ||
425 | 425 | ||
426 | /******************************************************************************* |
426 | /******************************************************************************* |
427 | * |
427 | * |
428 | * FUNCTION: AcpiExPciConfigSpaceHandler |
428 | * FUNCTION: AcpiExPciConfigSpaceHandler |
429 | * |
429 | * |
430 | * PARAMETERS: Function - Read or Write operation |
430 | * PARAMETERS: Function - Read or Write operation |
431 | * Address - Where in the space to read or write |
431 | * Address - Where in the space to read or write |
432 | * BitWidth - Field width in bits (8, 16, or 32) |
432 | * BitWidth - Field width in bits (8, 16, or 32) |
433 | * Value - Pointer to in or out value |
433 | * Value - Pointer to in or out value |
434 | * HandlerContext - Pointer to Handler's context |
434 | * HandlerContext - Pointer to Handler's context |
435 | * RegionContext - Pointer to context specific to the |
435 | * RegionContext - Pointer to context specific to the |
436 | * accessed region |
436 | * accessed region |
437 | * |
437 | * |
438 | * RETURN: Status |
438 | * RETURN: Status |
439 | * |
439 | * |
440 | * DESCRIPTION: Handler for the PCI Config address space (Op Region) |
440 | * DESCRIPTION: Handler for the PCI Config address space (Op Region) |
441 | * |
441 | * |
442 | ******************************************************************************/ |
442 | ******************************************************************************/ |
443 | 443 | ||
444 | ACPI_STATUS |
444 | ACPI_STATUS |
445 | AcpiExPciConfigSpaceHandler ( |
445 | AcpiExPciConfigSpaceHandler ( |
446 | UINT32 Function, |
446 | UINT32 Function, |
447 | ACPI_PHYSICAL_ADDRESS Address, |
447 | ACPI_PHYSICAL_ADDRESS Address, |
448 | UINT32 BitWidth, |
448 | UINT32 BitWidth, |
449 | UINT64 *Value, |
449 | UINT64 *Value, |
450 | void *HandlerContext, |
450 | void *HandlerContext, |
451 | void *RegionContext) |
451 | void *RegionContext) |
452 | { |
452 | { |
453 | ACPI_STATUS Status = AE_OK; |
453 | ACPI_STATUS Status = AE_OK; |
454 | ACPI_PCI_ID *PciId; |
454 | ACPI_PCI_ID *PciId; |
455 | UINT16 PciRegister; |
455 | UINT16 PciRegister; |
456 | 456 | ||
457 | 457 | ||
458 | ACPI_FUNCTION_TRACE (ExPciConfigSpaceHandler); |
458 | ACPI_FUNCTION_TRACE (ExPciConfigSpaceHandler); |
459 | 459 | ||
460 | 460 | ||
461 | /* |
461 | /* |
462 | * The arguments to AcpiOs(Read|Write)PciConfiguration are: |
462 | * The arguments to AcpiOs(Read|Write)PciConfiguration are: |
463 | * |
463 | * |
464 | * PciSegment is the PCI bus segment range 0-31 |
464 | * PciSegment is the PCI bus segment range 0-31 |
465 | * PciBus is the PCI bus number range 0-255 |
465 | * PciBus is the PCI bus number range 0-255 |
466 | * PciDevice is the PCI device number range 0-31 |
466 | * PciDevice is the PCI device number range 0-31 |
467 | * PciFunction is the PCI device function number |
467 | * PciFunction is the PCI device function number |
468 | * PciRegister is the Config space register range 0-255 bytes |
468 | * PciRegister is the Config space register range 0-255 bytes |
469 | * |
469 | * |
470 | * Value - input value for write, output address for read |
470 | * Value - input value for write, output address for read |
471 | * |
471 | * |
472 | */ |
472 | */ |
473 | PciId = (ACPI_PCI_ID *) RegionContext; |
473 | PciId = (ACPI_PCI_ID *) RegionContext; |
474 | PciRegister = (UINT16) (UINT32) Address; |
474 | PciRegister = (UINT16) (UINT32) Address; |
475 | 475 | ||
476 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
476 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
477 | "Pci-Config %u (%u) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", |
477 | "Pci-Config %u (%u) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", |
478 | Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device, |
478 | Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device, |
479 | PciId->Function, PciRegister)); |
479 | PciId->Function, PciRegister)); |
480 | 480 | ||
481 | switch (Function) |
481 | switch (Function) |
482 | { |
482 | { |
483 | case ACPI_READ: |
483 | case ACPI_READ: |
484 | 484 | ||
485 | *Value = 0; |
485 | *Value = 0; |
486 | Status = AcpiOsReadPciConfiguration (PciId, PciRegister, |
486 | Status = AcpiOsReadPciConfiguration (PciId, PciRegister, |
487 | Value, BitWidth); |
487 | Value, BitWidth); |
488 | break; |
488 | break; |
489 | 489 | ||
490 | case ACPI_WRITE: |
490 | case ACPI_WRITE: |
491 | 491 | ||
492 | Status = AcpiOsWritePciConfiguration (PciId, PciRegister, |
492 | Status = AcpiOsWritePciConfiguration (PciId, PciRegister, |
493 | *Value, BitWidth); |
493 | *Value, BitWidth); |
494 | break; |
494 | break; |
495 | 495 | ||
496 | default: |
496 | default: |
497 | 497 | ||
498 | Status = AE_BAD_PARAMETER; |
498 | Status = AE_BAD_PARAMETER; |
499 | break; |
499 | break; |
500 | } |
500 | } |
501 | 501 | ||
502 | return_ACPI_STATUS (Status); |
502 | return_ACPI_STATUS (Status); |
503 | } |
503 | } |
504 | 504 | ||
505 | 505 | ||
506 | /******************************************************************************* |
506 | /******************************************************************************* |
507 | * |
507 | * |
508 | * FUNCTION: AcpiExCmosSpaceHandler |
508 | * FUNCTION: AcpiExCmosSpaceHandler |
509 | * |
509 | * |
510 | * PARAMETERS: Function - Read or Write operation |
510 | * PARAMETERS: Function - Read or Write operation |
511 | * Address - Where in the space to read or write |
511 | * Address - Where in the space to read or write |
512 | * BitWidth - Field width in bits (8, 16, or 32) |
512 | * BitWidth - Field width in bits (8, 16, or 32) |
513 | * Value - Pointer to in or out value |
513 | * Value - Pointer to in or out value |
514 | * HandlerContext - Pointer to Handler's context |
514 | * HandlerContext - Pointer to Handler's context |
515 | * RegionContext - Pointer to context specific to the |
515 | * RegionContext - Pointer to context specific to the |
516 | * accessed region |
516 | * accessed region |
517 | * |
517 | * |
518 | * RETURN: Status |
518 | * RETURN: Status |
519 | * |
519 | * |
520 | * DESCRIPTION: Handler for the CMOS address space (Op Region) |
520 | * DESCRIPTION: Handler for the CMOS address space (Op Region) |
521 | * |
521 | * |
522 | ******************************************************************************/ |
522 | ******************************************************************************/ |
523 | 523 | ||
524 | ACPI_STATUS |
524 | ACPI_STATUS |
525 | AcpiExCmosSpaceHandler ( |
525 | AcpiExCmosSpaceHandler ( |
526 | UINT32 Function, |
526 | UINT32 Function, |
527 | ACPI_PHYSICAL_ADDRESS Address, |
527 | ACPI_PHYSICAL_ADDRESS Address, |
528 | UINT32 BitWidth, |
528 | UINT32 BitWidth, |
529 | UINT64 *Value, |
529 | UINT64 *Value, |
530 | void *HandlerContext, |
530 | void *HandlerContext, |
531 | void *RegionContext) |
531 | void *RegionContext) |
532 | { |
532 | { |
533 | ACPI_STATUS Status = AE_OK; |
533 | ACPI_STATUS Status = AE_OK; |
534 | 534 | ||
535 | 535 | ||
536 | ACPI_FUNCTION_TRACE (ExCmosSpaceHandler); |
536 | ACPI_FUNCTION_TRACE (ExCmosSpaceHandler); |
537 | 537 | ||
538 | 538 | ||
539 | return_ACPI_STATUS (Status); |
539 | return_ACPI_STATUS (Status); |
540 | } |
540 | } |
541 | 541 | ||
542 | 542 | ||
543 | /******************************************************************************* |
543 | /******************************************************************************* |
544 | * |
544 | * |
545 | * FUNCTION: AcpiExPciBarSpaceHandler |
545 | * FUNCTION: AcpiExPciBarSpaceHandler |
546 | * |
546 | * |
547 | * PARAMETERS: Function - Read or Write operation |
547 | * PARAMETERS: Function - Read or Write operation |
548 | * Address - Where in the space to read or write |
548 | * Address - Where in the space to read or write |
549 | * BitWidth - Field width in bits (8, 16, or 32) |
549 | * BitWidth - Field width in bits (8, 16, or 32) |
550 | * Value - Pointer to in or out value |
550 | * Value - Pointer to in or out value |
551 | * HandlerContext - Pointer to Handler's context |
551 | * HandlerContext - Pointer to Handler's context |
552 | * RegionContext - Pointer to context specific to the |
552 | * RegionContext - Pointer to context specific to the |
553 | * accessed region |
553 | * accessed region |
554 | * |
554 | * |
555 | * RETURN: Status |
555 | * RETURN: Status |
556 | * |
556 | * |
557 | * DESCRIPTION: Handler for the PCI BarTarget address space (Op Region) |
557 | * DESCRIPTION: Handler for the PCI BarTarget address space (Op Region) |
558 | * |
558 | * |
559 | ******************************************************************************/ |
559 | ******************************************************************************/ |
560 | 560 | ||
561 | ACPI_STATUS |
561 | ACPI_STATUS |
562 | AcpiExPciBarSpaceHandler ( |
562 | AcpiExPciBarSpaceHandler ( |
563 | UINT32 Function, |
563 | UINT32 Function, |
564 | ACPI_PHYSICAL_ADDRESS Address, |
564 | ACPI_PHYSICAL_ADDRESS Address, |
565 | UINT32 BitWidth, |
565 | UINT32 BitWidth, |
566 | UINT64 *Value, |
566 | UINT64 *Value, |
567 | void *HandlerContext, |
567 | void *HandlerContext, |
568 | void *RegionContext) |
568 | void *RegionContext) |
569 | { |
569 | { |
570 | ACPI_STATUS Status = AE_OK; |
570 | ACPI_STATUS Status = AE_OK; |
571 | 571 | ||
572 | 572 | ||
573 | ACPI_FUNCTION_TRACE (ExPciBarSpaceHandler); |
573 | ACPI_FUNCTION_TRACE (ExPciBarSpaceHandler); |
574 | 574 | ||
575 | 575 | ||
576 | return_ACPI_STATUS (Status); |
576 | return_ACPI_STATUS (Status); |
577 | } |
577 | } |
578 | 578 | ||
579 | 579 | ||
580 | /******************************************************************************* |
580 | /******************************************************************************* |
581 | * |
581 | * |
582 | * FUNCTION: AcpiExDataTableSpaceHandler |
582 | * FUNCTION: AcpiExDataTableSpaceHandler |
583 | * |
583 | * |
584 | * PARAMETERS: Function - Read or Write operation |
584 | * PARAMETERS: Function - Read or Write operation |
585 | * Address - Where in the space to read or write |
585 | * Address - Where in the space to read or write |
586 | * BitWidth - Field width in bits (8, 16, or 32) |
586 | * BitWidth - Field width in bits (8, 16, or 32) |
587 | * Value - Pointer to in or out value |
587 | * Value - Pointer to in or out value |
588 | * HandlerContext - Pointer to Handler's context |
588 | * HandlerContext - Pointer to Handler's context |
589 | * RegionContext - Pointer to context specific to the |
589 | * RegionContext - Pointer to context specific to the |
590 | * accessed region |
590 | * accessed region |
591 | * |
591 | * |
592 | * RETURN: Status |
592 | * RETURN: Status |
593 | * |
593 | * |
594 | * DESCRIPTION: Handler for the Data Table address space (Op Region) |
594 | * DESCRIPTION: Handler for the Data Table address space (Op Region) |
595 | * |
595 | * |
596 | ******************************************************************************/ |
596 | ******************************************************************************/ |
597 | 597 | ||
598 | ACPI_STATUS |
598 | ACPI_STATUS |
599 | AcpiExDataTableSpaceHandler ( |
599 | AcpiExDataTableSpaceHandler ( |
600 | UINT32 Function, |
600 | UINT32 Function, |
601 | ACPI_PHYSICAL_ADDRESS Address, |
601 | ACPI_PHYSICAL_ADDRESS Address, |
602 | UINT32 BitWidth, |
602 | UINT32 BitWidth, |
603 | UINT64 *Value, |
603 | UINT64 *Value, |
604 | void *HandlerContext, |
604 | void *HandlerContext, |
605 | void *RegionContext) |
605 | void *RegionContext) |
606 | { |
606 | { |
607 | ACPI_FUNCTION_TRACE (ExDataTableSpaceHandler); |
607 | ACPI_FUNCTION_TRACE (ExDataTableSpaceHandler); |
608 | 608 | ||
609 | 609 | ||
610 | /* |
610 | /* |
611 | * Perform the memory read or write. The BitWidth was already |
611 | * Perform the memory read or write. The BitWidth was already |
612 | * validated. |
612 | * validated. |
613 | */ |
613 | */ |
614 | switch (Function) |
614 | switch (Function) |
615 | { |
615 | { |
616 | case ACPI_READ: |
616 | case ACPI_READ: |
617 | 617 | ||
618 | ACPI_MEMCPY (ACPI_CAST_PTR (char, Value), ACPI_PHYSADDR_TO_PTR (Address), |
618 | ACPI_MEMCPY (ACPI_CAST_PTR (char, Value), ACPI_PHYSADDR_TO_PTR (Address), |
619 | ACPI_DIV_8 (BitWidth)); |
619 | ACPI_DIV_8 (BitWidth)); |
620 | break; |
620 | break; |
621 | 621 | ||
622 | case ACPI_WRITE: |
622 | case ACPI_WRITE: |
623 | 623 | ||
624 | ACPI_MEMCPY (ACPI_PHYSADDR_TO_PTR (Address), ACPI_CAST_PTR (char, Value), |
624 | ACPI_MEMCPY (ACPI_PHYSADDR_TO_PTR (Address), ACPI_CAST_PTR (char, Value), |
625 | ACPI_DIV_8 (BitWidth)); |
625 | ACPI_DIV_8 (BitWidth)); |
626 | break; |
626 | break; |
627 | 627 | ||
628 | default: |
628 | default: |
629 | 629 | ||
630 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
630 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
631 | } |
631 | } |
632 | 632 | ||
633 | return_ACPI_STATUS (AE_OK); |
633 | return_ACPI_STATUS (AE_OK); |
634 | }> |
634 | }> |