Blame view

drivers/acpi/acpica/exregion.c 15 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
  
  /******************************************************************************
   *
   * Module Name: exregion - ACPI default op_region (address space) handlers
   *
   *****************************************************************************/
  
  /*
75a44ce00   Len Brown   ACPICA: update In...
9
   * Copyright (C) 2000 - 2008, Intel Corp.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions, and the following disclaimer,
   *    without modification.
   * 2. Redistributions in binary form must reproduce at minimum a disclaimer
   *    substantially similar to the "NO WARRANTY" disclaimer below
   *    ("Disclaimer") and any redistribution must be conditioned upon
   *    including a substantially similar Disclaimer requirement for further
   *    binary redistribution.
   * 3. Neither the names of the above-listed copyright holders nor the names
   *    of any contributors may be used to endorse or promote products derived
   *    from this software without specific prior written permission.
   *
   * Alternatively, this software may be distributed under the terms of the
   * GNU General Public License ("GPL") version 2 as published by the Free
   * Software Foundation.
   *
   * NO WARRANTY
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
   * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   * POSSIBILITY OF SUCH DAMAGES.
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
44
  #include <acpi/acpi.h>
e2f7a7772   Len Brown   ACPICA: hide priv...
45
46
  #include "accommon.h"
  #include "acinterp.h"
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
47

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
48
  #define _COMPONENT          ACPI_EXECUTER
4be44fcd3   Len Brown   [ACPI] Lindent al...
49
  ACPI_MODULE_NAME("exregion")
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  
  /*******************************************************************************
   *
   * FUNCTION:    acpi_ex_system_memory_space_handler
   *
   * PARAMETERS:  Function            - Read or Write operation
   *              Address             - Where in the space to read or write
   *              bit_width           - Field width in bits (8, 16, or 32)
   *              Value               - Pointer to in or out value
   *              handler_context     - Pointer to Handler's context
   *              region_context      - Pointer to context specific to the
   *                                    accessed region
   *
   * RETURN:      Status
   *
   * DESCRIPTION: Handler for the System Memory address space (Op Region)
   *
   ******************************************************************************/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
68
  acpi_status
4be44fcd3   Len Brown   [ACPI] Lindent al...
69
70
71
72
73
  acpi_ex_system_memory_space_handler(u32 function,
  				    acpi_physical_address address,
  				    u32 bit_width,
  				    acpi_integer * value,
  				    void *handler_context, void *region_context)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74
  {
4be44fcd3   Len Brown   [ACPI] Lindent al...
75
76
77
78
  	acpi_status status = AE_OK;
  	void *logical_addr_ptr = NULL;
  	struct acpi_mem_space_context *mem_info = region_context;
  	u32 length;
d410ee510   Bob Moore   ACPICA: avoid "In...
79
80
  	acpi_size map_length;
  	acpi_size page_boundary_map_length;
0897831bb   Bob Moore   [ACPI] ACPICA 200...
81
  #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
4be44fcd3   Len Brown   [ACPI] Lindent al...
82
  	u32 remainder;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
83
  #endif
b229cf92e   Bob Moore   ACPI: ACPICA 2006...
84
  	ACPI_FUNCTION_TRACE(ex_system_memory_space_handler);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
  
  	/* Validate and translate the bit width */
  
  	switch (bit_width) {
  	case 8:
  		length = 1;
  		break;
  
  	case 16:
  		length = 2;
  		break;
  
  	case 32:
  		length = 4;
  		break;
  
  	case 64:
  		length = 8;
  		break;
  
  	default:
b229cf92e   Bob Moore   ACPI: ACPICA 2006...
106
  		ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %d",
b8e4d8935   Bob Moore   [ACPI] ACPICA 200...
107
  			    bit_width));
4be44fcd3   Len Brown   [ACPI] Lindent al...
108
  		return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
109
  	}
0897831bb   Bob Moore   [ACPI] ACPICA 200...
110
  #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
111
112
113
114
  	/*
  	 * Hardware does not support non-aligned data transfers, we must verify
  	 * the request.
  	 */
4be44fcd3   Len Brown   [ACPI] Lindent al...
115
116
  	(void)acpi_ut_short_divide((acpi_integer) address, length, NULL,
  				   &remainder);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
