diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/resources/rsaddr.c | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/resources/rsaddr.c')
-rw-r--r-- | drivers/acpi/resources/rsaddr.c | 503 |
1 files changed, 246 insertions, 257 deletions
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 55d264771c48..4cf46e1ee01b 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.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 ("rsaddr") | 48 | ACPI_MODULE_NAME("rsaddr") |
50 | |||
51 | 49 | ||
52 | /******************************************************************************* | 50 | /******************************************************************************* |
53 | * | 51 | * |
@@ -69,36 +67,31 @@ | |||
69 | * number of bytes consumed from the byte stream. | 67 | * number of bytes consumed from the byte stream. |
70 | * | 68 | * |
71 | ******************************************************************************/ | 69 | ******************************************************************************/ |
72 | |||
73 | acpi_status | 70 | acpi_status |
74 | acpi_rs_address16_resource ( | 71 | acpi_rs_address16_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 | u32 index; | 75 | u32 index; |
81 | u16 temp16; | 76 | u16 temp16; |
82 | u8 temp8; | 77 | u8 temp8; |
83 | u8 *temp_ptr; | 78 | u8 *temp_ptr; |
84 | u8 *buffer = byte_stream_buffer; | 79 | u8 *buffer = byte_stream_buffer; |
85 | struct acpi_resource *output_struct = (void *) *output_buffer; | 80 | struct acpi_resource *output_struct = (void *)*output_buffer; |
86 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( | 81 | acpi_size struct_size = |
87 | struct acpi_resource_address16); | 82 | ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16); |
88 | |||
89 | |||
90 | ACPI_FUNCTION_TRACE ("rs_address16_resource"); | ||
91 | 83 | ||
84 | ACPI_FUNCTION_TRACE("rs_address16_resource"); | ||
92 | 85 | ||
93 | /* Point past the Descriptor to get the number of bytes consumed */ | 86 | /* Point past the Descriptor to get the number of bytes consumed */ |
94 | 87 | ||
95 | buffer += 1; | 88 | buffer += 1; |
96 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 89 | ACPI_MOVE_16_TO_16(&temp16, buffer); |
97 | 90 | ||
98 | /* Validate minimum descriptor length */ | 91 | /* Validate minimum descriptor length */ |
99 | 92 | ||
100 | if (temp16 < 13) { | 93 | if (temp16 < 13) { |
101 | return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); | 94 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); |
102 | } | 95 | } |
103 | 96 | ||
104 | *bytes_consumed = temp16 + 3; | 97 | *bytes_consumed = temp16 + 3; |
@@ -112,7 +105,7 @@ acpi_rs_address16_resource ( | |||
112 | /* Values 0-2 and 0xC0-0xFF are valid */ | 105 | /* Values 0-2 and 0xC0-0xFF are valid */ |
113 | 106 | ||
114 | if ((temp8 > 2) && (temp8 < 0xC0)) { | 107 | if ((temp8 > 2) && (temp8 < 0xC0)) { |
115 | return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); | 108 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); |
116 | } | 109 | } |
117 | 110 | ||
118 | output_struct->data.address16.resource_type = temp8; | 111 | output_struct->data.address16.resource_type = temp8; |
@@ -144,19 +137,18 @@ acpi_rs_address16_resource ( | |||
144 | temp8 = *buffer; | 137 | temp8 = *buffer; |
145 | 138 | ||
146 | if (ACPI_MEMORY_RANGE == output_struct->data.address16.resource_type) { | 139 | if (ACPI_MEMORY_RANGE == output_struct->data.address16.resource_type) { |
147 | output_struct->data.address16.attribute.memory.read_write_attribute = | 140 | output_struct->data.address16.attribute.memory. |
148 | (u16) (temp8 & 0x01); | 141 | read_write_attribute = (u16) (temp8 & 0x01); |
149 | output_struct->data.address16.attribute.memory.cache_attribute = | 142 | output_struct->data.address16.attribute.memory.cache_attribute = |
150 | (u16) ((temp8 >> 1) & 0x03); | 143 | (u16) ((temp8 >> 1) & 0x03); |
151 | } | 144 | } else { |
152 | else { | 145 | if (ACPI_IO_RANGE == |
153 | if (ACPI_IO_RANGE == output_struct->data.address16.resource_type) { | 146 | output_struct->data.address16.resource_type) { |
154 | output_struct->data.address16.attribute.io.range_attribute = | 147 | output_struct->data.address16.attribute.io. |
155 | (u16) (temp8 & 0x03); | 148 | range_attribute = (u16) (temp8 & 0x03); |
156 | output_struct->data.address16.attribute.io.translation_attribute = | 149 | output_struct->data.address16.attribute.io. |
157 | (u16) ((temp8 >> 4) & 0x03); | 150 | translation_attribute = (u16) ((temp8 >> 4) & 0x03); |
158 | } | 151 | } else { |
159 | else { | ||
160 | /* BUS_NUMBER_RANGE == Address16.Data->resource_type */ | 152 | /* BUS_NUMBER_RANGE == Address16.Data->resource_type */ |
161 | /* Nothing needs to be filled in */ | 153 | /* Nothing needs to be filled in */ |
162 | } | 154 | } |
@@ -165,28 +157,31 @@ acpi_rs_address16_resource ( | |||
165 | /* Get Granularity (Bytes 6-7) */ | 157 | /* Get Granularity (Bytes 6-7) */ |
166 | 158 | ||
167 | buffer += 1; | 159 | buffer += 1; |
168 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer); | 160 | ACPI_MOVE_16_TO_32(&output_struct->data.address16.granularity, buffer); |
169 | 161 | ||
170 | /* Get min_address_range (Bytes 8-9) */ | 162 | /* Get min_address_range (Bytes 8-9) */ |
171 | 163 | ||
172 | buffer += 2; | 164 | buffer += 2; |
173 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer); | 165 | ACPI_MOVE_16_TO_32(&output_struct->data.address16.min_address_range, |
166 | buffer); | ||
174 | 167 | ||
175 | /* Get max_address_range (Bytes 10-11) */ | 168 | /* Get max_address_range (Bytes 10-11) */ |
176 | 169 | ||
177 | buffer += 2; | 170 | buffer += 2; |
178 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer); | 171 | ACPI_MOVE_16_TO_32(&output_struct->data.address16.max_address_range, |
172 | buffer); | ||
179 | 173 | ||
180 | /* Get address_translation_offset (Bytes 12-13) */ | 174 | /* Get address_translation_offset (Bytes 12-13) */ |
181 | 175 | ||
182 | buffer += 2; | 176 | buffer += 2; |
183 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, | 177 | ACPI_MOVE_16_TO_32(&output_struct->data.address16. |
184 | buffer); | 178 | address_translation_offset, buffer); |
185 | 179 | ||
186 | /* Get address_length (Bytes 14-15) */ | 180 | /* Get address_length (Bytes 14-15) */ |
187 | 181 | ||
188 | buffer += 2; | 182 | buffer += 2; |
189 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer); | 183 | ACPI_MOVE_16_TO_32(&output_struct->data.address16.address_length, |
184 | buffer); | ||
190 | 185 | ||
191 | /* Resource Source Index (if present) */ | 186 | /* Resource Source Index (if present) */ |
192 | 187 | ||
@@ -206,7 +201,8 @@ acpi_rs_address16_resource ( | |||
206 | /* Dereference the Index */ | 201 | /* Dereference the Index */ |
207 | 202 | ||
208 | temp8 = *buffer; | 203 | temp8 = *buffer; |
209 | output_struct->data.address16.resource_source.index = (u32) temp8; | 204 | output_struct->data.address16.resource_source.index = |
205 | (u32) temp8; | ||
210 | 206 | ||
211 | /* Point to the String */ | 207 | /* Point to the String */ |
212 | 208 | ||
@@ -215,10 +211,10 @@ acpi_rs_address16_resource ( | |||
215 | /* Point the String pointer to the end of this structure */ | 211 | /* Point the String pointer to the end of this structure */ |
216 | 212 | ||
217 | output_struct->data.address16.resource_source.string_ptr = | 213 | output_struct->data.address16.resource_source.string_ptr = |
218 | (char *)((u8 * )output_struct + struct_size); | 214 | (char *)((u8 *) output_struct + struct_size); |
219 | 215 | ||
220 | temp_ptr = (u8 *) | 216 | temp_ptr = (u8 *) |
221 | output_struct->data.address16.resource_source.string_ptr; | 217 | output_struct->data.address16.resource_source.string_ptr; |
222 | 218 | ||
223 | /* Copy the string into the buffer */ | 219 | /* Copy the string into the buffer */ |
224 | 220 | ||
@@ -236,7 +232,8 @@ acpi_rs_address16_resource ( | |||
236 | 232 | ||
237 | *temp_ptr = 0x00; | 233 | *temp_ptr = 0x00; |
238 | 234 | ||
239 | output_struct->data.address16.resource_source.string_length = index + 1; | 235 | output_struct->data.address16.resource_source.string_length = |
236 | index + 1; | ||
240 | 237 | ||
241 | /* | 238 | /* |
242 | * In order for the struct_size to fall on a 32-bit boundary, | 239 | * In order for the struct_size to fall on a 32-bit boundary, |
@@ -244,9 +241,8 @@ acpi_rs_address16_resource ( | |||
244 | * struct_size to the next 32-bit boundary. | 241 | * struct_size to the next 32-bit boundary. |
245 | */ | 242 | */ |
246 | temp8 = (u8) (index + 1); | 243 | temp8 = (u8) (index + 1); |
247 | struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); | 244 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); |
248 | } | 245 | } else { |
249 | else { | ||
250 | output_struct->data.address16.resource_source.index = 0x00; | 246 | output_struct->data.address16.resource_source.index = 0x00; |
251 | output_struct->data.address16.resource_source.string_length = 0; | 247 | output_struct->data.address16.resource_source.string_length = 0; |
252 | output_struct->data.address16.resource_source.string_ptr = NULL; | 248 | output_struct->data.address16.resource_source.string_ptr = NULL; |
@@ -259,10 +255,9 @@ acpi_rs_address16_resource ( | |||
259 | /* Return the final size of the structure */ | 255 | /* Return the final size of the structure */ |
260 | 256 | ||
261 | *structure_size = struct_size; | 257 | *structure_size = struct_size; |
262 | return_ACPI_STATUS (AE_OK); | 258 | return_ACPI_STATUS(AE_OK); |
263 | } | 259 | } |
264 | 260 | ||
265 | |||
266 | /******************************************************************************* | 261 | /******************************************************************************* |
267 | * | 262 | * |
268 | * FUNCTION: acpi_rs_address16_stream | 263 | * FUNCTION: acpi_rs_address16_stream |
@@ -280,20 +275,16 @@ acpi_rs_address16_resource ( | |||
280 | ******************************************************************************/ | 275 | ******************************************************************************/ |
281 | 276 | ||
282 | acpi_status | 277 | acpi_status |
283 | acpi_rs_address16_stream ( | 278 | acpi_rs_address16_stream(struct acpi_resource *linked_list, |
284 | struct acpi_resource *linked_list, | 279 | u8 ** output_buffer, acpi_size * bytes_consumed) |
285 | u8 **output_buffer, | ||
286 | acpi_size *bytes_consumed) | ||
287 | { | 280 | { |
288 | u8 *buffer = *output_buffer; | 281 | u8 *buffer = *output_buffer; |
289 | u8 *length_field; | 282 | u8 *length_field; |
290 | u8 temp8; | 283 | u8 temp8; |
291 | char *temp_pointer = NULL; | 284 | char *temp_pointer = NULL; |
292 | acpi_size actual_bytes; | 285 | acpi_size actual_bytes; |
293 | |||
294 | |||
295 | ACPI_FUNCTION_TRACE ("rs_address16_stream"); | ||
296 | 286 | ||
287 | ACPI_FUNCTION_TRACE("rs_address16_stream"); | ||
297 | 288 | ||
298 | /* The descriptor field is static */ | 289 | /* The descriptor field is static */ |
299 | 290 | ||
@@ -328,20 +319,19 @@ acpi_rs_address16_stream ( | |||
328 | 319 | ||
329 | if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { | 320 | if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { |
330 | temp8 = (u8) | 321 | temp8 = (u8) |
331 | (linked_list->data.address16.attribute.memory.read_write_attribute & | 322 | (linked_list->data.address16.attribute.memory. |
332 | 0x01); | 323 | read_write_attribute & 0x01); |
333 | 324 | ||
334 | temp8 |= | 325 | temp8 |= |
335 | (linked_list->data.address16.attribute.memory.cache_attribute & | 326 | (linked_list->data.address16.attribute.memory. |
336 | 0x03) << 1; | 327 | cache_attribute & 0x03) << 1; |
337 | } | 328 | } else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) { |
338 | else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) { | ||
339 | temp8 = (u8) | 329 | temp8 = (u8) |
340 | (linked_list->data.address16.attribute.io.range_attribute & | 330 | (linked_list->data.address16.attribute.io.range_attribute & |
341 | 0x03); | 331 | 0x03); |
342 | temp8 |= | 332 | temp8 |= |
343 | (linked_list->data.address16.attribute.io.translation_attribute & | 333 | (linked_list->data.address16.attribute.io. |
344 | 0x03) << 4; | 334 | translation_attribute & 0x03) << 4; |
345 | } | 335 | } |
346 | 336 | ||
347 | *buffer = temp8; | 337 | *buffer = temp8; |
@@ -349,28 +339,31 @@ acpi_rs_address16_stream ( | |||
349 | 339 | ||
350 | /* Set the address space granularity */ | 340 | /* Set the address space granularity */ |
351 | 341 | ||
352 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity); | 342 | ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.granularity); |
353 | buffer += 2; | 343 | buffer += 2; |
354 | 344 | ||
355 | /* Set the address range minimum */ | 345 | /* Set the address range minimum */ |
356 | 346 | ||
357 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range); | 347 | ACPI_MOVE_32_TO_16(buffer, |
348 | &linked_list->data.address16.min_address_range); | ||
358 | buffer += 2; | 349 | buffer += 2; |
359 | 350 | ||
360 | /* Set the address range maximum */ | 351 | /* Set the address range maximum */ |
361 | 352 | ||
362 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range); | 353 | ACPI_MOVE_32_TO_16(buffer, |
354 | &linked_list->data.address16.max_address_range); | ||
363 | buffer += 2; | 355 | buffer += 2; |
364 | 356 | ||
365 | /* Set the address translation offset */ | 357 | /* Set the address translation offset */ |
366 | 358 | ||
367 | ACPI_MOVE_32_TO_16 (buffer, | 359 | ACPI_MOVE_32_TO_16(buffer, |
368 | &linked_list->data.address16.address_translation_offset); | 360 | &linked_list->data.address16. |
361 | address_translation_offset); | ||
369 | buffer += 2; | 362 | buffer += 2; |
370 | 363 | ||
371 | /* Set the address length */ | 364 | /* Set the address length */ |
372 | 365 | ||
373 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length); | 366 | ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.address_length); |
374 | buffer += 2; | 367 | buffer += 2; |
375 | 368 | ||
376 | /* Resource Source Index and Resource Source are optional */ | 369 | /* Resource Source Index and Resource Source are optional */ |
@@ -381,24 +374,27 @@ acpi_rs_address16_stream ( | |||
381 | *buffer = temp8; | 374 | *buffer = temp8; |
382 | buffer += 1; | 375 | buffer += 1; |
383 | 376 | ||
384 | temp_pointer = (char *) buffer; | 377 | temp_pointer = (char *)buffer; |
385 | 378 | ||
386 | /* Copy the string */ | 379 | /* Copy the string */ |
387 | 380 | ||
388 | ACPI_STRCPY (temp_pointer, | 381 | ACPI_STRCPY(temp_pointer, |
389 | linked_list->data.address16.resource_source.string_ptr); | 382 | linked_list->data.address16.resource_source. |
383 | string_ptr); | ||
390 | 384 | ||
391 | /* | 385 | /* |
392 | * Buffer needs to be set to the length of the sting + one for the | 386 | * Buffer needs to be set to the length of the sting + one for the |
393 | * terminating null | 387 | * terminating null |
394 | */ | 388 | */ |
395 | buffer += (acpi_size)(ACPI_STRLEN ( | 389 | buffer += |
396 | linked_list->data.address16.resource_source.string_ptr) + 1); | 390 | (acpi_size) (ACPI_STRLEN |
391 | (linked_list->data.address16.resource_source. | ||
392 | string_ptr) + 1); | ||
397 | } | 393 | } |
398 | 394 | ||
399 | /* Return the number of bytes consumed in this operation */ | 395 | /* Return the number of bytes consumed in this operation */ |
400 | 396 | ||
401 | actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer); | 397 | actual_bytes = ACPI_PTR_DIFF(buffer, *output_buffer); |
402 | *bytes_consumed = actual_bytes; | 398 | *bytes_consumed = actual_bytes; |
403 | 399 | ||
404 | /* | 400 | /* |
@@ -406,11 +402,10 @@ acpi_rs_address16_stream ( | |||
406 | * minus the header size (3 bytes) | 402 | * minus the header size (3 bytes) |
407 | */ | 403 | */ |
408 | actual_bytes -= 3; | 404 | actual_bytes -= 3; |
409 | ACPI_MOVE_SIZE_TO_16 (length_field, &actual_bytes); | 405 | ACPI_MOVE_SIZE_TO_16(length_field, &actual_bytes); |
410 | return_ACPI_STATUS (AE_OK); | 406 | return_ACPI_STATUS(AE_OK); |
411 | } | 407 | } |
412 | 408 | ||
413 | |||
414 | /******************************************************************************* | 409 | /******************************************************************************* |
415 | * | 410 | * |
416 | * FUNCTION: acpi_rs_address32_resource | 411 | * FUNCTION: acpi_rs_address32_resource |
@@ -433,36 +428,32 @@ acpi_rs_address16_stream ( | |||
433 | ******************************************************************************/ | 428 | ******************************************************************************/ |
434 | 429 | ||
435 | acpi_status | 430 | acpi_status |
436 | acpi_rs_address32_resource ( | 431 | acpi_rs_address32_resource(u8 * byte_stream_buffer, |
437 | u8 *byte_stream_buffer, | 432 | acpi_size * bytes_consumed, |
438 | acpi_size *bytes_consumed, | 433 | u8 ** output_buffer, acpi_size * structure_size) |
439 | u8 **output_buffer, | ||
440 | acpi_size *structure_size) | ||
441 | { | 434 | { |
442 | u8 *buffer; | 435 | u8 *buffer; |
443 | struct acpi_resource *output_struct= (void *) *output_buffer; | 436 | struct acpi_resource *output_struct = (void *)*output_buffer; |
444 | u16 temp16; | 437 | u16 temp16; |
445 | u8 temp8; | 438 | u8 temp8; |
446 | u8 *temp_ptr; | 439 | u8 *temp_ptr; |
447 | acpi_size struct_size; | 440 | acpi_size struct_size; |
448 | u32 index; | 441 | u32 index; |
449 | |||
450 | |||
451 | ACPI_FUNCTION_TRACE ("rs_address32_resource"); | ||
452 | 442 | ||
443 | ACPI_FUNCTION_TRACE("rs_address32_resource"); | ||
453 | 444 | ||
454 | buffer = byte_stream_buffer; | 445 | buffer = byte_stream_buffer; |
455 | struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32); | 446 | struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32); |
456 | 447 | ||
457 | /* Point past the Descriptor to get the number of bytes consumed */ | 448 | /* Point past the Descriptor to get the number of bytes consumed */ |
458 | 449 | ||
459 | buffer += 1; | 450 | buffer += 1; |
460 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 451 | ACPI_MOVE_16_TO_16(&temp16, buffer); |
461 | 452 | ||
462 | /* Validate minimum descriptor length */ | 453 | /* Validate minimum descriptor length */ |
463 | 454 | ||
464 | if (temp16 < 23) { | 455 | if (temp16 < 23) { |
465 | return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); | 456 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); |
466 | } | 457 | } |
467 | 458 | ||
468 | *bytes_consumed = temp16 + 3; | 459 | *bytes_consumed = temp16 + 3; |
@@ -476,7 +467,7 @@ acpi_rs_address32_resource ( | |||
476 | /* Values 0-2 and 0xC0-0xFF are valid */ | 467 | /* Values 0-2 and 0xC0-0xFF are valid */ |
477 | 468 | ||
478 | if ((temp8 > 2) && (temp8 < 0xC0)) { | 469 | if ((temp8 > 2) && (temp8 < 0xC0)) { |
479 | return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); | 470 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); |
480 | } | 471 | } |
481 | 472 | ||
482 | output_struct->data.address32.resource_type = temp8; | 473 | output_struct->data.address32.resource_type = temp8; |
@@ -508,20 +499,19 @@ acpi_rs_address32_resource ( | |||
508 | temp8 = *buffer; | 499 | temp8 = *buffer; |
509 | 500 | ||
510 | if (ACPI_MEMORY_RANGE == output_struct->data.address32.resource_type) { | 501 | if (ACPI_MEMORY_RANGE == output_struct->data.address32.resource_type) { |
511 | output_struct->data.address32.attribute.memory.read_write_attribute = | 502 | output_struct->data.address32.attribute.memory. |
512 | (u16) (temp8 & 0x01); | 503 | read_write_attribute = (u16) (temp8 & 0x01); |
513 | 504 | ||
514 | output_struct->data.address32.attribute.memory.cache_attribute = | 505 | output_struct->data.address32.attribute.memory.cache_attribute = |
515 | (u16) ((temp8 >> 1) & 0x03); | 506 | (u16) ((temp8 >> 1) & 0x03); |
516 | } | 507 | } else { |
517 | else { | 508 | if (ACPI_IO_RANGE == |
518 | if (ACPI_IO_RANGE == output_struct->data.address32.resource_type) { | 509 | output_struct->data.address32.resource_type) { |
519 | output_struct->data.address32.attribute.io.range_attribute = | 510 | output_struct->data.address32.attribute.io. |
520 | (u16) (temp8 & 0x03); | 511 | range_attribute = (u16) (temp8 & 0x03); |
521 | output_struct->data.address32.attribute.io.translation_attribute = | 512 | output_struct->data.address32.attribute.io. |
522 | (u16) ((temp8 >> 4) & 0x03); | 513 | translation_attribute = (u16) ((temp8 >> 4) & 0x03); |
523 | } | 514 | } else { |
524 | else { | ||
525 | /* BUS_NUMBER_RANGE == output_struct->Data.Address32.resource_type */ | 515 | /* BUS_NUMBER_RANGE == output_struct->Data.Address32.resource_type */ |
526 | /* Nothing needs to be filled in */ | 516 | /* Nothing needs to be filled in */ |
527 | } | 517 | } |
@@ -530,28 +520,31 @@ acpi_rs_address32_resource ( | |||
530 | /* Get Granularity (Bytes 6-9) */ | 520 | /* Get Granularity (Bytes 6-9) */ |
531 | 521 | ||
532 | buffer += 1; | 522 | buffer += 1; |
533 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer); | 523 | ACPI_MOVE_32_TO_32(&output_struct->data.address32.granularity, buffer); |
534 | 524 | ||
535 | /* Get min_address_range (Bytes 10-13) */ | 525 | /* Get min_address_range (Bytes 10-13) */ |
536 | 526 | ||
537 | buffer += 4; | 527 | buffer += 4; |
538 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer); | 528 | ACPI_MOVE_32_TO_32(&output_struct->data.address32.min_address_range, |
529 | buffer); | ||
539 | 530 | ||
540 | /* Get max_address_range (Bytes 14-17) */ | 531 | /* Get max_address_range (Bytes 14-17) */ |
541 | 532 | ||
542 | buffer += 4; | 533 | buffer += 4; |
543 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer); | 534 | ACPI_MOVE_32_TO_32(&output_struct->data.address32.max_address_range, |
535 | buffer); | ||
544 | 536 | ||
545 | /* Get address_translation_offset (Bytes 18-21) */ | 537 | /* Get address_translation_offset (Bytes 18-21) */ |
546 | 538 | ||
547 | buffer += 4; | 539 | buffer += 4; |
548 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, | 540 | ACPI_MOVE_32_TO_32(&output_struct->data.address32. |
549 | buffer); | 541 | address_translation_offset, buffer); |
550 | 542 | ||
551 | /* Get address_length (Bytes 22-25) */ | 543 | /* Get address_length (Bytes 22-25) */ |
552 | 544 | ||
553 | buffer += 4; | 545 | buffer += 4; |
554 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer); | 546 | ACPI_MOVE_32_TO_32(&output_struct->data.address32.address_length, |
547 | buffer); | ||
555 | 548 | ||
556 | /* Resource Source Index (if present) */ | 549 | /* Resource Source Index (if present) */ |
557 | 550 | ||
@@ -570,7 +563,7 @@ acpi_rs_address32_resource ( | |||
570 | 563 | ||
571 | temp8 = *buffer; | 564 | temp8 = *buffer; |
572 | output_struct->data.address32.resource_source.index = | 565 | output_struct->data.address32.resource_source.index = |
573 | (u32) temp8; | 566 | (u32) temp8; |
574 | 567 | ||
575 | /* Point to the String */ | 568 | /* Point to the String */ |
576 | 569 | ||
@@ -579,10 +572,10 @@ acpi_rs_address32_resource ( | |||
579 | /* Point the String pointer to the end of this structure */ | 572 | /* Point the String pointer to the end of this structure */ |
580 | 573 | ||
581 | output_struct->data.address32.resource_source.string_ptr = | 574 | output_struct->data.address32.resource_source.string_ptr = |
582 | (char *)((u8 *)output_struct + struct_size); | 575 | (char *)((u8 *) output_struct + struct_size); |
583 | 576 | ||
584 | temp_ptr = (u8 *) | 577 | temp_ptr = (u8 *) |
585 | output_struct->data.address32.resource_source.string_ptr; | 578 | output_struct->data.address32.resource_source.string_ptr; |
586 | 579 | ||
587 | /* Copy the string into the buffer */ | 580 | /* Copy the string into the buffer */ |
588 | 581 | ||
@@ -598,7 +591,8 @@ acpi_rs_address32_resource ( | |||
598 | /* Add the terminating null */ | 591 | /* Add the terminating null */ |
599 | 592 | ||
600 | *temp_ptr = 0x00; | 593 | *temp_ptr = 0x00; |
601 | output_struct->data.address32.resource_source.string_length = index + 1; | 594 | output_struct->data.address32.resource_source.string_length = |
595 | index + 1; | ||
602 | 596 | ||
603 | /* | 597 | /* |
604 | * In order for the struct_size to fall on a 32-bit boundary, | 598 | * In order for the struct_size to fall on a 32-bit boundary, |
@@ -606,9 +600,8 @@ acpi_rs_address32_resource ( | |||
606 | * struct_size to the next 32-bit boundary. | 600 | * struct_size to the next 32-bit boundary. |
607 | */ | 601 | */ |
608 | temp8 = (u8) (index + 1); | 602 | temp8 = (u8) (index + 1); |
609 | struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); | 603 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); |
610 | } | 604 | } else { |
611 | else { | ||
612 | output_struct->data.address32.resource_source.index = 0x00; | 605 | output_struct->data.address32.resource_source.index = 0x00; |
613 | output_struct->data.address32.resource_source.string_length = 0; | 606 | output_struct->data.address32.resource_source.string_length = 0; |
614 | output_struct->data.address32.resource_source.string_ptr = NULL; | 607 | output_struct->data.address32.resource_source.string_ptr = NULL; |
@@ -621,10 +614,9 @@ acpi_rs_address32_resource ( | |||
621 | /* Return the final size of the structure */ | 614 | /* Return the final size of the structure */ |
622 | 615 | ||
623 | *structure_size = struct_size; | 616 | *structure_size = struct_size; |
624 | return_ACPI_STATUS (AE_OK); | 617 | return_ACPI_STATUS(AE_OK); |
625 | } | 618 | } |
626 | 619 | ||
627 | |||
628 | /******************************************************************************* | 620 | /******************************************************************************* |
629 | * | 621 | * |
630 | * FUNCTION: acpi_rs_address32_stream | 622 | * FUNCTION: acpi_rs_address32_stream |
@@ -642,19 +634,15 @@ acpi_rs_address32_resource ( | |||
642 | ******************************************************************************/ | 634 | ******************************************************************************/ |
643 | 635 | ||
644 | acpi_status | 636 | acpi_status |
645 | acpi_rs_address32_stream ( | 637 | acpi_rs_address32_stream(struct acpi_resource *linked_list, |
646 | struct acpi_resource *linked_list, | 638 | u8 ** output_buffer, acpi_size * bytes_consumed) |
647 | u8 **output_buffer, | ||
648 | acpi_size *bytes_consumed) | ||
649 | { | 639 | { |
650 | u8 *buffer; | 640 | u8 *buffer; |
651 | u16 *length_field; | 641 | u16 *length_field; |
652 | u8 temp8; | 642 | u8 temp8; |
653 | char *temp_pointer; | 643 | char *temp_pointer; |
654 | |||
655 | |||
656 | ACPI_FUNCTION_TRACE ("rs_address32_stream"); | ||
657 | 644 | ||
645 | ACPI_FUNCTION_TRACE("rs_address32_stream"); | ||
658 | 646 | ||
659 | buffer = *output_buffer; | 647 | buffer = *output_buffer; |
660 | 648 | ||
@@ -665,7 +653,7 @@ acpi_rs_address32_stream ( | |||
665 | 653 | ||
666 | /* Set a pointer to the Length field - to be filled in later */ | 654 | /* Set a pointer to the Length field - to be filled in later */ |
667 | 655 | ||
668 | length_field = ACPI_CAST_PTR (u16, buffer); | 656 | length_field = ACPI_CAST_PTR(u16, buffer); |
669 | buffer += 2; | 657 | buffer += 2; |
670 | 658 | ||
671 | /* Set the Resource Type (Memory, Io, bus_number) */ | 659 | /* Set the Resource Type (Memory, Io, bus_number) */ |
@@ -691,20 +679,19 @@ acpi_rs_address32_stream ( | |||
691 | 679 | ||
692 | if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { | 680 | if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { |
693 | temp8 = (u8) | 681 | temp8 = (u8) |
694 | (linked_list->data.address32.attribute.memory.read_write_attribute & | 682 | (linked_list->data.address32.attribute.memory. |
695 | 0x01); | 683 | read_write_attribute & 0x01); |
696 | 684 | ||
697 | temp8 |= | 685 | temp8 |= |
698 | (linked_list->data.address32.attribute.memory.cache_attribute & | 686 | (linked_list->data.address32.attribute.memory. |
699 | 0x03) << 1; | 687 | cache_attribute & 0x03) << 1; |
700 | } | 688 | } else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) { |
701 | else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) { | ||
702 | temp8 = (u8) | 689 | temp8 = (u8) |
703 | (linked_list->data.address32.attribute.io.range_attribute & | 690 | (linked_list->data.address32.attribute.io.range_attribute & |
704 | 0x03); | 691 | 0x03); |
705 | temp8 |= | 692 | temp8 |= |
706 | (linked_list->data.address32.attribute.io.translation_attribute & | 693 | (linked_list->data.address32.attribute.io. |
707 | 0x03) << 4; | 694 | translation_attribute & 0x03) << 4; |
708 | } | 695 | } |
709 | 696 | ||
710 | *buffer = temp8; | 697 | *buffer = temp8; |
@@ -712,28 +699,31 @@ acpi_rs_address32_stream ( | |||
712 | 699 | ||
713 | /* Set the address space granularity */ | 700 | /* Set the address space granularity */ |
714 | 701 | ||
715 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity); | 702 | ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.granularity); |
716 | buffer += 4; | 703 | buffer += 4; |
717 | 704 | ||
718 | /* Set the address range minimum */ | 705 | /* Set the address range minimum */ |
719 | 706 | ||
720 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range); | 707 | ACPI_MOVE_32_TO_32(buffer, |
708 | &linked_list->data.address32.min_address_range); | ||
721 | buffer += 4; | 709 | buffer += 4; |
722 | 710 | ||
723 | /* Set the address range maximum */ | 711 | /* Set the address range maximum */ |
724 | 712 | ||
725 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range); | 713 | ACPI_MOVE_32_TO_32(buffer, |
714 | &linked_list->data.address32.max_address_range); | ||
726 | buffer += 4; | 715 | buffer += 4; |
727 | 716 | ||
728 | /* Set the address translation offset */ | 717 | /* Set the address translation offset */ |
729 | 718 | ||
730 | ACPI_MOVE_32_TO_32 (buffer, | 719 | ACPI_MOVE_32_TO_32(buffer, |
731 | &linked_list->data.address32.address_translation_offset); | 720 | &linked_list->data.address32. |
721 | address_translation_offset); | ||
732 | buffer += 4; | 722 | buffer += 4; |
733 | 723 | ||
734 | /* Set the address length */ | 724 | /* Set the address length */ |
735 | 725 | ||
736 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length); | 726 | ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.address_length); |
737 | buffer += 4; | 727 | buffer += 4; |
738 | 728 | ||
739 | /* Resource Source Index and Resource Source are optional */ | 729 | /* Resource Source Index and Resource Source are optional */ |
@@ -744,34 +734,36 @@ acpi_rs_address32_stream ( | |||
744 | *buffer = temp8; | 734 | *buffer = temp8; |
745 | buffer += 1; | 735 | buffer += 1; |
746 | 736 | ||
747 | temp_pointer = (char *) buffer; | 737 | temp_pointer = (char *)buffer; |
748 | 738 | ||
749 | /* Copy the string */ | 739 | /* Copy the string */ |
750 | 740 | ||
751 | ACPI_STRCPY (temp_pointer, | 741 | ACPI_STRCPY(temp_pointer, |
752 | linked_list->data.address32.resource_source.string_ptr); | 742 | linked_list->data.address32.resource_source. |
743 | string_ptr); | ||
753 | 744 | ||
754 | /* | 745 | /* |
755 | * Buffer needs to be set to the length of the sting + one for the | 746 | * Buffer needs to be set to the length of the sting + one for the |
756 | * terminating null | 747 | * terminating null |
757 | */ | 748 | */ |
758 | buffer += (acpi_size)(ACPI_STRLEN ( | 749 | buffer += |
759 | linked_list->data.address32.resource_source.string_ptr) + 1); | 750 | (acpi_size) (ACPI_STRLEN |
751 | (linked_list->data.address32.resource_source. | ||
752 | string_ptr) + 1); | ||
760 | } | 753 | } |
761 | 754 | ||
762 | /* Return the number of bytes consumed in this operation */ | 755 | /* Return the number of bytes consumed in this operation */ |
763 | 756 | ||
764 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 757 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); |
765 | 758 | ||
766 | /* | 759 | /* |
767 | * Set the length field to the number of bytes consumed | 760 | * Set the length field to the number of bytes consumed |
768 | * minus the header size (3 bytes) | 761 | * minus the header size (3 bytes) |
769 | */ | 762 | */ |
770 | *length_field = (u16) (*bytes_consumed - 3); | 763 | *length_field = (u16) (*bytes_consumed - 3); |
771 | return_ACPI_STATUS (AE_OK); | 764 | return_ACPI_STATUS(AE_OK); |
772 | } | 765 | } |
773 | 766 | ||
774 | |||
775 | /******************************************************************************* | 767 | /******************************************************************************* |
776 | * | 768 | * |
777 | * FUNCTION: acpi_rs_address64_resource | 769 | * FUNCTION: acpi_rs_address64_resource |
@@ -794,38 +786,34 @@ acpi_rs_address32_stream ( | |||
794 | ******************************************************************************/ | 786 | ******************************************************************************/ |
795 | 787 | ||
796 | acpi_status | 788 | acpi_status |
797 | acpi_rs_address64_resource ( | 789 | acpi_rs_address64_resource(u8 * byte_stream_buffer, |
798 | u8 *byte_stream_buffer, | 790 | acpi_size * bytes_consumed, |
799 | acpi_size *bytes_consumed, | 791 | u8 ** output_buffer, acpi_size * structure_size) |
800 | u8 **output_buffer, | ||
801 | acpi_size *structure_size) | ||
802 | { | 792 | { |
803 | u8 *buffer; | 793 | u8 *buffer; |
804 | struct acpi_resource *output_struct = (void *) *output_buffer; | 794 | struct acpi_resource *output_struct = (void *)*output_buffer; |
805 | u16 temp16; | 795 | u16 temp16; |
806 | u8 temp8; | 796 | u8 temp8; |
807 | u8 resource_type; | 797 | u8 resource_type; |
808 | u8 *temp_ptr; | 798 | u8 *temp_ptr; |
809 | acpi_size struct_size; | 799 | acpi_size struct_size; |
810 | u32 index; | 800 | u32 index; |
811 | |||
812 | |||
813 | ACPI_FUNCTION_TRACE ("rs_address64_resource"); | ||
814 | 801 | ||
802 | ACPI_FUNCTION_TRACE("rs_address64_resource"); | ||
815 | 803 | ||
816 | buffer = byte_stream_buffer; | 804 | buffer = byte_stream_buffer; |
817 | struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); | 805 | struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64); |
818 | resource_type = *buffer; | 806 | resource_type = *buffer; |
819 | 807 | ||
820 | /* Point past the Descriptor to get the number of bytes consumed */ | 808 | /* Point past the Descriptor to get the number of bytes consumed */ |
821 | 809 | ||
822 | buffer += 1; | 810 | buffer += 1; |
823 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 811 | ACPI_MOVE_16_TO_16(&temp16, buffer); |
824 | 812 | ||
825 | /* Validate minimum descriptor length */ | 813 | /* Validate minimum descriptor length */ |
826 | 814 | ||
827 | if (temp16 < 43) { | 815 | if (temp16 < 43) { |
828 | return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); | 816 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); |
829 | } | 817 | } |
830 | 818 | ||
831 | *bytes_consumed = temp16 + 3; | 819 | *bytes_consumed = temp16 + 3; |
@@ -839,7 +827,7 @@ acpi_rs_address64_resource ( | |||
839 | /* Values 0-2 and 0xC0-0xFF are valid */ | 827 | /* Values 0-2 and 0xC0-0xFF are valid */ |
840 | 828 | ||
841 | if ((temp8 > 2) && (temp8 < 0xC0)) { | 829 | if ((temp8 > 2) && (temp8 < 0xC0)) { |
842 | return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); | 830 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); |
843 | } | 831 | } |
844 | 832 | ||
845 | output_struct->data.address64.resource_type = temp8; | 833 | output_struct->data.address64.resource_type = temp8; |
@@ -871,20 +859,19 @@ acpi_rs_address64_resource ( | |||
871 | temp8 = *buffer; | 859 | temp8 = *buffer; |
872 | 860 | ||
873 | if (ACPI_MEMORY_RANGE == output_struct->data.address64.resource_type) { | 861 | if (ACPI_MEMORY_RANGE == output_struct->data.address64.resource_type) { |
874 | output_struct->data.address64.attribute.memory.read_write_attribute = | 862 | output_struct->data.address64.attribute.memory. |
875 | (u16) (temp8 & 0x01); | 863 | read_write_attribute = (u16) (temp8 & 0x01); |
876 | 864 | ||
877 | output_struct->data.address64.attribute.memory.cache_attribute = | 865 | output_struct->data.address64.attribute.memory.cache_attribute = |
878 | (u16) ((temp8 >> 1) & 0x03); | 866 | (u16) ((temp8 >> 1) & 0x03); |
879 | } | 867 | } else { |
880 | else { | 868 | if (ACPI_IO_RANGE == |
881 | if (ACPI_IO_RANGE == output_struct->data.address64.resource_type) { | 869 | output_struct->data.address64.resource_type) { |
882 | output_struct->data.address64.attribute.io.range_attribute = | 870 | output_struct->data.address64.attribute.io. |
883 | (u16) (temp8 & 0x03); | 871 | range_attribute = (u16) (temp8 & 0x03); |
884 | output_struct->data.address64.attribute.io.translation_attribute = | 872 | output_struct->data.address64.attribute.io. |
885 | (u16) ((temp8 >> 4) & 0x03); | 873 | translation_attribute = (u16) ((temp8 >> 4) & 0x03); |
886 | } | 874 | } else { |
887 | else { | ||
888 | /* BUS_NUMBER_RANGE == output_struct->Data.Address64.resource_type */ | 875 | /* BUS_NUMBER_RANGE == output_struct->Data.Address64.resource_type */ |
889 | /* Nothing needs to be filled in */ | 876 | /* Nothing needs to be filled in */ |
890 | } | 877 | } |
@@ -899,28 +886,31 @@ acpi_rs_address64_resource ( | |||
899 | /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */ | 886 | /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */ |
900 | 887 | ||
901 | buffer += 1; | 888 | buffer += 1; |
902 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer); | 889 | ACPI_MOVE_64_TO_64(&output_struct->data.address64.granularity, buffer); |
903 | 890 | ||
904 | /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */ | 891 | /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */ |
905 | 892 | ||
906 | buffer += 8; | 893 | buffer += 8; |
907 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer); | 894 | ACPI_MOVE_64_TO_64(&output_struct->data.address64.min_address_range, |
895 | buffer); | ||
908 | 896 | ||
909 | /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */ | 897 | /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */ |
910 | 898 | ||
911 | buffer += 8; | 899 | buffer += 8; |
912 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer); | 900 | ACPI_MOVE_64_TO_64(&output_struct->data.address64.max_address_range, |
901 | buffer); | ||
913 | 902 | ||
914 | /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */ | 903 | /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */ |
915 | 904 | ||
916 | buffer += 8; | 905 | buffer += 8; |
917 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, | 906 | ACPI_MOVE_64_TO_64(&output_struct->data.address64. |
918 | buffer); | 907 | address_translation_offset, buffer); |
919 | 908 | ||
920 | /* Get address_length (Bytes 38-45) or (Bytes 40-47) */ | 909 | /* Get address_length (Bytes 38-45) or (Bytes 40-47) */ |
921 | 910 | ||
922 | buffer += 8; | 911 | buffer += 8; |
923 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer); | 912 | ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length, |
913 | buffer); | ||
924 | 914 | ||
925 | output_struct->data.address64.resource_source.index = 0x00; | 915 | output_struct->data.address64.resource_source.index = 0x00; |
926 | output_struct->data.address64.resource_source.string_length = 0; | 916 | output_struct->data.address64.resource_source.string_length = 0; |
@@ -930,11 +920,9 @@ acpi_rs_address64_resource ( | |||
930 | /* Get type_specific_attribute (Bytes 48-55) */ | 920 | /* Get type_specific_attribute (Bytes 48-55) */ |
931 | 921 | ||
932 | buffer += 8; | 922 | buffer += 8; |
933 | ACPI_MOVE_64_TO_64 ( | 923 | ACPI_MOVE_64_TO_64(&output_struct->data.address64. |
934 | &output_struct->data.address64.type_specific_attributes, | 924 | type_specific_attributes, buffer); |
935 | buffer); | 925 | } else { |
936 | } | ||
937 | else { | ||
938 | output_struct->data.address64.type_specific_attributes = 0; | 926 | output_struct->data.address64.type_specific_attributes = 0; |
939 | 927 | ||
940 | /* Resource Source Index (if present) */ | 928 | /* Resource Source Index (if present) */ |
@@ -956,7 +944,7 @@ acpi_rs_address64_resource ( | |||
956 | 944 | ||
957 | temp8 = *buffer; | 945 | temp8 = *buffer; |
958 | output_struct->data.address64.resource_source.index = | 946 | output_struct->data.address64.resource_source.index = |
959 | (u32) temp8; | 947 | (u32) temp8; |
960 | 948 | ||
961 | /* Point to the String */ | 949 | /* Point to the String */ |
962 | 950 | ||
@@ -964,11 +952,13 @@ acpi_rs_address64_resource ( | |||
964 | 952 | ||
965 | /* Point the String pointer to the end of this structure */ | 953 | /* Point the String pointer to the end of this structure */ |
966 | 954 | ||
967 | output_struct->data.address64.resource_source.string_ptr = | 955 | output_struct->data.address64.resource_source. |
968 | (char *)((u8 *)output_struct + struct_size); | 956 | string_ptr = |
957 | (char *)((u8 *) output_struct + struct_size); | ||
969 | 958 | ||
970 | temp_ptr = (u8 *) | 959 | temp_ptr = (u8 *) |
971 | output_struct->data.address64.resource_source.string_ptr; | 960 | output_struct->data.address64.resource_source. |
961 | string_ptr; | ||
972 | 962 | ||
973 | /* Copy the string into the buffer */ | 963 | /* Copy the string into the buffer */ |
974 | 964 | ||
@@ -985,8 +975,8 @@ acpi_rs_address64_resource ( | |||
985 | * Add the terminating null | 975 | * Add the terminating null |
986 | */ | 976 | */ |
987 | *temp_ptr = 0x00; | 977 | *temp_ptr = 0x00; |
988 | output_struct->data.address64.resource_source.string_length = | 978 | output_struct->data.address64.resource_source. |
989 | index + 1; | 979 | string_length = index + 1; |
990 | 980 | ||
991 | /* | 981 | /* |
992 | * In order for the struct_size to fall on a 32-bit boundary, | 982 | * In order for the struct_size to fall on a 32-bit boundary, |
@@ -994,7 +984,7 @@ acpi_rs_address64_resource ( | |||
994 | * struct_size to the next 32-bit boundary. | 984 | * struct_size to the next 32-bit boundary. |
995 | */ | 985 | */ |
996 | temp8 = (u8) (index + 1); | 986 | temp8 = (u8) (index + 1); |
997 | struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); | 987 | struct_size += ACPI_ROUND_UP_to_32_bITS(temp8); |
998 | } | 988 | } |
999 | } | 989 | } |
1000 | 990 | ||
@@ -1005,10 +995,9 @@ acpi_rs_address64_resource ( | |||
1005 | /* Return the final size of the structure */ | 995 | /* Return the final size of the structure */ |
1006 | 996 | ||
1007 | *structure_size = struct_size; | 997 | *structure_size = struct_size; |
1008 | return_ACPI_STATUS (AE_OK); | 998 | return_ACPI_STATUS(AE_OK); |
1009 | } | 999 | } |
1010 | 1000 | ||
1011 | |||
1012 | /******************************************************************************* | 1001 | /******************************************************************************* |
1013 | * | 1002 | * |
1014 | * FUNCTION: acpi_rs_address64_stream | 1003 | * FUNCTION: acpi_rs_address64_stream |
@@ -1026,19 +1015,15 @@ acpi_rs_address64_resource ( | |||
1026 | ******************************************************************************/ | 1015 | ******************************************************************************/ |
1027 | 1016 | ||
1028 | acpi_status | 1017 | acpi_status |
1029 | acpi_rs_address64_stream ( | 1018 | acpi_rs_address64_stream(struct acpi_resource *linked_list, |
1030 | struct acpi_resource *linked_list, | 1019 | u8 ** output_buffer, acpi_size * bytes_consumed) |
1031 | u8 **output_buffer, | ||
1032 | acpi_size *bytes_consumed) | ||
1033 | { | 1020 | { |
1034 | u8 *buffer; | 1021 | u8 *buffer; |
1035 | u16 *length_field; | 1022 | u16 *length_field; |
1036 | u8 temp8; | 1023 | u8 temp8; |
1037 | char *temp_pointer; | 1024 | char *temp_pointer; |
1038 | |||
1039 | |||
1040 | ACPI_FUNCTION_TRACE ("rs_address64_stream"); | ||
1041 | 1025 | ||
1026 | ACPI_FUNCTION_TRACE("rs_address64_stream"); | ||
1042 | 1027 | ||
1043 | buffer = *output_buffer; | 1028 | buffer = *output_buffer; |
1044 | 1029 | ||
@@ -1049,7 +1034,7 @@ acpi_rs_address64_stream ( | |||
1049 | 1034 | ||
1050 | /* Set a pointer to the Length field - to be filled in later */ | 1035 | /* Set a pointer to the Length field - to be filled in later */ |
1051 | 1036 | ||
1052 | length_field = ACPI_CAST_PTR (u16, buffer); | 1037 | length_field = ACPI_CAST_PTR(u16, buffer); |
1053 | buffer += 2; | 1038 | buffer += 2; |
1054 | 1039 | ||
1055 | /* Set the Resource Type (Memory, Io, bus_number) */ | 1040 | /* Set the Resource Type (Memory, Io, bus_number) */ |
@@ -1075,20 +1060,19 @@ acpi_rs_address64_stream ( | |||
1075 | 1060 | ||
1076 | if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { | 1061 | if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { |
1077 | temp8 = (u8) | 1062 | temp8 = (u8) |
1078 | (linked_list->data.address64.attribute.memory.read_write_attribute & | 1063 | (linked_list->data.address64.attribute.memory. |
1079 | 0x01); | 1064 | read_write_attribute & 0x01); |
1080 | 1065 | ||
1081 | temp8 |= | 1066 | temp8 |= |
1082 | (linked_list->data.address64.attribute.memory.cache_attribute & | 1067 | (linked_list->data.address64.attribute.memory. |
1083 | 0x03) << 1; | 1068 | cache_attribute & 0x03) << 1; |
1084 | } | 1069 | } else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) { |
1085 | else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) { | ||
1086 | temp8 = (u8) | 1070 | temp8 = (u8) |
1087 | (linked_list->data.address64.attribute.io.range_attribute & | 1071 | (linked_list->data.address64.attribute.io.range_attribute & |
1088 | 0x03); | 1072 | 0x03); |
1089 | temp8 |= | 1073 | temp8 |= |
1090 | (linked_list->data.address64.attribute.io.range_attribute & | 1074 | (linked_list->data.address64.attribute.io.range_attribute & |
1091 | 0x03) << 4; | 1075 | 0x03) << 4; |
1092 | } | 1076 | } |
1093 | 1077 | ||
1094 | *buffer = temp8; | 1078 | *buffer = temp8; |
@@ -1096,28 +1080,31 @@ acpi_rs_address64_stream ( | |||
1096 | 1080 | ||
1097 | /* Set the address space granularity */ | 1081 | /* Set the address space granularity */ |
1098 | 1082 | ||
1099 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity); | 1083 | ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.granularity); |
1100 | buffer += 8; | 1084 | buffer += 8; |
1101 | 1085 | ||
1102 | /* Set the address range minimum */ | 1086 | /* Set the address range minimum */ |
1103 | 1087 | ||
1104 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range); | 1088 | ACPI_MOVE_64_TO_64(buffer, |
1089 | &linked_list->data.address64.min_address_range); | ||
1105 | buffer += 8; | 1090 | buffer += 8; |
1106 | 1091 | ||
1107 | /* Set the address range maximum */ | 1092 | /* Set the address range maximum */ |
1108 | 1093 | ||
1109 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range); | 1094 | ACPI_MOVE_64_TO_64(buffer, |
1095 | &linked_list->data.address64.max_address_range); | ||
1110 | buffer += 8; | 1096 | buffer += 8; |
1111 | 1097 | ||
1112 | /* Set the address translation offset */ | 1098 | /* Set the address translation offset */ |
1113 | 1099 | ||
1114 | ACPI_MOVE_64_TO_64 (buffer, | 1100 | ACPI_MOVE_64_TO_64(buffer, |
1115 | &linked_list->data.address64.address_translation_offset); | 1101 | &linked_list->data.address64. |
1102 | address_translation_offset); | ||
1116 | buffer += 8; | 1103 | buffer += 8; |
1117 | 1104 | ||
1118 | /* Set the address length */ | 1105 | /* Set the address length */ |
1119 | 1106 | ||
1120 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length); | 1107 | ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.address_length); |
1121 | buffer += 8; | 1108 | buffer += 8; |
1122 | 1109 | ||
1123 | /* Resource Source Index and Resource Source are optional */ | 1110 | /* Resource Source Index and Resource Source are optional */ |
@@ -1128,30 +1115,32 @@ acpi_rs_address64_stream ( | |||
1128 | *buffer = temp8; | 1115 | *buffer = temp8; |
1129 | buffer += 1; | 1116 | buffer += 1; |
1130 | 1117 | ||
1131 | temp_pointer = (char *) buffer; | 1118 | temp_pointer = (char *)buffer; |
1132 | 1119 | ||
1133 | /* Copy the string */ | 1120 | /* Copy the string */ |
1134 | 1121 | ||
1135 | ACPI_STRCPY (temp_pointer, | 1122 | ACPI_STRCPY(temp_pointer, |
1136 | linked_list->data.address64.resource_source.string_ptr); | 1123 | linked_list->data.address64.resource_source. |
1124 | string_ptr); | ||
1137 | 1125 | ||
1138 | /* | 1126 | /* |
1139 | * Buffer needs to be set to the length of the sting + one for the | 1127 | * Buffer needs to be set to the length of the sting + one for the |
1140 | * terminating null | 1128 | * terminating null |
1141 | */ | 1129 | */ |
1142 | buffer += (acpi_size)(ACPI_STRLEN ( | 1130 | buffer += |
1143 | linked_list->data.address64.resource_source.string_ptr) + 1); | 1131 | (acpi_size) (ACPI_STRLEN |
1132 | (linked_list->data.address64.resource_source. | ||
1133 | string_ptr) + 1); | ||
1144 | } | 1134 | } |
1145 | 1135 | ||
1146 | /* Return the number of bytes consumed in this operation */ | 1136 | /* Return the number of bytes consumed in this operation */ |
1147 | 1137 | ||
1148 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 1138 | *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer); |
1149 | 1139 | ||
1150 | /* | 1140 | /* |
1151 | * Set the length field to the number of bytes consumed | 1141 | * Set the length field to the number of bytes consumed |
1152 | * minus the header size (3 bytes) | 1142 | * minus the header size (3 bytes) |
1153 | */ | 1143 | */ |
1154 | *length_field = (u16) (*bytes_consumed - 3); | 1144 | *length_field = (u16) (*bytes_consumed - 3); |
1155 | return_ACPI_STATUS (AE_OK); | 1145 | return_ACPI_STATUS(AE_OK); |
1156 | } | 1146 | } |
1157 | |||