blob: 486b2e5661b692f6d03d0c4c67680d3f90c06669 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001
2/******************************************************************************
3 *
4 * Module Name: exregion - ACPI default op_region (address space) handlers
5 *
6 *****************************************************************************/
7
8/*
Bob Moorea8357b02010-01-22 19:07:36 +08009 * Copyright (C) 2000 - 2010, Intel Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#include <acpi/acpi.h>
Len Browne2f7a772009-01-09 00:30:03 -050046#include "accommon.h"
47#include "acinterp.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070048
Linus Torvalds1da177e2005-04-16 15:20:36 -070049#define _COMPONENT ACPI_EXECUTER
Len Brown4be44fc2005-08-05 00:44:28 -040050ACPI_MODULE_NAME("exregion")
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
52/*******************************************************************************
53 *
54 * FUNCTION: acpi_ex_system_memory_space_handler
55 *
56 * PARAMETERS: Function - Read or Write operation
57 * Address - Where in the space to read or write
58 * bit_width - Field width in bits (8, 16, or 32)
59 * Value - Pointer to in or out value
60 * handler_context - Pointer to Handler's context
61 * region_context - Pointer to context specific to the
62 * accessed region
63 *
64 * RETURN: Status
65 *
66 * DESCRIPTION: Handler for the System Memory address space (Op Region)
67 *
68 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -070069acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -040070acpi_ex_system_memory_space_handler(u32 function,
71 acpi_physical_address address,
72 u32 bit_width,
Bob Moore5df7e6c2010-01-21 10:06:32 +080073 u64 *value,
Len Brown4be44fc2005-08-05 00:44:28 -040074 void *handler_context, void *region_context)
Linus Torvalds1da177e2005-04-16 15:20:36 -070075{
Len Brown4be44fc2005-08-05 00:44:28 -040076 acpi_status status = AE_OK;
77 void *logical_addr_ptr = NULL;
78 struct acpi_mem_space_context *mem_info = region_context;
79 u32 length;
Bob Moored410ee52009-10-22 09:11:11 +080080 acpi_size map_length;
81 acpi_size page_boundary_map_length;
Bob Moore08978312005-10-21 00:00:00 -040082#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
Len Brown4be44fc2005-08-05 00:44:28 -040083 u32 remainder;
Linus Torvalds1da177e2005-04-16 15:20:36 -070084#endif
85
Bob Mooreb229cf92006-04-21 17:15:00 -040086 ACPI_FUNCTION_TRACE(ex_system_memory_space_handler);
Linus Torvalds1da177e2005-04-16 15:20:36 -070087
88 /* Validate and translate the bit width */
89
90 switch (bit_width) {
91 case 8:
92 length = 1;
93 break;
94
95 case 16:
96 length = 2;
97 break;
98
99 case 32:
100 length = 4;
101 break;
102
103 case 64:
104 length = 8;
105 break;
106
107 default:
Bob Mooreb229cf92006-04-21 17:15:00 -0400108 ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %d",
Bob Mooreb8e4d892006-01-27 16:43:00 -0500109 bit_width));
Len Brown4be44fc2005-08-05 00:44:28 -0400110 return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 }
112
Bob Moore08978312005-10-21 00:00:00 -0400113#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 /*
115 * Hardware does not support non-aligned data transfers, we must verify
116 * the request.
117 */
Bob Moore5df7e6c2010-01-21 10:06:32 +0800118 (void)acpi_ut_short_divide((u64) address, length, NULL, &remainder);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119 if (remainder != 0) {
Len Brown4be44fc2005-08-05 00:44:28 -0400120 return_ACPI_STATUS(AE_AML_ALIGNMENT);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 }
122#endif
123
124 /*
125 * Does the request fit into the cached memory mapping?
126 * Is 1) Address below the current mapping? OR
127 * 2) Address beyond the current mapping?
128 */
129 if ((address < mem_info->mapped_physical_address) ||
Bob Moore5df7e6c2010-01-21 10:06:32 +0800130 (((u64) address + length) > ((u64)
131 mem_info->mapped_physical_address +
132 mem_info->mapped_length))) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 /*
134 * The request cannot be resolved by the current memory mapping;
135 * Delete the existing mapping and create a new one.
136 */
137 if (mem_info->mapped_length) {
Bob Moore52fc0b02006-10-02 00:00:00 -0400138
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139 /* Valid mapping, delete it */
140
Len Brown4be44fc2005-08-05 00:44:28 -0400141 acpi_os_unmap_memory(mem_info->mapped_logical_address,
142 mem_info->mapped_length);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 }
144
145 /*
Bob Moored410ee52009-10-22 09:11:11 +0800146 * Attempt to map from the requested address to the end of the region.
147 * However, we will never map more than one page, nor will we cross
148 * a page boundary.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149 */
Bob Moored410ee52009-10-22 09:11:11 +0800150 map_length = (acpi_size)
Len Brown4be44fc2005-08-05 00:44:28 -0400151 ((mem_info->address + mem_info->length) - address);
Robert Moore44f6c012005-04-18 22:49:35 -0400152
Bob Moored410ee52009-10-22 09:11:11 +0800153 /*
154 * If mapping the entire remaining portion of the region will cross
155 * a page boundary, just map up to the page boundary, do not cross.
156 * On some systems, crossing a page boundary while mapping regions
157 * can cause warnings if the pages have different attributes
158 * due to resource management
159 */
160 page_boundary_map_length =
161 ACPI_ROUND_UP(address, ACPI_DEFAULT_PAGE_SIZE) - address;
162
163 if (!page_boundary_map_length) {
164 page_boundary_map_length = ACPI_DEFAULT_PAGE_SIZE;
165 }
166
167 if (map_length > page_boundary_map_length) {
168 map_length = page_boundary_map_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169 }
170
171 /* Create a new mapping starting at the address given */
172
Bob Moored410ee52009-10-22 09:11:11 +0800173 mem_info->mapped_logical_address = acpi_os_map_memory((acpi_physical_address) address, map_length);
Bob Mooref3d2e782007-02-02 19:48:18 +0300174 if (!mem_info->mapped_logical_address) {
Bob Mooreb8e4d892006-01-27 16:43:00 -0500175 ACPI_ERROR((AE_INFO,
176 "Could not map memory at %8.8X%8.8X, size %X",
Bob Mooreb7f9f042008-04-10 19:06:40 +0400177 ACPI_FORMAT_NATIVE_UINT(address),
Bob Moored410ee52009-10-22 09:11:11 +0800178 (u32) map_length));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179 mem_info->mapped_length = 0;
Bob Mooref3d2e782007-02-02 19:48:18 +0300180 return_ACPI_STATUS(AE_NO_MEMORY);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 }
182
183 /* Save the physical address and mapping size */
184
185 mem_info->mapped_physical_address = address;
Bob Moored410ee52009-10-22 09:11:11 +0800186 mem_info->mapped_length = map_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187 }
188
189 /*
190 * Generate a logical pointer corresponding to the address we want to
191 * access
192 */
193 logical_addr_ptr = mem_info->mapped_logical_address +
Bob Moore5df7e6c2010-01-21 10:06:32 +0800194 ((u64) address - (u64) mem_info->mapped_physical_address);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195
Len Brown4be44fc2005-08-05 00:44:28 -0400196 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
Bob Moore83135242006-10-03 00:00:00 -0400197 "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n",
Bob Mooreb7f9f042008-04-10 19:06:40 +0400198 bit_width, function,
199 ACPI_FORMAT_NATIVE_UINT(address)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200
Len Brown4be44fc2005-08-05 00:44:28 -0400201 /*
202 * Perform the memory read or write
203 *
204 * Note: For machines that do not support non-aligned transfers, the target
205 * address was checked for alignment above. We do not attempt to break the
206 * transfer up into smaller (byte-size) chunks because the AML specifically
207 * asked for a transfer width that the hardware may require.
208 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209 switch (function) {
210 case ACPI_READ:
211
212 *value = 0;
213 switch (bit_width) {
214 case 8:
Bob Moore5df7e6c2010-01-21 10:06:32 +0800215 *value = (u64) ACPI_GET8(logical_addr_ptr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216 break;
217
218 case 16:
Bob Moore5df7e6c2010-01-21 10:06:32 +0800219 *value = (u64) ACPI_GET16(logical_addr_ptr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220 break;
221
222 case 32:
Bob Moore5df7e6c2010-01-21 10:06:32 +0800223 *value = (u64) ACPI_GET32(logical_addr_ptr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224 break;
225
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226 case 64:
Bob Moore5df7e6c2010-01-21 10:06:32 +0800227 *value = (u64) ACPI_GET64(logical_addr_ptr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228 break;
Bob Moore59fa8502007-02-02 19:48:23 +0300229
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230 default:
231 /* bit_width was already validated */
232 break;
233 }
234 break;
235
236 case ACPI_WRITE:
237
238 switch (bit_width) {
239 case 8:
Bob Moorec51a4de2005-11-17 13:07:00 -0500240 ACPI_SET8(logical_addr_ptr) = (u8) * value;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241 break;
242
243 case 16:
Bob Moorec51a4de2005-11-17 13:07:00 -0500244 ACPI_SET16(logical_addr_ptr) = (u16) * value;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245 break;
246
247 case 32:
Bob Moorec51a4de2005-11-17 13:07:00 -0500248 ACPI_SET32(logical_addr_ptr) = (u32) * value;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249 break;
250
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251 case 64:
Bob Moorec51a4de2005-11-17 13:07:00 -0500252 ACPI_SET64(logical_addr_ptr) = (u64) * value;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254
255 default:
256 /* bit_width was already validated */
257 break;
258 }
259 break;
260
261 default:
262 status = AE_BAD_PARAMETER;
263 break;
264 }
265
Len Brown4be44fc2005-08-05 00:44:28 -0400266 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267}
268
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269/*******************************************************************************
270 *
271 * FUNCTION: acpi_ex_system_io_space_handler
272 *
273 * PARAMETERS: Function - Read or Write operation
274 * Address - Where in the space to read or write
275 * bit_width - Field width in bits (8, 16, or 32)
276 * Value - Pointer to in or out value
277 * handler_context - Pointer to Handler's context
278 * region_context - Pointer to context specific to the
279 * accessed region
280 *
281 * RETURN: Status
282 *
283 * DESCRIPTION: Handler for the System IO address space (Op Region)
284 *
285 ******************************************************************************/
286
287acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400288acpi_ex_system_io_space_handler(u32 function,
289 acpi_physical_address address,
290 u32 bit_width,
Bob Moore5df7e6c2010-01-21 10:06:32 +0800291 u64 *value,
Len Brown4be44fc2005-08-05 00:44:28 -0400292 void *handler_context, void *region_context)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293{
Len Brown4be44fc2005-08-05 00:44:28 -0400294 acpi_status status = AE_OK;
295 u32 value32;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296
Bob Mooreb229cf92006-04-21 17:15:00 -0400297 ACPI_FUNCTION_TRACE(ex_system_io_space_handler);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298
Len Brown4be44fc2005-08-05 00:44:28 -0400299 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
Bob Moore83135242006-10-03 00:00:00 -0400300 "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n",
Bob Mooreb7f9f042008-04-10 19:06:40 +0400301 bit_width, function,
302 ACPI_FORMAT_NATIVE_UINT(address)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303
304 /* Decode the function parameter */
305
306 switch (function) {
307 case ACPI_READ:
308
Bob Moore7f071902009-03-19 09:37:47 +0800309 status = acpi_hw_read_port((acpi_io_address) address,
Len Brown4be44fc2005-08-05 00:44:28 -0400310 &value32, bit_width);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700311 *value = value32;
312 break;
313
314 case ACPI_WRITE:
315
Bob Moore7f071902009-03-19 09:37:47 +0800316 status = acpi_hw_write_port((acpi_io_address) address,
Len Brown4be44fc2005-08-05 00:44:28 -0400317 (u32) * value, bit_width);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318 break;
319
320 default:
321 status = AE_BAD_PARAMETER;
322 break;
323 }
324
Len Brown4be44fc2005-08-05 00:44:28 -0400325 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700326}
327
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328/*******************************************************************************
329 *
330 * FUNCTION: acpi_ex_pci_config_space_handler
331 *
332 * PARAMETERS: Function - Read or Write operation
333 * Address - Where in the space to read or write
334 * bit_width - Field width in bits (8, 16, or 32)
335 * Value - Pointer to in or out value
336 * handler_context - Pointer to Handler's context
337 * region_context - Pointer to context specific to the
338 * accessed region
339 *
340 * RETURN: Status
341 *
342 * DESCRIPTION: Handler for the PCI Config address space (Op Region)
343 *
344 ******************************************************************************/
345
346acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400347acpi_ex_pci_config_space_handler(u32 function,
348 acpi_physical_address address,
349 u32 bit_width,
Bob Moore5df7e6c2010-01-21 10:06:32 +0800350 u64 *value,
Len Brown4be44fc2005-08-05 00:44:28 -0400351 void *handler_context, void *region_context)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352{
Len Brown4be44fc2005-08-05 00:44:28 -0400353 acpi_status status = AE_OK;
354 struct acpi_pci_id *pci_id;
355 u16 pci_register;
Ming Lin11869742008-02-21 02:01:30 -0500356 u32 value32;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700357
Bob Mooreb229cf92006-04-21 17:15:00 -0400358 ACPI_FUNCTION_TRACE(ex_pci_config_space_handler);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700359
360 /*
361 * The arguments to acpi_os(Read|Write)pci_configuration are:
362 *
363 * pci_segment is the PCI bus segment range 0-31
364 * pci_bus is the PCI bus number range 0-255
365 * pci_device is the PCI device number range 0-31
366 * pci_function is the PCI device function number
367 * pci_register is the Config space register range 0-255 bytes
368 *
369 * Value - input value for write, output address for read
370 *
371 */
Len Brown4be44fc2005-08-05 00:44:28 -0400372 pci_id = (struct acpi_pci_id *)region_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373 pci_register = (u16) (u32) address;
374
Len Brown4be44fc2005-08-05 00:44:28 -0400375 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
Bob Moore83135242006-10-03 00:00:00 -0400376 "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
Len Brown4be44fc2005-08-05 00:44:28 -0400377 function, bit_width, pci_id->segment, pci_id->bus,
378 pci_id->device, pci_id->function, pci_register));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379
380 switch (function) {
381 case ACPI_READ:
382
Len Brown4be44fc2005-08-05 00:44:28 -0400383 status = acpi_os_read_pci_configuration(pci_id, pci_register,
Ming Lin11869742008-02-21 02:01:30 -0500384 &value32, bit_width);
385 *value = value32;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386 break;
387
388 case ACPI_WRITE:
389
Len Brown4be44fc2005-08-05 00:44:28 -0400390 status = acpi_os_write_pci_configuration(pci_id, pci_register,
391 *value, bit_width);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700392 break;
393
394 default:
395
396 status = AE_BAD_PARAMETER;
397 break;
398 }
399
Len Brown4be44fc2005-08-05 00:44:28 -0400400 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401}
402
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403/*******************************************************************************
404 *
405 * FUNCTION: acpi_ex_cmos_space_handler
406 *
407 * PARAMETERS: Function - Read or Write operation
408 * Address - Where in the space to read or write
409 * bit_width - Field width in bits (8, 16, or 32)
410 * Value - Pointer to in or out value
411 * handler_context - Pointer to Handler's context
412 * region_context - Pointer to context specific to the
413 * accessed region
414 *
415 * RETURN: Status
416 *
417 * DESCRIPTION: Handler for the CMOS address space (Op Region)
418 *
419 ******************************************************************************/
420
421acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400422acpi_ex_cmos_space_handler(u32 function,
423 acpi_physical_address address,
424 u32 bit_width,
Bob Moore5df7e6c2010-01-21 10:06:32 +0800425 u64 *value,
Len Brown4be44fc2005-08-05 00:44:28 -0400426 void *handler_context, void *region_context)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427{
Len Brown4be44fc2005-08-05 00:44:28 -0400428 acpi_status status = AE_OK;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429
Bob Mooreb229cf92006-04-21 17:15:00 -0400430 ACPI_FUNCTION_TRACE(ex_cmos_space_handler);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431
Len Brown4be44fc2005-08-05 00:44:28 -0400432 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433}
434
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435/*******************************************************************************
436 *
437 * FUNCTION: acpi_ex_pci_bar_space_handler
438 *
439 * PARAMETERS: Function - Read or Write operation
440 * Address - Where in the space to read or write
441 * bit_width - Field width in bits (8, 16, or 32)
442 * Value - Pointer to in or out value
443 * handler_context - Pointer to Handler's context
444 * region_context - Pointer to context specific to the
445 * accessed region
446 *
447 * RETURN: Status
448 *
449 * DESCRIPTION: Handler for the PCI bar_target address space (Op Region)
450 *
451 ******************************************************************************/
452
453acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400454acpi_ex_pci_bar_space_handler(u32 function,
455 acpi_physical_address address,
456 u32 bit_width,
Bob Moore5df7e6c2010-01-21 10:06:32 +0800457 u64 *value,
Len Brown4be44fc2005-08-05 00:44:28 -0400458 void *handler_context, void *region_context)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459{
Len Brown4be44fc2005-08-05 00:44:28 -0400460 acpi_status status = AE_OK;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461
Bob Mooreb229cf92006-04-21 17:15:00 -0400462 ACPI_FUNCTION_TRACE(ex_pci_bar_space_handler);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463
Len Brown4be44fc2005-08-05 00:44:28 -0400464 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465}
466
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467/*******************************************************************************
468 *
469 * FUNCTION: acpi_ex_data_table_space_handler
470 *
471 * PARAMETERS: Function - Read or Write operation
472 * Address - Where in the space to read or write
473 * bit_width - Field width in bits (8, 16, or 32)
474 * Value - Pointer to in or out value
475 * handler_context - Pointer to Handler's context
476 * region_context - Pointer to context specific to the
477 * accessed region
478 *
479 * RETURN: Status
480 *
481 * DESCRIPTION: Handler for the Data Table address space (Op Region)
482 *
483 ******************************************************************************/
484
485acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400486acpi_ex_data_table_space_handler(u32 function,
487 acpi_physical_address address,
488 u32 bit_width,
Bob Moore5df7e6c2010-01-21 10:06:32 +0800489 u64 *value,
Len Brown4be44fc2005-08-05 00:44:28 -0400490 void *handler_context, void *region_context)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491{
Bob Mooreb229cf92006-04-21 17:15:00 -0400492 ACPI_FUNCTION_TRACE(ex_data_table_space_handler);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700493
Robert Moore44f6c012005-04-18 22:49:35 -0400494 /* Perform the memory read or write */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700495
496 switch (function) {
497 case ACPI_READ:
498
Bob Moore41195322006-05-26 16:36:00 -0400499 ACPI_MEMCPY(ACPI_CAST_PTR(char, value),
500 ACPI_PHYSADDR_TO_PTR(address),
501 ACPI_DIV_8(bit_width));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502 break;
503
504 case ACPI_WRITE:
505 default:
506
Len Brown4be44fc2005-08-05 00:44:28 -0400507 return_ACPI_STATUS(AE_SUPPORT);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508 }
509
Bob Moore41195322006-05-26 16:36:00 -0400510 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700511}