hwregs.c 24 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1
2
3
4
5
6
7
8
9

/*******************************************************************************
 *
 * Module Name: hwregs - Read/write access functions for the various ACPI
 *                       control and status registers.
 *
 ******************************************************************************/

/*
Bob Moore's avatar
Bob Moore committed
10
 * Copyright (C) 2000 - 2006, R. Byron Moore
Linus Torvalds's avatar
Linus Torvalds committed
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
44
45
46
47
48
49
50
 * 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.
 */

#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#include <acpi/acevents.h>

#define _COMPONENT          ACPI_HARDWARE
Len Brown's avatar
Len Brown committed
51
ACPI_MODULE_NAME("hwregs")
Linus Torvalds's avatar
Linus Torvalds committed
52
53
54
55
56
57
58
59
60
61
62
63

/*******************************************************************************
 *
 * FUNCTION:    acpi_hw_clear_acpi_status
 *
 * PARAMETERS:  Flags           - Lock the hardware or not
 *
 * RETURN:      none
 *
 * DESCRIPTION: Clears all fixed and general purpose status bits
 *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
 *
Bob Moore's avatar
Bob Moore committed
64
65
 * NOTE: TBD: Flags parameter is obsolete, to be removed
 *
Linus Torvalds's avatar
Linus Torvalds committed
66
 ******************************************************************************/
Len Brown's avatar
Len Brown committed
67
acpi_status acpi_hw_clear_acpi_status(u32 flags)
Linus Torvalds's avatar
Linus Torvalds committed
68
{
Len Brown's avatar
Len Brown committed
69
	acpi_status status;
Bob Moore's avatar
Bob Moore committed
70
	acpi_cpu_flags lock_flags = 0;
Linus Torvalds's avatar
Linus Torvalds committed
71

Bob Moore's avatar
Bob Moore committed
72
	ACPI_FUNCTION_TRACE(hw_clear_acpi_status);
Linus Torvalds's avatar
Linus Torvalds committed
73

Len Brown's avatar
Len Brown committed
74
75
76
	ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n",
			  ACPI_BITMASK_ALL_FIXED_STATUS,
			  (u16) acpi_gbl_FADT->xpm1a_evt_blk.address));
Linus Torvalds's avatar
Linus Torvalds committed
77

Bob Moore's avatar
Bob Moore committed
78
	lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
Linus Torvalds's avatar
Linus Torvalds committed
79

Len Brown's avatar
Len Brown committed
80
81
82
83
	status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
					ACPI_REGISTER_PM1_STATUS,
					ACPI_BITMASK_ALL_FIXED_STATUS);
	if (ACPI_FAILURE(status)) {
Linus Torvalds's avatar
Linus Torvalds committed
84
85
86
87
88
89
		goto unlock_and_exit;
	}

	/* Clear the fixed events */

	if (acpi_gbl_FADT->xpm1b_evt_blk.address) {
Len Brown's avatar
Len Brown committed
90
91
92
93
		status =
		    acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS,
					    &acpi_gbl_FADT->xpm1b_evt_blk);
		if (ACPI_FAILURE(status)) {
Linus Torvalds's avatar
Linus Torvalds committed
94
95
96
97
98
99
			goto unlock_and_exit;
		}
	}

	/* Clear the GPE Bits in all GPE registers in all GPE blocks */

Len Brown's avatar
Len Brown committed
100
	status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
Linus Torvalds's avatar
Linus Torvalds committed
101

Len Brown's avatar
Len Brown committed
102
      unlock_and_exit:
Bob Moore's avatar
Bob Moore committed
103
	acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
Len Brown's avatar
Len Brown committed
104
	return_ACPI_STATUS(status);
Linus Torvalds's avatar
Linus Torvalds committed
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
}

/*******************************************************************************
 *
 * FUNCTION:    acpi_get_sleep_type_data
 *
 * PARAMETERS:  sleep_state         - Numeric sleep state
 *              *sleep_type_a        - Where SLP_TYPa is returned
 *              *sleep_type_b        - Where SLP_TYPb is returned
 *
 * RETURN:      Status - ACPI status
 *
 * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep
 *              state.
 *
 ******************************************************************************/

acpi_status
Len Brown's avatar
Len Brown committed
123
acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
Linus Torvalds's avatar
Linus Torvalds committed
124
{
Len Brown's avatar
Len Brown committed
125
	acpi_status status = AE_OK;
Bob Moore's avatar
Bob Moore committed
126
	struct acpi_evaluate_info *info;
Linus Torvalds's avatar
Linus Torvalds committed
127

Bob Moore's avatar
Bob Moore committed
128
	ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data);
Linus Torvalds's avatar
Linus Torvalds committed
129

Robert Moore's avatar
Robert Moore committed
130
131
	/* Validate parameters */

Len Brown's avatar
Len Brown committed
132
133
	if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) {
		return_ACPI_STATUS(AE_BAD_PARAMETER);
Linus Torvalds's avatar
Linus Torvalds committed
134
135
	}

Bob Moore's avatar
Bob Moore committed
136
137
138
139
140
141
	/* Allocate the evaluation information block */

	info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
	if (!info) {
		return_ACPI_STATUS(AE_NO_MEMORY);
	}
Robert Moore's avatar
Robert Moore committed
142

Bob Moore's avatar
Bob Moore committed
143
	info->pathname =
Bob Moore's avatar
Bob Moore committed
144
	    ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
Robert Moore's avatar
Robert Moore committed
145