117
  	if (remainder != 0) {
4be44fcd3   Len Brown   [ACPI] Lindent al...
118
  		return_ACPI_STATUS(AE_AML_ALIGNMENT);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
119
120
121
122
123
124
125
126
127
  	}
  #endif
  
  	/*
  	 * Does the request fit into the cached memory mapping?
  	 * Is 1) Address below the current mapping? OR
  	 *    2) Address beyond the current mapping?
  	 */
  	if ((address < mem_info->mapped_physical_address) ||
4be44fcd3   Len Brown   [ACPI] Lindent al...
128
129
130
131
  	    (((acpi_integer) address + length) > ((acpi_integer)
  						  mem_info->
  						  mapped_physical_address +
  						  mem_info->mapped_length))) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
132
133
134
135
136
  		/*
  		 * The request cannot be resolved by the current memory mapping;
  		 * Delete the existing mapping and create a new one.
  		 */
  		if (mem_info->mapped_length) {
52fc0b026   Bob Moore   [ACPI] ACPICA 200...
137

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
138
  			/* Valid mapping, delete it */
4be44fcd3   Len Brown   [ACPI] Lindent al...
139
140
  			acpi_os_unmap_memory(mem_info->mapped_logical_address,
  					     mem_info->mapped_length);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
141
142
143
  		}
  
  		/*
d410ee510   Bob Moore   ACPICA: avoid "In...
144
145
146
  		 * Attempt to map from the requested address to the end of the region.
  		 * However, we will never map more than one page, nor will we cross
  		 * a page boundary.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
147
  		 */
d410ee510   Bob Moore   ACPICA: avoid "In...
148
  		map_length = (acpi_size)
4be44fcd3   Len Brown   [ACPI] Lindent al...
149
  		    ((mem_info->address + mem_info->length) - address);
44f6c0124   Robert Moore   ACPICA 20050408 f...
150

d410ee510   Bob Moore   ACPICA: avoid "In...
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
  		/*
  		 * If mapping the entire remaining portion of the region will cross
  		 * a page boundary, just map up to the page boundary, do not cross.
  		 * On some systems, crossing a page boundary while mapping regions
  		 * can cause warnings if the pages have different attributes
  		 * due to resource management
  		 */
  		page_boundary_map_length =
  		    ACPI_ROUND_UP(address, ACPI_DEFAULT_PAGE_SIZE) - address;
  
  		if (!page_boundary_map_length) {
  			page_boundary_map_length = ACPI_DEFAULT_PAGE_SIZE;
  		}
  
  		if (map_length > page_boundary_map_length) {
  			map_length = page_boundary_map_length;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
167
168
169
  		}
  
  		/* Create a new mapping starting at the address given */
d410ee510   Bob Moore   ACPICA: avoid "In...
170
  		mem_info->mapped_logical_address = acpi_os_map_memory((acpi_physical_address) address, map_length);
f3d2e7865   Bob Moore   ACPICA: Implement...
171
  		if (!mem_info->mapped_logical_address) {
b8e4d8935   Bob Moore   [ACPI] ACPICA 200...
172
173
  			ACPI_ERROR((AE_INFO,
  				    "Could not map memory at %8.8X%8.8X, size %X",
b7f9f0422   Bob Moore   ACPICA: Cosmetic ...
174
  				    ACPI_FORMAT_NATIVE_UINT(address),
d410ee510   Bob Moore   ACPICA: avoid "In...
175
  				    (u32) map_length));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
176
  			mem_info->mapped_length = 0;
f3d2e7865   Bob Moore   ACPICA: Implement...
177
  			return_ACPI_STATUS(AE_NO_MEMORY);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
178
179
180
181
182
  		}
  
  		/* Save the physical address and mapping size */
  
  		mem_info->mapped_physical_address = address;
d410ee510   Bob Moore   ACPICA: avoid "In...
183
  		mem_info->mapped_length = map_length;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
184
185
186
187
188
189
190
  	}
  
  	/*
  	 * Generate a logical pointer corresponding to the address we want to
  	 * access
  	 */
  	logical_addr_ptr = mem_info->mapped_logical_address +
4be44fcd3   Len Brown   [ACPI] Lindent al...
191
192
193
194
  	    ((acpi_integer) address -
  	     (acpi_integer) mem_info->mapped_physical_address);
  
  	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
8313524a0   Bob Moore   ACPI: ACPICA 2006...
195
196
  			  "System-Memory (width %d) R/W %d Address=%8.8X%8.8X
  ",
b7f9f0422   Bob Moore   ACPICA: Cosmetic ...
197
198
  			  bit_width, function,
  			  ACPI_FORMAT_NATIVE_UINT(address)));
