[ACPI] ACPICA 20050930
[safe/jmp/linux-2.6] / drivers / acpi / resources / rsaddr.c
1 /*******************************************************************************
2  *
3  * Module Name: rsaddr - Address resource descriptors (16/32/64)
4  *
5  ******************************************************************************/
6
7 /*
8  * Copyright (C) 2000 - 2005, R. Byron Moore
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43
44 #include <acpi/acpi.h>
45 #include <acpi/acresrc.h>
46
47 #define _COMPONENT          ACPI_RESOURCES
48 ACPI_MODULE_NAME("rsaddr")
49
50 /* Local prototypes */
51 static void
52 acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags);
53
54 static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource);
55
56 static void
57 acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags);
58
59 static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource);
60
61 static void
62 acpi_rs_set_address_common(union aml_resource *aml,
63                            struct acpi_resource *resource);
64
65 static u8
66 acpi_rs_get_address_common(struct acpi_resource *resource,
67                            union aml_resource *aml);
68
69 /*******************************************************************************
70  *
71  * FUNCTION:    acpi_rs_decode_general_flags
72  *
73  * PARAMETERS:  Resource            - Address resource data struct
74  *              Flags               - Raw AML flag byte
75  *
76  * RETURN:      Decoded flag bits in resource struct
77  *
78  * DESCRIPTION: Decode a general flag byte to an address resource struct
79  *
80  ******************************************************************************/
81
82 static void
83 acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags)
84 {
85         ACPI_FUNCTION_ENTRY();
86
87         /* Producer / Consumer - flag bit[0] */
88
89         resource->address.producer_consumer = (u32) (flags & 0x01);
90
91         /* Decode (_DEC) - flag bit[1] */
92
93         resource->address.decode = (u32) ((flags >> 1) & 0x01);
94
95         /* Min Address Fixed (_MIF) - flag bit[2] */
96
97         resource->address.min_address_fixed = (u32) ((flags >> 2) & 0x01);
98
99         /* Max Address Fixed (_MAF) - flag bit[3] */
100
101         resource->address.max_address_fixed = (u32) ((flags >> 3) & 0x01);
102 }
103
104 /*******************************************************************************
105  *
106  * FUNCTION:    acpi_rs_encode_general_flags
107  *
108  * PARAMETERS:  Resource            - Address resource data struct
109  *
110  * RETURN:      Encoded general flag byte
111  *
112  * DESCRIPTION: Construct a general flag byte from an address resource struct
113  *
114  ******************************************************************************/
115
116 static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource)
117 {
118         ACPI_FUNCTION_ENTRY();
119
120         return ((u8)
121
122                 /* Producer / Consumer - flag bit[0] */
123                 ((resource->address.producer_consumer & 0x01) |
124                  /* Decode (_DEC) - flag bit[1] */
125                  ((resource->address.decode & 0x01) << 1) |
126                  /* Min Address Fixed (_MIF) - flag bit[2] */
127                  ((resource->address.min_address_fixed & 0x01) << 2) |
128                  /* Max Address Fixed (_MAF) - flag bit[3] */
129                  ((resource->address.max_address_fixed & 0x01) << 3))
130             );
131 }
132
133 /*******************************************************************************
134  *
135  * FUNCTION:    acpi_rs_decode_specific_flags
136  *
137  * PARAMETERS:  Resource            - Address resource data struct
138  *              Flags               - Raw AML flag byte
139  *
140  * RETURN:      Decoded flag bits in attribute struct
141  *
142  * DESCRIPTION: Decode a type-specific flag byte to an attribute struct.
143  *              Type-specific flags are only defined for the Memory and IO
144  *              resource types.
145  *
146  ******************************************************************************/
147
148 static void
149 acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags)
150 {
151         ACPI_FUNCTION_ENTRY();
152
153         if (resource->address.resource_type == ACPI_MEMORY_RANGE) {
154                 /* Write Status (_RW) - flag bit[0] */
155
156                 resource->address.attribute.memory.read_write_attribute =
157                     (u16) (flags & 0x01);
158
159                 /* Memory Attributes (_MEM) - flag bits[2:1] */
160
161                 resource->address.attribute.memory.cache_attribute =
162                     (u16) ((flags >> 1) & 0x03);
163         } else if (resource->address.resource_type == ACPI_IO_RANGE) {
164                 /* Ranges (_RNG) - flag bits[1:0] */
165
166                 resource->address.attribute.io.range_attribute =
167                     (u16) (flags & 0x03);
168
169                 /* Translations (_TTP and _TRS) - flag bits[5:4] */
170
171                 resource->address.attribute.io.translation_attribute =
172                     (u16) ((flags >> 4) & 0x03);
173         }
174 }
175
176 /*******************************************************************************
177  *
178  * FUNCTION:    acpi_rs_encode_specific_flags
179  *
180  * PARAMETERS:  Resource            - Address resource data struct
181  *
182  * RETURN:      Encoded type-specific flag byte
183  *
184  * DESCRIPTION: Construct a type-specific flag byte from an attribute struct.
185  *              Type-specific flags are only defined for the Memory and IO
186  *              resource types.
187  *
188  ******************************************************************************/
189
190 static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource)
191 {
192         ACPI_FUNCTION_ENTRY();
193
194         if (resource->address.resource_type == ACPI_MEMORY_RANGE) {
195                 return ((u8)
196
197                         /* Write Status (_RW) - flag bit[0] */
198                         ((resource->address.attribute.memory.
199                           read_write_attribute & 0x01) |
200                          /* Memory Attributes (_MEM) - flag bits[2:1] */
201                          ((resource->address.attribute.memory.
202                            cache_attribute & 0x03) << 1)));
203         } else if (resource->address.resource_type == ACPI_IO_RANGE) {
204                 return ((u8)
205
206                         /* Ranges (_RNG) - flag bits[1:0] */
207                         ((resource->address.attribute.io.
208                           range_attribute & 0x03) |
209                          /* Translations (_TTP and _TRS) - flag bits[5:4] */
210                          ((resource->address.attribute.io.
211                            translation_attribute & 0x03) << 4)));
212         }
213
214         return (0);
215 }
216
217 /*******************************************************************************
218  *
219  * FUNCTION:    acpi_rs_set_address_common
220  *
221  * PARAMETERS:  Aml                 - Pointer to the AML resource descriptor
222  *              Resource            - Pointer to the internal resource struct
223  *
224  * RETURN:      None
225  *
226  * DESCRIPTION: Convert common flag fields from a resource descriptor to an
227  *              AML descriptor
228  *
229  ******************************************************************************/
230
231 static void
232 acpi_rs_set_address_common(union aml_resource *aml,
233                            struct acpi_resource *resource)
234 {
235         ACPI_FUNCTION_ENTRY();
236
237         /* Set the Resource Type (Memory, Io, bus_number, etc.) */
238
239         aml->address.resource_type = (u8) resource->data.address.resource_type;
240
241         /* Set the general flags */
242
243         aml->address.flags = acpi_rs_encode_general_flags(&resource->data);
244
245         /* Set the type-specific flags */
246
247         aml->address.specific_flags =
248             acpi_rs_encode_specific_flags(&resource->data);
249 }
250
251 /*******************************************************************************
252  *
253  * FUNCTION:    acpi_rs_get_address_common
254  *
255  * PARAMETERS:  Resource            - Pointer to the internal resource struct
256  *              Aml                 - Pointer to the AML resource descriptor
257  *
258  * RETURN:      TRUE if the resource_type field is OK, FALSE otherwise
259  *
260  * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor
261  *              to an internal resource descriptor
262  *
263  ******************************************************************************/
264
265 static u8
266 acpi_rs_get_address_common(struct acpi_resource *resource,
267                            union aml_resource *aml)
268 {
269         ACPI_FUNCTION_ENTRY();
270
271         /* Validate resource type */
272
273         if ((aml->address.resource_type > 2)
274             && (aml->address.resource_type < 0xC0)) {
275                 return (FALSE);
276         }
277
278         /* Get the Resource Type (Memory, Io, bus_number, etc.) */
279
280         resource->data.address.resource_type = aml->address.resource_type;
281
282         /* Get the General Flags */
283
284         acpi_rs_decode_general_flags(&resource->data, aml->address.flags);
285
286         /* Get the Type-Specific Flags */
287
288         acpi_rs_decode_specific_flags(&resource->data,
289                                       aml->address.specific_flags);
290         return (TRUE);
291 }
292
293 /*******************************************************************************
294  *
295  * FUNCTION:    acpi_rs_get_address16
296  *
297  * PARAMETERS:  Aml                 - Pointer to the AML resource descriptor
298  *              aml_resource_length - Length of the resource from the AML header
299  *              Resource            - Where the internal resource is returned
300  *
301  * RETURN:      Status
302  *
303  * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
304  *              internal resource descriptor, simplifying bitflags and handling
305  *              alignment and endian issues if necessary.
306  *
307  ******************************************************************************/
308
309 acpi_status
310 acpi_rs_get_address16(union aml_resource * aml,
311                       u16 aml_resource_length, struct acpi_resource * resource)
312 {
313         ACPI_FUNCTION_TRACE("rs_get_address16");
314
315         /* Get the Resource Type, general flags, and type-specific flags */
316
317         if (!acpi_rs_get_address_common(resource, aml)) {
318                 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
319         }
320
321         /*
322          * Get the following contiguous fields from the AML descriptor:
323          * Address Granularity
324          * Address Range Minimum
325          * Address Range Maximum
326          * Address Translation Offset
327          * Address Length
328          */
329         acpi_rs_move_data(&resource->data.address16.granularity,
330                           &aml->address16.granularity, 5,
331                           ACPI_MOVE_TYPE_16_TO_32);
332
333         /* Get the optional resource_source (index and string) */
334
335         resource->length =
336             ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16) +
337             acpi_rs_get_resource_source(aml_resource_length,
338                                         sizeof(struct aml_resource_address16),
339                                         &resource->data.address16.
340                                         resource_source, aml, NULL);
341
342         /* Complete the resource header */
343
344         resource->type = ACPI_RESOURCE_TYPE_ADDRESS16;
345         return_ACPI_STATUS(AE_OK);
346 }
347
348 /*******************************************************************************
349  *
350  * FUNCTION:    acpi_rs_set_address16
351  *
352  * PARAMETERS:  Resource            - Pointer to the resource descriptor
353  *              Aml                 - Where the AML descriptor is returned
354  *
355  * RETURN:      Status
356  *
357  * DESCRIPTION: Convert an internal resource descriptor to the corresponding
358  *              external AML resource descriptor.
359  *
360  ******************************************************************************/
361
362 acpi_status
363 acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml)
364 {
365         acpi_size descriptor_length;
366
367         ACPI_FUNCTION_TRACE("rs_set_address16");
368
369         /* Set the Resource Type, General Flags, and Type-Specific Flags */
370
371         acpi_rs_set_address_common(aml, resource);
372
373         /*
374          * Set the following contiguous fields in the AML descriptor:
375          * Address Granularity
376          * Address Range Minimum
377          * Address Range Maximum
378          * Address Translation Offset
379          * Address Length
380          */
381         acpi_rs_move_data(&aml->address16.granularity,
382                           &resource->data.address16.granularity, 5,
383                           ACPI_MOVE_TYPE_32_TO_16);
384
385         /* Resource Source Index and Resource Source are optional */
386
387         descriptor_length = acpi_rs_set_resource_source(aml,
388                                                         sizeof(struct
389                                                                aml_resource_address16),
390                                                         &resource->data.
391                                                         address16.
392                                                         resource_source);
393
394         /* Complete the AML descriptor header */
395
396         acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS16,
397                                     descriptor_length, aml);
398         return_ACPI_STATUS(AE_OK);
399 }
400
401 /*******************************************************************************
402  *
403  * FUNCTION:    acpi_rs_get_address32
404  *
405  * PARAMETERS:  Aml                 - Pointer to the AML resource descriptor
406  *              aml_resource_length - Length of the resource from the AML header
407  *              Resource            - Where the internal resource is returned
408  *
409  * RETURN:      Status
410  *
411  * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
412  *              internal resource descriptor, simplifying bitflags and handling
413  *              alignment and endian issues if necessary.
414  *
415  ******************************************************************************/
416
417 acpi_status
418 acpi_rs_get_address32(union aml_resource *aml,
419                       u16 aml_resource_length, struct acpi_resource *resource)
420 {
421
422         ACPI_FUNCTION_TRACE("rs_get_address32");
423
424         /* Get the Resource Type, general flags, and type-specific flags */
425
426         if (!acpi_rs_get_address_common(resource, (void *)aml)) {
427                 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
428         }
429
430         /*
431          * Get the following contiguous fields from the AML descriptor:
432          * Address Granularity
433          * Address Range Minimum
434          * Address Range Maximum
435          * Address Translation Offset
436          * Address Length
437          */
438         acpi_rs_move_data(&resource->data.address32.granularity,
439                           &aml->address32.granularity, 5,
440                           ACPI_MOVE_TYPE_32_TO_32);
441
442         /* Get the optional resource_source (index and string) */
443
444         resource->length =
445             ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32) +
446             acpi_rs_get_resource_source(aml_resource_length,
447                                         sizeof(struct aml_resource_address32),
448                                         &resource->data.address32.
449                                         resource_source, aml, NULL);
450
451         /* Complete the resource header */
452
453         resource->type = ACPI_RESOURCE_TYPE_ADDRESS32;
454         return_ACPI_STATUS(AE_OK);
455 }
456
457 /*******************************************************************************
458  *
459  * FUNCTION:    acpi_rs_set_address32
460  *
461  * PARAMETERS:  Resource            - Pointer to the resource descriptor
462  *              Aml                 - Where the AML descriptor is returned
463  *
464  * RETURN:      Status
465  *
466  * DESCRIPTION: Convert an internal resource descriptor to the corresponding
467  *              external AML resource descriptor.
468  *
469  ******************************************************************************/
470
471 acpi_status
472 acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml)
473 {
474         acpi_size descriptor_length;
475
476         ACPI_FUNCTION_TRACE("rs_set_address32");
477
478         /* Set the Resource Type, General Flags, and Type-Specific Flags */
479
480         acpi_rs_set_address_common(aml, resource);
481
482         /*
483          * Set the following contiguous fields in the AML descriptor:
484          * Address Granularity
485          * Address Range Minimum
486          * Address Range Maximum
487          * Address Translation Offset
488          * Address Length
489          */
490         acpi_rs_move_data(&aml->address32.granularity,
491                           &resource->data.address32.granularity, 5,
492                           ACPI_MOVE_TYPE_32_TO_32);
493
494         /* Resource Source Index and Resource Source are optional */
495
496         descriptor_length = acpi_rs_set_resource_source(aml,
497                                                         sizeof(struct
498                                                                aml_resource_address32),
499                                                         &resource->data.
500                                                         address32.
501                                                         resource_source);
502
503         /* Complete the AML descriptor header */
504
505         acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS32,
506                                     descriptor_length, aml);
507         return_ACPI_STATUS(AE_OK);
508 }
509
510 /*******************************************************************************
511  *
512  * FUNCTION:    acpi_rs_get_address64
513  *
514  * PARAMETERS:  Aml                 - Pointer to the AML resource descriptor
515  *              aml_resource_length - Length of the resource from the AML header
516  *              Resource            - Where the internal resource is returned
517  *
518  * RETURN:      Status
519  *
520  * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
521  *              internal resource descriptor, simplifying bitflags and handling
522  *              alignment and endian issues if necessary.
523  *
524  ******************************************************************************/
525
526 acpi_status
527 acpi_rs_get_address64(union aml_resource *aml,
528                       u16 aml_resource_length, struct acpi_resource *resource)
529 {
530         ACPI_FUNCTION_TRACE("rs_get_address64");
531
532         /* Get the Resource Type, general Flags, and type-specific Flags */
533
534         if (!acpi_rs_get_address_common(resource, aml)) {
535                 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
536         }
537
538         /*
539          * Get the following contiguous fields from the AML descriptor:
540          * Address Granularity
541          * Address Range Minimum
542          * Address Range Maximum
543          * Address Translation Offset
544          * Address Length
545          */
546         acpi_rs_move_data(&resource->data.address64.granularity,
547                           &aml->address64.granularity, 5,
548                           ACPI_MOVE_TYPE_64_TO_64);
549
550         /* Get the optional resource_source (index and string) */
551
552         resource->length =
553             ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64) +
554             acpi_rs_get_resource_source(aml_resource_length,
555                                         sizeof(struct aml_resource_address64),
556                                         &resource->data.address64.
557                                         resource_source, aml, NULL);
558
559         /* Complete the resource header */
560
561         resource->type = ACPI_RESOURCE_TYPE_ADDRESS64;
562         return_ACPI_STATUS(AE_OK);
563 }
564
565 /*******************************************************************************
566  *
567  * FUNCTION:    acpi_rs_set_address64
568  *
569  * PARAMETERS:  Resource            - Pointer to the resource descriptor
570  *              Aml                 - Where the AML descriptor is returned
571  *
572  * RETURN:      Status
573  *
574  * DESCRIPTION: Convert an internal resource descriptor to the corresponding
575  *              external AML resource descriptor.
576  *
577  ******************************************************************************/
578
579 acpi_status
580 acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml)
581 {
582         acpi_size descriptor_length;
583
584         ACPI_FUNCTION_TRACE("rs_set_address64");
585
586         /* Set the Resource Type, General Flags, and Type-Specific Flags */
587
588         acpi_rs_set_address_common(aml, resource);
589
590         /*
591          * Set the following contiguous fields in the AML descriptor:
592          * Address Granularity
593          * Address Range Minimum
594          * Address Range Maximum
595          * Address Translation Offset
596          * Address Length
597          */
598         acpi_rs_move_data(&aml->address64.granularity,
599                           &resource->data.address64.granularity, 5,
600                           ACPI_MOVE_TYPE_64_TO_64);
601
602         /* Resource Source Index and Resource Source are optional */
603
604         descriptor_length = acpi_rs_set_resource_source(aml,
605                                                         sizeof(struct
606                                                                aml_resource_address64),
607                                                         &resource->data.
608                                                         address64.
609                                                         resource_source);
610
611         /* Complete the AML descriptor header */
612
613         acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_ADDRESS64,
614                                     descriptor_length, aml);
615         return_ACPI_STATUS(AE_OK);
616 }
617
618 /*******************************************************************************
619  *
620  * FUNCTION:    acpi_rs_get_ext_address64
621  *
622  * PARAMETERS:  Aml                 - Pointer to the AML resource descriptor
623  *              aml_resource_length - Length of the resource from the AML header
624  *              Resource            - Where the internal resource is returned
625  *
626  * RETURN:      Status
627  *
628  * DESCRIPTION: Convert a raw AML resource descriptor to the corresponding
629  *              internal resource descriptor, simplifying bitflags and handling
630  *              alignment and endian issues if necessary.
631  *
632  ******************************************************************************/
633
634 acpi_status
635 acpi_rs_get_ext_address64(union aml_resource *aml,
636                           u16 aml_resource_length,
637                           struct acpi_resource *resource)
638 {
639
640         ACPI_FUNCTION_TRACE("rs_get_ext_address64");
641
642         /* Get the Resource Type, general flags, and type-specific flags */
643
644         if (!acpi_rs_get_address_common(resource, aml)) {
645                 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
646         }
647
648         /*
649          * Get and validate the Revision ID
650          * Note: Only one revision ID is currently supported
651          */
652         resource->data.ext_address64.revision_iD =
653             aml->ext_address64.revision_iD;
654         if (aml->ext_address64.revision_iD !=
655             AML_RESOURCE_EXTENDED_ADDRESS_REVISION) {
656                 return_ACPI_STATUS(AE_SUPPORT);
657         }
658
659         /*
660          * Get the following contiguous fields from the AML descriptor:
661          * Address Granularity
662          * Address Range Minimum
663          * Address Range Maximum
664          * Address Translation Offset
665          * Address Length
666          * Type-Specific Attribute
667          */
668         acpi_rs_move_data(&resource->data.ext_address64.granularity,
669                           &aml->ext_address64.granularity, 6,
670                           ACPI_MOVE_TYPE_64_TO_64);
671
672         /* Complete the resource header */
673
674         resource->type = ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64;
675         resource->length =
676             ACPI_SIZEOF_RESOURCE(struct acpi_resource_extended_address64);
677         return_ACPI_STATUS(AE_OK);
678 }
679
680 /*******************************************************************************
681  *
682  * FUNCTION:    acpi_rs_set_ext_address64
683  *
684  * PARAMETERS:  Resource            - Pointer to the resource descriptor
685  *              Aml                 - Where the AML descriptor is returned
686  *
687  * RETURN:      Status
688  *
689  * DESCRIPTION: Convert an internal resource descriptor to the corresponding
690  *              external AML resource descriptor.
691  *
692  ******************************************************************************/
693
694 acpi_status
695 acpi_rs_set_ext_address64(struct acpi_resource *resource,
696                           union aml_resource *aml)
697 {
698         ACPI_FUNCTION_TRACE("rs_set_ext_address64");
699
700         /* Set the Resource Type, General Flags, and Type-Specific Flags */
701
702         acpi_rs_set_address_common(aml, resource);
703
704         /* Only one Revision ID is currently supported */
705
706         aml->ext_address64.revision_iD = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
707         aml->ext_address64.reserved = 0;
708
709         /*
710          * Set the following contiguous fields in the AML descriptor:
711          * Address Granularity
712          * Address Range Minimum
713          * Address Range Maximum
714          * Address Translation Offset
715          * Address Length
716          * Type-Specific Attribute
717          */
718         acpi_rs_move_data(&aml->ext_address64.granularity,
719                           &resource->data.address64.granularity, 6,
720                           ACPI_MOVE_TYPE_64_TO_64);
721
722         /* Complete the AML descriptor header */
723
724         acpi_rs_set_resource_header(ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64,
725                                     sizeof(struct
726                                            aml_resource_extended_address64),
727                                     aml);
728         return_ACPI_STATUS(AE_OK);
729 }