Bob Moore's avatar
Bob Moore committed
146
147
148
	/* Evaluate the namespace object containing the values for this state */

	status = acpi_ns_evaluate(info);
Len Brown's avatar
Len Brown committed
149
150
	if (ACPI_FAILURE(status)) {
		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
Bob Moore's avatar
Bob Moore committed
151
				  "%s while evaluating SleepState [%s]\n",
Len Brown's avatar
Len Brown committed
152
				  acpi_format_exception(status),
Bob Moore's avatar
Bob Moore committed
153
				  info->pathname));
Linus Torvalds's avatar
Linus Torvalds committed
154

Bob Moore's avatar
Bob Moore committed
155
		goto cleanup;
Linus Torvalds's avatar
Linus Torvalds committed
156
157
158
159
	}

	/* Must have a return object */

Bob Moore's avatar
Bob Moore committed
160
	if (!info->return_object) {
Bob Moore's avatar
Bob Moore committed
161
		ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]",
Bob Moore's avatar
Bob Moore committed
162
			    info->pathname));
Linus Torvalds's avatar
Linus Torvalds committed
163
164
165
166
167
		status = AE_NOT_EXIST;
	}

	/* It must be of type Package */

Bob Moore's avatar
Bob Moore committed
168
	else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) {
Bob Moore's avatar
Bob Moore committed
169
170
		ACPI_ERROR((AE_INFO,
			    "Sleep State return object is not a Package"));
Linus Torvalds's avatar
Linus Torvalds committed
171
172
173
		status = AE_AML_OPERAND_TYPE;
	}

Robert Moore's avatar
Robert Moore committed
174
	/*
Bob Moore's avatar
Bob Moore committed
175
	 * The package must have at least two elements. NOTE (March 2005): This
Robert Moore's avatar
Robert Moore committed
176
	 * goes against the current ACPI spec which defines this object as a
Bob Moore's avatar
Bob Moore committed
177
	 * package with one encoded DWORD element. However, existing practice
Robert Moore's avatar
Robert Moore committed
178
179
180
	 * by BIOS vendors seems to be to have 2 or more elements, at least
	 * one per sleep type (A/B).
	 */
Bob Moore's avatar
Bob Moore committed
181
	else if (info->return_object->package.count < 2) {
Bob Moore's avatar
Bob Moore committed
182
183
		ACPI_ERROR((AE_INFO,
			    "Sleep State return package does not have at least two elements"));
Linus Torvalds's avatar
Linus Torvalds committed
184
185
186
187
188
		status = AE_AML_NO_OPERAND;
	}

	/* The first two elements must both be of type Integer */

Bob Moore's avatar
Bob Moore committed
189
	else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0])
Len Brown's avatar
Len Brown committed
190
		  != ACPI_TYPE_INTEGER) ||
Bob Moore's avatar
Bob Moore committed
191
		 (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1])
Len Brown's avatar
Len Brown committed
192
		  != ACPI_TYPE_INTEGER)) {
Bob Moore's avatar
Bob Moore committed
193
194
		ACPI_ERROR((AE_INFO,
			    "Sleep State return package elements are not both Integers (%s, %s)",
Bob Moore's avatar
Bob Moore committed
195
			    acpi_ut_get_object_type_name(info->return_object->
Bob Moore's avatar
Bob Moore committed
196
							 package.elements[0]),
Bob Moore's avatar
Bob Moore committed
197
			    acpi_ut_get_object_type_name(info->return_object->
Bob Moore's avatar
Bob Moore committed
198
							 package.elements[1])));
Linus Torvalds's avatar
Linus Torvalds committed
199
		status = AE_AML_OPERAND_TYPE;
Len Brown's avatar
Len Brown committed
200
	} else {
Robert Moore's avatar
Robert Moore committed
201
202
203
		/* Valid _Sx_ package size, type, and value */

		*sleep_type_a = (u8)
Bob Moore's avatar
Bob Moore committed
204
		    (info->return_object->package.elements[0])->integer.value;
Robert Moore's avatar
Robert Moore committed
205
		*sleep_type_b = (u8)
Bob Moore's avatar
Bob Moore committed
206
		    (info->return_object->package.elements[1])->integer.value;
Linus Torvalds's avatar
Linus Torvalds committed
207
208
	}

Len Brown's avatar
Len Brown committed
209
	if (ACPI_FAILURE(status)) {
Bob Moore's avatar
Bob Moore committed
210
		ACPI_EXCEPTION((AE_INFO, status,
Bob Moore's avatar
Bob Moore committed
211
				"While evaluating SleepState [%s], bad Sleep object %p type %s",
Bob Moore's avatar
Bob Moore committed
212
213
				info->pathname, info->return_object,
				acpi_ut_get_object_type_name(info->
Bob Moore's avatar
Bob Moore committed
214
							     return_object)));
Linus Torvalds's avatar
Linus Torvalds committed
215
216
	}

Bob Moore's avatar
Bob Moore committed
217
218
219
220
	acpi_ut_remove_reference(info->return_object);

      cleanup:
	ACPI_FREE(info);
Len Brown's avatar
Len Brown committed
221
	return_ACPI_STATUS(status);
Linus Torvalds's avatar
Linus Torvalds committed
222
223
}

Bob Moore's avatar
Bob Moore committed
224
ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data)
Linus Torvalds's avatar
Linus Torvalds committed
225
226
227
228
229
230
231