4be44fcd3   Len Brown   [ACPI] Lindent al...
199
200
201
202
203
204
205
206
207
  
  	/*
  	 * Perform the memory read or write
  	 *
  	 * Note: For machines that do not support non-aligned transfers, the target
  	 * address was checked for alignment above.  We do not attempt to break the
  	 * transfer up into smaller (byte-size) chunks because the AML specifically
  	 * asked for a transfer width that the hardware may require.
  	 */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
208
209
210
211
212
213
  	switch (function) {
  	case ACPI_READ:
  
  		*value = 0;
  		switch (bit_width) {
  		case 8:
c51a4de85   Bob Moore   [ACPI] ACPICA 200...
214
  			*value = (acpi_integer) ACPI_GET8(logical_addr_ptr);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
215
216
217
  			break;
  
  		case 16:
c51a4de85   Bob Moore   [ACPI] ACPICA 200...
218
  			*value = (acpi_integer) ACPI_GET16(logical_addr_ptr);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
219
220
221
  			break;
  
  		case 32:
c51a4de85   Bob Moore   [ACPI] ACPICA 200...
222
  			*value = (acpi_integer) ACPI_GET32(logical_addr_ptr);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
223
  			break;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
224
  		case 64:
c51a4de85   Bob Moore   [ACPI] ACPICA 200...
225
  			*value = (acpi_integer) ACPI_GET64(logical_addr_ptr);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
226
  			break;
59fa85057   Bob Moore   ACPICA: Removed a...
227

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
228
229
230
231
232
233
234
235
236
237
  		default:
  			/* bit_width was already validated */
  			break;
  		}
  		break;
  
  	case ACPI_WRITE:
  
  		switch (bit_width) {
  		case 8:
c51a4de85   Bob Moore   [ACPI] ACPICA 200...
238
  			ACPI_SET8(logical_addr_ptr) = (u8) * value;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
239
240
241
  			break;
  
  		case 16:
c51a4de85   Bob Moore   [ACPI] ACPICA 200...
242
  			ACPI_SET16(logical_addr_ptr) = (u16) * value;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
243
244
245
  			break;
  
  		case 32:
c51a4de85   Bob Moore   [ACPI] ACPICA 200...
246
  			ACPI_SET32(logical_addr_ptr) = (u32) * value;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
247
  			break;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
248
  		case 64:
c51a4de85   Bob Moore   [ACPI] ACPICA 200...
249
  			ACPI_SET64(logical_addr_ptr) = (u64) * value;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
250
  			break;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
251
252
253
254
255
256
257
258
259
260
261
  
  		default:
  			/* bit_width was already validated */
  			break;
  		}
  		break;
  
  	default:
  		status = AE_BAD_PARAMETER;
  		break;
  	}
4be44fcd3   Len Brown   [ACPI] Lindent al...
262
  	return_ACPI_STATUS(status);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
263
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
  /*******************************************************************************
   *
   * FUNCTION:    acpi_ex_system_io_space_handler
   *
   * PARAMETERS:  Function            - Read or Write operation
   *              Address             - Where in the space to read or write
   *              bit_width           - Field width in bits (8, 16, or 32)
   *              Value               - Pointer to in or out value
   *              handler_context     - Pointer to Handler's context
   *              region_context      - Pointer to context specific to the
   *                                    accessed region
   *
   * RETURN:      Status
   *
   * DESCRIPTION: Handler for the System IO address space (Op Region)
   *
   ******************************************************************************/
  
  acpi_status
4be44fcd3   Len Brown   [ACPI] Lindent al...
283
284
285
286
287
  acpi_ex_system_io_space_handler(u32 function,
  				acpi_physical_address address,
  				u32 bit_width,
  				acpi_integer * value,
  				void *handler_context, void *region_context)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
288
  {
4be44fcd3   Len Brown   [ACPI] Lindent al...
289
290
  	acpi_status status = AE_OK;
  	u32 value32;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
291

b229cf92e   Bob Moore   ACPI: ACPICA 2006...
292
  	ACPI_FUNCTION_TRACE(ex_system_io_space_handler);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
293

4be44fcd3   Len Brown   [ACPI] Lindent al...
294
  	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
8313524a0   Bob Moore   ACPI: ACPICA 2006...
295
296
  			  "System-IO (width %d) R/W %d Address=%8.8X%8.8X
  ",
b7f9f0422   Bob Moore   ACPICA: Cosmetic ...
297
298
  			  bit_width, function,
  			  ACPI_FORMAT_NATIVE_UINT(address)));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
