Deleted Added
full compact
rsmemory.c (126372) rsmemory.c (151600)
1/*******************************************************************************
2 *
3 * Module Name: rsmem24 - Memory resource descriptors
4 * $Revision: 25 $
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
21 *
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
28 *
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
37 *
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
40 *
41 * 3. Conditions
42 *
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
54 *
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
66 *
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
75 *
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
80 *
81 * 4. Disclaimer and Export Compliance
82 *
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
90 *
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
99 *
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117#define __RSMEMORY_C__
118
1/*******************************************************************************
2 *
3 * Module Name: rsmem24 - Memory resource descriptors
4 * $Revision: 25 $
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
21 *
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
28 *
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
37 *
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
40 *
41 * 3. Conditions
42 *
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
54 *
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
66 *
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
75 *
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
80 *
81 * 4. Disclaimer and Export Compliance
82 *
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
90 *
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
99 *
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117#define __RSMEMORY_C__
118
119#include "acpi.h"
120#include "acresrc.h"
119#include <contrib/dev/acpica/acpi.h>
120#include <contrib/dev/acpica/acresrc.h>
121
122#define _COMPONENT ACPI_RESOURCES
123 ACPI_MODULE_NAME ("rsmemory")
124
125
126/*******************************************************************************
127 *
128 * FUNCTION: AcpiRsMemory24Resource
129 *
130 * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
131 * stream
132 * BytesConsumed - Pointer to where the number of bytes
133 * consumed the ByteStreamBuffer is
134 * returned
135 * OutputBuffer - Pointer to the return data buffer
136 * StructureSize - Pointer to where the number of bytes
137 * in the return data struct is returned
138 *
139 * RETURN: Status
140 *
141 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
142 * structure pointed to by the OutputBuffer. Return the
143 * number of bytes consumed from the byte stream.
144 *
145 ******************************************************************************/
146
147ACPI_STATUS
148AcpiRsMemory24Resource (
149 UINT8 *ByteStreamBuffer,
150 ACPI_SIZE *BytesConsumed,
151 UINT8 **OutputBuffer,
152 ACPI_SIZE *StructureSize)
153{
154 UINT8 *Buffer = ByteStreamBuffer;
155 ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
156 UINT16 Temp16 = 0;
157 UINT8 Temp8 = 0;
158 ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
159
160
161 ACPI_FUNCTION_TRACE ("RsMemory24Resource");
162
163
164 /*
165 * Point past the Descriptor to get the number of bytes consumed
166 */
167 Buffer += 1;
168
169 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
170 Buffer += 2;
171 *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
172 OutputStruct->Id = ACPI_RSTYPE_MEM24;
173
174 /*
175 * Check Byte 3 the Read/Write bit
176 */
177 Temp8 = *Buffer;
178 Buffer += 1;
179 OutputStruct->Data.Memory24.ReadWriteAttribute = Temp8 & 0x01;
180
181 /*
182 * Get MinBaseAddress (Bytes 4-5)
183 */
184 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
185 Buffer += 2;
186 OutputStruct->Data.Memory24.MinBaseAddress = Temp16;
187
188 /*
189 * Get MaxBaseAddress (Bytes 6-7)
190 */
191 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
192 Buffer += 2;
193 OutputStruct->Data.Memory24.MaxBaseAddress = Temp16;
194
195 /*
196 * Get Alignment (Bytes 8-9)
197 */
198 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
199 Buffer += 2;
200 OutputStruct->Data.Memory24.Alignment = Temp16;
201
202 /*
203 * Get RangeLength (Bytes 10-11)
204 */
205 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
206 OutputStruct->Data.Memory24.RangeLength = Temp16;
207
208 /*
209 * Set the Length parameter
210 */
211 OutputStruct->Length = (UINT32) StructSize;
212
213 /*
214 * Return the final size of the structure
215 */
216 *StructureSize = StructSize;
217 return_ACPI_STATUS (AE_OK);
218}
219
220
221/*******************************************************************************
222 *
223 * FUNCTION: AcpiRsMemory24Stream
224 *
225 * PARAMETERS: LinkedList - Pointer to the resource linked list
226 * OutputBuffer - Pointer to the user's return buffer
227 * BytesConsumed - Pointer to where the number of bytes
228 * used in the OutputBuffer is returned
229 *
230 * RETURN: Status
231 *
232 * DESCRIPTION: Take the linked list resource structure and fills in the
233 * the appropriate bytes in a byte stream
234 *
235 ******************************************************************************/
236
237ACPI_STATUS
238AcpiRsMemory24Stream (
239 ACPI_RESOURCE *LinkedList,
240 UINT8 **OutputBuffer,
241 ACPI_SIZE *BytesConsumed)
242{
243 UINT8 *Buffer = *OutputBuffer;
244 UINT16 Temp16 = 0;
245 UINT8 Temp8 = 0;
246
247
248 ACPI_FUNCTION_TRACE ("RsMemory24Stream");
249
250
251 /*
252 * The descriptor field is static
253 */
254 *Buffer = 0x81;
255 Buffer += 1;
256
257 /*
258 * The length field is static
259 */
260 Temp16 = 0x09;
261 ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
262 Buffer += 2;
263
264 /*
265 * Set the Information Byte
266 */
267 Temp8 = (UINT8) (LinkedList->Data.Memory24.ReadWriteAttribute & 0x01);
268 *Buffer = Temp8;
269 Buffer += 1;
270
271 /*
272 * Set the Range minimum base address
273 */
274 ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MinBaseAddress);
275 Buffer += 2;
276
277 /*
278 * Set the Range maximum base address
279 */
280 ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MaxBaseAddress);
281 Buffer += 2;
282
283 /*
284 * Set the base alignment
285 */
286 ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.Alignment);
287 Buffer += 2;
288
289 /*
290 * Set the range length
291 */
292 ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.RangeLength);
293 Buffer += 2;
294
295 /*
296 * Return the number of bytes consumed in this operation
297 */
298 *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
299 return_ACPI_STATUS (AE_OK);
300}
301
302
303/*******************************************************************************
304 *
305 * FUNCTION: AcpiRsMemory32RangeResource
306 *
307 * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
308 * stream
309 * BytesConsumed - Pointer to where the number of bytes
310 * consumed the ByteStreamBuffer is
311 * returned
312 * OutputBuffer - Pointer to the return data buffer
313 * StructureSize - Pointer to where the number of bytes
314 * in the return data struct is returned
315 *
316 * RETURN: Status
317 *
318 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
319 * structure pointed to by the OutputBuffer. Return the
320 * number of bytes consumed from the byte stream.
321 *
322 ******************************************************************************/
323
324ACPI_STATUS
325AcpiRsMemory32RangeResource (
326 UINT8 *ByteStreamBuffer,
327 ACPI_SIZE *BytesConsumed,
328 UINT8 **OutputBuffer,
329 ACPI_SIZE *StructureSize)
330{
331 UINT8 *Buffer = ByteStreamBuffer;
332 ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
333 UINT16 Temp16 = 0;
334 UINT8 Temp8 = 0;
335 ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
336
337
338 ACPI_FUNCTION_TRACE ("RsMemory32RangeResource");
339
340
341 /*
342 * Point past the Descriptor to get the number of bytes consumed
343 */
344 Buffer += 1;
345
346 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
347 Buffer += 2;
348 *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
349
350 OutputStruct->Id = ACPI_RSTYPE_MEM32;
351
352 /*
353 * Point to the place in the output buffer where the data portion will
354 * begin.
355 * 1. Set the RESOURCE_DATA * Data to point to its own address, then
356 * 2. Set the pointer to the next address.
357 *
358 * NOTE: OutputStruct->Data is cast to UINT8, otherwise, this addition adds
359 * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(UINT8)
360 */
361
362 /*
363 * Check Byte 3 the Read/Write bit
364 */
365 Temp8 = *Buffer;
366 Buffer += 1;
367
368 OutputStruct->Data.Memory32.ReadWriteAttribute = Temp8 & 0x01;
369
370 /*
371 * Get MinBaseAddress (Bytes 4-7)
372 */
373 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MinBaseAddress, Buffer);
374 Buffer += 4;
375
376 /*
377 * Get MaxBaseAddress (Bytes 8-11)
378 */
379 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MaxBaseAddress, Buffer);
380 Buffer += 4;
381
382 /*
383 * Get Alignment (Bytes 12-15)
384 */
385 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.Alignment, Buffer);
386 Buffer += 4;
387
388 /*
389 * Get RangeLength (Bytes 16-19)
390 */
391 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.RangeLength, Buffer);
392
393 /*
394 * Set the Length parameter
395 */
396 OutputStruct->Length = (UINT32) StructSize;
397
398 /*
399 * Return the final size of the structure
400 */
401 *StructureSize = StructSize;
402 return_ACPI_STATUS (AE_OK);
403}
404
405
406/*******************************************************************************
407 *
408 * FUNCTION: AcpiRsFixedMemory32Resource
409 *
410 * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
411 * stream
412 * BytesConsumed - Pointer to where the number of bytes
413 * consumed the ByteStreamBuffer is
414 * returned
415 * OutputBuffer - Pointer to the return data buffer
416 * StructureSize - Pointer to where the number of bytes
417 * in the return data struct is returned
418 *
419 * RETURN: Status
420 *
421 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
422 * structure pointed to by the OutputBuffer. Return the
423 * number of bytes consumed from the byte stream.
424 *
425 ******************************************************************************/
426
427ACPI_STATUS
428AcpiRsFixedMemory32Resource (
429 UINT8 *ByteStreamBuffer,
430 ACPI_SIZE *BytesConsumed,
431 UINT8 **OutputBuffer,
432 ACPI_SIZE *StructureSize)
433{
434 UINT8 *Buffer = ByteStreamBuffer;
435 ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
436 UINT16 Temp16 = 0;
437 UINT8 Temp8 = 0;
438 ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
439
440
441 ACPI_FUNCTION_TRACE ("RsFixedMemory32Resource");
442
443
444 /*
445 * Point past the Descriptor to get the number of bytes consumed
446 */
447 Buffer += 1;
448 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
449
450 Buffer += 2;
451 *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
452
453 OutputStruct->Id = ACPI_RSTYPE_FIXED_MEM32;
454
455 /*
456 * Check Byte 3 the Read/Write bit
457 */
458 Temp8 = *Buffer;
459 Buffer += 1;
460 OutputStruct->Data.FixedMemory32.ReadWriteAttribute = Temp8 & 0x01;
461
462 /*
463 * Get RangeBaseAddress (Bytes 4-7)
464 */
465 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeBaseAddress, Buffer);
466 Buffer += 4;
467
468 /*
469 * Get RangeLength (Bytes 8-11)
470 */
471 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeLength, Buffer);
472
473 /*
474 * Set the Length parameter
475 */
476 OutputStruct->Length = (UINT32) StructSize;
477
478 /*
479 * Return the final size of the structure
480 */
481 *StructureSize = StructSize;
482 return_ACPI_STATUS (AE_OK);
483}
484
485
486/*******************************************************************************
487 *
488 * FUNCTION: AcpiRsMemory32RangeStream
489 *
490 * PARAMETERS: LinkedList - Pointer to the resource linked list
491 * OutputBuffer - Pointer to the user's return buffer
492 * BytesConsumed - Pointer to where the number of bytes
493 * used in the OutputBuffer is returned
494 *
495 * RETURN: Status
496 *
497 * DESCRIPTION: Take the linked list resource structure and fills in the
498 * the appropriate bytes in a byte stream
499 *
500 ******************************************************************************/
501
502ACPI_STATUS
503AcpiRsMemory32RangeStream (
504 ACPI_RESOURCE *LinkedList,
505 UINT8 **OutputBuffer,
506 ACPI_SIZE *BytesConsumed)
507{
508 UINT8 *Buffer = *OutputBuffer;
509 UINT16 Temp16 = 0;
510 UINT8 Temp8 = 0;
511
512
513 ACPI_FUNCTION_TRACE ("RsMemory32RangeStream");
514
515
516 /*
517 * The descriptor field is static
518 */
519 *Buffer = 0x85;
520 Buffer += 1;
521
522 /*
523 * The length field is static
524 */
525 Temp16 = 0x11;
526
527 ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
528 Buffer += 2;
529
530 /*
531 * Set the Information Byte
532 */
533 Temp8 = (UINT8) (LinkedList->Data.Memory32.ReadWriteAttribute & 0x01);
534 *Buffer = Temp8;
535 Buffer += 1;
536
537 /*
538 * Set the Range minimum base address
539 */
540 ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MinBaseAddress);
541 Buffer += 4;
542
543 /*
544 * Set the Range maximum base address
545 */
546 ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MaxBaseAddress);
547 Buffer += 4;
548
549 /*
550 * Set the base alignment
551 */
552 ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.Alignment);
553 Buffer += 4;
554
555 /*
556 * Set the range length
557 */
558 ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.RangeLength);
559 Buffer += 4;
560
561 /*
562 * Return the number of bytes consumed in this operation
563 */
564 *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
565 return_ACPI_STATUS (AE_OK);
566}
567
568
569/*******************************************************************************
570 *
571 * FUNCTION: AcpiRsFixedMemory32Stream
572 *
573 * PARAMETERS: LinkedList - Pointer to the resource linked list
574 * OutputBuffer - Pointer to the user's return buffer
575 * BytesConsumed - Pointer to where the number of bytes
576 * used in the OutputBuffer is returned
577 *
578 * RETURN: Status
579 *
580 * DESCRIPTION: Take the linked list resource structure and fills in the
581 * the appropriate bytes in a byte stream
582 *
583 ******************************************************************************/
584
585ACPI_STATUS
586AcpiRsFixedMemory32Stream (
587 ACPI_RESOURCE *LinkedList,
588 UINT8 **OutputBuffer,
589 ACPI_SIZE *BytesConsumed)
590{
591 UINT8 *Buffer = *OutputBuffer;
592 UINT16 Temp16 = 0;
593 UINT8 Temp8 = 0;
594
595
596 ACPI_FUNCTION_TRACE ("RsFixedMemory32Stream");
597
598
599 /*
600 * The descriptor field is static
601 */
602 *Buffer = 0x86;
603 Buffer += 1;
604
605 /*
606 * The length field is static
607 */
608 Temp16 = 0x09;
609
610 ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
611 Buffer += 2;
612
613 /*
614 * Set the Information Byte
615 */
616 Temp8 = (UINT8) (LinkedList->Data.FixedMemory32.ReadWriteAttribute & 0x01);
617 *Buffer = Temp8;
618 Buffer += 1;
619
620 /*
621 * Set the Range base address
622 */
623 ACPI_MOVE_32_TO_32 (Buffer,
624 &LinkedList->Data.FixedMemory32.RangeBaseAddress);
625 Buffer += 4;
626
627 /*
628 * Set the range length
629 */
630 ACPI_MOVE_32_TO_32 (Buffer,
631 &LinkedList->Data.FixedMemory32.RangeLength);
632 Buffer += 4;
633
634 /*
635 * Return the number of bytes consumed in this operation
636 */
637 *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
638 return_ACPI_STATUS (AE_OK);
639}
640
121
122#define _COMPONENT ACPI_RESOURCES
123 ACPI_MODULE_NAME ("rsmemory")
124
125
126/*******************************************************************************
127 *
128 * FUNCTION: AcpiRsMemory24Resource
129 *
130 * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
131 * stream
132 * BytesConsumed - Pointer to where the number of bytes
133 * consumed the ByteStreamBuffer is
134 * returned
135 * OutputBuffer - Pointer to the return data buffer
136 * StructureSize - Pointer to where the number of bytes
137 * in the return data struct is returned
138 *
139 * RETURN: Status
140 *
141 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
142 * structure pointed to by the OutputBuffer. Return the
143 * number of bytes consumed from the byte stream.
144 *
145 ******************************************************************************/
146
147ACPI_STATUS
148AcpiRsMemory24Resource (
149 UINT8 *ByteStreamBuffer,
150 ACPI_SIZE *BytesConsumed,
151 UINT8 **OutputBuffer,
152 ACPI_SIZE *StructureSize)
153{
154 UINT8 *Buffer = ByteStreamBuffer;
155 ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
156 UINT16 Temp16 = 0;
157 UINT8 Temp8 = 0;
158 ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
159
160
161 ACPI_FUNCTION_TRACE ("RsMemory24Resource");
162
163
164 /*
165 * Point past the Descriptor to get the number of bytes consumed
166 */
167 Buffer += 1;
168
169 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
170 Buffer += 2;
171 *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
172 OutputStruct->Id = ACPI_RSTYPE_MEM24;
173
174 /*
175 * Check Byte 3 the Read/Write bit
176 */
177 Temp8 = *Buffer;
178 Buffer += 1;
179 OutputStruct->Data.Memory24.ReadWriteAttribute = Temp8 & 0x01;
180
181 /*
182 * Get MinBaseAddress (Bytes 4-5)
183 */
184 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
185 Buffer += 2;
186 OutputStruct->Data.Memory24.MinBaseAddress = Temp16;
187
188 /*
189 * Get MaxBaseAddress (Bytes 6-7)
190 */
191 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
192 Buffer += 2;
193 OutputStruct->Data.Memory24.MaxBaseAddress = Temp16;
194
195 /*
196 * Get Alignment (Bytes 8-9)
197 */
198 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
199 Buffer += 2;
200 OutputStruct->Data.Memory24.Alignment = Temp16;
201
202 /*
203 * Get RangeLength (Bytes 10-11)
204 */
205 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
206 OutputStruct->Data.Memory24.RangeLength = Temp16;
207
208 /*
209 * Set the Length parameter
210 */
211 OutputStruct->Length = (UINT32) StructSize;
212
213 /*
214 * Return the final size of the structure
215 */
216 *StructureSize = StructSize;
217 return_ACPI_STATUS (AE_OK);
218}
219
220
221/*******************************************************************************
222 *
223 * FUNCTION: AcpiRsMemory24Stream
224 *
225 * PARAMETERS: LinkedList - Pointer to the resource linked list
226 * OutputBuffer - Pointer to the user's return buffer
227 * BytesConsumed - Pointer to where the number of bytes
228 * used in the OutputBuffer is returned
229 *
230 * RETURN: Status
231 *
232 * DESCRIPTION: Take the linked list resource structure and fills in the
233 * the appropriate bytes in a byte stream
234 *
235 ******************************************************************************/
236
237ACPI_STATUS
238AcpiRsMemory24Stream (
239 ACPI_RESOURCE *LinkedList,
240 UINT8 **OutputBuffer,
241 ACPI_SIZE *BytesConsumed)
242{
243 UINT8 *Buffer = *OutputBuffer;
244 UINT16 Temp16 = 0;
245 UINT8 Temp8 = 0;
246
247
248 ACPI_FUNCTION_TRACE ("RsMemory24Stream");
249
250
251 /*
252 * The descriptor field is static
253 */
254 *Buffer = 0x81;
255 Buffer += 1;
256
257 /*
258 * The length field is static
259 */
260 Temp16 = 0x09;
261 ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
262 Buffer += 2;
263
264 /*
265 * Set the Information Byte
266 */
267 Temp8 = (UINT8) (LinkedList->Data.Memory24.ReadWriteAttribute & 0x01);
268 *Buffer = Temp8;
269 Buffer += 1;
270
271 /*
272 * Set the Range minimum base address
273 */
274 ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MinBaseAddress);
275 Buffer += 2;
276
277 /*
278 * Set the Range maximum base address
279 */
280 ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MaxBaseAddress);
281 Buffer += 2;
282
283 /*
284 * Set the base alignment
285 */
286 ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.Alignment);
287 Buffer += 2;
288
289 /*
290 * Set the range length
291 */
292 ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.RangeLength);
293 Buffer += 2;
294
295 /*
296 * Return the number of bytes consumed in this operation
297 */
298 *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
299 return_ACPI_STATUS (AE_OK);
300}
301
302
303/*******************************************************************************
304 *
305 * FUNCTION: AcpiRsMemory32RangeResource
306 *
307 * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
308 * stream
309 * BytesConsumed - Pointer to where the number of bytes
310 * consumed the ByteStreamBuffer is
311 * returned
312 * OutputBuffer - Pointer to the return data buffer
313 * StructureSize - Pointer to where the number of bytes
314 * in the return data struct is returned
315 *
316 * RETURN: Status
317 *
318 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
319 * structure pointed to by the OutputBuffer. Return the
320 * number of bytes consumed from the byte stream.
321 *
322 ******************************************************************************/
323
324ACPI_STATUS
325AcpiRsMemory32RangeResource (
326 UINT8 *ByteStreamBuffer,
327 ACPI_SIZE *BytesConsumed,
328 UINT8 **OutputBuffer,
329 ACPI_SIZE *StructureSize)
330{
331 UINT8 *Buffer = ByteStreamBuffer;
332 ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
333 UINT16 Temp16 = 0;
334 UINT8 Temp8 = 0;
335 ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
336
337
338 ACPI_FUNCTION_TRACE ("RsMemory32RangeResource");
339
340
341 /*
342 * Point past the Descriptor to get the number of bytes consumed
343 */
344 Buffer += 1;
345
346 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
347 Buffer += 2;
348 *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
349
350 OutputStruct->Id = ACPI_RSTYPE_MEM32;
351
352 /*
353 * Point to the place in the output buffer where the data portion will
354 * begin.
355 * 1. Set the RESOURCE_DATA * Data to point to its own address, then
356 * 2. Set the pointer to the next address.
357 *
358 * NOTE: OutputStruct->Data is cast to UINT8, otherwise, this addition adds
359 * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(UINT8)
360 */
361
362 /*
363 * Check Byte 3 the Read/Write bit
364 */
365 Temp8 = *Buffer;
366 Buffer += 1;
367
368 OutputStruct->Data.Memory32.ReadWriteAttribute = Temp8 & 0x01;
369
370 /*
371 * Get MinBaseAddress (Bytes 4-7)
372 */
373 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MinBaseAddress, Buffer);
374 Buffer += 4;
375
376 /*
377 * Get MaxBaseAddress (Bytes 8-11)
378 */
379 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MaxBaseAddress, Buffer);
380 Buffer += 4;
381
382 /*
383 * Get Alignment (Bytes 12-15)
384 */
385 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.Alignment, Buffer);
386 Buffer += 4;
387
388 /*
389 * Get RangeLength (Bytes 16-19)
390 */
391 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.RangeLength, Buffer);
392
393 /*
394 * Set the Length parameter
395 */
396 OutputStruct->Length = (UINT32) StructSize;
397
398 /*
399 * Return the final size of the structure
400 */
401 *StructureSize = StructSize;
402 return_ACPI_STATUS (AE_OK);
403}
404
405
406/*******************************************************************************
407 *
408 * FUNCTION: AcpiRsFixedMemory32Resource
409 *
410 * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
411 * stream
412 * BytesConsumed - Pointer to where the number of bytes
413 * consumed the ByteStreamBuffer is
414 * returned
415 * OutputBuffer - Pointer to the return data buffer
416 * StructureSize - Pointer to where the number of bytes
417 * in the return data struct is returned
418 *
419 * RETURN: Status
420 *
421 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
422 * structure pointed to by the OutputBuffer. Return the
423 * number of bytes consumed from the byte stream.
424 *
425 ******************************************************************************/
426
427ACPI_STATUS
428AcpiRsFixedMemory32Resource (
429 UINT8 *ByteStreamBuffer,
430 ACPI_SIZE *BytesConsumed,
431 UINT8 **OutputBuffer,
432 ACPI_SIZE *StructureSize)
433{
434 UINT8 *Buffer = ByteStreamBuffer;
435 ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
436 UINT16 Temp16 = 0;
437 UINT8 Temp8 = 0;
438 ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
439
440
441 ACPI_FUNCTION_TRACE ("RsFixedMemory32Resource");
442
443
444 /*
445 * Point past the Descriptor to get the number of bytes consumed
446 */
447 Buffer += 1;
448 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
449
450 Buffer += 2;
451 *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
452
453 OutputStruct->Id = ACPI_RSTYPE_FIXED_MEM32;
454
455 /*
456 * Check Byte 3 the Read/Write bit
457 */
458 Temp8 = *Buffer;
459 Buffer += 1;
460 OutputStruct->Data.FixedMemory32.ReadWriteAttribute = Temp8 & 0x01;
461
462 /*
463 * Get RangeBaseAddress (Bytes 4-7)
464 */
465 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeBaseAddress, Buffer);
466 Buffer += 4;
467
468 /*
469 * Get RangeLength (Bytes 8-11)
470 */
471 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeLength, Buffer);
472
473 /*
474 * Set the Length parameter
475 */
476 OutputStruct->Length = (UINT32) StructSize;
477
478 /*
479 * Return the final size of the structure
480 */
481 *StructureSize = StructSize;
482 return_ACPI_STATUS (AE_OK);
483}
484
485
486/*******************************************************************************
487 *
488 * FUNCTION: AcpiRsMemory32RangeStream
489 *
490 * PARAMETERS: LinkedList - Pointer to the resource linked list
491 * OutputBuffer - Pointer to the user's return buffer
492 * BytesConsumed - Pointer to where the number of bytes
493 * used in the OutputBuffer is returned
494 *
495 * RETURN: Status
496 *
497 * DESCRIPTION: Take the linked list resource structure and fills in the
498 * the appropriate bytes in a byte stream
499 *
500 ******************************************************************************/
501
502ACPI_STATUS
503AcpiRsMemory32RangeStream (
504 ACPI_RESOURCE *LinkedList,
505 UINT8 **OutputBuffer,
506 ACPI_SIZE *BytesConsumed)
507{
508 UINT8 *Buffer = *OutputBuffer;
509 UINT16 Temp16 = 0;
510 UINT8 Temp8 = 0;
511
512
513 ACPI_FUNCTION_TRACE ("RsMemory32RangeStream");
514
515
516 /*
517 * The descriptor field is static
518 */
519 *Buffer = 0x85;
520 Buffer += 1;
521
522 /*
523 * The length field is static
524 */
525 Temp16 = 0x11;
526
527 ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
528 Buffer += 2;
529
530 /*
531 * Set the Information Byte
532 */
533 Temp8 = (UINT8) (LinkedList->Data.Memory32.ReadWriteAttribute & 0x01);
534 *Buffer = Temp8;
535 Buffer += 1;
536
537 /*
538 * Set the Range minimum base address
539 */
540 ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MinBaseAddress);
541 Buffer += 4;
542
543 /*
544 * Set the Range maximum base address
545 */
546 ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MaxBaseAddress);
547 Buffer += 4;
548
549 /*
550 * Set the base alignment
551 */
552 ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.Alignment);
553 Buffer += 4;
554
555 /*
556 * Set the range length
557 */
558 ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.RangeLength);
559 Buffer += 4;
560
561 /*
562 * Return the number of bytes consumed in this operation
563 */
564 *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
565 return_ACPI_STATUS (AE_OK);
566}
567
568
569/*******************************************************************************
570 *
571 * FUNCTION: AcpiRsFixedMemory32Stream
572 *
573 * PARAMETERS: LinkedList - Pointer to the resource linked list
574 * OutputBuffer - Pointer to the user's return buffer
575 * BytesConsumed - Pointer to where the number of bytes
576 * used in the OutputBuffer is returned
577 *
578 * RETURN: Status
579 *
580 * DESCRIPTION: Take the linked list resource structure and fills in the
581 * the appropriate bytes in a byte stream
582 *
583 ******************************************************************************/
584
585ACPI_STATUS
586AcpiRsFixedMemory32Stream (
587 ACPI_RESOURCE *LinkedList,
588 UINT8 **OutputBuffer,
589 ACPI_SIZE *BytesConsumed)
590{
591 UINT8 *Buffer = *OutputBuffer;
592 UINT16 Temp16 = 0;
593 UINT8 Temp8 = 0;
594
595
596 ACPI_FUNCTION_TRACE ("RsFixedMemory32Stream");
597
598
599 /*
600 * The descriptor field is static
601 */
602 *Buffer = 0x86;
603 Buffer += 1;
604
605 /*
606 * The length field is static
607 */
608 Temp16 = 0x09;
609
610 ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
611 Buffer += 2;
612
613 /*
614 * Set the Information Byte
615 */
616 Temp8 = (UINT8) (LinkedList->Data.FixedMemory32.ReadWriteAttribute & 0x01);
617 *Buffer = Temp8;
618 Buffer += 1;
619
620 /*
621 * Set the Range base address
622 */
623 ACPI_MOVE_32_TO_32 (Buffer,
624 &LinkedList->Data.FixedMemory32.RangeBaseAddress);
625 Buffer += 4;
626
627 /*
628 * Set the range length
629 */
630 ACPI_MOVE_32_TO_32 (Buffer,
631 &LinkedList->Data.FixedMemory32.RangeLength);
632 Buffer += 4;
633
634 /*
635 * Return the number of bytes consumed in this operation
636 */
637 *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
638 return_ACPI_STATUS (AE_OK);
639}
640