/*******************************************************************************
 *
 * FUNCTION:    acpi_hw_get_register_bit_mask
 *
 * PARAMETERS:  register_id         - Index of ACPI Register to access
 *
Robert Moore's avatar
Robert Moore committed
232
 * RETURN:      The bitmask to be used when accessing the register
Linus Torvalds's avatar
Linus Torvalds committed
233
 *
Robert Moore's avatar
Robert Moore committed
234
 * DESCRIPTION: Map register_id into a register bitmask.
Linus Torvalds's avatar
Linus Torvalds committed
235
236
 *
 ******************************************************************************/
Len Brown's avatar
Len Brown committed
237
struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
Linus Torvalds's avatar
Linus Torvalds committed
238
{
Bob Moore's avatar
Bob Moore committed
239
	ACPI_FUNCTION_ENTRY();
Linus Torvalds's avatar
Linus Torvalds committed
240
241

	if (register_id > ACPI_BITREG_MAX) {
Bob Moore's avatar
Bob Moore committed
242
		ACPI_ERROR((AE_INFO, "Invalid BitRegister ID: %X",
Bob Moore's avatar
Bob Moore committed
243
			    register_id));
Linus Torvalds's avatar
Linus Torvalds committed
244
245
246
247
248
249
250
251
252
253
254
255
256
257
		return (NULL);
	}

	return (&acpi_gbl_bit_register_info[register_id]);
}

/*******************************************************************************
 *
 * FUNCTION:    acpi_get_register
 *
 * PARAMETERS:  register_id     - ID of ACPI bit_register to access
 *              return_value    - Value that was read from the register
 *              Flags           - Lock the hardware or not
 *
Bob Moore's avatar
Bob Moore committed
258
 * RETURN:      Status and the value read from specified Register. Value
Linus Torvalds's avatar
Linus Torvalds committed
259
260
261
262
 *              returned is normalized to bit0 (is shifted all the way right)
 *
 * DESCRIPTION: ACPI bit_register read function.
 *
Bob Moore's avatar
Bob Moore committed
263
264
 * NOTE: TBD: Flags parameter is obsolete, to be removed
 *
Linus Torvalds's avatar
Linus Torvalds committed
265
266
 ******************************************************************************/

Len Brown's avatar
Len Brown committed
267
acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
Linus Torvalds's avatar
Linus Torvalds committed
268
{
Len Brown's avatar
Len Brown committed
269
270
271
	u32 register_value = 0;
	struct acpi_bit_register_info *bit_reg_info;
	acpi_status status;
Linus Torvalds's avatar
Linus Torvalds committed
272

Bob Moore's avatar
Bob Moore committed
273
	ACPI_FUNCTION_TRACE(acpi_get_register);
Linus Torvalds's avatar
Linus Torvalds committed
274
275
276

	/* Get the info structure corresponding to the requested ACPI Register */

Len Brown's avatar
Len Brown committed
277
	bit_reg_info = acpi_hw_get_bit_register_info(register_id);
Linus Torvalds's avatar
Linus Torvalds committed
278
	if (!bit_reg_info) {
Len Brown's avatar
Len Brown committed
279
		return_ACPI_STATUS(AE_BAD_PARAMETER);
Linus Torvalds's avatar
Linus Torvalds committed
280
281
282
283
	}

	/* Read from the register */

Bob Moore's avatar
Bob Moore committed
284
	status = acpi_hw_register_read(ACPI_MTX_LOCK,
Len Brown's avatar
Len Brown committed
285
286
				       bit_reg_info->parent_register,
				       &register_value);
Linus Torvalds's avatar
Linus Torvalds committed
287

Len Brown's avatar
Len Brown committed
288
	if (ACPI_SUCCESS(status)) {
Bob Moore's avatar
Bob Moore committed
289

Linus Torvalds's avatar
Linus Torvalds committed
290
291
		/* Normalize the value that was read */

Len Brown's avatar
Len Brown committed
292
293
294
		register_value =
		    ((register_value & bit_reg_info->access_bit_mask)
		     >> bit_reg_info->bit_position);
Linus Torvalds's avatar
Linus Torvalds committed
295
296
297

		*return_value = register_value;

Len Brown's avatar
Len Brown committed
298
299
300
		ACPI_DEBUG_PRINT((ACPI_DB_IO, "Read value %8.8X register %X\n",
				  register_value,
				  bit_reg_info->parent_register));
Linus Torvalds's avatar
Linus Torvalds committed
301
302
	}

Len Brown's avatar
Len Brown committed
303
	return_ACPI_STATUS(status);
Linus Torvalds's avatar
Linus Torvalds committed
304
305
}

Bob Moore's avatar
Bob Moore committed
306
ACPI_EXPORT_SYMBOL(acpi_get_register)
Linus Torvalds's avatar
Linus Torvalds committed
307
308
309
310
311
312
313
314
315
316
317
318
319
320

/*******************************************************************************
 *
 * FUNCTION:    acpi_set_register
 *
 * PARAMETERS:  register_id     - ID of ACPI bit_register to access
 *              Value           - (only used on write) value to write to the
 *                                Register, NOT pre-normalized to the bit pos
 *              Flags           - Lock the hardware or not
 *
 * RETURN:      Status
 *
 * DESCRIPTION: ACPI Bit Register write function.
 *
Bob Moore's avatar
Bob Moore committed
321
322
 * NOTE: TBD: Flags parameter is obsolete, to be removed
 *
Linus Torvalds's avatar
Linus Torvalds committed
323
 ******************************************************************************/
