aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rsio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/resources/rsio.c')
-rw-r--r--drivers/acpi/resources/rsio.c172
1 files changed, 68 insertions, 104 deletions
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c
index 23a4d149fac8..d53bbe89e851 100644
--- a/drivers/acpi/resources/rsio.c
+++ b/drivers/acpi/resources/rsio.c
@@ -41,13 +41,11 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acresrc.h> 45#include <acpi/acresrc.h>
47 46
48#define _COMPONENT ACPI_RESOURCES 47#define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME ("rsio") 48ACPI_MODULE_NAME("rsio")
50
51 49
52/******************************************************************************* 50/*******************************************************************************
53 * 51 *
@@ -69,24 +67,18 @@
69 * number of bytes consumed from the byte stream. 67 * number of bytes consumed from the byte stream.
70 * 68 *
71 ******************************************************************************/ 69 ******************************************************************************/
72
73acpi_status 70acpi_status
74acpi_rs_io_resource ( 71acpi_rs_io_resource(u8 * byte_stream_buffer,
75 u8 *byte_stream_buffer, 72 acpi_size * bytes_consumed,
76 acpi_size *bytes_consumed, 73 u8 ** output_buffer, acpi_size * structure_size)
77 u8 **output_buffer,
78 acpi_size *structure_size)
79{ 74{
80 u8 *buffer = byte_stream_buffer; 75 u8 *buffer = byte_stream_buffer;
81 struct acpi_resource *output_struct = (void *) *output_buffer; 76 struct acpi_resource *output_struct = (void *)*output_buffer;
82 u16 temp16 = 0; 77 u16 temp16 = 0;
83 u8 temp8 = 0; 78 u8 temp8 = 0;
84 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 79 acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io);
85 struct acpi_resource_io);
86
87
88 ACPI_FUNCTION_TRACE ("rs_io_resource");
89 80
81 ACPI_FUNCTION_TRACE("rs_io_resource");
90 82
91 /* The number of bytes consumed are Constant */ 83 /* The number of bytes consumed are Constant */
92 84
@@ -104,14 +96,14 @@ acpi_rs_io_resource (
104 /* Check min_base Address */ 96 /* Check min_base Address */
105 97
106 buffer += 1; 98 buffer += 1;
107 ACPI_MOVE_16_TO_16 (&temp16, buffer); 99 ACPI_MOVE_16_TO_16(&temp16, buffer);
108 100
109 output_struct->data.io.min_base_address = temp16; 101 output_struct->data.io.min_base_address = temp16;
110 102
111 /* Check max_base Address */ 103 /* Check max_base Address */
112 104
113 buffer += 2; 105 buffer += 2;
114 ACPI_MOVE_16_TO_16 (&temp16, buffer); 106 ACPI_MOVE_16_TO_16(&temp16, buffer);
115 107
116 output_struct->data.io.max_base_address = temp16; 108 output_struct->data.io.max_base_address = temp16;
117 109
@@ -136,10 +128,9 @@ acpi_rs_io_resource (
136 /* Return the final size of the structure */ 128 /* Return the final size of the structure */
137 129
138 *structure_size = struct_size; 130 *structure_size = struct_size;
139 return_ACPI_STATUS (AE_OK); 131 return_ACPI_STATUS(AE_OK);
140} 132}
141 133
142
143/******************************************************************************* 134/*******************************************************************************
144 * 135 *
145 * FUNCTION: acpi_rs_fixed_io_resource 136 * FUNCTION: acpi_rs_fixed_io_resource
@@ -162,22 +153,18 @@ acpi_rs_io_resource (
162 ******************************************************************************/ 153 ******************************************************************************/
163 154
164acpi_status 155acpi_status
165acpi_rs_fixed_io_resource ( 156acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
166 u8 *byte_stream_buffer, 157 acpi_size * bytes_consumed,
167 acpi_size *bytes_consumed, 158 u8 ** output_buffer, acpi_size * structure_size)
168 u8 **output_buffer,
169 acpi_size *structure_size)
170{ 159{
171 u8 *buffer = byte_stream_buffer; 160 u8 *buffer = byte_stream_buffer;
172 struct acpi_resource *output_struct = (void *) *output_buffer; 161 struct acpi_resource *output_struct = (void *)*output_buffer;
173 u16 temp16 = 0; 162 u16 temp16 = 0;
174 u8 temp8 = 0; 163 u8 temp8 = 0;
175 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 164 acpi_size struct_size =
176 struct acpi_resource_fixed_io); 165 ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io);
177
178
179 ACPI_FUNCTION_TRACE ("rs_fixed_io_resource");
180 166
167 ACPI_FUNCTION_TRACE("rs_fixed_io_resource");
181 168
182 /* The number of bytes consumed are Constant */ 169 /* The number of bytes consumed are Constant */
183 170
@@ -188,7 +175,7 @@ acpi_rs_fixed_io_resource (
188 /* Check Range Base Address */ 175 /* Check Range Base Address */
189 176
190 buffer += 1; 177 buffer += 1;
191 ACPI_MOVE_16_TO_16 (&temp16, buffer); 178 ACPI_MOVE_16_TO_16(&temp16, buffer);
192 179
193 output_struct->data.fixed_io.base_address = temp16; 180 output_struct->data.fixed_io.base_address = temp16;
194 181
@@ -206,10 +193,9 @@ acpi_rs_fixed_io_resource (
206 /* Return the final size of the structure */ 193 /* Return the final size of the structure */
207 194
208 *structure_size = struct_size; 195 *structure_size = struct_size;
209 return_ACPI_STATUS (AE_OK); 196 return_ACPI_STATUS(AE_OK);
210} 197}
211 198
212
213/******************************************************************************* 199/*******************************************************************************
214 * 200 *
215 * FUNCTION: acpi_rs_io_stream 201 * FUNCTION: acpi_rs_io_stream
@@ -227,18 +213,14 @@ acpi_rs_fixed_io_resource (
227 ******************************************************************************/ 213 ******************************************************************************/
228 214
229acpi_status 215acpi_status
230acpi_rs_io_stream ( 216acpi_rs_io_stream(struct acpi_resource *linked_list,
231 struct acpi_resource *linked_list, 217 u8 ** output_buffer, acpi_size * bytes_consumed)
232 u8 **output_buffer,
233 acpi_size *bytes_consumed)
234{ 218{
235 u8 *buffer = *output_buffer; 219 u8 *buffer = *output_buffer;
236 u16 temp16 = 0; 220 u16 temp16 = 0;
237 u8 temp8 = 0; 221 u8 temp8 = 0;
238
239
240 ACPI_FUNCTION_TRACE ("rs_io_stream");
241 222
223 ACPI_FUNCTION_TRACE("rs_io_stream");
242 224
243 /* The descriptor field is static */ 225 /* The descriptor field is static */
244 226
@@ -256,14 +238,14 @@ acpi_rs_io_stream (
256 238
257 temp16 = (u16) linked_list->data.io.min_base_address; 239 temp16 = (u16) linked_list->data.io.min_base_address;
258 240
259 ACPI_MOVE_16_TO_16 (buffer, &temp16); 241 ACPI_MOVE_16_TO_16(buffer, &temp16);
260 buffer += 2; 242 buffer += 2;
261 243
262 /* Set the Range maximum base address */ 244 /* Set the Range maximum base address */
263 245
264 temp16 = (u16) linked_list->data.io.max_base_address; 246 temp16 = (u16) linked_list->data.io.max_base_address;
265 247
266 ACPI_MOVE_16_TO_16 (buffer, &temp16); 248 ACPI_MOVE_16_TO_16(buffer, &temp16);
267 buffer += 2; 249 buffer += 2;
268 250
269 /* Set the base alignment */ 251 /* Set the base alignment */
@@ -282,11 +264,10 @@ acpi_rs_io_stream (
282 264
283 /* Return the number of bytes consumed in this operation */ 265 /* Return the number of bytes consumed in this operation */
284 266
285 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 267 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
286 return_ACPI_STATUS (AE_OK); 268 return_ACPI_STATUS(AE_OK);
287} 269}
288 270
289
290/******************************************************************************* 271/*******************************************************************************
291 * 272 *
292 * FUNCTION: acpi_rs_fixed_io_stream 273 * FUNCTION: acpi_rs_fixed_io_stream
@@ -304,18 +285,14 @@ acpi_rs_io_stream (
304 ******************************************************************************/ 285 ******************************************************************************/
305 286
306acpi_status 287acpi_status
307acpi_rs_fixed_io_stream ( 288acpi_rs_fixed_io_stream(struct acpi_resource *linked_list,
308 struct acpi_resource *linked_list, 289 u8 ** output_buffer, acpi_size * bytes_consumed)
309 u8 **output_buffer,
310 acpi_size *bytes_consumed)
311{ 290{
312 u8 *buffer = *output_buffer; 291 u8 *buffer = *output_buffer;
313 u16 temp16 = 0; 292 u16 temp16 = 0;
314 u8 temp8 = 0; 293 u8 temp8 = 0;
315
316
317 ACPI_FUNCTION_TRACE ("rs_fixed_io_stream");
318 294
295 ACPI_FUNCTION_TRACE("rs_fixed_io_stream");
319 296
320 /* The descriptor field is static */ 297 /* The descriptor field is static */
321 298
@@ -327,7 +304,7 @@ acpi_rs_fixed_io_stream (
327 304
328 temp16 = (u16) linked_list->data.fixed_io.base_address; 305 temp16 = (u16) linked_list->data.fixed_io.base_address;
329 306
330 ACPI_MOVE_16_TO_16 (buffer, &temp16); 307 ACPI_MOVE_16_TO_16(buffer, &temp16);
331 buffer += 2; 308 buffer += 2;
332 309
333 /* Set the range length */ 310 /* Set the range length */
@@ -339,11 +316,10 @@ acpi_rs_fixed_io_stream (
339 316
340 /* Return the number of bytes consumed in this operation */ 317 /* Return the number of bytes consumed in this operation */
341 318
342 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 319 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
343 return_ACPI_STATUS (AE_OK); 320 return_ACPI_STATUS(AE_OK);
344} 321}
345 322
346
347/******************************************************************************* 323/*******************************************************************************
348 * 324 *
349 * FUNCTION: acpi_rs_dma_resource 325 * FUNCTION: acpi_rs_dma_resource
@@ -366,23 +342,18 @@ acpi_rs_fixed_io_stream (
366 ******************************************************************************/ 342 ******************************************************************************/
367 343
368acpi_status 344acpi_status
369acpi_rs_dma_resource ( 345acpi_rs_dma_resource(u8 * byte_stream_buffer,
370 u8 *byte_stream_buffer, 346 acpi_size * bytes_consumed,
371 acpi_size *bytes_consumed, 347 u8 ** output_buffer, acpi_size * structure_size)
372 u8 **output_buffer,
373 acpi_size *structure_size)
374{ 348{
375 u8 *buffer = byte_stream_buffer; 349 u8 *buffer = byte_stream_buffer;
376 struct acpi_resource *output_struct = (void *) *output_buffer; 350 struct acpi_resource *output_struct = (void *)*output_buffer;
377 u8 temp8 = 0; 351 u8 temp8 = 0;
378 u8 index; 352 u8 index;
379 u8 i; 353 u8 i;
380 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 354 acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma);
381 struct acpi_resource_dma);
382
383
384 ACPI_FUNCTION_TRACE ("rs_dma_resource");
385 355
356 ACPI_FUNCTION_TRACE("rs_dma_resource");
386 357
387 /* The number of bytes consumed are Constant */ 358 /* The number of bytes consumed are Constant */
388 359
@@ -422,9 +393,9 @@ acpi_rs_dma_resource (
422 output_struct->data.dma.transfer = temp8 & 0x03; 393 output_struct->data.dma.transfer = temp8 & 0x03;
423 394
424 if (0x03 == output_struct->data.dma.transfer) { 395 if (0x03 == output_struct->data.dma.transfer) {
425 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 396 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
426 "Invalid DMA.Transfer preference (3)\n")); 397 "Invalid DMA.Transfer preference (3)\n"));
427 return_ACPI_STATUS (AE_BAD_DATA); 398 return_ACPI_STATUS(AE_BAD_DATA);
428 } 399 }
429 400
430 /* Get bus master preference (Bit[2]) */ 401 /* Get bus master preference (Bit[2]) */
@@ -442,10 +413,9 @@ acpi_rs_dma_resource (
442 /* Return the final size of the structure */ 413 /* Return the final size of the structure */
443 414
444 *structure_size = struct_size; 415 *structure_size = struct_size;
445 return_ACPI_STATUS (AE_OK); 416 return_ACPI_STATUS(AE_OK);
446} 417}
447 418
448
449/******************************************************************************* 419/*******************************************************************************
450 * 420 *
451 * FUNCTION: acpi_rs_dma_stream 421 * FUNCTION: acpi_rs_dma_stream
@@ -463,19 +433,15 @@ acpi_rs_dma_resource (
463 ******************************************************************************/ 433 ******************************************************************************/
464 434
465acpi_status 435acpi_status
466acpi_rs_dma_stream ( 436acpi_rs_dma_stream(struct acpi_resource *linked_list,
467 struct acpi_resource *linked_list, 437 u8 ** output_buffer, acpi_size * bytes_consumed)
468 u8 **output_buffer,
469 acpi_size *bytes_consumed)
470{ 438{
471 u8 *buffer = *output_buffer; 439 u8 *buffer = *output_buffer;
472 u16 temp16 = 0; 440 u16 temp16 = 0;
473 u8 temp8 = 0; 441 u8 temp8 = 0;
474 u8 index; 442 u8 index;
475
476
477 ACPI_FUNCTION_TRACE ("rs_dma_stream");
478 443
444 ACPI_FUNCTION_TRACE("rs_dma_stream");
479 445
480 /* The descriptor field is static */ 446 /* The descriptor field is static */
481 447
@@ -486,8 +452,7 @@ acpi_rs_dma_stream (
486 /* Loop through all of the Channels and set the mask bits */ 452 /* Loop through all of the Channels and set the mask bits */
487 453
488 for (index = 0; 454 for (index = 0;
489 index < linked_list->data.dma.number_of_channels; 455 index < linked_list->data.dma.number_of_channels; index++) {
490 index++) {
491 temp16 = (u16) linked_list->data.dma.channels[index]; 456 temp16 = (u16) linked_list->data.dma.channels[index];
492 temp8 |= 0x1 << temp16; 457 temp8 |= 0x1 << temp16;
493 } 458 }
@@ -506,7 +471,6 @@ acpi_rs_dma_stream (
506 471
507 /* Return the number of bytes consumed in this operation */ 472 /* Return the number of bytes consumed in this operation */
508 473
509 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 474 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
510 return_ACPI_STATUS (AE_OK); 475 return_ACPI_STATUS(AE_OK);
511} 476}
512