1 /*******************************************************************************
3 * Module Name: rsmem24 - Memory resource descriptors
6 ******************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
13 * All rights reserved.
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
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
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;
38 * The above copyright and patent license is granted only if the following
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.
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
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
73 * 3.4. Intel retains all right, title, and interest in and to the Original
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.
81 * 4. Disclaimer and Export Compliance
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
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
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.
115 *****************************************************************************/
117 #define __RSMEMORY_C__
122 #define _COMPONENT ACPI_RESOURCES
123 ACPI_MODULE_NAME ("rsmemory")
126 /*******************************************************************************
128 * FUNCTION: AcpiRsMemory24Resource
130 * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
132 * BytesConsumed - Pointer to where the number of bytes
133 * consumed the ByteStreamBuffer is
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
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.
145 ******************************************************************************/
148 AcpiRsMemory24Resource (
149 UINT8 *ByteStreamBuffer,
150 ACPI_SIZE *BytesConsumed,
151 UINT8 **OutputBuffer,
152 ACPI_SIZE *StructureSize)
154 UINT8 *Buffer = ByteStreamBuffer;
155 ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
158 ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
161 ACPI_FUNCTION_TRACE ("RsMemory24Resource");
165 * Point past the Descriptor to get the number of bytes consumed
169 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
171 *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
172 OutputStruct->Id = ACPI_RSTYPE_MEM24;
175 * Check Byte 3 the Read/Write bit
179 OutputStruct->Data.Memory24.ReadWriteAttribute = Temp8 & 0x01;
182 * Get MinBaseAddress (Bytes 4-5)
184 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
186 OutputStruct->Data.Memory24.MinBaseAddress = Temp16;
189 * Get MaxBaseAddress (Bytes 6-7)
191 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
193 OutputStruct->Data.Memory24.MaxBaseAddress = Temp16;
196 * Get Alignment (Bytes 8-9)
198 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
200 OutputStruct->Data.Memory24.Alignment = Temp16;
203 * Get RangeLength (Bytes 10-11)
205 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
206 OutputStruct->Data.Memory24.RangeLength = Temp16;
209 * Set the Length parameter
211 OutputStruct->Length = (UINT32) StructSize;
214 * Return the final size of the structure
216 *StructureSize = StructSize;
217 return_ACPI_STATUS (AE_OK);
221 /*******************************************************************************
223 * FUNCTION: AcpiRsMemory24Stream
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
232 * DESCRIPTION: Take the linked list resource structure and fills in the
233 * the appropriate bytes in a byte stream
235 ******************************************************************************/
238 AcpiRsMemory24Stream (
239 ACPI_RESOURCE *LinkedList,
240 UINT8 **OutputBuffer,
241 ACPI_SIZE *BytesConsumed)
243 UINT8 *Buffer = *OutputBuffer;
248 ACPI_FUNCTION_TRACE ("RsMemory24Stream");
252 * The descriptor field is static
258 * The length field is static
261 ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
265 * Set the Information Byte
267 Temp8 = (UINT8) (LinkedList->Data.Memory24.ReadWriteAttribute & 0x01);
272 * Set the Range minimum base address
274 ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MinBaseAddress);
278 * Set the Range maximum base address
280 ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MaxBaseAddress);
284 * Set the base alignment
286 ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.Alignment);
290 * Set the range length
292 ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.RangeLength);
296 * Return the number of bytes consumed in this operation
298 *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
299 return_ACPI_STATUS (AE_OK);
303 /*******************************************************************************
305 * FUNCTION: AcpiRsMemory32RangeResource
307 * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
309 * BytesConsumed - Pointer to where the number of bytes
310 * consumed the ByteStreamBuffer is
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
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.
322 ******************************************************************************/
325 AcpiRsMemory32RangeResource (
326 UINT8 *ByteStreamBuffer,
327 ACPI_SIZE *BytesConsumed,
328 UINT8 **OutputBuffer,
329 ACPI_SIZE *StructureSize)
331 UINT8 *Buffer = ByteStreamBuffer;
332 ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
335 ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
338 ACPI_FUNCTION_TRACE ("RsMemory32RangeResource");
342 * Point past the Descriptor to get the number of bytes consumed
346 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
348 *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
350 OutputStruct->Id = ACPI_RSTYPE_MEM32;
353 * Point to the place in the output buffer where the data portion will
355 * 1. Set the RESOURCE_DATA * Data to point to its own address, then
356 * 2. Set the pointer to the next address.
358 * NOTE: OutputStruct->Data is cast to UINT8, otherwise, this addition adds
359 * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(UINT8)
363 * Check Byte 3 the Read/Write bit
368 OutputStruct->Data.Memory32.ReadWriteAttribute = Temp8 & 0x01;
371 * Get MinBaseAddress (Bytes 4-7)
373 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MinBaseAddress, Buffer);
377 * Get MaxBaseAddress (Bytes 8-11)
379 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MaxBaseAddress, Buffer);
383 * Get Alignment (Bytes 12-15)
385 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.Alignment, Buffer);
389 * Get RangeLength (Bytes 16-19)
391 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.RangeLength, Buffer);
394 * Set the Length parameter
396 OutputStruct->Length = (UINT32) StructSize;
399 * Return the final size of the structure
401 *StructureSize = StructSize;
402 return_ACPI_STATUS (AE_OK);
406 /*******************************************************************************
408 * FUNCTION: AcpiRsFixedMemory32Resource
410 * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
412 * BytesConsumed - Pointer to where the number of bytes
413 * consumed the ByteStreamBuffer is
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
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.
425 ******************************************************************************/
428 AcpiRsFixedMemory32Resource (
429 UINT8 *ByteStreamBuffer,
430 ACPI_SIZE *BytesConsumed,
431 UINT8 **OutputBuffer,
432 ACPI_SIZE *StructureSize)
434 UINT8 *Buffer = ByteStreamBuffer;
435 ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
438 ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
441 ACPI_FUNCTION_TRACE ("RsFixedMemory32Resource");
445 * Point past the Descriptor to get the number of bytes consumed
448 ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
451 *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
453 OutputStruct->Id = ACPI_RSTYPE_FIXED_MEM32;
456 * Check Byte 3 the Read/Write bit
460 OutputStruct->Data.FixedMemory32.ReadWriteAttribute = Temp8 & 0x01;
463 * Get RangeBaseAddress (Bytes 4-7)
465 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeBaseAddress, Buffer);
469 * Get RangeLength (Bytes 8-11)
471 ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeLength, Buffer);
474 * Set the Length parameter
476 OutputStruct->Length = (UINT32) StructSize;
479 * Return the final size of the structure
481 *StructureSize = StructSize;
482 return_ACPI_STATUS (AE_OK);
486 /*******************************************************************************
488 * FUNCTION: AcpiRsMemory32RangeStream
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
497 * DESCRIPTION: Take the linked list resource structure and fills in the
498 * the appropriate bytes in a byte stream
500 ******************************************************************************/
503 AcpiRsMemory32RangeStream (
504 ACPI_RESOURCE *LinkedList,
505 UINT8 **OutputBuffer,
506 ACPI_SIZE *BytesConsumed)
508 UINT8 *Buffer = *OutputBuffer;
513 ACPI_FUNCTION_TRACE ("RsMemory32RangeStream");
517 * The descriptor field is static
523 * The length field is static
527 ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
531 * Set the Information Byte
533 Temp8 = (UINT8) (LinkedList->Data.Memory32.ReadWriteAttribute & 0x01);
538 * Set the Range minimum base address
540 ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MinBaseAddress);
544 * Set the Range maximum base address
546 ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MaxBaseAddress);
550 * Set the base alignment
552 ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.Alignment);
556 * Set the range length
558 ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.RangeLength);
562 * Return the number of bytes consumed in this operation
564 *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
565 return_ACPI_STATUS (AE_OK);
569 /*******************************************************************************
571 * FUNCTION: AcpiRsFixedMemory32Stream
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
580 * DESCRIPTION: Take the linked list resource structure and fills in the
581 * the appropriate bytes in a byte stream
583 ******************************************************************************/
586 AcpiRsFixedMemory32Stream (
587 ACPI_RESOURCE *LinkedList,
588 UINT8 **OutputBuffer,
589 ACPI_SIZE *BytesConsumed)
591 UINT8 *Buffer = *OutputBuffer;
596 ACPI_FUNCTION_TRACE ("RsFixedMemory32Stream");
600 * The descriptor field is static
606 * The length field is static
610 ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
614 * Set the Information Byte
616 Temp8 = (UINT8) (LinkedList->Data.FixedMemory32.ReadWriteAttribute & 0x01);
621 * Set the Range base address
623 ACPI_MOVE_32_TO_32 (Buffer,
624 &LinkedList->Data.FixedMemory32.RangeBaseAddress);
628 * Set the range length
630 ACPI_MOVE_32_TO_32 (Buffer,
631 &LinkedList->Data.FixedMemory32.RangeLength);
635 * Return the number of bytes consumed in this operation
637 *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
638 return_ACPI_STATUS (AE_OK);