Len Brown's avatar
Len Brown committed
324
acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
Linus Torvalds's avatar
Linus Torvalds committed
325
{
Len Brown's avatar
Len Brown committed
326
327
328
	u32 register_value = 0;
	struct acpi_bit_register_info *bit_reg_info;
	acpi_status status;
Bob Moore's avatar
Bob Moore committed
329
	acpi_cpu_flags lock_flags;
Linus Torvalds's avatar
Linus Torvalds committed
330

Bob Moore's avatar
Bob Moore committed
331
	ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id);
Linus Torvalds's avatar
Linus Torvalds committed
332
333
334

	/* Get the info structure corresponding to the requested ACPI Register */

Len Brown's avatar
Len Brown committed
335
	bit_reg_info = acpi_hw_get_bit_register_info(register_id);
Linus Torvalds's avatar
Linus Torvalds committed
336
	if (!bit_reg_info) {
Bob Moore's avatar
Bob Moore committed
337
		ACPI_ERROR((AE_INFO, "Bad ACPI HW RegisterId: %X",
Bob Moore's avatar
Bob Moore committed
338
			    register_id));
Len Brown's avatar
Len Brown committed
339
		return_ACPI_STATUS(AE_BAD_PARAMETER);
Linus Torvalds's avatar
Linus Torvalds committed
340
341
	}

Bob Moore's avatar
Bob Moore committed
342
	lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
Linus Torvalds's avatar
Linus Torvalds committed
343
344
345

	/* Always do a register read first so we can insert the new bits  */

Len Brown's avatar
Len Brown committed
346
347
348
349
	status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
				       bit_reg_info->parent_register,
				       &register_value);
	if (ACPI_FAILURE(status)) {
Linus Torvalds's avatar
Linus Torvalds committed
350
351
352
353
354
355
356
357
358
359
360
361
362
363
		goto unlock_and_exit;
	}

	/*
	 * Decode the Register ID
	 * Register ID = [Register block ID] | [bit ID]
	 *
	 * Check bit ID to fine locate Register offset.
	 * Check Mask to determine Register offset, and then read-write.
	 */
	switch (bit_reg_info->parent_register) {
	case ACPI_REGISTER_PM1_STATUS:

		/*
Bob Moore's avatar
Bob Moore committed
364
365
		 * Status Registers are different from the rest. Clear by
		 * writing 1, and writing 0 has no effect. So, the only relevant
Linus Torvalds's avatar
Linus Torvalds committed
366
367
368
		 * information is the single bit we're interested in, all others should
		 * be written as 0 so they will be left unchanged.
		 */
Len Brown's avatar
Len Brown committed
369
370
371
372
		value = ACPI_REGISTER_PREPARE_BITS(value,
						   bit_reg_info->bit_position,
						   bit_reg_info->
						   access_bit_mask);
Linus Torvalds's avatar
Linus Torvalds committed
373
		if (value) {
Len Brown's avatar
Len Brown committed
374
375
376
			status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
							ACPI_REGISTER_PM1_STATUS,
							(u16) value);
Linus Torvalds's avatar
Linus Torvalds committed
377
378
379
380
381
382
			register_value = 0;
		}
		break;

	case ACPI_REGISTER_PM1_ENABLE:

Len Brown's avatar
Len Brown committed
383
384
385
386
		ACPI_REGISTER_INSERT_VALUE(register_value,
					   bit_reg_info->bit_position,
					   bit_reg_info->access_bit_mask,
					   value);
Linus Torvalds's avatar
Linus Torvalds committed
387

Len Brown's avatar
Len Brown committed
388
389
390
		status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
						ACPI_REGISTER_PM1_ENABLE,
						(u16) register_value);
Linus Torvalds's avatar
Linus Torvalds committed
391
392
393
394
395
396
397
398
399
		break;

	case ACPI_REGISTER_PM1_CONTROL:

		/*
		 * Write the PM1 Control register.
		 * Note that at this level, the fact that there are actually TWO
		 * registers (A and B - and B may not exist) is abstracted.
		 */
Len Brown's avatar
Len Brown committed
400
401
		ACPI_DEBUG_PRINT((ACPI_DB_IO, "PM1 control: Read %X\n",
				  register_value));
Linus Torvalds's avatar
Linus Torvalds committed
402

Len Brown's avatar
Len Brown committed
403
404
405
406
		ACPI_REGISTER_INSERT_VALUE(register_value,
					   bit_reg_info->bit_position,
					   bit_reg_info->access_bit_mask,
					   value);
Linus Torvalds's avatar
Linus Torvalds committed
407

Len Brown's avatar
Len Brown committed
408
409
410
		status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
						ACPI_REGISTER_PM1_CONTROL,
						(u16) register_value);
Linus Torvalds's avatar
Linus Torvalds committed
411
412
413
414
		break;

	case ACPI_REGISTER_PM2_CONTROL:

Len Brown's avatar
Len Brown committed
415
416
417
418
		status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
					       ACPI_REGISTER_PM2_CONTROL,
					       &register_value);
		if (ACPI_FAILURE(status)) {
Linus Torvalds's avatar
Linus Torvalds committed
419
420
421
			goto unlock_and_exit;
		}