299
300
301
302
303
  
  	/* Decode the function parameter */
  
  	switch (function) {
  	case ACPI_READ:
7f0719039   Bob Moore   ACPICA: New: I/O ...
304
  		status = acpi_hw_read_port((acpi_io_address) address,
4be44fcd3   Len Brown   [ACPI] Lindent al...
305
  					   &value32, bit_width);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
306
307
308
309
  		*value = value32;
  		break;
  
  	case ACPI_WRITE:
7f0719039   Bob Moore   ACPICA: New: I/O ...
310
  		status = acpi_hw_write_port((acpi_io_address) address,
4be44fcd3   Len Brown   [ACPI] Lindent al...
311
  					    (u32) * value, bit_width);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
312
313
314
315
316
317
  		break;
  
  	default:
  		status = AE_BAD_PARAMETER;
  		break;
  	}
4be44fcd3   Len Brown   [ACPI] Lindent al...
318
  	return_ACPI_STATUS(status);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
319
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
  /*******************************************************************************
   *
   * FUNCTION:    acpi_ex_pci_config_space_handler
   *
   * PARAMETERS:  Function            - Read or Write operation
   *              Address             - Where in the space to read or write
   *              bit_width           - Field width in bits (8, 16, or 32)
   *              Value               - Pointer to in or out value
   *              handler_context     - Pointer to Handler's context
   *              region_context      - Pointer to context specific to the
   *                                    accessed region
   *
   * RETURN:      Status
   *
   * DESCRIPTION: Handler for the PCI Config address space (Op Region)
   *
   ******************************************************************************/
  
  acpi_status
4be44fcd3   Len Brown   [ACPI] Lindent al...
339
340
341
342
343
  acpi_ex_pci_config_space_handler(u32 function,
  				 acpi_physical_address address,
  				 u32 bit_width,
  				 acpi_integer * value,
  				 void *handler_context, void *region_context)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
344
  {
4be44fcd3   Len Brown   [ACPI] Lindent al...
345
346
347
  	acpi_status status = AE_OK;
  	struct acpi_pci_id *pci_id;
  	u16 pci_register;
1186974f3   Ming Lin   ACPI: fix build w...
348
  	u32 value32;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
349

b229cf92e   Bob Moore   ACPI: ACPICA 2006...
350
  	ACPI_FUNCTION_TRACE(ex_pci_config_space_handler);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
351
352
353
354
355
356
357
358
359
360
361
362
363
  
  	/*
  	 *  The arguments to acpi_os(Read|Write)pci_configuration are:
  	 *
  	 *  pci_segment is the PCI bus segment range 0-31
  	 *  pci_bus     is the PCI bus number range 0-255
  	 *  pci_device  is the PCI device number range 0-31
  	 *  pci_function is the PCI device function number
  	 *  pci_register is the Config space register range 0-255 bytes
  	 *
  	 *  Value - input value for write, output address for read
  	 *
  	 */
4be44fcd3   Len Brown   [ACPI] Lindent al...
364
  	pci_id = (struct acpi_pci_id *)region_context;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
365
  	pci_register = (u16) (u32) address;
4be44fcd3   Len Brown   [ACPI] Lindent al...
366
  	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
8313524a0   Bob Moore   ACPI: ACPICA 2006...
367
368
  			  "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)
  ",
4be44fcd3   Len Brown   [ACPI] Lindent al...
369
370
  			  function, bit_width, pci_id->segment, pci_id->bus,
  			  pci_id->device, pci_id->function, pci_register));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
371
372
373
  
  	switch (function) {
  	case ACPI_READ:
4be44fcd3   Len Brown   [ACPI] Lindent al...
374
  		status = acpi_os_read_pci_configuration(pci_id, pci_register,
1186974f3   Ming Lin   ACPI: fix build w...
375
376
  							&value32, bit_width);
  		*value = value32;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
377
378
379
  		break;
  
  	case ACPI_WRITE:
4be44fcd3   Len Brown   [ACPI] Lindent al...
380
381
  		status = acpi_os_write_pci_configuration(pci_id, pci_register,
  							 *value, bit_width);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
382
383
384
385
386
387
388
  		break;
  
  	default:
  
  		status = AE_BAD_PARAMETER;
  		break;
  	}
4be44fcd3   Len Brown   [ACPI] Lindent al...
389
  	return_ACPI_STATUS(status);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
