diff options
Diffstat (limited to 'drivers/acpi/resources/rsmemory.c')
-rw-r--r-- | drivers/acpi/resources/rsmemory.c | 236 |
1 files changed, 98 insertions, 138 deletions
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index 7c935aecf075..91d0207f01ac 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c | |||
@@ -81,15 +81,15 @@ acpi_rs_memory24_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_mem24); | 84 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
85 | struct acpi_resource_mem24); | ||
85 | 86 | ||
86 | 87 | ||
87 | ACPI_FUNCTION_TRACE ("rs_memory24_resource"); | 88 | ACPI_FUNCTION_TRACE ("rs_memory24_resource"); |
88 | 89 | ||
89 | 90 | ||
90 | /* | 91 | /* Point past the Descriptor to get the number of bytes consumed */ |
91 | * Point past the Descriptor to get the number of bytes consumed | 92 | |
92 | */ | ||
93 | buffer += 1; | 93 | buffer += 1; |
94 | 94 | ||
95 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 95 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
@@ -97,48 +97,41 @@ acpi_rs_memory24_resource ( | |||
97 | *bytes_consumed = (acpi_size) temp16 + 3; | 97 | *bytes_consumed = (acpi_size) temp16 + 3; |
98 | output_struct->id = ACPI_RSTYPE_MEM24; | 98 | output_struct->id = ACPI_RSTYPE_MEM24; |
99 | 99 | ||
100 | /* | 100 | /* Check Byte 3 the Read/Write bit */ |
101 | * Check Byte 3 the Read/Write bit | 101 | |
102 | */ | ||
103 | temp8 = *buffer; | 102 | temp8 = *buffer; |
104 | buffer += 1; | 103 | buffer += 1; |
105 | output_struct->data.memory24.read_write_attribute = temp8 & 0x01; | 104 | output_struct->data.memory24.read_write_attribute = temp8 & 0x01; |
106 | 105 | ||
107 | /* | 106 | /* Get min_base_address (Bytes 4-5) */ |
108 | * Get min_base_address (Bytes 4-5) | 107 | |
109 | */ | ||
110 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 108 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
111 | buffer += 2; | 109 | buffer += 2; |
112 | output_struct->data.memory24.min_base_address = temp16; | 110 | output_struct->data.memory24.min_base_address = temp16; |
113 | 111 | ||
114 | /* | 112 | /* Get max_base_address (Bytes 6-7) */ |
115 | * Get max_base_address (Bytes 6-7) | 113 | |
116 | */ | ||
117 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 114 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
118 | buffer += 2; | 115 | buffer += 2; |
119 | output_struct->data.memory24.max_base_address = temp16; | 116 | output_struct->data.memory24.max_base_address = temp16; |
120 | 117 | ||
121 | /* | 118 | /* Get Alignment (Bytes 8-9) */ |
122 | * Get Alignment (Bytes 8-9) | 119 | |
123 | */ | ||
124 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 120 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
125 | buffer += 2; | 121 | buffer += 2; |
126 | output_struct->data.memory24.alignment = temp16; | 122 | output_struct->data.memory24.alignment = temp16; |
127 | 123 | ||
128 | /* | 124 | /* Get range_length (Bytes 10-11) */ |
129 | * Get range_length (Bytes 10-11) | 125 | |
130 | */ | ||
131 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 126 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
132 | output_struct->data.memory24.range_length = temp16; | 127 | output_struct->data.memory24.range_length = temp16; |
133 | 128 | ||
134 | /* | 129 | /* Set the Length parameter */ |
135 | * Set the Length parameter | 130 | |
136 | */ | ||
137 | output_struct->length = (u32) struct_size; | 131 | output_struct->length = (u32) struct_size; |
138 | 132 | ||
139 | /* | 133 | /* Return the final size of the structure */ |
140 | * Return the final size of the structure | 134 | |
141 | */ | ||
142 | *structure_size = struct_size; | 135 | *structure_size = struct_size; |
143 | return_ACPI_STATUS (AE_OK); | 136 | return_ACPI_STATUS (AE_OK); |
144 | } | 137 | } |
@@ -174,53 +167,45 @@ acpi_rs_memory24_stream ( | |||
174 | ACPI_FUNCTION_TRACE ("rs_memory24_stream"); | 167 | ACPI_FUNCTION_TRACE ("rs_memory24_stream"); |
175 | 168 | ||
176 | 169 | ||
177 | /* | 170 | /* The descriptor field is static */ |
178 | * The descriptor field is static | 171 | |
179 | */ | ||
180 | *buffer = 0x81; | 172 | *buffer = 0x81; |
181 | buffer += 1; | 173 | buffer += 1; |
182 | 174 | ||
183 | /* | 175 | /* The length field is static */ |
184 | * The length field is static | 176 | |
185 | */ | ||
186 | temp16 = 0x09; | 177 | temp16 = 0x09; |
187 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 178 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
188 | buffer += 2; | 179 | buffer += 2; |
189 | 180 | ||
190 | /* | 181 | /* Set the Information Byte */ |
191 | * Set the Information Byte | 182 | |
192 | */ | ||
193 | temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01); | 183 | temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01); |
194 | *buffer = temp8; | 184 | *buffer = temp8; |
195 | buffer += 1; | 185 | buffer += 1; |
196 | 186 | ||
197 | /* | 187 | /* Set the Range minimum base address */ |
198 | * Set the Range minimum base address | 188 | |
199 | */ | ||
200 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address); | 189 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address); |
201 | buffer += 2; | 190 | buffer += 2; |
202 | 191 | ||
203 | /* | 192 | /* Set the Range maximum base address */ |
204 | * Set the Range maximum base address | 193 | |
205 | */ | ||
206 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address); | 194 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address); |
207 | buffer += 2; | 195 | buffer += 2; |
208 | 196 | ||
209 | /* | 197 | /* Set the base alignment */ |
210 | * Set the base alignment | 198 | |
211 | */ | ||
212 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment); | 199 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment); |
213 | buffer += 2; | 200 | buffer += 2; |
214 | 201 | ||
215 | /* | 202 | /* Set the range length */ |
216 | * Set the range length | 203 | |
217 | */ | ||
218 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length); | 204 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length); |
219 | buffer += 2; | 205 | buffer += 2; |
220 | 206 | ||
221 | /* | 207 | /* Return the number of bytes consumed in this operation */ |
222 | * Return the number of bytes consumed in this operation | 208 | |
223 | */ | ||
224 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 209 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
225 | return_ACPI_STATUS (AE_OK); | 210 | return_ACPI_STATUS (AE_OK); |
226 | } | 211 | } |
@@ -258,15 +243,15 @@ acpi_rs_memory32_range_resource ( | |||
258 | struct acpi_resource *output_struct = (void *) *output_buffer; | 243 | struct acpi_resource *output_struct = (void *) *output_buffer; |
259 | u16 temp16 = 0; | 244 | u16 temp16 = 0; |
260 | u8 temp8 = 0; | 245 | u8 temp8 = 0; |
261 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem32); | 246 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
247 | struct acpi_resource_mem32); | ||
262 | 248 | ||
263 | 249 | ||
264 | ACPI_FUNCTION_TRACE ("rs_memory32_range_resource"); | 250 | ACPI_FUNCTION_TRACE ("rs_memory32_range_resource"); |
265 | 251 | ||
266 | 252 | ||
267 | /* | 253 | /* Point past the Descriptor to get the number of bytes consumed */ |
268 | * Point past the Descriptor to get the number of bytes consumed | 254 | |
269 | */ | ||
270 | buffer += 1; | 255 | buffer += 1; |
271 | 256 | ||
272 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 257 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
@@ -285,45 +270,38 @@ acpi_rs_memory32_range_resource ( | |||
285 | * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(u8) | 270 | * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(u8) |
286 | */ | 271 | */ |
287 | 272 | ||
288 | /* | 273 | /* Check Byte 3 the Read/Write bit */ |
289 | * Check Byte 3 the Read/Write bit | 274 | |
290 | */ | ||
291 | temp8 = *buffer; | 275 | temp8 = *buffer; |
292 | buffer += 1; | 276 | buffer += 1; |
293 | 277 | ||
294 | output_struct->data.memory32.read_write_attribute = temp8 & 0x01; | 278 | output_struct->data.memory32.read_write_attribute = temp8 & 0x01; |
295 | 279 | ||
296 | /* | 280 | /* Get min_base_address (Bytes 4-7) */ |
297 | * Get min_base_address (Bytes 4-7) | 281 | |
298 | */ | ||
299 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer); | 282 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer); |
300 | buffer += 4; | 283 | buffer += 4; |
301 | 284 | ||
302 | /* | 285 | /* Get max_base_address (Bytes 8-11) */ |
303 | * Get max_base_address (Bytes 8-11) | 286 | |
304 | */ | ||
305 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer); | 287 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer); |
306 | buffer += 4; | 288 | buffer += 4; |
307 | 289 | ||
308 | /* | 290 | /* Get Alignment (Bytes 12-15) */ |
309 | * Get Alignment (Bytes 12-15) | 291 | |
310 | */ | ||
311 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer); | 292 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer); |
312 | buffer += 4; | 293 | buffer += 4; |
313 | 294 | ||
314 | /* | 295 | /* Get range_length (Bytes 16-19) */ |
315 | * Get range_length (Bytes 16-19) | 296 | |
316 | */ | ||
317 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer); | 297 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer); |
318 | 298 | ||
319 | /* | 299 | /* Set the Length parameter */ |
320 | * Set the Length parameter | 300 | |
321 | */ | ||
322 | output_struct->length = (u32) struct_size; | 301 | output_struct->length = (u32) struct_size; |
323 | 302 | ||
324 | /* | 303 | /* Return the final size of the structure */ |
325 | * Return the final size of the structure | 304 | |
326 | */ | ||
327 | *structure_size = struct_size; | 305 | *structure_size = struct_size; |
328 | return_ACPI_STATUS (AE_OK); | 306 | return_ACPI_STATUS (AE_OK); |
329 | } | 307 | } |
@@ -361,15 +339,15 @@ acpi_rs_fixed_memory32_resource ( | |||
361 | struct acpi_resource *output_struct = (void *) *output_buffer; | 339 | struct acpi_resource *output_struct = (void *) *output_buffer; |
362 | u16 temp16 = 0; | 340 | u16 temp16 = 0; |
363 | u8 temp8 = 0; | 341 | u8 temp8 = 0; |
364 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_mem32); | 342 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
343 | struct acpi_resource_fixed_mem32); | ||
365 | 344 | ||
366 | 345 | ||
367 | ACPI_FUNCTION_TRACE ("rs_fixed_memory32_resource"); | 346 | ACPI_FUNCTION_TRACE ("rs_fixed_memory32_resource"); |
368 | 347 | ||
369 | 348 | ||
370 | /* | 349 | /* Point past the Descriptor to get the number of bytes consumed */ |
371 | * Point past the Descriptor to get the number of bytes consumed | 350 | |
372 | */ | ||
373 | buffer += 1; | 351 | buffer += 1; |
374 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 352 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
375 | 353 | ||
@@ -378,32 +356,28 @@ acpi_rs_fixed_memory32_resource ( | |||
378 | 356 | ||
379 | output_struct->id = ACPI_RSTYPE_FIXED_MEM32; | 357 | output_struct->id = ACPI_RSTYPE_FIXED_MEM32; |
380 | 358 | ||
381 | /* | 359 | /* Check Byte 3 the Read/Write bit */ |
382 | * Check Byte 3 the Read/Write bit | 360 | |
383 | */ | ||
384 | temp8 = *buffer; | 361 | temp8 = *buffer; |
385 | buffer += 1; | 362 | buffer += 1; |
386 | output_struct->data.fixed_memory32.read_write_attribute = temp8 & 0x01; | 363 | output_struct->data.fixed_memory32.read_write_attribute = temp8 & 0x01; |
387 | 364 | ||
388 | /* | 365 | /* Get range_base_address (Bytes 4-7) */ |
389 | * Get range_base_address (Bytes 4-7) | 366 | |
390 | */ | 367 | ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address, |
391 | ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address, buffer); | 368 | buffer); |
392 | buffer += 4; | 369 | buffer += 4; |
393 | 370 | ||
394 | /* | 371 | /* Get range_length (Bytes 8-11) */ |
395 | * Get range_length (Bytes 8-11) | 372 | |
396 | */ | ||
397 | ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer); | 373 | ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer); |
398 | 374 | ||
399 | /* | 375 | /* Set the Length parameter */ |
400 | * Set the Length parameter | 376 | |
401 | */ | ||
402 | output_struct->length = (u32) struct_size; | 377 | output_struct->length = (u32) struct_size; |
403 | 378 | ||
404 | /* | 379 | /* Return the final size of the structure */ |
405 | * Return the final size of the structure | 380 | |
406 | */ | ||
407 | *structure_size = struct_size; | 381 | *structure_size = struct_size; |
408 | return_ACPI_STATUS (AE_OK); | 382 | return_ACPI_STATUS (AE_OK); |
409 | } | 383 | } |
@@ -439,54 +413,46 @@ acpi_rs_memory32_range_stream ( | |||
439 | ACPI_FUNCTION_TRACE ("rs_memory32_range_stream"); | 413 | ACPI_FUNCTION_TRACE ("rs_memory32_range_stream"); |
440 | 414 | ||
441 | 415 | ||
442 | /* | 416 | /* The descriptor field is static */ |
443 | * The descriptor field is static | 417 | |
444 | */ | ||
445 | *buffer = 0x85; | 418 | *buffer = 0x85; |
446 | buffer += 1; | 419 | buffer += 1; |
447 | 420 | ||
448 | /* | 421 | /* The length field is static */ |
449 | * The length field is static | 422 | |
450 | */ | ||
451 | temp16 = 0x11; | 423 | temp16 = 0x11; |
452 | 424 | ||
453 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 425 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
454 | buffer += 2; | 426 | buffer += 2; |
455 | 427 | ||
456 | /* | 428 | /* Set the Information Byte */ |
457 | * Set the Information Byte | 429 | |
458 | */ | ||
459 | temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01); | 430 | temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01); |
460 | *buffer = temp8; | 431 | *buffer = temp8; |
461 | buffer += 1; | 432 | buffer += 1; |
462 | 433 | ||
463 | /* | 434 | /* Set the Range minimum base address */ |
464 | * Set the Range minimum base address | 435 | |
465 | */ | ||
466 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address); | 436 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address); |
467 | buffer += 4; | 437 | buffer += 4; |
468 | 438 | ||
469 | /* | 439 | /* Set the Range maximum base address */ |
470 | * Set the Range maximum base address | 440 | |
471 | */ | ||
472 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address); | 441 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address); |
473 | buffer += 4; | 442 | buffer += 4; |
474 | 443 | ||
475 | /* | 444 | /* Set the base alignment */ |
476 | * Set the base alignment | 445 | |
477 | */ | ||
478 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment); | 446 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment); |
479 | buffer += 4; | 447 | buffer += 4; |
480 | 448 | ||
481 | /* | 449 | /* Set the range length */ |
482 | * Set the range length | 450 | |
483 | */ | ||
484 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length); | 451 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length); |
485 | buffer += 4; | 452 | buffer += 4; |
486 | 453 | ||
487 | /* | 454 | /* Return the number of bytes consumed in this operation */ |
488 | * Return the number of bytes consumed in this operation | 455 | |
489 | */ | ||
490 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 456 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
491 | return_ACPI_STATUS (AE_OK); | 457 | return_ACPI_STATUS (AE_OK); |
492 | } | 458 | } |
@@ -522,44 +488,38 @@ acpi_rs_fixed_memory32_stream ( | |||
522 | ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream"); | 488 | ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream"); |
523 | 489 | ||
524 | 490 | ||
525 | /* | 491 | /* The descriptor field is static */ |
526 | * The descriptor field is static | 492 | |
527 | */ | ||
528 | *buffer = 0x86; | 493 | *buffer = 0x86; |
529 | buffer += 1; | 494 | buffer += 1; |
530 | 495 | ||
531 | /* | 496 | /* The length field is static */ |
532 | * The length field is static | 497 | |
533 | */ | ||
534 | temp16 = 0x09; | 498 | temp16 = 0x09; |
535 | 499 | ||
536 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 500 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
537 | buffer += 2; | 501 | buffer += 2; |
538 | 502 | ||
539 | /* | 503 | /* Set the Information Byte */ |
540 | * Set the Information Byte | 504 | |
541 | */ | ||
542 | temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); | 505 | temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); |
543 | *buffer = temp8; | 506 | *buffer = temp8; |
544 | buffer += 1; | 507 | buffer += 1; |
545 | 508 | ||
546 | /* | 509 | /* Set the Range base address */ |
547 | * Set the Range base address | 510 | |
548 | */ | ||
549 | ACPI_MOVE_32_TO_32 (buffer, | 511 | ACPI_MOVE_32_TO_32 (buffer, |
550 | &linked_list->data.fixed_memory32.range_base_address); | 512 | &linked_list->data.fixed_memory32.range_base_address); |
551 | buffer += 4; | 513 | buffer += 4; |
552 | 514 | ||
553 | /* | 515 | /* Set the range length */ |
554 | * Set the range length | 516 | |
555 | */ | ||
556 | ACPI_MOVE_32_TO_32 (buffer, | 517 | ACPI_MOVE_32_TO_32 (buffer, |
557 | &linked_list->data.fixed_memory32.range_length); | 518 | &linked_list->data.fixed_memory32.range_length); |
558 | buffer += 4; | 519 | buffer += 4; |
559 | 520 | ||
560 | /* | 521 | /* Return the number of bytes consumed in this operation */ |
561 | * Return the number of bytes consumed in this operation | 522 | |
562 | */ | ||
563 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 523 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
564 | return_ACPI_STATUS (AE_OK); | 524 | return_ACPI_STATUS (AE_OK); |
565 | } | 525 | } |