rsmemory.c revision 70243
138494Sobrien/*******************************************************************************
2174294Sobrien *
338494Sobrien * Module Name: rsmem24 - AcpiRsMemory24Resource
438494Sobrien *                        AcpiRsMemory24Stream
538494Sobrien *                        AcpiRsMemory32RangeResource
638494Sobrien *                        AcpiRsFixedMemory32Resource
738494Sobrien *                        AcpiRsMemory32RangeStream
838494Sobrien *                        AcpiRsFixedMemory32Stream
938494Sobrien *              $Revision: 11 $
1038494Sobrien *
1138494Sobrien ******************************************************************************/
1238494Sobrien
1338494Sobrien/******************************************************************************
1438494Sobrien *
1538494Sobrien * 1. Copyright Notice
1638494Sobrien *
1738494Sobrien * Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
1838494Sobrien * All rights reserved.
1938494Sobrien *
2042629Sobrien * 2. License
2138494Sobrien *
2238494Sobrien * 2.1. This is your license from Intel Corp. under its intellectual property
2338494Sobrien * rights.  You may have additional license terms from the party that provided
2438494Sobrien * you this software, covering your right to use that party's intellectual
2538494Sobrien * property rights.
2638494Sobrien *
2738494Sobrien * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2838494Sobrien * copy of the source code appearing in this file ("Covered Code") an
2938494Sobrien * irrevocable, perpetual, worldwide license under Intel's copyrights in the
3038494Sobrien * base code distributed originally by Intel ("Original Intel Code") to copy,
3138494Sobrien * make derivatives, distribute, use and display any portion of the Covered
3238494Sobrien * Code in any form, with the right to sublicense such rights; and
3338494Sobrien *
3438494Sobrien * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
3538494Sobrien * license (with the right to sublicense), under only those claims of Intel
3638494Sobrien * patents that are infringed by the Original Intel Code, to make, use, sell,
3738494Sobrien * offer to sell, and import the Covered Code and derivative works thereof
3838494Sobrien * solely to the minimum extent necessary to exercise the above copyright
3938494Sobrien * license, and in no event shall the patent license extend to any additions
40174294Sobrien * to or modifications of the Original Intel Code.  No other license or right
4138494Sobrien * is granted directly or by implication, estoppel or otherwise;
4238494Sobrien *
4338494Sobrien * The above copyright and patent license is granted only if the following
4438494Sobrien * conditions are met:
4538494Sobrien *
4638494Sobrien * 3. Conditions
4738494Sobrien *
4838494Sobrien * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4938494Sobrien * Redistribution of source code of any substantial portion of the Covered
5038494Sobrien * Code or modification with rights to further distribute source must include
5138494Sobrien * the above Copyright Notice, the above License, this list of Conditions,
5238494Sobrien * and the following Disclaimer and Export Compliance provision.  In addition,
5338494Sobrien * Licensee must cause all Covered Code to which Licensee contributes to
5438494Sobrien * contain a file documenting the changes Licensee made to create that Covered
5538494Sobrien * Code and the date of any change.  Licensee must include in that file the
5638494Sobrien * documentation of any changes made by any predecessor Licensee.  Licensee
5738494Sobrien * must include a prominent statement that the modification is derived,
5838494Sobrien * directly or indirectly, from Original Intel Code.
5938494Sobrien *
6038494Sobrien * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
6138494Sobrien * Redistribution of source code of any substantial portion of the Covered
6238494Sobrien * Code or modification without rights to further distribute source must
6338494Sobrien * include the following Disclaimer and Export Compliance provision in the
6438494Sobrien * documentation and/or other materials provided with distribution.  In
6538494Sobrien * addition, Licensee may not authorize further sublicense of source of any
6638494Sobrien * portion of the Covered Code, and must include terms to the effect that the
67174294Sobrien * license from Licensee to its licensee is limited to the intellectual
6838494Sobrien * property embodied in the software Licensee provides to its licensee, and
6938494Sobrien * not to intellectual property embodied in modifications its licensee may
7038494Sobrien * make.
7138494Sobrien *
7238494Sobrien * 3.3. Redistribution of Executable. Redistribution in executable form of any
7338494Sobrien * substantial portion of the Covered Code or modification must reproduce the
7438494Sobrien * above Copyright Notice, and the following Disclaimer and Export Compliance
7538494Sobrien * provision in the documentation and/or other materials provided with the
76174294Sobrien * distribution.
7738494Sobrien *
7838494Sobrien * 3.4. Intel retains all right, title, and interest in and to the Original
79174294Sobrien * Intel Code.
80174294Sobrien *
81174294Sobrien * 3.5. Neither the name Intel nor any other trademark owned or controlled by
82174294Sobrien * Intel shall be used in advertising or otherwise to promote the sale, use or
8338494Sobrien * other dealings in products derived from or relating to the Covered Code
84174294Sobrien * without prior written authorization from Intel.
85174294Sobrien *
86174294Sobrien * 4. Disclaimer and Export Compliance
87174294Sobrien *
88174294Sobrien * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
89174294Sobrien * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
90174294Sobrien * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
91174294Sobrien * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
9238494Sobrien * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
9338494Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
9438494Sobrien * PARTICULAR PURPOSE.
9538494Sobrien *
9638494Sobrien * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9738494Sobrien * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9838494Sobrien * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9938494Sobrien * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
10038494Sobrien * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
10138494Sobrien * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
102174294Sobrien * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
10338494Sobrien * LIMITED REMEDY.
10438494Sobrien *
10538494Sobrien * 4.3. Licensee shall not export, either directly or indirectly, any of this
10638494Sobrien * software or system incorporating such software without first obtaining any
10738494Sobrien * required license or other approval from the U. S. Department of Commerce or
10838494Sobrien * any other agency or department of the United States Government.  In the
10938494Sobrien * event Licensee exports any such software from the United States or
11038494Sobrien * re-exports any such software from a foreign destination, Licensee shall
11138494Sobrien * ensure that the distribution and export/re-export of the software is in
11238494Sobrien * compliance with all laws, regulations, orders, or other restrictions of the
11338494Sobrien * U.S. Export Administration Regulations. Licensee agrees that neither it nor
11438494Sobrien * any of its subsidiaries will export/re-export any technical data, process,
11538494Sobrien * software, or service, directly or indirectly, to any country for which the
11638494Sobrien * United States government or any agency thereof requires an export license,
11738494Sobrien * other governmental approval, or letter of assurance, without first obtaining
11838494Sobrien * such license, approval or letter.
11938494Sobrien *
12038494Sobrien *****************************************************************************/
12138494Sobrien
12238494Sobrien#define __RSMEMORY_C__
12338494Sobrien
12438494Sobrien#include "acpi.h"
12538494Sobrien#include "acresrc.h"
12638494Sobrien
12738494Sobrien#define _COMPONENT          RESOURCE_MANAGER
12838494Sobrien        MODULE_NAME         ("rsmemory")
12938494Sobrien
13038494Sobrien
13138494Sobrien/*******************************************************************************
13238494Sobrien *
13338494Sobrien * FUNCTION:    AcpiRsMemory24Resource
134119679Smbr *
13538494Sobrien * PARAMETERS:  ByteStreamBuffer        - Pointer to the resource input byte
13638494Sobrien *                                          stream
13738494Sobrien *              BytesConsumed           - UINT32 pointer that is filled with
13838494Sobrien *                                          the number of bytes consumed from
13938494Sobrien *                                          the ByteStreamBuffer
14038494Sobrien *              OutputBuffer            - Pointer to the user's return buffer
14138494Sobrien *              StructureSize           - UINT32 pointer that is filled with
14238494Sobrien *                                          the number of bytes in the filled
14338494Sobrien *                                          in structure
14438494Sobrien *
14538494Sobrien * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
14638494Sobrien *
14738494Sobrien * DESCRIPTION: Take the resource byte stream and fill out the appropriate
14838494Sobrien *                  structure pointed to by the OutputBuffer.  Return the
14938494Sobrien *                  number of bytes consumed from the byte stream.
15038494Sobrien *
15138494Sobrien ******************************************************************************/
15238494Sobrien
153174294SobrienACPI_STATUS
154174294SobrienAcpiRsMemory24Resource (
155174294Sobrien    UINT8                   *ByteStreamBuffer,
156174294Sobrien    UINT32                  *BytesConsumed,
15738494Sobrien    UINT8                   **OutputBuffer,
158174294Sobrien    UINT32                  *StructureSize)
15938494Sobrien{
160174294Sobrien    UINT8                   *Buffer = ByteStreamBuffer;
161174294Sobrien    RESOURCE                *OutputStruct = (RESOURCE *) * OutputBuffer;
162174294Sobrien    UINT16                  Temp16 = 0;
163174294Sobrien    UINT8                   Temp8 = 0;
164174294Sobrien    UINT32                  StructSize = sizeof (MEMORY24_RESOURCE) +
165174294Sobrien                                         RESOURCE_LENGTH_NO_DATA;
16638494Sobrien
16738494Sobrien
168174294Sobrien    FUNCTION_TRACE ("RsMemory24Resource");
16938494Sobrien
17038494Sobrien    /*
171174294Sobrien     * Point past the Descriptor to get the number of bytes consumed
17238494Sobrien     */
173174294Sobrien    Buffer += 1;
17438494Sobrien
17538494Sobrien    MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
17638494Sobrien    Buffer += 2;
177    *BytesConsumed = Temp16 + 3;
178    OutputStruct->Id = Memory24;
179
180    /*
181     * Check Byte 3 the Read/Write bit
182     */
183    Temp8 = *Buffer;
184    Buffer += 1;
185    OutputStruct->Data.Memory24.ReadWriteAttribute = Temp8 & 0x01;
186
187    /*
188     * Get MinBaseAddress (Bytes 4-5)
189     */
190    MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
191    Buffer += 2;
192    OutputStruct->Data.Memory24.MinBaseAddress = Temp16;
193
194    /*
195     * Get MaxBaseAddress (Bytes 6-7)
196     */
197    MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
198    Buffer += 2;
199    OutputStruct->Data.Memory24.MaxBaseAddress = Temp16;
200
201    /*
202     * Get Alignment (Bytes 8-9)
203     */
204    MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
205    Buffer += 2;
206    OutputStruct->Data.Memory24.Alignment = Temp16;
207
208    /*
209     * Get RangeLength (Bytes 10-11)
210     */
211    MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
212    OutputStruct->Data.Memory24.RangeLength = Temp16;
213
214    /*
215     * Set the Length parameter
216     */
217    OutputStruct->Length = StructSize;
218
219    /*
220     * Return the final size of the structure
221     */
222    *StructureSize = StructSize;
223
224    return_ACPI_STATUS (AE_OK);
225}
226
227
228/*******************************************************************************
229 *
230 * FUNCTION:    AcpiRsMemory24Stream
231 *
232 * PARAMETERS:  LinkedList              - Pointer to the resource linked list
233 *              OutputBuffer            - Pointer to the user's return buffer
234 *              BytesConsumed           - UINT32 pointer that is filled with
235 *                                          the number of bytes of the
236 *                                          OutputBuffer used
237 *
238 * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
239 *
240 * DESCRIPTION: Take the linked list resource structure and fills in the
241 *                  the appropriate bytes in a byte stream
242 *
243 ******************************************************************************/
244
245ACPI_STATUS
246AcpiRsMemory24Stream (
247    RESOURCE                *LinkedList,
248    UINT8                   **OutputBuffer,
249    UINT32                  *BytesConsumed)
250{
251    UINT8                   *Buffer = *OutputBuffer;
252    UINT16                  Temp16 = 0;
253    UINT8                   Temp8 = 0;
254
255
256    FUNCTION_TRACE ("RsMemory24Stream");
257
258    /*
259     * The descriptor field is static
260     */
261    *Buffer = 0x81;
262    Buffer += 1;
263
264    /*
265     * The length field is static
266     */
267    Temp16 = 0x09;
268    MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
269    Buffer += 2;
270
271    /*
272     * Set the Information Byte
273     */
274    Temp8 = (UINT8) (LinkedList->Data.Memory24.ReadWriteAttribute & 0x01);
275    *Buffer = Temp8;
276    Buffer += 1;
277
278    /*
279     * Set the Range minimum base address
280     */
281    MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.MinBaseAddress);
282    Buffer += 2;
283
284    /*
285     * Set the Range maximum base address
286     */
287    MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.MaxBaseAddress);
288    Buffer += 2;
289
290    /*
291     * Set the base alignment
292     */
293    MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.Alignment);
294    Buffer += 2;
295
296    /*
297     * Set the range length
298     */
299    MOVE_UNALIGNED16_TO_16 (Buffer, &LinkedList->Data.Memory24.RangeLength);
300    Buffer += 2;
301
302    /*
303     * Return the number of bytes consumed in this operation
304     */
305    *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer -
306                     (NATIVE_UINT) *OutputBuffer);
307
308    return_ACPI_STATUS (AE_OK);
309}
310
311
312/*******************************************************************************
313 *
314 * FUNCTION:    AcpiRsMemory32RangeResource
315 *
316 * PARAMETERS:  ByteStreamBuffer        - Pointer to the resource input byte
317 *                                          stream
318 *              BytesConsumed           - UINT32 pointer that is filled with
319 *                                          the number of bytes consumed from
320 *                                          the ByteStreamBuffer
321 *              OutputBuffer            - Pointer to the user's return buffer
322 *              StructureSize           - UINT32 pointer that is filled with
323 *                                          the number of bytes in the filled
324 *                                          in structure
325 *
326 * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
327 *
328 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
329 *                  structure pointed to by the OutputBuffer.  Return the
330 *                  number of bytes consumed from the byte stream.
331 *
332 ******************************************************************************/
333
334ACPI_STATUS
335AcpiRsMemory32RangeResource (
336    UINT8                   *ByteStreamBuffer,
337    UINT32                  *BytesConsumed,
338    UINT8                   **OutputBuffer,
339    UINT32                  *StructureSize)
340{
341    UINT8                   *Buffer = ByteStreamBuffer;
342    RESOURCE                *OutputStruct = (RESOURCE *) * OutputBuffer;
343    UINT16                  Temp16 = 0;
344    UINT8                   Temp8 = 0;
345    UINT32                  StructSize = sizeof (MEMORY32_RESOURCE) +
346                                         RESOURCE_LENGTH_NO_DATA;
347
348
349    FUNCTION_TRACE ("RsMemory32RangeResource");
350
351    /*
352     * Point past the Descriptor to get the number of bytes consumed
353     */
354    Buffer += 1;
355
356    MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
357    Buffer += 2;
358    *BytesConsumed = Temp16 + 3;
359
360    OutputStruct->Id = Memory32;
361
362    /*
363     *  Point to the place in the output buffer where the data portion will
364     *    begin.
365     *  1. Set the RESOURCE_DATA * Data to point to it's own address, then
366     *  2. Set the pointer to the next address.
367     *
368     *  NOTE: OutputStruct->Data is cast to UINT8, otherwise, this addition adds
369     *  4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(UINT8)
370     */
371
372    /*
373     * Check Byte 3 the Read/Write bit
374     */
375    Temp8 = *Buffer;
376    Buffer += 1;
377
378    OutputStruct->Data.Memory32.ReadWriteAttribute = Temp8 & 0x01;
379
380    /*
381     * Get MinBaseAddress (Bytes 4-7)
382     */
383    MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.MinBaseAddress,
384                            Buffer);
385    Buffer += 4;
386
387    /*
388     * Get MaxBaseAddress (Bytes 8-11)
389     */
390    MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.MaxBaseAddress,
391                            Buffer);
392    Buffer += 4;
393
394    /*
395     * Get Alignment (Bytes 12-15)
396     */
397    MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.Alignment, Buffer);
398    Buffer += 4;
399
400    /*
401     * Get RangeLength (Bytes 16-19)
402     */
403    MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Memory32.RangeLength, Buffer);
404
405    /*
406     * Set the Length parameter
407     */
408    OutputStruct->Length = StructSize;
409
410    /*
411     * Return the final size of the structure
412     */
413    *StructureSize = StructSize;
414
415    return_ACPI_STATUS (AE_OK);
416}
417
418
419/*******************************************************************************
420 *
421 * FUNCTION:    AcpiRsFixedMemory32Resource
422 *
423 * PARAMETERS:  ByteStreamBuffer        - Pointer to the resource input byte
424 *                                          stream
425 *              BytesConsumed           - UINT32 pointer that is filled with
426 *                                          the number of bytes consumed from
427 *                                          the ByteStreamBuffer
428 *              OutputBuffer            - Pointer to the user's return buffer
429 *              StructureSize           - UINT32 pointer that is filled with
430 *                                          the number of bytes in the filled
431 *                                          in structure
432 *
433 * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
434 *
435 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
436 *                  structure pointed to by the OutputBuffer.  Return the
437 *                  number of bytes consumed from the byte stream.
438 *
439 ******************************************************************************/
440
441ACPI_STATUS
442AcpiRsFixedMemory32Resource (
443    UINT8                   *ByteStreamBuffer,
444    UINT32                  *BytesConsumed,
445    UINT8                   **OutputBuffer,
446    UINT32                  *StructureSize)
447{
448    UINT8                   *Buffer = ByteStreamBuffer;
449    RESOURCE                *OutputStruct = (RESOURCE *) * OutputBuffer;
450    UINT16                  Temp16 = 0;
451    UINT8                   Temp8 = 0;
452    UINT32                  StructSize = sizeof (FIXED_MEMORY32_RESOURCE) +
453                                         RESOURCE_LENGTH_NO_DATA;
454
455
456    FUNCTION_TRACE ("RsFixedMemory32Resource");
457
458    /*
459     * Point past the Descriptor to get the number of bytes consumed
460     */
461    Buffer += 1;
462    MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer);
463
464    Buffer += 2;
465    *BytesConsumed = Temp16 + 3;
466
467    OutputStruct->Id = FixedMemory32;
468
469    /*
470     * Check Byte 3 the Read/Write bit
471     */
472    Temp8 = *Buffer;
473    Buffer += 1;
474    OutputStruct->Data.FixedMemory32.ReadWriteAttribute = Temp8 & 0x01;
475
476    /*
477     * Get RangeBaseAddress (Bytes 4-7)
478     */
479    MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeBaseAddress,
480                            Buffer);
481    Buffer += 4;
482
483    /*
484     * Get RangeLength (Bytes 8-11)
485     */
486    MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeLength,
487                            Buffer);
488
489    /*
490     * Set the Length parameter
491     */
492    OutputStruct->Length = StructSize;
493
494    /*
495     * Return the final size of the structure
496     */
497    *StructureSize = StructSize;
498
499    return_ACPI_STATUS (AE_OK);
500}
501
502
503/*******************************************************************************
504 *
505 * FUNCTION:    AcpiRsMemory32RangeStream
506 *
507 * PARAMETERS:  LinkedList              - Pointer to the resource linked list
508 *              OutputBuffer            - Pointer to the user's return buffer
509 *              BytesConsumed           - UINT32 pointer that is filled with
510 *                                          the number of bytes of the
511 *                                          OutputBuffer used
512 *
513 * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
514 *
515 * DESCRIPTION: Take the linked list resource structure and fills in the
516 *                  the appropriate bytes in a byte stream
517 *
518 ******************************************************************************/
519
520ACPI_STATUS
521AcpiRsMemory32RangeStream (
522    RESOURCE                *LinkedList,
523    UINT8                   **OutputBuffer,
524    UINT32                  *BytesConsumed)
525{
526    UINT8                   *Buffer = *OutputBuffer;
527    UINT16                  Temp16 = 0;
528    UINT8                   Temp8 = 0;
529
530
531    FUNCTION_TRACE ("RsMemory32RangeStream");
532
533    /*
534     * The descriptor field is static
535     */
536    *Buffer = 0x85;
537    Buffer += 1;
538
539    /*
540     * The length field is static
541     */
542    Temp16 = 0x11;
543
544    MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
545    Buffer += 2;
546
547    /*
548     * Set the Information Byte
549     */
550    Temp8 = (UINT8) (LinkedList->Data.Memory32.ReadWriteAttribute & 0x01);
551    *Buffer = Temp8;
552    Buffer += 1;
553
554    /*
555     * Set the Range minimum base address
556     */
557    MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.MinBaseAddress);
558    Buffer += 4;
559
560    /*
561     * Set the Range maximum base address
562     */
563    MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.MaxBaseAddress);
564    Buffer += 4;
565
566    /*
567     * Set the base alignment
568     */
569    MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.Alignment);
570    Buffer += 4;
571
572    /*
573     * Set the range length
574     */
575    MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.Memory32.RangeLength);
576    Buffer += 4;
577
578    /*
579     * Return the number of bytes consumed in this operation
580     */
581    *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer -
582                     (NATIVE_UINT) *OutputBuffer);
583
584    return_ACPI_STATUS (AE_OK);
585}
586
587
588/*******************************************************************************
589 *
590 * FUNCTION:    AcpiRsFixedMemory32Stream
591 *
592 * PARAMETERS:  LinkedList              - Pointer to the resource linked list
593 *              OutputBuffer            - Pointer to the user's return buffer
594 *              BytesConsumed           - UINT32 pointer that is filled with
595 *                                          the number of bytes of the
596 *                                          OutputBuffer used
597 *
598 * RETURN:      Status  AE_OK if okay, else a valid ACPI_STATUS code
599 *
600 * DESCRIPTION: Take the linked list resource structure and fills in the
601 *                  the appropriate bytes in a byte stream
602 *
603 ******************************************************************************/
604
605ACPI_STATUS
606AcpiRsFixedMemory32Stream (
607    RESOURCE                *LinkedList,
608    UINT8                   **OutputBuffer,
609    UINT32                  *BytesConsumed)
610{
611    UINT8                   *Buffer = *OutputBuffer;
612    UINT16                  Temp16 = 0;
613    UINT8                   Temp8 = 0;
614
615
616    FUNCTION_TRACE ("RsFixedMemory32Stream");
617
618    /*
619     * The descriptor field is static
620     */
621    *Buffer = 0x86;
622    Buffer += 1;
623
624    /*
625     * The length field is static
626     */
627    Temp16 = 0x09;
628
629    MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16);
630    Buffer += 2;
631
632    /*
633     * Set the Information Byte
634     */
635    Temp8 = (UINT8) (LinkedList->Data.FixedMemory32.ReadWriteAttribute & 0x01);
636    *Buffer = Temp8;
637    Buffer += 1;
638
639    /*
640     * Set the Range base address
641     */
642    MOVE_UNALIGNED32_TO_32 (Buffer,
643                            &LinkedList->Data.FixedMemory32.RangeBaseAddress);
644    Buffer += 4;
645
646    /*
647     * Set the range length
648     */
649    MOVE_UNALIGNED32_TO_32 (Buffer,
650                            &LinkedList->Data.FixedMemory32.RangeLength);
651    Buffer += 4;
652
653    /*
654     * Return the number of bytes consumed in this operation
655     */
656    *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer -
657                     (NATIVE_UINT) *OutputBuffer);
658
659    return_ACPI_STATUS (AE_OK);
660}
661
662