aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rsmemory.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/resources/rsmemory.c')
-rw-r--r--drivers/acpi/resources/rsmemory.c218
1 files changed, 97 insertions, 121 deletions
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c
index 91d0207f01ac..daba1a1ed46d 100644
--- a/drivers/acpi/resources/rsmemory.c
+++ b/drivers/acpi/resources/rsmemory.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 ("rsmemory") 48ACPI_MODULE_NAME("rsmemory")
50
51 49
52/******************************************************************************* 50/*******************************************************************************
53 * 51 *
@@ -69,30 +67,25 @@
69 * number of bytes consumed from the byte stream. 67 * number of bytes consumed from the byte stream.
70 * 68 *
71 ******************************************************************************/ 69 ******************************************************************************/
72
73acpi_status 70acpi_status
74acpi_rs_memory24_resource ( 71acpi_rs_memory24_resource(u8 * byte_stream_buffer,
75 u8 *byte_stream_buffer, 72 acpi_size * bytes_consumed,
76 acpi_size *bytes_consumed, 73 u8 ** output_buffer, acpi_size * structure_size)
77 u8 **output_buffer,
78 acpi_size *structure_size)
79{ 74{
80 u8 *buffer = byte_stream_buffer; 75 u8 *buffer = byte_stream_buffer;
81 struct acpi_resource *output_struct = (void *) *output_buffer; 76 struct acpi_resource *output_struct = (void *)*output_buffer;
82 u16 temp16 = 0; 77 u16 temp16 = 0;
83 u8 temp8 = 0; 78 u8 temp8 = 0;
84 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 79 acpi_size struct_size =
85 struct acpi_resource_mem24); 80 ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24);
86
87
88 ACPI_FUNCTION_TRACE ("rs_memory24_resource");
89 81
82 ACPI_FUNCTION_TRACE("rs_memory24_resource");
90 83
91 /* Point past the Descriptor to get the number of bytes consumed */ 84 /* Point past the Descriptor to get the number of bytes consumed */
92 85
93 buffer += 1; 86 buffer += 1;
94 87
95 ACPI_MOVE_16_TO_16 (&temp16, buffer); 88 ACPI_MOVE_16_TO_16(&temp16, buffer);
96 buffer += 2; 89 buffer += 2;
97 *bytes_consumed = (acpi_size) temp16 + 3; 90 *bytes_consumed = (acpi_size) temp16 + 3;
98 output_struct->id = ACPI_RSTYPE_MEM24; 91 output_struct->id = ACPI_RSTYPE_MEM24;
@@ -105,25 +98,25 @@ acpi_rs_memory24_resource (
105 98
106 /* Get min_base_address (Bytes 4-5) */ 99 /* Get min_base_address (Bytes 4-5) */
107 100
108 ACPI_MOVE_16_TO_16 (&temp16, buffer); 101 ACPI_MOVE_16_TO_16(&temp16, buffer);
109 buffer += 2; 102 buffer += 2;
110 output_struct->data.memory24.min_base_address = temp16; 103 output_struct->data.memory24.min_base_address = temp16;
111 104
112 /* Get max_base_address (Bytes 6-7) */ 105 /* Get max_base_address (Bytes 6-7) */
113 106
114 ACPI_MOVE_16_TO_16 (&temp16, buffer); 107 ACPI_MOVE_16_TO_16(&temp16, buffer);
115 buffer += 2; 108 buffer += 2;
116 output_struct->data.memory24.max_base_address = temp16; 109 output_struct->data.memory24.max_base_address = temp16;
117 110
118 /* Get Alignment (Bytes 8-9) */ 111 /* Get Alignment (Bytes 8-9) */
119 112
120 ACPI_MOVE_16_TO_16 (&temp16, buffer); 113 ACPI_MOVE_16_TO_16(&temp16, buffer);
121 buffer += 2; 114 buffer += 2;
122 output_struct->data.memory24.alignment = temp16; 115 output_struct->data.memory24.alignment = temp16;
123 116
124 /* Get range_length (Bytes 10-11) */ 117 /* Get range_length (Bytes 10-11) */
125 118
126 ACPI_MOVE_16_TO_16 (&temp16, buffer); 119 ACPI_MOVE_16_TO_16(&temp16, buffer);
127 output_struct->data.memory24.range_length = temp16; 120 output_struct->data.memory24.range_length = temp16;
128 121
129 /* Set the Length parameter */ 122 /* Set the Length parameter */
@@ -133,10 +126,9 @@ acpi_rs_memory24_resource (
133 /* Return the final size of the structure */ 126 /* Return the final size of the structure */
134 127
135 *structure_size = struct_size; 128 *structure_size = struct_size;
136 return_ACPI_STATUS (AE_OK); 129 return_ACPI_STATUS(AE_OK);
137} 130}
138 131
139
140/******************************************************************************* 132/*******************************************************************************
141 * 133 *
142 * FUNCTION: acpi_rs_memory24_stream 134 * FUNCTION: acpi_rs_memory24_stream
@@ -154,18 +146,14 @@ acpi_rs_memory24_resource (
154 ******************************************************************************/ 146 ******************************************************************************/
155 147
156acpi_status 148acpi_status
157acpi_rs_memory24_stream ( 149acpi_rs_memory24_stream(struct acpi_resource *linked_list,
158 struct acpi_resource *linked_list, 150 u8 ** output_buffer, acpi_size * bytes_consumed)
159 u8 **output_buffer,
160 acpi_size *bytes_consumed)
161{ 151{
162 u8 *buffer = *output_buffer; 152 u8 *buffer = *output_buffer;
163 u16 temp16 = 0; 153 u16 temp16 = 0;
164 u8 temp8 = 0; 154 u8 temp8 = 0;
165
166
167 ACPI_FUNCTION_TRACE ("rs_memory24_stream");
168 155
156 ACPI_FUNCTION_TRACE("rs_memory24_stream");
169 157
170 /* The descriptor field is static */ 158 /* The descriptor field is static */
171 159
@@ -175,7 +163,7 @@ acpi_rs_memory24_stream (
175 /* The length field is static */ 163 /* The length field is static */
176 164
177 temp16 = 0x09; 165 temp16 = 0x09;
178 ACPI_MOVE_16_TO_16 (buffer, &temp16); 166 ACPI_MOVE_16_TO_16(buffer, &temp16);
179 buffer += 2; 167 buffer += 2;
180 168
181 /* Set the Information Byte */ 169 /* Set the Information Byte */
@@ -186,31 +174,32 @@ acpi_rs_memory24_stream (
186 174
187 /* Set the Range minimum base address */ 175 /* Set the Range minimum base address */
188 176
189 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address); 177 ACPI_MOVE_32_TO_16(buffer,
178 &linked_list->data.memory24.min_base_address);
190 buffer += 2; 179 buffer += 2;
191 180
192 /* Set the Range maximum base address */ 181 /* Set the Range maximum base address */
193 182
194 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address); 183 ACPI_MOVE_32_TO_16(buffer,
184 &linked_list->data.memory24.max_base_address);
195 buffer += 2; 185 buffer += 2;
196 186
197 /* Set the base alignment */ 187 /* Set the base alignment */
198 188
199 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment); 189 ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.alignment);
200 buffer += 2; 190 buffer += 2;
201 191
202 /* Set the range length */ 192 /* Set the range length */
203 193
204 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length); 194 ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.range_length);
205 buffer += 2; 195 buffer += 2;
206 196
207 /* Return the number of bytes consumed in this operation */ 197 /* Return the number of bytes consumed in this operation */
208 198
209 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 199 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
210 return_ACPI_STATUS (AE_OK); 200 return_ACPI_STATUS(AE_OK);
211} 201}
212 202
213
214/******************************************************************************* 203/*******************************************************************************
215 * 204 *
216 * FUNCTION: acpi_rs_memory32_range_resource 205 * FUNCTION: acpi_rs_memory32_range_resource
@@ -233,28 +222,24 @@ acpi_rs_memory24_stream (
233 ******************************************************************************/ 222 ******************************************************************************/
234 223
235acpi_status 224acpi_status
236acpi_rs_memory32_range_resource ( 225acpi_rs_memory32_range_resource(u8 * byte_stream_buffer,
237 u8 *byte_stream_buffer, 226 acpi_size * bytes_consumed,
238 acpi_size *bytes_consumed, 227 u8 ** output_buffer, acpi_size * structure_size)
239 u8 **output_buffer,
240 acpi_size *structure_size)
241{ 228{
242 u8 *buffer = byte_stream_buffer; 229 u8 *buffer = byte_stream_buffer;
243 struct acpi_resource *output_struct = (void *) *output_buffer; 230 struct acpi_resource *output_struct = (void *)*output_buffer;
244 u16 temp16 = 0; 231 u16 temp16 = 0;
245 u8 temp8 = 0; 232 u8 temp8 = 0;
246 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 233 acpi_size struct_size =
247 struct acpi_resource_mem32); 234 ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32);
248
249
250 ACPI_FUNCTION_TRACE ("rs_memory32_range_resource");
251 235
236 ACPI_FUNCTION_TRACE("rs_memory32_range_resource");
252 237
253 /* Point past the Descriptor to get the number of bytes consumed */ 238 /* Point past the Descriptor to get the number of bytes consumed */
254 239
255 buffer += 1; 240 buffer += 1;
256 241
257 ACPI_MOVE_16_TO_16 (&temp16, buffer); 242 ACPI_MOVE_16_TO_16(&temp16, buffer);
258 buffer += 2; 243 buffer += 2;
259 *bytes_consumed = (acpi_size) temp16 + 3; 244 *bytes_consumed = (acpi_size) temp16 + 3;
260 245
@@ -279,22 +264,24 @@ acpi_rs_memory32_range_resource (
279 264
280 /* Get min_base_address (Bytes 4-7) */ 265 /* Get min_base_address (Bytes 4-7) */
281 266
282 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer); 267 ACPI_MOVE_32_TO_32(&output_struct->data.memory32.min_base_address,
268 buffer);
283 buffer += 4; 269 buffer += 4;
284 270
285 /* Get max_base_address (Bytes 8-11) */ 271 /* Get max_base_address (Bytes 8-11) */
286 272
287 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer); 273 ACPI_MOVE_32_TO_32(&output_struct->data.memory32.max_base_address,
274 buffer);
288 buffer += 4; 275 buffer += 4;
289 276
290 /* Get Alignment (Bytes 12-15) */ 277 /* Get Alignment (Bytes 12-15) */
291 278
292 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer); 279 ACPI_MOVE_32_TO_32(&output_struct->data.memory32.alignment, buffer);
293 buffer += 4; 280 buffer += 4;
294 281
295 /* Get range_length (Bytes 16-19) */ 282 /* Get range_length (Bytes 16-19) */
296 283
297 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer); 284 ACPI_MOVE_32_TO_32(&output_struct->data.memory32.range_length, buffer);
298 285
299 /* Set the Length parameter */ 286 /* Set the Length parameter */
300 287
@@ -303,10 +290,9 @@ acpi_rs_memory32_range_resource (
303 /* Return the final size of the structure */ 290 /* Return the final size of the structure */
304 291
305 *structure_size = struct_size; 292 *structure_size = struct_size;
306 return_ACPI_STATUS (AE_OK); 293 return_ACPI_STATUS(AE_OK);
307} 294}
308 295
309
310/******************************************************************************* 296/*******************************************************************************
311 * 297 *
312 * FUNCTION: acpi_rs_fixed_memory32_resource 298 * FUNCTION: acpi_rs_fixed_memory32_resource
@@ -329,27 +315,23 @@ acpi_rs_memory32_range_resource (
329 ******************************************************************************/ 315 ******************************************************************************/
330 316
331acpi_status 317acpi_status
332acpi_rs_fixed_memory32_resource ( 318acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
333 u8 *byte_stream_buffer, 319 acpi_size * bytes_consumed,
334 acpi_size *bytes_consumed, 320 u8 ** output_buffer, acpi_size * structure_size)
335 u8 **output_buffer,
336 acpi_size *structure_size)
337{ 321{
338 u8 *buffer = byte_stream_buffer; 322 u8 *buffer = byte_stream_buffer;
339 struct acpi_resource *output_struct = (void *) *output_buffer; 323 struct acpi_resource *output_struct = (void *)*output_buffer;
340 u16 temp16 = 0; 324 u16 temp16 = 0;
341 u8 temp8 = 0; 325 u8 temp8 = 0;
342 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 326 acpi_size struct_size =
343 struct acpi_resource_fixed_mem32); 327 ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32);
344
345
346 ACPI_FUNCTION_TRACE ("rs_fixed_memory32_resource");
347 328
329 ACPI_FUNCTION_TRACE("rs_fixed_memory32_resource");
348 330
349 /* Point past the Descriptor to get the number of bytes consumed */ 331 /* Point past the Descriptor to get the number of bytes consumed */
350 332
351 buffer += 1; 333 buffer += 1;
352 ACPI_MOVE_16_TO_16 (&temp16, buffer); 334 ACPI_MOVE_16_TO_16(&temp16, buffer);
353 335
354 buffer += 2; 336 buffer += 2;
355 *bytes_consumed = (acpi_size) temp16 + 3; 337 *bytes_consumed = (acpi_size) temp16 + 3;
@@ -364,13 +346,14 @@ acpi_rs_fixed_memory32_resource (
364 346
365 /* Get range_base_address (Bytes 4-7) */ 347 /* Get range_base_address (Bytes 4-7) */
366 348
367 ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address, 349 ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.
368 buffer); 350 range_base_address, buffer);
369 buffer += 4; 351 buffer += 4;
370 352
371 /* Get range_length (Bytes 8-11) */ 353 /* Get range_length (Bytes 8-11) */
372 354
373 ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer); 355 ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.range_length,
356 buffer);
374 357
375 /* Set the Length parameter */ 358 /* Set the Length parameter */
376 359
@@ -379,10 +362,9 @@ acpi_rs_fixed_memory32_resource (
379 /* Return the final size of the structure */ 362 /* Return the final size of the structure */
380 363
381 *structure_size = struct_size; 364 *structure_size = struct_size;
382 return_ACPI_STATUS (AE_OK); 365 return_ACPI_STATUS(AE_OK);
383} 366}
384 367
385
386/******************************************************************************* 368/*******************************************************************************
387 * 369 *
388 * FUNCTION: acpi_rs_memory32_range_stream 370 * FUNCTION: acpi_rs_memory32_range_stream
@@ -400,18 +382,14 @@ acpi_rs_fixed_memory32_resource (
400 ******************************************************************************/ 382 ******************************************************************************/
401 383
402acpi_status 384acpi_status
403acpi_rs_memory32_range_stream ( 385acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
404 struct acpi_resource *linked_list, 386 u8 ** output_buffer, acpi_size * bytes_consumed)
405 u8 **output_buffer,
406 acpi_size *bytes_consumed)
407{ 387{
408 u8 *buffer = *output_buffer; 388 u8 *buffer = *output_buffer;
409 u16 temp16 = 0; 389 u16 temp16 = 0;
410 u8 temp8 = 0; 390 u8 temp8 = 0;
411
412
413 ACPI_FUNCTION_TRACE ("rs_memory32_range_stream");
414 391
392 ACPI_FUNCTION_TRACE("rs_memory32_range_stream");
415 393
416 /* The descriptor field is static */ 394 /* The descriptor field is static */
417 395
@@ -422,7 +400,7 @@ acpi_rs_memory32_range_stream (
422 400
423 temp16 = 0x11; 401 temp16 = 0x11;
424 402
425 ACPI_MOVE_16_TO_16 (buffer, &temp16); 403 ACPI_MOVE_16_TO_16(buffer, &temp16);
426 buffer += 2; 404 buffer += 2;
427 405
428 /* Set the Information Byte */ 406 /* Set the Information Byte */
@@ -433,31 +411,32 @@ acpi_rs_memory32_range_stream (
433 411
434 /* Set the Range minimum base address */ 412 /* Set the Range minimum base address */
435 413
436 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address); 414 ACPI_MOVE_32_TO_32(buffer,
415 &linked_list->data.memory32.min_base_address);
437 buffer += 4; 416 buffer += 4;
438 417
439 /* Set the Range maximum base address */ 418 /* Set the Range maximum base address */
440 419
441 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address); 420 ACPI_MOVE_32_TO_32(buffer,
421 &linked_list->data.memory32.max_base_address);
442 buffer += 4; 422 buffer += 4;
443 423
444 /* Set the base alignment */ 424 /* Set the base alignment */
445 425
446 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment); 426 ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.alignment);
447 buffer += 4; 427 buffer += 4;
448 428
449 /* Set the range length */ 429 /* Set the range length */
450 430
451 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length); 431 ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.range_length);
452 buffer += 4; 432 buffer += 4;
453 433
454 /* Return the number of bytes consumed in this operation */ 434 /* Return the number of bytes consumed in this operation */
455 435
456 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 436 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
457 return_ACPI_STATUS (AE_OK); 437 return_ACPI_STATUS(AE_OK);
458} 438}
459 439
460
461/******************************************************************************* 440/*******************************************************************************
462 * 441 *
463 * FUNCTION: acpi_rs_fixed_memory32_stream 442 * FUNCTION: acpi_rs_fixed_memory32_stream
@@ -475,18 +454,14 @@ acpi_rs_memory32_range_stream (
475 ******************************************************************************/ 454 ******************************************************************************/
476 455
477acpi_status 456acpi_status
478acpi_rs_fixed_memory32_stream ( 457acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
479 struct acpi_resource *linked_list, 458 u8 ** output_buffer, acpi_size * bytes_consumed)
480 u8 **output_buffer,
481 acpi_size *bytes_consumed)
482{ 459{
483 u8 *buffer = *output_buffer; 460 u8 *buffer = *output_buffer;
484 u16 temp16 = 0; 461 u16 temp16 = 0;
485 u8 temp8 = 0; 462 u8 temp8 = 0;
486
487
488 ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream");
489 463
464 ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream");
490 465
491 /* The descriptor field is static */ 466 /* The descriptor field is static */
492 467
@@ -497,30 +472,31 @@ acpi_rs_fixed_memory32_stream (
497 472
498 temp16 = 0x09; 473 temp16 = 0x09;
499 474
500 ACPI_MOVE_16_TO_16 (buffer, &temp16); 475 ACPI_MOVE_16_TO_16(buffer, &temp16);
501 buffer += 2; 476 buffer += 2;
502 477
503 /* Set the Information Byte */ 478 /* Set the Information Byte */
504 479
505 temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); 480 temp8 =
481 (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01);
506 *buffer = temp8; 482 *buffer = temp8;
507 buffer += 1; 483 buffer += 1;
508 484
509 /* Set the Range base address */ 485 /* Set the Range base address */
510 486
511 ACPI_MOVE_32_TO_32 (buffer, 487 ACPI_MOVE_32_TO_32(buffer,
512 &linked_list->data.fixed_memory32.range_base_address); 488 &linked_list->data.fixed_memory32.
489 range_base_address);
513 buffer += 4; 490 buffer += 4;
514 491
515 /* Set the range length */ 492 /* Set the range length */
516 493
517 ACPI_MOVE_32_TO_32 (buffer, 494 ACPI_MOVE_32_TO_32(buffer,
518 &linked_list->data.fixed_memory32.range_length); 495 &linked_list->data.fixed_memory32.range_length);
519 buffer += 4; 496 buffer += 4;
520 497
521 /* Return the number of bytes consumed in this operation */ 498 /* Return the number of bytes consumed in this operation */
522 499
523 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 500 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
524 return_ACPI_STATUS (AE_OK); 501 return_ACPI_STATUS(AE_OK);
525} 502}
526