aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rsio.c
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2005-09-16 16:51:15 -0400
committerLen Brown <len.brown@intel.com>2005-09-21 23:51:39 -0400
commitbda663d36b94c723153246a4231bbc0f1cd1836e (patch)
treecc9f75c1d010d1b99d29f13acd600b21eda5eec5 /drivers/acpi/resources/rsio.c
parentefb0372bbaf5b829ff8c39db372779928af542a7 (diff)
[ACPI] ACPICA 20050916
Fixed a problem within the Resource Manager where support for the Generic Register descriptor was not fully implemented. This descriptor is now fully recognized, parsed, disassembled, and displayed. Restructured the Resource Manager code to utilize table-driven dispatch and lookup, eliminating many of the large switch() statements. This reduces overall subsystem code size and code complexity. Affects the resource parsing and construction, disassembly, and debug dump output. Cleaned up and restructured the debug dump output for all resource descriptors. Improved readability of the output and reduced code size. Fixed a problem where changes to internal data structures caused the optional ACPI_MUTEX_DEBUG code to fail compilation if specified. Signed-off-by: Robert Moore <Robert.Moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/resources/rsio.c')
-rw-r--r--drivers/acpi/resources/rsio.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c
index d53bbe89e851..6574e2ae2e52 100644
--- a/drivers/acpi/resources/rsio.c
+++ b/drivers/acpi/resources/rsio.c
@@ -84,7 +84,7 @@ acpi_rs_io_resource(u8 * byte_stream_buffer,
84 84
85 *bytes_consumed = 8; 85 *bytes_consumed = 8;
86 86
87 output_struct->id = ACPI_RSTYPE_IO; 87 output_struct->type = ACPI_RSTYPE_IO;
88 88
89 /* Check Decode */ 89 /* Check Decode */
90 90
@@ -170,7 +170,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
170 170
171 *bytes_consumed = 4; 171 *bytes_consumed = 4;
172 172
173 output_struct->id = ACPI_RSTYPE_FIXED_IO; 173 output_struct->type = ACPI_RSTYPE_FIXED_IO;
174 174
175 /* Check Range Base Address */ 175 /* Check Range Base Address */
176 176
@@ -200,7 +200,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
200 * 200 *
201 * FUNCTION: acpi_rs_io_stream 201 * FUNCTION: acpi_rs_io_stream
202 * 202 *
203 * PARAMETERS: linked_list - Pointer to the resource linked list 203 * PARAMETERS: Resource - Pointer to the resource linked list
204 * output_buffer - Pointer to the user's return buffer 204 * output_buffer - Pointer to the user's return buffer
205 * bytes_consumed - Pointer to where the number of bytes 205 * bytes_consumed - Pointer to where the number of bytes
206 * used in the output_buffer is returned 206 * used in the output_buffer is returned
@@ -213,7 +213,7 @@ acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
213 ******************************************************************************/ 213 ******************************************************************************/
214 214
215acpi_status 215acpi_status
216acpi_rs_io_stream(struct acpi_resource *linked_list, 216acpi_rs_io_stream(struct acpi_resource *resource,
217 u8 ** output_buffer, acpi_size * bytes_consumed) 217 u8 ** output_buffer, acpi_size * bytes_consumed)
218{ 218{
219 u8 *buffer = *output_buffer; 219 u8 *buffer = *output_buffer;
@@ -222,42 +222,42 @@ acpi_rs_io_stream(struct acpi_resource *linked_list,
222 222
223 ACPI_FUNCTION_TRACE("rs_io_stream"); 223 ACPI_FUNCTION_TRACE("rs_io_stream");
224 224
225 /* The descriptor field is static */ 225 /* The Descriptor Type field is static */
226 226
227 *buffer = 0x47; 227 *buffer = ACPI_RDESC_TYPE_IO_PORT | 0x07;
228 buffer += 1; 228 buffer += 1;
229 229
230 /* Io Information Byte */ 230 /* Io Information Byte */
231 231
232 temp8 = (u8) (linked_list->data.io.io_decode & 0x01); 232 temp8 = (u8) (resource->data.io.io_decode & 0x01);
233 233
234 *buffer = temp8; 234 *buffer = temp8;
235 buffer += 1; 235 buffer += 1;
236 236
237 /* Set the Range minimum base address */ 237 /* Set the Range minimum base address */
238 238
239 temp16 = (u16) linked_list->data.io.min_base_address; 239 temp16 = (u16) resource->data.io.min_base_address;
240 240
241 ACPI_MOVE_16_TO_16(buffer, &temp16); 241 ACPI_MOVE_16_TO_16(buffer, &temp16);
242 buffer += 2; 242 buffer += 2;
243 243
244 /* Set the Range maximum base address */ 244 /* Set the Range maximum base address */
245 245
246 temp16 = (u16) linked_list->data.io.max_base_address; 246 temp16 = (u16) resource->data.io.max_base_address;
247 247
248 ACPI_MOVE_16_TO_16(buffer, &temp16); 248 ACPI_MOVE_16_TO_16(buffer, &temp16);
249 buffer += 2; 249 buffer += 2;
250 250
251 /* Set the base alignment */ 251 /* Set the base alignment */
252 252
253 temp8 = (u8) linked_list->data.io.alignment; 253 temp8 = (u8) resource->data.io.alignment;
254 254
255 *buffer = temp8; 255 *buffer = temp8;
256 buffer += 1; 256 buffer += 1;
257 257
258 /* Set the range length */ 258 /* Set the range length */
259 259
260 temp8 = (u8) linked_list->data.io.range_length; 260 temp8 = (u8) resource->data.io.range_length;
261 261
262 *buffer = temp8; 262 *buffer = temp8;
263 buffer += 1; 263 buffer += 1;
@@ -272,7 +272,7 @@ acpi_rs_io_stream(struct acpi_resource *linked_list,
272 * 272 *
273 * FUNCTION: acpi_rs_fixed_io_stream 273 * FUNCTION: acpi_rs_fixed_io_stream
274 * 274 *
275 * PARAMETERS: linked_list - Pointer to the resource linked list 275 * PARAMETERS: Resource - Pointer to the resource linked list
276 * output_buffer - Pointer to the user's return buffer 276 * output_buffer - Pointer to the user's return buffer
277 * bytes_consumed - Pointer to where the number of bytes 277 * bytes_consumed - Pointer to where the number of bytes
278 * used in the output_buffer is returned 278 * used in the output_buffer is returned
@@ -285,7 +285,7 @@ acpi_rs_io_stream(struct acpi_resource *linked_list,
285 ******************************************************************************/ 285 ******************************************************************************/
286 286
287acpi_status 287acpi_status
288acpi_rs_fixed_io_stream(struct acpi_resource *linked_list, 288acpi_rs_fixed_io_stream(struct acpi_resource *resource,
289 u8 ** output_buffer, acpi_size * bytes_consumed) 289 u8 ** output_buffer, acpi_size * bytes_consumed)
290{ 290{
291 u8 *buffer = *output_buffer; 291 u8 *buffer = *output_buffer;
@@ -294,22 +294,21 @@ acpi_rs_fixed_io_stream(struct acpi_resource *linked_list,
294 294
295 ACPI_FUNCTION_TRACE("rs_fixed_io_stream"); 295 ACPI_FUNCTION_TRACE("rs_fixed_io_stream");
296 296
297 /* The descriptor field is static */ 297 /* The Descriptor Type field is static */
298
299 *buffer = 0x4B;
300 298
299 *buffer = ACPI_RDESC_TYPE_FIXED_IO_PORT | 0x03;
301 buffer += 1; 300 buffer += 1;
302 301
303 /* Set the Range base address */ 302 /* Set the Range base address */
304 303
305 temp16 = (u16) linked_list->data.fixed_io.base_address; 304 temp16 = (u16) resource->data.fixed_io.base_address;
306 305
307 ACPI_MOVE_16_TO_16(buffer, &temp16); 306 ACPI_MOVE_16_TO_16(buffer, &temp16);
308 buffer += 2; 307 buffer += 2;
309 308
310 /* Set the range length */ 309 /* Set the range length */
311 310
312 temp8 = (u8) linked_list->data.fixed_io.range_length; 311 temp8 = (u8) resource->data.fixed_io.range_length;
313 312
314 *buffer = temp8; 313 *buffer = temp8;
315 buffer += 1; 314 buffer += 1;
@@ -358,7 +357,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer,
358 /* The number of bytes consumed are Constant */ 357 /* The number of bytes consumed are Constant */
359 358
360 *bytes_consumed = 3; 359 *bytes_consumed = 3;
361 output_struct->id = ACPI_RSTYPE_DMA; 360 output_struct->type = ACPI_RSTYPE_DMA;
362 361
363 /* Point to the 8-bits of Byte 1 */ 362 /* Point to the 8-bits of Byte 1 */
364 363
@@ -420,7 +419,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer,
420 * 419 *
421 * FUNCTION: acpi_rs_dma_stream 420 * FUNCTION: acpi_rs_dma_stream
422 * 421 *
423 * PARAMETERS: linked_list - Pointer to the resource linked list 422 * PARAMETERS: Resource - Pointer to the resource linked list
424 * output_buffer - Pointer to the user's return buffer 423 * output_buffer - Pointer to the user's return buffer
425 * bytes_consumed - Pointer to where the number of bytes 424 * bytes_consumed - Pointer to where the number of bytes
426 * used in the output_buffer is returned 425 * used in the output_buffer is returned
@@ -433,7 +432,7 @@ acpi_rs_dma_resource(u8 * byte_stream_buffer,
433 ******************************************************************************/ 432 ******************************************************************************/
434 433
435acpi_status 434acpi_status
436acpi_rs_dma_stream(struct acpi_resource *linked_list, 435acpi_rs_dma_stream(struct acpi_resource *resource,
437 u8 ** output_buffer, acpi_size * bytes_consumed) 436 u8 ** output_buffer, acpi_size * bytes_consumed)
438{ 437{
439 u8 *buffer = *output_buffer; 438 u8 *buffer = *output_buffer;
@@ -443,17 +442,16 @@ acpi_rs_dma_stream(struct acpi_resource *linked_list,
443 442
444 ACPI_FUNCTION_TRACE("rs_dma_stream"); 443 ACPI_FUNCTION_TRACE("rs_dma_stream");
445 444
446 /* The descriptor field is static */ 445 /* The Descriptor Type field is static */
447 446
448 *buffer = 0x2A; 447 *buffer = ACPI_RDESC_TYPE_DMA_FORMAT | 0x02;
449 buffer += 1; 448 buffer += 1;
450 temp8 = 0; 449 temp8 = 0;
451 450
452 /* Loop through all of the Channels and set the mask bits */ 451 /* Loop through all of the Channels and set the mask bits */
453 452
454 for (index = 0; 453 for (index = 0; index < resource->data.dma.number_of_channels; index++) {
455 index < linked_list->data.dma.number_of_channels; index++) { 454 temp16 = (u16) resource->data.dma.channels[index];
456 temp16 = (u16) linked_list->data.dma.channels[index];
457 temp8 |= 0x1 << temp16; 455 temp8 |= 0x1 << temp16;
458 } 456 }
459 457
@@ -462,9 +460,9 @@ acpi_rs_dma_stream(struct acpi_resource *linked_list,
462 460
463 /* Set the DMA Info */ 461 /* Set the DMA Info */
464 462
465 temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5); 463 temp8 = (u8) ((resource->data.dma.type & 0x03) << 5);
466 temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2); 464 temp8 |= ((resource->data.dma.bus_master & 0x01) << 2);
467 temp8 |= (linked_list->data.dma.transfer & 0x03); 465 temp8 |= (resource->data.dma.transfer & 0x03);
468 466
469 *buffer = temp8; 467 *buffer = temp8;
470 buffer += 1; 468 buffer += 1;