Len Brown's avatar
Len Brown committed
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
		ACPI_DEBUG_PRINT((ACPI_DB_IO,
				  "PM2 control: Read %X from %8.8X%8.8X\n",
				  register_value,
				  ACPI_FORMAT_UINT64(acpi_gbl_FADT->
						     xpm2_cnt_blk.address)));

		ACPI_REGISTER_INSERT_VALUE(register_value,
					   bit_reg_info->bit_position,
					   bit_reg_info->access_bit_mask,
					   value);

		ACPI_DEBUG_PRINT((ACPI_DB_IO,
				  "About to write %4.4X to %8.8X%8.8X\n",
				  register_value,
				  ACPI_FORMAT_UINT64(acpi_gbl_FADT->
						     xpm2_cnt_blk.address)));

		status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
						ACPI_REGISTER_PM2_CONTROL,
						(u8) (register_value));
Linus Torvalds's avatar
Linus Torvalds committed
442
443
444
445
446
447
		break;

	default:
		break;
	}

Len Brown's avatar
Len Brown committed
448
      unlock_and_exit:
Linus Torvalds's avatar
Linus Torvalds committed
449

Bob Moore's avatar
Bob Moore committed
450
	acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
Linus Torvalds's avatar
Linus Torvalds committed
451
452
453

	/* Normalize the value that was read */

Len Brown's avatar
Len Brown committed
454
455
456
	ACPI_DEBUG_EXEC(register_value =
			((register_value & bit_reg_info->access_bit_mask) >>
			 bit_reg_info->bit_position));
Linus Torvalds's avatar
Linus Torvalds committed
457

Len Brown's avatar
Len Brown committed
458
459
460
461
	ACPI_DEBUG_PRINT((ACPI_DB_IO,
			  "Set bits: %8.8X actual %8.8X register %X\n", value,
			  register_value, bit_reg_info->parent_register));
	return_ACPI_STATUS(status);
Linus Torvalds's avatar
Linus Torvalds committed
462
463
}

Bob Moore's avatar
Bob Moore committed
464
ACPI_EXPORT_SYMBOL(acpi_set_register)
Linus Torvalds's avatar
Linus Torvalds committed
465
466
467
468
469

/******************************************************************************
 *
 * FUNCTION:    acpi_hw_register_read
 *
Bob Moore's avatar
Bob Moore committed
470
471
 * PARAMETERS:  use_lock            - Lock hardware? True/False
 *              register_id         - ACPI Register ID
Robert Moore's avatar
Robert Moore committed
472
 *              return_value        - Where the register value is returned
Linus Torvalds's avatar
Linus Torvalds committed
473
474
475
 *
 * RETURN:      Status and the value read.
 *
Bob Moore's avatar
Bob Moore committed
476
 * DESCRIPTION: Read from the specified ACPI register
Linus Torvalds's avatar
Linus Torvalds committed
477
478
479
 *
 ******************************************************************************/
