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