xref: /titanic_44/usr/src/uts/intel/io/acpica/resources/rsaddr.c (revision cb56572868bfc488bbd3ab847b09db2a25554d44)
1ae115bc7Smrj /*******************************************************************************
2ae115bc7Smrj  *
3ae115bc7Smrj  * Module Name: rsaddr - Address resource descriptors (16/32/64)
4ae115bc7Smrj  *
5ae115bc7Smrj  ******************************************************************************/
6ae115bc7Smrj 
726f3cdf0SGordon Ross /*
8*cb565728SJerry Jelinek  * Copyright (C) 2000 - 2016, Intel Corp.
9ae115bc7Smrj  * All rights reserved.
10ae115bc7Smrj  *
1126f3cdf0SGordon Ross  * Redistribution and use in source and binary forms, with or without
1226f3cdf0SGordon Ross  * modification, are permitted provided that the following conditions
1326f3cdf0SGordon Ross  * are met:
1426f3cdf0SGordon Ross  * 1. Redistributions of source code must retain the above copyright
1526f3cdf0SGordon Ross  *    notice, this list of conditions, and the following disclaimer,
1626f3cdf0SGordon Ross  *    without modification.
1726f3cdf0SGordon Ross  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1826f3cdf0SGordon Ross  *    substantially similar to the "NO WARRANTY" disclaimer below
1926f3cdf0SGordon Ross  *    ("Disclaimer") and any redistribution must be conditioned upon
2026f3cdf0SGordon Ross  *    including a substantially similar Disclaimer requirement for further
2126f3cdf0SGordon Ross  *    binary redistribution.
2226f3cdf0SGordon Ross  * 3. Neither the names of the above-listed copyright holders nor the names
2326f3cdf0SGordon Ross  *    of any contributors may be used to endorse or promote products derived
2426f3cdf0SGordon Ross  *    from this software without specific prior written permission.
25ae115bc7Smrj  *
2626f3cdf0SGordon Ross  * Alternatively, this software may be distributed under the terms of the
2726f3cdf0SGordon Ross  * GNU General Public License ("GPL") version 2 as published by the Free
2826f3cdf0SGordon Ross  * Software Foundation.
29ae115bc7Smrj  *
3026f3cdf0SGordon Ross  * NO WARRANTY
3126f3cdf0SGordon Ross  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3226f3cdf0SGordon Ross  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3326f3cdf0SGordon Ross  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
3426f3cdf0SGordon Ross  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3526f3cdf0SGordon Ross  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3626f3cdf0SGordon Ross  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3726f3cdf0SGordon Ross  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3826f3cdf0SGordon Ross  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3926f3cdf0SGordon Ross  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
4026f3cdf0SGordon Ross  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4126f3cdf0SGordon Ross  * POSSIBILITY OF SUCH DAMAGES.
4226f3cdf0SGordon Ross  */
43ae115bc7Smrj 
44ae115bc7Smrj #include "acpi.h"
45aa2aa9a6SDana Myers #include "accommon.h"
46ae115bc7Smrj #include "acresrc.h"
47ae115bc7Smrj 
48ae115bc7Smrj #define _COMPONENT          ACPI_RESOURCES
49ae115bc7Smrj         ACPI_MODULE_NAME    ("rsaddr")
50ae115bc7Smrj 
51ae115bc7Smrj 
52ae115bc7Smrj /*******************************************************************************
53ae115bc7Smrj  *
54ae115bc7Smrj  * AcpiRsConvertAddress16 - All WORD (16-bit) address resources
55ae115bc7Smrj  *
56ae115bc7Smrj  ******************************************************************************/
57ae115bc7Smrj 
58ae115bc7Smrj ACPI_RSCONVERT_INFO     AcpiRsConvertAddress16[5] =
59ae115bc7Smrj {
60ae115bc7Smrj     {ACPI_RSC_INITGET,  ACPI_RESOURCE_TYPE_ADDRESS16,
61ae115bc7Smrj                         ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS16),
62ae115bc7Smrj                         ACPI_RSC_TABLE_SIZE (AcpiRsConvertAddress16)},
63ae115bc7Smrj 
64ae115bc7Smrj     {ACPI_RSC_INITSET,  ACPI_RESOURCE_NAME_ADDRESS16,
65ae115bc7Smrj                         sizeof (AML_RESOURCE_ADDRESS16),
66ae115bc7Smrj                         0},
67ae115bc7Smrj 
68ae115bc7Smrj     /* Resource Type, General Flags, and Type-Specific Flags */
69ae115bc7Smrj 
70ae115bc7Smrj     {ACPI_RSC_ADDRESS,  0, 0, 0},
71ae115bc7Smrj 
72ae115bc7Smrj     /*
73ae115bc7Smrj      * These fields are contiguous in both the source and destination:
74ae115bc7Smrj      * Address Granularity
75ae115bc7Smrj      * Address Range Minimum
76ae115bc7Smrj      * Address Range Maximum
77ae115bc7Smrj      * Address Translation Offset
78ae115bc7Smrj      * Address Length
79ae115bc7Smrj      */
80*cb565728SJerry Jelinek     {ACPI_RSC_MOVE16,   ACPI_RS_OFFSET (Data.Address16.Address.Granularity),
81ae115bc7Smrj                         AML_OFFSET (Address16.Granularity),
82ae115bc7Smrj                         5},
83ae115bc7Smrj 
84ae115bc7Smrj     /* Optional ResourceSource (Index and String) */
85ae115bc7Smrj 
86ae115bc7Smrj     {ACPI_RSC_SOURCE,   ACPI_RS_OFFSET (Data.Address16.ResourceSource),
87ae115bc7Smrj                         0,
88ae115bc7Smrj                         sizeof (AML_RESOURCE_ADDRESS16)}
89ae115bc7Smrj };
90ae115bc7Smrj 
91ae115bc7Smrj 
92ae115bc7Smrj /*******************************************************************************
93ae115bc7Smrj  *
94ae115bc7Smrj  * AcpiRsConvertAddress32 - All DWORD (32-bit) address resources
95ae115bc7Smrj  *
96ae115bc7Smrj  ******************************************************************************/
97ae115bc7Smrj 
98ae115bc7Smrj ACPI_RSCONVERT_INFO     AcpiRsConvertAddress32[5] =
99ae115bc7Smrj {
100ae115bc7Smrj     {ACPI_RSC_INITGET,  ACPI_RESOURCE_TYPE_ADDRESS32,
101ae115bc7Smrj                         ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS32),
102ae115bc7Smrj                         ACPI_RSC_TABLE_SIZE (AcpiRsConvertAddress32)},
103ae115bc7Smrj 
104ae115bc7Smrj     {ACPI_RSC_INITSET,  ACPI_RESOURCE_NAME_ADDRESS32,
105ae115bc7Smrj                         sizeof (AML_RESOURCE_ADDRESS32),
106ae115bc7Smrj                         0},
107ae115bc7Smrj 
108ae115bc7Smrj     /* Resource Type, General Flags, and Type-Specific Flags */
109ae115bc7Smrj 
110ae115bc7Smrj     {ACPI_RSC_ADDRESS,  0, 0, 0},
111ae115bc7Smrj 
112ae115bc7Smrj     /*
113ae115bc7Smrj      * These fields are contiguous in both the source and destination:
114ae115bc7Smrj      * Address Granularity
115ae115bc7Smrj      * Address Range Minimum
116ae115bc7Smrj      * Address Range Maximum
117ae115bc7Smrj      * Address Translation Offset
118ae115bc7Smrj      * Address Length
119ae115bc7Smrj      */
120*cb565728SJerry Jelinek     {ACPI_RSC_MOVE32,   ACPI_RS_OFFSET (Data.Address32.Address.Granularity),
121ae115bc7Smrj                         AML_OFFSET (Address32.Granularity),
122ae115bc7Smrj                         5},
123ae115bc7Smrj 
124ae115bc7Smrj     /* Optional ResourceSource (Index and String) */
125ae115bc7Smrj 
126ae115bc7Smrj     {ACPI_RSC_SOURCE,   ACPI_RS_OFFSET (Data.Address32.ResourceSource),
127ae115bc7Smrj                         0,
128ae115bc7Smrj                         sizeof (AML_RESOURCE_ADDRESS32)}
129ae115bc7Smrj };
130ae115bc7Smrj 
131ae115bc7Smrj 
132ae115bc7Smrj /*******************************************************************************
133ae115bc7Smrj  *
134ae115bc7Smrj  * AcpiRsConvertAddress64 - All QWORD (64-bit) address resources
135ae115bc7Smrj  *
136ae115bc7Smrj  ******************************************************************************/
137ae115bc7Smrj 
138ae115bc7Smrj ACPI_RSCONVERT_INFO     AcpiRsConvertAddress64[5] =
139ae115bc7Smrj {
140ae115bc7Smrj     {ACPI_RSC_INITGET,  ACPI_RESOURCE_TYPE_ADDRESS64,
141ae115bc7Smrj                         ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64),
142ae115bc7Smrj                         ACPI_RSC_TABLE_SIZE (AcpiRsConvertAddress64)},
143ae115bc7Smrj 
144ae115bc7Smrj     {ACPI_RSC_INITSET,  ACPI_RESOURCE_NAME_ADDRESS64,
145ae115bc7Smrj                         sizeof (AML_RESOURCE_ADDRESS64),
146ae115bc7Smrj                         0},
147ae115bc7Smrj 
148ae115bc7Smrj     /* Resource Type, General Flags, and Type-Specific Flags */
149ae115bc7Smrj 
150ae115bc7Smrj     {ACPI_RSC_ADDRESS,  0, 0, 0},
151ae115bc7Smrj 
152ae115bc7Smrj     /*
153ae115bc7Smrj      * These fields are contiguous in both the source and destination:
154ae115bc7Smrj      * Address Granularity
155ae115bc7Smrj      * Address Range Minimum
156ae115bc7Smrj      * Address Range Maximum
157ae115bc7Smrj      * Address Translation Offset
158ae115bc7Smrj      * Address Length
159ae115bc7Smrj      */
160*cb565728SJerry Jelinek     {ACPI_RSC_MOVE64,   ACPI_RS_OFFSET (Data.Address64.Address.Granularity),
161ae115bc7Smrj                         AML_OFFSET (Address64.Granularity),
162ae115bc7Smrj                         5},
163ae115bc7Smrj 
164ae115bc7Smrj     /* Optional ResourceSource (Index and String) */
165ae115bc7Smrj 
166ae115bc7Smrj     {ACPI_RSC_SOURCE,   ACPI_RS_OFFSET (Data.Address64.ResourceSource),
167ae115bc7Smrj                         0,
168ae115bc7Smrj                         sizeof (AML_RESOURCE_ADDRESS64)}
169ae115bc7Smrj };
170ae115bc7Smrj 
171ae115bc7Smrj 
172ae115bc7Smrj /*******************************************************************************
173ae115bc7Smrj  *
174ae115bc7Smrj  * AcpiRsConvertExtAddress64 - All Extended (64-bit) address resources
175ae115bc7Smrj  *
176ae115bc7Smrj  ******************************************************************************/
177ae115bc7Smrj 
178ae115bc7Smrj ACPI_RSCONVERT_INFO     AcpiRsConvertExtAddress64[5] =
179ae115bc7Smrj {
180ae115bc7Smrj     {ACPI_RSC_INITGET,  ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64,
181ae115bc7Smrj                         ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64),
182ae115bc7Smrj                         ACPI_RSC_TABLE_SIZE (AcpiRsConvertExtAddress64)},
183ae115bc7Smrj 
184ae115bc7Smrj     {ACPI_RSC_INITSET,  ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64,
185ae115bc7Smrj                         sizeof (AML_RESOURCE_EXTENDED_ADDRESS64),
186ae115bc7Smrj                         0},
187ae115bc7Smrj 
188ae115bc7Smrj     /* Resource Type, General Flags, and Type-Specific Flags */
189ae115bc7Smrj 
190ae115bc7Smrj     {ACPI_RSC_ADDRESS,  0, 0, 0},
191ae115bc7Smrj 
192ae115bc7Smrj     /* Revision ID */
193ae115bc7Smrj 
194ae115bc7Smrj     {ACPI_RSC_MOVE8,    ACPI_RS_OFFSET (Data.ExtAddress64.RevisionID),
195ae115bc7Smrj                         AML_OFFSET (ExtAddress64.RevisionID),
196ae115bc7Smrj                         1},
197ae115bc7Smrj     /*
198ae115bc7Smrj      * These fields are contiguous in both the source and destination:
199ae115bc7Smrj      * Address Granularity
200ae115bc7Smrj      * Address Range Minimum
201ae115bc7Smrj      * Address Range Maximum
202ae115bc7Smrj      * Address Translation Offset
203ae115bc7Smrj      * Address Length
204ae115bc7Smrj      * Type-Specific Attribute
205ae115bc7Smrj      */
206*cb565728SJerry Jelinek     {ACPI_RSC_MOVE64,   ACPI_RS_OFFSET (Data.ExtAddress64.Address.Granularity),
207ae115bc7Smrj                         AML_OFFSET (ExtAddress64.Granularity),
208ae115bc7Smrj                         6}
209ae115bc7Smrj };
210ae115bc7Smrj 
211ae115bc7Smrj 
212ae115bc7Smrj /*******************************************************************************
213ae115bc7Smrj  *
214ae115bc7Smrj  * AcpiRsConvertGeneralFlags - Flags common to all address descriptors
215ae115bc7Smrj  *
216ae115bc7Smrj  ******************************************************************************/
217ae115bc7Smrj 
218ae115bc7Smrj static ACPI_RSCONVERT_INFO  AcpiRsConvertGeneralFlags[6] =
219ae115bc7Smrj {
220ae115bc7Smrj     {ACPI_RSC_FLAGINIT, 0, AML_OFFSET (Address.Flags),
221ae115bc7Smrj                         ACPI_RSC_TABLE_SIZE (AcpiRsConvertGeneralFlags)},
222ae115bc7Smrj 
223ae115bc7Smrj     /* Resource Type (Memory, Io, BusNumber, etc.) */
224ae115bc7Smrj 
225ae115bc7Smrj     {ACPI_RSC_MOVE8,    ACPI_RS_OFFSET (Data.Address.ResourceType),
226ae115bc7Smrj                         AML_OFFSET (Address.ResourceType),
227ae115bc7Smrj                         1},
228ae115bc7Smrj 
229ae115bc7Smrj     /* General Flags - Consume, Decode, MinFixed, MaxFixed */
230ae115bc7Smrj 
231ae115bc7Smrj     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.ProducerConsumer),
232ae115bc7Smrj                         AML_OFFSET (Address.Flags),
233ae115bc7Smrj                         0},
234ae115bc7Smrj 
235ae115bc7Smrj     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Decode),
236ae115bc7Smrj                         AML_OFFSET (Address.Flags),
237ae115bc7Smrj                         1},
238ae115bc7Smrj 
239ae115bc7Smrj     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.MinAddressFixed),
240ae115bc7Smrj                         AML_OFFSET (Address.Flags),
241ae115bc7Smrj                         2},
242ae115bc7Smrj 
243ae115bc7Smrj     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.MaxAddressFixed),
244ae115bc7Smrj                         AML_OFFSET (Address.Flags),
245ae115bc7Smrj                         3}
246ae115bc7Smrj };
247ae115bc7Smrj 
248ae115bc7Smrj 
249ae115bc7Smrj /*******************************************************************************
250ae115bc7Smrj  *
251ae115bc7Smrj  * AcpiRsConvertMemFlags - Flags common to Memory address descriptors
252ae115bc7Smrj  *
253ae115bc7Smrj  ******************************************************************************/
254ae115bc7Smrj 
255ae115bc7Smrj static ACPI_RSCONVERT_INFO  AcpiRsConvertMemFlags[5] =
256ae115bc7Smrj {
257ae115bc7Smrj     {ACPI_RSC_FLAGINIT, 0, AML_OFFSET (Address.SpecificFlags),
258ae115bc7Smrj                         ACPI_RSC_TABLE_SIZE (AcpiRsConvertMemFlags)},
259ae115bc7Smrj 
260ae115bc7Smrj     /* Memory-specific flags */
261ae115bc7Smrj 
262ae115bc7Smrj     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.WriteProtect),
263ae115bc7Smrj                         AML_OFFSET (Address.SpecificFlags),
264ae115bc7Smrj                         0},
265ae115bc7Smrj 
266ae115bc7Smrj     {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.Caching),
267ae115bc7Smrj                         AML_OFFSET (Address.SpecificFlags),
268ae115bc7Smrj                         1},
269ae115bc7Smrj 
270ae115bc7Smrj     {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.RangeType),
271ae115bc7Smrj                         AML_OFFSET (Address.SpecificFlags),
272ae115bc7Smrj                         3},
273ae115bc7Smrj 
274ae115bc7Smrj     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.Translation),
275ae115bc7Smrj                         AML_OFFSET (Address.SpecificFlags),
276ae115bc7Smrj                         5}
277ae115bc7Smrj };
278ae115bc7Smrj 
279ae115bc7Smrj 
280ae115bc7Smrj /*******************************************************************************
281ae115bc7Smrj  *
282ae115bc7Smrj  * AcpiRsConvertIoFlags - Flags common to I/O address descriptors
283ae115bc7Smrj  *
284ae115bc7Smrj  ******************************************************************************/
285ae115bc7Smrj 
286ae115bc7Smrj static ACPI_RSCONVERT_INFO  AcpiRsConvertIoFlags[4] =
287ae115bc7Smrj {
288ae115bc7Smrj     {ACPI_RSC_FLAGINIT, 0, AML_OFFSET (Address.SpecificFlags),
289ae115bc7Smrj                         ACPI_RSC_TABLE_SIZE (AcpiRsConvertIoFlags)},
290ae115bc7Smrj 
291ae115bc7Smrj     /* I/O-specific flags */
292ae115bc7Smrj 
293ae115bc7Smrj     {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Io.RangeType),
294ae115bc7Smrj                         AML_OFFSET (Address.SpecificFlags),
295ae115bc7Smrj                         0},
296ae115bc7Smrj 
297ae115bc7Smrj     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Io.Translation),
298ae115bc7Smrj                         AML_OFFSET (Address.SpecificFlags),
299ae115bc7Smrj                         4},
300ae115bc7Smrj 
301ae115bc7Smrj     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Io.TranslationType),
302ae115bc7Smrj                         AML_OFFSET (Address.SpecificFlags),
303ae115bc7Smrj                         5}
304ae115bc7Smrj };
305ae115bc7Smrj 
306ae115bc7Smrj 
307ae115bc7Smrj /*******************************************************************************
308ae115bc7Smrj  *
309ae115bc7Smrj  * FUNCTION:    AcpiRsGetAddressCommon
310ae115bc7Smrj  *
311ae115bc7Smrj  * PARAMETERS:  Resource            - Pointer to the internal resource struct
312ae115bc7Smrj  *              Aml                 - Pointer to the AML resource descriptor
313ae115bc7Smrj  *
314ae115bc7Smrj  * RETURN:      TRUE if the ResourceType field is OK, FALSE otherwise
315ae115bc7Smrj  *
316ae115bc7Smrj  * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor
317ae115bc7Smrj  *              to an internal resource descriptor
318ae115bc7Smrj  *
319ae115bc7Smrj  ******************************************************************************/
320ae115bc7Smrj 
321ae115bc7Smrj BOOLEAN
AcpiRsGetAddressCommon(ACPI_RESOURCE * Resource,AML_RESOURCE * Aml)322ae115bc7Smrj AcpiRsGetAddressCommon (
323ae115bc7Smrj     ACPI_RESOURCE           *Resource,
324ae115bc7Smrj     AML_RESOURCE            *Aml)
325ae115bc7Smrj {
326ae115bc7Smrj     ACPI_FUNCTION_ENTRY ();
327ae115bc7Smrj 
328ae115bc7Smrj 
329ae115bc7Smrj     /* Validate the Resource Type */
330ae115bc7Smrj 
331*cb565728SJerry Jelinek     if ((Aml->Address.ResourceType > 2) &&
332*cb565728SJerry Jelinek         (Aml->Address.ResourceType < 0xC0))
333ae115bc7Smrj     {
334ae115bc7Smrj         return (FALSE);
335ae115bc7Smrj     }
336ae115bc7Smrj 
337ae115bc7Smrj     /* Get the Resource Type and General Flags */
338ae115bc7Smrj 
339*cb565728SJerry Jelinek     (void) AcpiRsConvertAmlToResource (
340*cb565728SJerry Jelinek         Resource, Aml, AcpiRsConvertGeneralFlags);
341ae115bc7Smrj 
342ae115bc7Smrj     /* Get the Type-Specific Flags (Memory and I/O descriptors only) */
343ae115bc7Smrj 
344ae115bc7Smrj     if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE)
345ae115bc7Smrj     {
346*cb565728SJerry Jelinek         (void) AcpiRsConvertAmlToResource (
347*cb565728SJerry Jelinek             Resource, Aml, AcpiRsConvertMemFlags);
348ae115bc7Smrj     }
349ae115bc7Smrj     else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE)
350ae115bc7Smrj     {
351*cb565728SJerry Jelinek         (void) AcpiRsConvertAmlToResource (
352*cb565728SJerry Jelinek             Resource, Aml, AcpiRsConvertIoFlags);
353ae115bc7Smrj     }
354ae115bc7Smrj     else
355ae115bc7Smrj     {
356ae115bc7Smrj         /* Generic resource type, just grab the TypeSpecific byte */
357ae115bc7Smrj 
358*cb565728SJerry Jelinek         Resource->Data.Address.Info.TypeSpecific =
359*cb565728SJerry Jelinek             Aml->Address.SpecificFlags;
360ae115bc7Smrj     }
361ae115bc7Smrj 
362ae115bc7Smrj     return (TRUE);
363ae115bc7Smrj }
364ae115bc7Smrj 
365ae115bc7Smrj 
366ae115bc7Smrj /*******************************************************************************
367ae115bc7Smrj  *
368ae115bc7Smrj  * FUNCTION:    AcpiRsSetAddressCommon
369ae115bc7Smrj  *
370ae115bc7Smrj  * PARAMETERS:  Aml                 - Pointer to the AML resource descriptor
371ae115bc7Smrj  *              Resource            - Pointer to the internal resource struct
372ae115bc7Smrj  *
373ae115bc7Smrj  * RETURN:      None
374ae115bc7Smrj  *
375ae115bc7Smrj  * DESCRIPTION: Convert common flag fields from a resource descriptor to an
376ae115bc7Smrj  *              AML descriptor
377ae115bc7Smrj  *
378ae115bc7Smrj  ******************************************************************************/
379ae115bc7Smrj 
380ae115bc7Smrj void
AcpiRsSetAddressCommon(AML_RESOURCE * Aml,ACPI_RESOURCE * Resource)381ae115bc7Smrj AcpiRsSetAddressCommon (
382ae115bc7Smrj     AML_RESOURCE            *Aml,
383ae115bc7Smrj     ACPI_RESOURCE           *Resource)
384ae115bc7Smrj {
385ae115bc7Smrj     ACPI_FUNCTION_ENTRY ();
386ae115bc7Smrj 
387ae115bc7Smrj 
388ae115bc7Smrj     /* Set the Resource Type and General Flags */
389ae115bc7Smrj 
390*cb565728SJerry Jelinek     (void) AcpiRsConvertResourceToAml (
391*cb565728SJerry Jelinek         Resource, Aml, AcpiRsConvertGeneralFlags);
392ae115bc7Smrj 
393ae115bc7Smrj     /* Set the Type-Specific Flags (Memory and I/O descriptors only) */
394ae115bc7Smrj 
395ae115bc7Smrj     if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE)
396ae115bc7Smrj     {
397*cb565728SJerry Jelinek         (void) AcpiRsConvertResourceToAml (
398*cb565728SJerry Jelinek             Resource, Aml, AcpiRsConvertMemFlags);
399ae115bc7Smrj     }
400ae115bc7Smrj     else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE)
401ae115bc7Smrj     {
402*cb565728SJerry Jelinek         (void) AcpiRsConvertResourceToAml (
403*cb565728SJerry Jelinek             Resource, Aml, AcpiRsConvertIoFlags);
404ae115bc7Smrj     }
405ae115bc7Smrj     else
406ae115bc7Smrj     {
407ae115bc7Smrj         /* Generic resource type, just copy the TypeSpecific byte */
408ae115bc7Smrj 
409*cb565728SJerry Jelinek         Aml->Address.SpecificFlags =
410*cb565728SJerry Jelinek             Resource->Data.Address.Info.TypeSpecific;
411ae115bc7Smrj     }
412ae115bc7Smrj }
413