acpi_status
Len Brown's avatar
Len Brown committed
480
acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
Linus Torvalds's avatar
Linus Torvalds committed
481
{
Len Brown's avatar
Len Brown committed
482
483
484
	u32 value1 = 0;
	u32 value2 = 0;
	acpi_status status;
Bob Moore's avatar
Bob Moore committed
485
	acpi_cpu_flags lock_flags = 0;
Linus Torvalds's avatar
Linus Torvalds committed
486

Bob Moore's avatar
Bob Moore committed
487
	ACPI_FUNCTION_TRACE(hw_register_read);
Linus Torvalds's avatar
Linus Torvalds committed
488
489

	if (ACPI_MTX_LOCK == use_lock) {
Bob Moore's avatar
Bob Moore committed
490
		lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
Linus Torvalds's avatar
Linus Torvalds committed
491
492
493
	}

	switch (register_id) {
Len Brown's avatar
Len Brown committed
494
	case ACPI_REGISTER_PM1_STATUS:	/* 16-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
495

Len Brown's avatar
Len Brown committed
496
497
498
499
		status =
		    acpi_hw_low_level_read(16, &value1,
					   &acpi_gbl_FADT->xpm1a_evt_blk);
		if (ACPI_FAILURE(status)) {
Linus Torvalds's avatar
Linus Torvalds committed
500
501
502
503
504
			goto unlock_and_exit;
		}

		/* PM1B is optional */

Len Brown's avatar
Len Brown committed
505
506
507
		status =
		    acpi_hw_low_level_read(16, &value2,
					   &acpi_gbl_FADT->xpm1b_evt_blk);
Linus Torvalds's avatar
Linus Torvalds committed
508
509
510
		value1 |= value2;
		break;

Len Brown's avatar
Len Brown committed
511
	case ACPI_REGISTER_PM1_ENABLE:	/* 16-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
512

Len Brown's avatar
Len Brown committed
513
514
515
		status =
		    acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable);
		if (ACPI_FAILURE(status)) {
Linus Torvalds's avatar
Linus Torvalds committed
516
517
518
519
520
			goto unlock_and_exit;
		}

		/* PM1B is optional */

Len Brown's avatar
Len Brown committed
521
522
		status =
		    acpi_hw_low_level_read(16, &value2, &acpi_gbl_xpm1b_enable);
Linus Torvalds's avatar
Linus Torvalds committed
523
524
525
		value1 |= value2;
		break;

Len Brown's avatar
Len Brown committed
526
	case ACPI_REGISTER_PM1_CONTROL:	/* 16-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
527

Len Brown's avatar
Len Brown committed
528
529
530
531
		status =
		    acpi_hw_low_level_read(16, &value1,
					   &acpi_gbl_FADT->xpm1a_cnt_blk);
		if (ACPI_FAILURE(status)) {
Linus Torvalds's avatar
Linus Torvalds committed
532
533
534
			goto unlock_and_exit;
		}

Len Brown's avatar
Len Brown committed
535
536
537
		status =
		    acpi_hw_low_level_read(16, &value2,
					   &acpi_gbl_FADT->xpm1b_cnt_blk);
Linus Torvalds's avatar
Linus Torvalds committed
538
539
540
		value1 |= value2;
		break;

Len Brown's avatar
Len Brown committed
541
	case ACPI_REGISTER_PM2_CONTROL:	/* 8-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
542

Len Brown's avatar
Len Brown committed
543
544
545
		status =
		    acpi_hw_low_level_read(8, &value1,
					   &acpi_gbl_FADT->xpm2_cnt_blk);
Linus Torvalds's avatar
Linus Torvalds committed
546
547
		break;

Len Brown's avatar
Len Brown committed
548
	case ACPI_REGISTER_PM_TIMER:	/* 32-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
549

Len Brown's avatar
Len Brown committed
550
551
552
		status =
		    acpi_hw_low_level_read(32, &value1,
					   &acpi_gbl_FADT->xpm_tmr_blk);
Linus Torvalds's avatar
Linus Torvalds committed
553
554
		break;

Len Brown's avatar
Len Brown committed
555
	case ACPI_REGISTER_SMI_COMMAND_BLOCK:	/* 8-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
556

Len Brown's avatar
Len Brown committed
557
		status = acpi_os_read_port(acpi_gbl_FADT->smi_cmd, &value1, 8);
Linus Torvalds's avatar
Linus Torvalds committed
558
559
560
		break;

	default:
Bob Moore's avatar
Bob Moore committed
561
		ACPI_ERROR((AE_INFO, "Unknown Register ID: %X", register_id));
Linus Torvalds's avatar
Linus Torvalds committed
562
563
564
565
		status = AE_BAD_PARAMETER;
		break;
	}

Len Brown's avatar
Len Brown committed
566
      unlock_and_exit:
Linus Torvalds's avatar
Linus Torvalds committed
567
	if (ACPI_MTX_LOCK == use_lock) {
Bob Moore's avatar
Bob Moore committed
568
		acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
Linus Torvalds's avatar
Linus Torvalds committed
569
570
	}

Len Brown's avatar
Len Brown committed
571
	if (ACPI_SUCCESS(status)) {
Linus Torvalds's avatar
Linus Torvalds committed
572
573
574
		*return_value = value1;
	}

Len Brown's avatar
Len Brown committed
575
	return_ACPI_STATUS(status);
Linus Torvalds's avatar
Linus Torvalds committed
576
577
578
579
580
581
}

/******************************************************************************
 *
 * FUNCTION:    acpi_hw_register_write
 *
Bob Moore's avatar
Bob Moore committed
582
583
 * PARAMETERS:  use_lock            - Lock hardware? True/False
 *              register_id         - ACPI Register ID
Linus Torvalds's avatar
Linus Torvalds committed
584
585
586
587
 *              Value               - The value to write
 *
 * RETURN:      Status
 *
Bob Moore's avatar
Bob Moore committed
588
589
590
591
592
593
594
595
596
597
598
599
600
601
 * DESCRIPTION: Write to the specified ACPI register
 *
 * NOTE: In accordance with the ACPI specification, this function automatically
 * preserves the value of the following bits, meaning that these bits cannot be
 * changed via this interface:
 *
 * PM1_CONTROL[0] = SCI_EN
 * PM1_CONTROL[9]
 * PM1_STATUS[11]
 *
 * ACPI References:
 * 1) Hardware Ignored Bits: When software writes to a register with ignored
 *      bit fields, it preserves the ignored bit fields
 * 2) SCI_EN: OSPM always preserves this bit position
Linus Torvalds's avatar
Linus Torvalds committed
602
603
604
 *
 ******************************************************************************/

Len Brown's avatar
Len Brown committed
605
acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
Linus Torvalds's avatar
Linus Torvalds committed
606
{
Len Brown's avatar
Len Brown committed
607
	acpi_status status;
Bob Moore's avatar
Bob Moore committed
608
	acpi_cpu_flags lock_flags = 0;
Bob Moore's avatar
Bob Moore committed
609
	u32 read_value;
Linus Torvalds's avatar
Linus Torvalds committed
610

Bob Moore's avatar
Bob Moore committed
611
	ACPI_FUNCTION_TRACE(hw_register_write);
Linus Torvalds's avatar
Linus Torvalds committed
612
613

	if (ACPI_MTX_LOCK == use_lock) {
Bob Moore's avatar
Bob Moore committed
614
		lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
Linus Torvalds's avatar
Linus Torvalds committed
615
616
617
	}

	switch (register_id) {
Len Brown's avatar
Len Brown committed
618
	case ACPI_REGISTER_PM1_STATUS:	/* 16-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
619

Bob Moore's avatar
Bob Moore committed
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
		/* Perform a read first to preserve certain bits (per ACPI spec) */

		status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
					       ACPI_REGISTER_PM1_STATUS,
					       &read_value);
		if (ACPI_FAILURE(status)) {
			goto unlock_and_exit;
		}

		/* Insert the bits to be preserved */

		ACPI_INSERT_BITS(value, ACPI_PM1_STATUS_PRESERVED_BITS,
				 read_value);

		/* Now we can write the data */

Len Brown's avatar
Len Brown committed
636
637
638
639
		status =
		    acpi_hw_low_level_write(16, value,
					    &acpi_gbl_FADT->xpm1a_evt_blk);
		if (ACPI_FAILURE(status)) {
Linus Torvalds's avatar
Linus Torvalds committed
640
641
642
643
644
			goto unlock_and_exit;
		}

		/* PM1B is optional */

Len Brown's avatar
Len Brown committed
645
646
647
		status =
		    acpi_hw_low_level_write(16, value,
					    &acpi_gbl_FADT->xpm1b_evt_blk);
Linus Torvalds's avatar
Linus Torvalds committed
648
649
		break;

Len Brown's avatar
Len Brown committed
650
	case ACPI_REGISTER_PM1_ENABLE:	/* 16-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
651

Len Brown's avatar
Len Brown committed
652
653
654
		status =
		    acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable);
		if (ACPI_FAILURE(status)) {
Linus Torvalds's avatar
Linus Torvalds committed
655
656
657
658
659
			goto unlock_and_exit;
		}

		/* PM1B is optional */

Len Brown's avatar
Len Brown committed
660
661
		status =
		    acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1b_enable);
Linus Torvalds's avatar
Linus Torvalds committed
662
663
		break;

Len Brown's avatar
Len Brown committed
664
	case ACPI_REGISTER_PM1_CONTROL:	/* 16-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
665

Bob Moore's avatar
Bob Moore committed
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
		/*
		 * Perform a read first to preserve certain bits (per ACPI spec)
		 */
		status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
					       ACPI_REGISTER_PM1_CONTROL,
					       &read_value);
		if (ACPI_FAILURE(status)) {
			goto unlock_and_exit;
		}

		/* Insert the bits to be preserved */

		ACPI_INSERT_BITS(value, ACPI_PM1_CONTROL_PRESERVED_BITS,
				 read_value);

		/* Now we can write the data */

Len Brown's avatar
Len Brown committed
683
684
685
686
		status =
		    acpi_hw_low_level_write(16, value,
					    &acpi_gbl_FADT->xpm1a_cnt_blk);
		if (ACPI_FAILURE(status)) {
Linus Torvalds's avatar
Linus Torvalds committed
687
688
689
			goto unlock_and_exit;
		}

Len Brown's avatar
Len Brown committed
690
691
692
		status =
		    acpi_hw_low_level_write(16, value,
					    &acpi_gbl_FADT->xpm1b_cnt_blk);
Linus Torvalds's avatar
Linus Torvalds committed
693
694
		break;

Len Brown's avatar
Len Brown committed
695
	case ACPI_REGISTER_PM1A_CONTROL:	/* 16-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
696

Len Brown's avatar
Len Brown committed
697
698
699
		status =
		    acpi_hw_low_level_write(16, value,
					    &acpi_gbl_FADT->xpm1a_cnt_blk);
Linus Torvalds's avatar
Linus Torvalds committed
700
701
		break;

Len Brown's avatar
Len Brown committed
702
	case ACPI_REGISTER_PM1B_CONTROL:	/* 16-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
703

Len Brown's avatar
Len Brown committed
704
705
706
		status =
		    acpi_hw_low_level_write(16, value,
					    &acpi_gbl_FADT->xpm1b_cnt_blk);
Linus Torvalds's avatar
Linus Torvalds committed
707
708
		break;

Len Brown's avatar
Len Brown committed
709
	case ACPI_REGISTER_PM2_CONTROL:	/* 8-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
710

Len Brown's avatar
Len Brown committed
711
712
713
		status =
		    acpi_hw_low_level_write(8, value,
					    &acpi_gbl_FADT->xpm2_cnt_blk);
Linus Torvalds's avatar
Linus Torvalds committed
714
715
		break;

Len Brown's avatar
Len Brown committed
716
	case ACPI_REGISTER_PM_TIMER:	/* 32-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
717

Len Brown's avatar
Len Brown committed
718
719
720
		status =
		    acpi_hw_low_level_write(32, value,
					    &acpi_gbl_FADT->xpm_tmr_blk);
Linus Torvalds's avatar
Linus Torvalds committed
721
722
		break;

Len Brown's avatar
Len Brown committed
723
	case ACPI_REGISTER_SMI_COMMAND_BLOCK:	/* 8-bit access */
Linus Torvalds's avatar
Linus Torvalds committed
724
725
726

		/* SMI_CMD is currently always in IO space */

Len Brown's avatar
Len Brown committed
727
		status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, value, 8);
