diff options
author | Thomas Gleixner <tglx@tglx.tec.linutronix.de> | 2005-07-13 04:45:00 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-07-13 04:45:00 -0400 |
commit | 1b3035b7fcc72b6b36f2a3634dad832eb2453ce8 (patch) | |
tree | 728174d72943cc9b981a5843553551df62eddc41 /drivers/acpi/resources/rsio.c | |
parent | a98a5d04f400ad112e59cadd739dbabf89417e60 (diff) | |
parent | c32511e2718618f0b53479eb36e07439aa363a74 (diff) |
Merge with rsync://fileserver/linux
Diffstat (limited to 'drivers/acpi/resources/rsio.c')
-rw-r--r-- | drivers/acpi/resources/rsio.c | 197 |
1 files changed, 82 insertions, 115 deletions
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index 972c746d37e4..23a4d149fac8 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c | |||
@@ -81,67 +81,60 @@ acpi_rs_io_resource ( | |||
81 | struct acpi_resource *output_struct = (void *) *output_buffer; | 81 | struct acpi_resource *output_struct = (void *) *output_buffer; |
82 | u16 temp16 = 0; | 82 | u16 temp16 = 0; |
83 | u8 temp8 = 0; | 83 | u8 temp8 = 0; |
84 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_io); | 84 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
85 | struct acpi_resource_io); | ||
85 | 86 | ||
86 | 87 | ||
87 | ACPI_FUNCTION_TRACE ("rs_io_resource"); | 88 | ACPI_FUNCTION_TRACE ("rs_io_resource"); |
88 | 89 | ||
89 | 90 | ||
90 | /* | 91 | /* The number of bytes consumed are Constant */ |
91 | * The number of bytes consumed are Constant | 92 | |
92 | */ | ||
93 | *bytes_consumed = 8; | 93 | *bytes_consumed = 8; |
94 | 94 | ||
95 | output_struct->id = ACPI_RSTYPE_IO; | 95 | output_struct->id = ACPI_RSTYPE_IO; |
96 | 96 | ||
97 | /* | 97 | /* Check Decode */ |
98 | * Check Decode | 98 | |
99 | */ | ||
100 | buffer += 1; | 99 | buffer += 1; |
101 | temp8 = *buffer; | 100 | temp8 = *buffer; |
102 | 101 | ||
103 | output_struct->data.io.io_decode = temp8 & 0x01; | 102 | output_struct->data.io.io_decode = temp8 & 0x01; |
104 | 103 | ||
105 | /* | 104 | /* Check min_base Address */ |
106 | * Check min_base Address | 105 | |
107 | */ | ||
108 | buffer += 1; | 106 | buffer += 1; |
109 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 107 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
110 | 108 | ||
111 | output_struct->data.io.min_base_address = temp16; | 109 | output_struct->data.io.min_base_address = temp16; |
112 | 110 | ||
113 | /* | 111 | /* Check max_base Address */ |
114 | * Check max_base Address | 112 | |
115 | */ | ||
116 | buffer += 2; | 113 | buffer += 2; |
117 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 114 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
118 | 115 | ||
119 | output_struct->data.io.max_base_address = temp16; | 116 | output_struct->data.io.max_base_address = temp16; |
120 | 117 | ||
121 | /* | 118 | /* Check Base alignment */ |
122 | * Check Base alignment | 119 | |
123 | */ | ||
124 | buffer += 2; | 120 | buffer += 2; |
125 | temp8 = *buffer; | 121 | temp8 = *buffer; |
126 | 122 | ||
127 | output_struct->data.io.alignment = temp8; | 123 | output_struct->data.io.alignment = temp8; |
128 | 124 | ||
129 | /* | 125 | /* Check range_length */ |
130 | * Check range_length | 126 | |
131 | */ | ||
132 | buffer += 1; | 127 | buffer += 1; |
133 | temp8 = *buffer; | 128 | temp8 = *buffer; |
134 | 129 | ||
135 | output_struct->data.io.range_length = temp8; | 130 | output_struct->data.io.range_length = temp8; |
136 | 131 | ||
137 | /* | 132 | /* Set the Length parameter */ |
138 | * Set the Length parameter | 133 | |
139 | */ | ||
140 | output_struct->length = (u32) struct_size; | 134 | output_struct->length = (u32) struct_size; |
141 | 135 | ||
142 | /* | 136 | /* Return the final size of the structure */ |
143 | * Return the final size of the structure | 137 | |
144 | */ | ||
145 | *structure_size = struct_size; | 138 | *structure_size = struct_size; |
146 | return_ACPI_STATUS (AE_OK); | 139 | return_ACPI_STATUS (AE_OK); |
147 | } | 140 | } |
@@ -179,43 +172,39 @@ acpi_rs_fixed_io_resource ( | |||
179 | struct acpi_resource *output_struct = (void *) *output_buffer; | 172 | struct acpi_resource *output_struct = (void *) *output_buffer; |
180 | u16 temp16 = 0; | 173 | u16 temp16 = 0; |
181 | u8 temp8 = 0; | 174 | u8 temp8 = 0; |
182 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_io); | 175 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
176 | struct acpi_resource_fixed_io); | ||
183 | 177 | ||
184 | 178 | ||
185 | ACPI_FUNCTION_TRACE ("rs_fixed_io_resource"); | 179 | ACPI_FUNCTION_TRACE ("rs_fixed_io_resource"); |
186 | 180 | ||
187 | 181 | ||
188 | /* | 182 | /* The number of bytes consumed are Constant */ |
189 | * The number of bytes consumed are Constant | 183 | |
190 | */ | ||
191 | *bytes_consumed = 4; | 184 | *bytes_consumed = 4; |
192 | 185 | ||
193 | output_struct->id = ACPI_RSTYPE_FIXED_IO; | 186 | output_struct->id = ACPI_RSTYPE_FIXED_IO; |
194 | 187 | ||
195 | /* | 188 | /* Check Range Base Address */ |
196 | * Check Range Base Address | 189 | |
197 | */ | ||
198 | buffer += 1; | 190 | buffer += 1; |
199 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 191 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
200 | 192 | ||
201 | output_struct->data.fixed_io.base_address = temp16; | 193 | output_struct->data.fixed_io.base_address = temp16; |
202 | 194 | ||
203 | /* | 195 | /* Check range_length */ |
204 | * Check range_length | 196 | |
205 | */ | ||
206 | buffer += 2; | 197 | buffer += 2; |
207 | temp8 = *buffer; | 198 | temp8 = *buffer; |
208 | 199 | ||
209 | output_struct->data.fixed_io.range_length = temp8; | 200 | output_struct->data.fixed_io.range_length = temp8; |
210 | 201 | ||
211 | /* | 202 | /* Set the Length parameter */ |
212 | * Set the Length parameter | 203 | |
213 | */ | ||
214 | output_struct->length = (u32) struct_size; | 204 | output_struct->length = (u32) struct_size; |
215 | 205 | ||
216 | /* | 206 | /* Return the final size of the structure */ |
217 | * Return the final size of the structure | 207 | |
218 | */ | ||
219 | *structure_size = struct_size; | 208 | *structure_size = struct_size; |
220 | return_ACPI_STATUS (AE_OK); | 209 | return_ACPI_STATUS (AE_OK); |
221 | } | 210 | } |
@@ -251,55 +240,48 @@ acpi_rs_io_stream ( | |||
251 | ACPI_FUNCTION_TRACE ("rs_io_stream"); | 240 | ACPI_FUNCTION_TRACE ("rs_io_stream"); |
252 | 241 | ||
253 | 242 | ||
254 | /* | 243 | /* The descriptor field is static */ |
255 | * The descriptor field is static | 244 | |
256 | */ | ||
257 | *buffer = 0x47; | 245 | *buffer = 0x47; |
258 | buffer += 1; | 246 | buffer += 1; |
259 | 247 | ||
260 | /* | 248 | /* Io Information Byte */ |
261 | * Io Information Byte | 249 | |
262 | */ | ||
263 | temp8 = (u8) (linked_list->data.io.io_decode & 0x01); | 250 | temp8 = (u8) (linked_list->data.io.io_decode & 0x01); |
264 | 251 | ||
265 | *buffer = temp8; | 252 | *buffer = temp8; |
266 | buffer += 1; | 253 | buffer += 1; |
267 | 254 | ||
268 | /* | 255 | /* Set the Range minimum base address */ |
269 | * Set the Range minimum base address | 256 | |
270 | */ | ||
271 | temp16 = (u16) linked_list->data.io.min_base_address; | 257 | temp16 = (u16) linked_list->data.io.min_base_address; |
272 | 258 | ||
273 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 259 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
274 | buffer += 2; | 260 | buffer += 2; |
275 | 261 | ||
276 | /* | 262 | /* Set the Range maximum base address */ |
277 | * Set the Range maximum base address | 263 | |
278 | */ | ||
279 | temp16 = (u16) linked_list->data.io.max_base_address; | 264 | temp16 = (u16) linked_list->data.io.max_base_address; |
280 | 265 | ||
281 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 266 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
282 | buffer += 2; | 267 | buffer += 2; |
283 | 268 | ||
284 | /* | 269 | /* Set the base alignment */ |
285 | * Set the base alignment | 270 | |
286 | */ | ||
287 | temp8 = (u8) linked_list->data.io.alignment; | 271 | temp8 = (u8) linked_list->data.io.alignment; |
288 | 272 | ||
289 | *buffer = temp8; | 273 | *buffer = temp8; |
290 | buffer += 1; | 274 | buffer += 1; |
291 | 275 | ||
292 | /* | 276 | /* Set the range length */ |
293 | * Set the range length | 277 | |
294 | */ | ||
295 | temp8 = (u8) linked_list->data.io.range_length; | 278 | temp8 = (u8) linked_list->data.io.range_length; |
296 | 279 | ||
297 | *buffer = temp8; | 280 | *buffer = temp8; |
298 | buffer += 1; | 281 | buffer += 1; |
299 | 282 | ||
300 | /* | 283 | /* Return the number of bytes consumed in this operation */ |
301 | * Return the number of bytes consumed in this operation | 284 | |
302 | */ | ||
303 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 285 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
304 | return_ACPI_STATUS (AE_OK); | 286 | return_ACPI_STATUS (AE_OK); |
305 | } | 287 | } |
@@ -335,32 +317,28 @@ acpi_rs_fixed_io_stream ( | |||
335 | ACPI_FUNCTION_TRACE ("rs_fixed_io_stream"); | 317 | ACPI_FUNCTION_TRACE ("rs_fixed_io_stream"); |
336 | 318 | ||
337 | 319 | ||
338 | /* | 320 | /* The descriptor field is static */ |
339 | * The descriptor field is static | 321 | |
340 | */ | ||
341 | *buffer = 0x4B; | 322 | *buffer = 0x4B; |
342 | 323 | ||
343 | buffer += 1; | 324 | buffer += 1; |
344 | 325 | ||
345 | /* | 326 | /* Set the Range base address */ |
346 | * Set the Range base address | 327 | |
347 | */ | ||
348 | temp16 = (u16) linked_list->data.fixed_io.base_address; | 328 | temp16 = (u16) linked_list->data.fixed_io.base_address; |
349 | 329 | ||
350 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 330 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
351 | buffer += 2; | 331 | buffer += 2; |
352 | 332 | ||
353 | /* | 333 | /* Set the range length */ |
354 | * Set the range length | 334 | |
355 | */ | ||
356 | temp8 = (u8) linked_list->data.fixed_io.range_length; | 335 | temp8 = (u8) linked_list->data.fixed_io.range_length; |
357 | 336 | ||
358 | *buffer = temp8; | 337 | *buffer = temp8; |
359 | buffer += 1; | 338 | buffer += 1; |
360 | 339 | ||
361 | /* | 340 | /* Return the number of bytes consumed in this operation */ |
362 | * Return the number of bytes consumed in this operation | 341 | |
363 | */ | ||
364 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 342 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
365 | return_ACPI_STATUS (AE_OK); | 343 | return_ACPI_STATUS (AE_OK); |
366 | } | 344 | } |
@@ -399,21 +377,20 @@ acpi_rs_dma_resource ( | |||
399 | u8 temp8 = 0; | 377 | u8 temp8 = 0; |
400 | u8 index; | 378 | u8 index; |
401 | u8 i; | 379 | u8 i; |
402 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_dma); | 380 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
381 | struct acpi_resource_dma); | ||
403 | 382 | ||
404 | 383 | ||
405 | ACPI_FUNCTION_TRACE ("rs_dma_resource"); | 384 | ACPI_FUNCTION_TRACE ("rs_dma_resource"); |
406 | 385 | ||
407 | 386 | ||
408 | /* | 387 | /* The number of bytes consumed are Constant */ |
409 | * The number of bytes consumed are Constant | 388 | |
410 | */ | ||
411 | *bytes_consumed = 3; | 389 | *bytes_consumed = 3; |
412 | output_struct->id = ACPI_RSTYPE_DMA; | 390 | output_struct->id = ACPI_RSTYPE_DMA; |
413 | 391 | ||
414 | /* | 392 | /* Point to the 8-bits of Byte 1 */ |
415 | * Point to the 8-bits of Byte 1 | 393 | |
416 | */ | ||
417 | buffer += 1; | 394 | buffer += 1; |
418 | temp8 = *buffer; | 395 | temp8 = *buffer; |
419 | 396 | ||
@@ -430,46 +407,40 @@ acpi_rs_dma_resource ( | |||
430 | 407 | ||
431 | output_struct->data.dma.number_of_channels = i; | 408 | output_struct->data.dma.number_of_channels = i; |
432 | if (i > 0) { | 409 | if (i > 0) { |
433 | /* | 410 | /* Calculate the structure size based upon the number of interrupts */ |
434 | * Calculate the structure size based upon the number of interrupts | 411 | |
435 | */ | ||
436 | struct_size += ((acpi_size) i - 1) * 4; | 412 | struct_size += ((acpi_size) i - 1) * 4; |
437 | } | 413 | } |
438 | 414 | ||
439 | /* | 415 | /* Point to Byte 2 */ |
440 | * Point to Byte 2 | 416 | |
441 | */ | ||
442 | buffer += 1; | 417 | buffer += 1; |
443 | temp8 = *buffer; | 418 | temp8 = *buffer; |
444 | 419 | ||
445 | /* | 420 | /* Check for transfer preference (Bits[1:0]) */ |
446 | * Check for transfer preference (Bits[1:0]) | 421 | |
447 | */ | ||
448 | output_struct->data.dma.transfer = temp8 & 0x03; | 422 | output_struct->data.dma.transfer = temp8 & 0x03; |
449 | 423 | ||
450 | if (0x03 == output_struct->data.dma.transfer) { | 424 | if (0x03 == output_struct->data.dma.transfer) { |
451 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid DMA.Transfer preference (3)\n")); | 425 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
426 | "Invalid DMA.Transfer preference (3)\n")); | ||
452 | return_ACPI_STATUS (AE_BAD_DATA); | 427 | return_ACPI_STATUS (AE_BAD_DATA); |
453 | } | 428 | } |
454 | 429 | ||
455 | /* | 430 | /* Get bus master preference (Bit[2]) */ |
456 | * Get bus master preference (Bit[2]) | 431 | |
457 | */ | ||
458 | output_struct->data.dma.bus_master = (temp8 >> 2) & 0x01; | 432 | output_struct->data.dma.bus_master = (temp8 >> 2) & 0x01; |
459 | 433 | ||
460 | /* | 434 | /* Get channel speed support (Bits[6:5]) */ |
461 | * Get channel speed support (Bits[6:5]) | 435 | |
462 | */ | ||
463 | output_struct->data.dma.type = (temp8 >> 5) & 0x03; | 436 | output_struct->data.dma.type = (temp8 >> 5) & 0x03; |
464 | 437 | ||
465 | /* | 438 | /* Set the Length parameter */ |
466 | * Set the Length parameter | 439 | |
467 | */ | ||
468 | output_struct->length = (u32) struct_size; | 440 | output_struct->length = (u32) struct_size; |
469 | 441 | ||
470 | /* | 442 | /* Return the final size of the structure */ |
471 | * Return the final size of the structure | 443 | |
472 | */ | ||
473 | *structure_size = struct_size; | 444 | *structure_size = struct_size; |
474 | return_ACPI_STATUS (AE_OK); | 445 | return_ACPI_STATUS (AE_OK); |
475 | } | 446 | } |
@@ -506,16 +477,14 @@ acpi_rs_dma_stream ( | |||
506 | ACPI_FUNCTION_TRACE ("rs_dma_stream"); | 477 | ACPI_FUNCTION_TRACE ("rs_dma_stream"); |
507 | 478 | ||
508 | 479 | ||
509 | /* | 480 | /* The descriptor field is static */ |
510 | * The descriptor field is static | 481 | |
511 | */ | ||
512 | *buffer = 0x2A; | 482 | *buffer = 0x2A; |
513 | buffer += 1; | 483 | buffer += 1; |
514 | temp8 = 0; | 484 | temp8 = 0; |
515 | 485 | ||
516 | /* | 486 | /* Loop through all of the Channels and set the mask bits */ |
517 | * Loop through all of the Channels and set the mask bits | 487 | |
518 | */ | ||
519 | for (index = 0; | 488 | for (index = 0; |
520 | index < linked_list->data.dma.number_of_channels; | 489 | index < linked_list->data.dma.number_of_channels; |
521 | index++) { | 490 | index++) { |
@@ -526,9 +495,8 @@ acpi_rs_dma_stream ( | |||
526 | *buffer = temp8; | 495 | *buffer = temp8; |
527 | buffer += 1; | 496 | buffer += 1; |
528 | 497 | ||
529 | /* | 498 | /* Set the DMA Info */ |
530 | * Set the DMA Info | 499 | |
531 | */ | ||
532 | temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5); | 500 | temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5); |
533 | temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2); | 501 | temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2); |
534 | temp8 |= (linked_list->data.dma.transfer & 0x03); | 502 | temp8 |= (linked_list->data.dma.transfer & 0x03); |
@@ -536,9 +504,8 @@ acpi_rs_dma_stream ( | |||
536 | *buffer = temp8; | 504 | *buffer = temp8; |
537 | buffer += 1; | 505 | buffer += 1; |
538 | 506 | ||
539 | /* | 507 | /* Return the number of bytes consumed in this operation */ |
540 | * Return the number of bytes consumed in this operation | 508 | |
541 | */ | ||
542 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 509 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
543 | return_ACPI_STATUS (AE_OK); | 510 | return_ACPI_STATUS (AE_OK); |
544 | } | 511 | } |