390
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
  /*******************************************************************************
   *
   * FUNCTION:    acpi_ex_cmos_space_handler
   *
   * PARAMETERS:  Function            - Read or Write operation
   *              Address             - Where in the space to read or write
   *              bit_width           - Field width in bits (8, 16, or 32)
   *              Value               - Pointer to in or out value
   *              handler_context     - Pointer to Handler's context
   *              region_context      - Pointer to context specific to the
   *                                    accessed region
   *
   * RETURN:      Status
   *
   * DESCRIPTION: Handler for the CMOS address space (Op Region)
   *
   ******************************************************************************/
  
  acpi_status
4be44fcd3   Len Brown   [ACPI] Lindent al...
410
411
412
413
414
  acpi_ex_cmos_space_handler(u32 function,
  			   acpi_physical_address address,
  			   u32 bit_width,
  			   acpi_integer * value,
  			   void *handler_context, void *region_context)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
415
  {
4be44fcd3   Len Brown   [ACPI] Lindent al...
416
  	acpi_status status = AE_OK;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
417

b229cf92e   Bob Moore   ACPI: ACPICA 2006...
418
  	ACPI_FUNCTION_TRACE(ex_cmos_space_handler);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
419

4be44fcd3   Len Brown   [ACPI] Lindent al...
420
  	return_ACPI_STATUS(status);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
421
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
  /*******************************************************************************
   *
   * FUNCTION:    acpi_ex_pci_bar_space_handler
   *
   * PARAMETERS:  Function            - Read or Write operation
   *              Address             - Where in the space to read or write
   *              bit_width           - Field width in bits (8, 16, or 32)
   *              Value               - Pointer to in or out value
   *              handler_context     - Pointer to Handler's context
   *              region_context      - Pointer to context specific to the
   *                                    accessed region
   *
   * RETURN:      Status
   *
   * DESCRIPTION: Handler for the PCI bar_target address space (Op Region)
   *
   ******************************************************************************/
  
  acpi_status
4be44fcd3   Len Brown   [ACPI] Lindent al...
441
442
443
444
445
  acpi_ex_pci_bar_space_handler(u32 function,
  			      acpi_physical_address address,
  			      u32 bit_width,
  			      acpi_integer * value,
  			      void *handler_context, void *region_context)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
446
  {
4be44fcd3   Len Brown   [ACPI] Lindent al...
447
  	acpi_status status = AE_OK;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
448

b229cf92e   Bob Moore   ACPI: ACPICA 2006...
449
  	ACPI_FUNCTION_TRACE(ex_pci_bar_space_handler);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
450

4be44fcd3   Len Brown   [ACPI] Lindent al...
451
  	return_ACPI_STATUS(status);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
452
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
  /*******************************************************************************
   *
   * FUNCTION:    acpi_ex_data_table_space_handler
   *
   * PARAMETERS:  Function            - Read or Write operation
   *              Address             - Where in the space to read or write
   *              bit_width           - Field width in bits (8, 16, or 32)
   *              Value               - Pointer to in or out value
   *              handler_context     - Pointer to Handler's context
   *              region_context      - Pointer to context specific to the
   *                                    accessed region
   *
   * RETURN:      Status
   *
   * DESCRIPTION: Handler for the Data Table address space (Op Region)
   *
   ******************************************************************************/
  
  acpi_status
4be44fcd3   Len Brown   [ACPI] Lindent al...
472
473
474
475
476
  acpi_ex_data_table_space_handler(u32 function,
  				 acpi_physical_address address,
  				 u32 bit_width,
  				 acpi_integer * value,
  				 void *handler_context, void *region_context)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
477
  {
b229cf92e   Bob Moore   ACPI: ACPICA 2006...
478
  	ACPI_FUNCTION_TRACE(ex_data_table_space_handler);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
479

44f6c0124   Robert Moore   ACPICA 20050408 f...
480
  	/* Perform the memory read or write */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
481
482
483
  
  	switch (function) {
  	case ACPI_READ:
4119532c9   Bob Moore   ACPI: ACPICA 2006...
484
485
486
  		ACPI_MEMCPY(ACPI_CAST_PTR(char, value),
  			    ACPI_PHYSADDR_TO_PTR(address),
  			    ACPI_DIV_8(bit_width));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
487
488
489
490
  		break;
  
  	case ACPI_WRITE:
  	default:
4be44fcd3   Len Brown   [ACPI] Lindent al...
491
  		return_ACPI_STATUS(AE_SUPPORT);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
492
  	}
4119532c9   Bob Moore   ACPI: ACPICA 2006...
493
  	return_ACPI_STATUS(AE_OK);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
494
  }