Linus Torvalds's avatar
Linus Torvalds committed
728
729
730
731
732
733
734
		break;

	default:
		status = AE_BAD_PARAMETER;
		break;
	}

Len Brown's avatar
Len Brown committed
735
      unlock_and_exit:
Linus Torvalds's avatar
Linus Torvalds committed
736
	if (ACPI_MTX_LOCK == use_lock) {
Bob Moore's avatar
Bob Moore committed
737
		acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
Linus Torvalds's avatar
Linus Torvalds committed
738
739
	}

Len Brown's avatar
Len Brown committed
740
	return_ACPI_STATUS(status);
Linus Torvalds's avatar
Linus Torvalds committed
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
}

/******************************************************************************
 *
 * FUNCTION:    acpi_hw_low_level_read
 *
 * PARAMETERS:  Width               - 8, 16, or 32
 *              Value               - Where the value is returned
 *              Reg                 - GAS register structure
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Read from either memory or IO space.
 *
 ******************************************************************************/

acpi_status
Len Brown's avatar
Len Brown committed
758
acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
Linus Torvalds's avatar
Linus Torvalds committed
759
{
Len Brown's avatar
Len Brown committed
760
761
	u64 address;
	acpi_status status;
Linus Torvalds's avatar
Linus Torvalds committed
762

Bob Moore's avatar
Bob Moore committed
763
	ACPI_FUNCTION_NAME(hw_low_level_read);
Linus Torvalds's avatar
Linus Torvalds committed
764
765
766
767
768
769
770
771
772
773

	/*
	 * Must have a valid pointer to a GAS structure, and
	 * a non-zero address within. However, don't return an error
	 * because the PM1A/B code must not fail if B isn't present.
	 */
	if (!reg) {
		return (AE_OK);
	}

Bob Moore's avatar
Bob Moore committed
774
	/* Get a local copy of the address. Handles possible alignment issues */
Linus Torvalds's avatar
Linus Torvalds committed
775

Len Brown's avatar
Len Brown committed
776
	ACPI_MOVE_64_TO_64(&address, &reg->address);
Linus Torvalds's avatar
Linus Torvalds committed
777
778
779
780
781
782
783
784
785
786
787
788
	if (!address) {
		return (AE_OK);
	}
	*value = 0;

	/*
	 * Two address spaces supported: Memory or IO.
	 * PCI_Config is not supported here because the GAS struct is insufficient
	 */
	switch (reg->address_space_id) {
	case ACPI_ADR_SPACE_SYSTEM_MEMORY:

Len Brown's avatar
Len Brown committed
789
790
		status = acpi_os_read_memory((acpi_physical_address) address,
					     value, width);
Linus Torvalds's avatar
Linus Torvalds committed
791
792
793
794
		break;

	case ACPI_ADR_SPACE_SYSTEM_IO:

Len Brown's avatar
Len Brown committed
795
796
		status = acpi_os_read_port((acpi_io_address) address,
					   value, width);
Linus Torvalds's avatar
Linus Torvalds committed
797
798
799
		break;

	default:
Bob Moore's avatar
Bob Moore committed
800
801
802
		ACPI_ERROR((AE_INFO,
			    "Unsupported address space: %X",
			    reg->address_space_id));
Linus Torvalds's avatar
Linus Torvalds committed
803
804
805
		return (AE_BAD_PARAMETER);
	}

Len Brown's avatar
Len Brown committed
806
807
808
809
810
	ACPI_DEBUG_PRINT((ACPI_DB_IO,
			  "Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
			  *value, width,
			  ACPI_FORMAT_UINT64(address),
			  acpi_ut_get_region_name(reg->address_space_id)));
Linus Torvalds's avatar
Linus Torvalds committed
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829

	return (status);
}

/******************************************************************************
 *
 * FUNCTION:    acpi_hw_low_level_write
 *
 * PARAMETERS:  Width               - 8, 16, or 32
 *              Value               - To be written
 *              Reg                 - GAS register structure
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Write to either memory or IO space.
 *
 ******************************************************************************/

acpi_status
Len Brown's avatar
Len Brown committed
830
acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
Linus Torvalds's avatar
Linus Torvalds committed
831
{
Len Brown's avatar
Len Brown committed
832
833
	u64 address;
	acpi_status status;
Linus Torvalds's avatar
Linus Torvalds committed
834

Bob Moore's avatar
Bob Moore committed
835
	ACPI_FUNCTION_NAME(hw_low_level_write);
Linus Torvalds's avatar
Linus Torvalds committed
836
837
838
839
840
841
842
843
844
845

	/*
	 * Must have a valid pointer to a GAS structure, and
	 * a non-zero address within. However, don't return an error
	 * because the PM1A/B code must not fail if B isn't present.
	 */
	if (!reg) {
		return (AE_OK);
	}

Bob Moore's avatar
Bob Moore committed
846
	/* Get a local copy of the address. Handles possible alignment issues */
Linus Torvalds's avatar
Linus Torvalds committed
847

Len Brown's avatar
Len Brown committed
848
	ACPI_MOVE_64_TO_64(&address, &reg->address);
Linus Torvalds's avatar
Linus Torvalds committed
849
850
851
852
853
854
855
856
857
858
859
	if (!address) {
		return (AE_OK);
	}

	/*
	 * Two address spaces supported: Memory or IO.
	 * PCI_Config is not supported here because the GAS struct is insufficient
	 */
	switch (reg->address_space_id) {
	case ACPI_ADR_SPACE_SYSTEM_MEMORY:

Len Brown's avatar
Len Brown committed
860
861
		status = acpi_os_write_memory((acpi_physical_address) address,
					      value, width);
Linus Torvalds's avatar
Linus Torvalds committed
862
863
864
865
		break;

	case ACPI_ADR_SPACE_SYSTEM_IO:

Len Brown's avatar
Len Brown committed
866
867
		status = acpi_os_write_port((acpi_io_address) address,
					    value, width);
Linus Torvalds's avatar
Linus Torvalds committed
868
869
870
		break;

	default:
Bob Moore's avatar
Bob Moore committed
871
872
873
		ACPI_ERROR((AE_INFO,
			    "Unsupported address space: %X",
			    reg->address_space_id));
Linus Torvalds's avatar
Linus Torvalds committed
874
875
876
		return (AE_BAD_PARAMETER);
	}

Len Brown's avatar
Len Brown committed
877
878
879
880
881
	ACPI_DEBUG_PRINT((ACPI_DB_IO,
			  "Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
			  value, width,
			  ACPI_FORMAT_UINT64(address),
			  acpi_ut_get_region_name(reg->address_space_id)));
Linus Torvalds's avatar
Linus Torvalds committed
882
883
884

	return (status);
}