1 /*******************************************************************************
3 * Module Name: rsmem24 - Memory resource descriptors
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2015, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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.
44 #include <acpi/acpi.h>
48 #define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME("rsmemory")
51 /*******************************************************************************
53 * acpi_rs_convert_memory24
55 ******************************************************************************/
56 struct acpi_rsconvert_info acpi_rs_convert_memory24
[4] = {
57 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_MEMORY24
,
58 ACPI_RS_SIZE(struct acpi_resource_memory24
),
59 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory24
)},
61 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_MEMORY24
,
62 sizeof(struct aml_resource_memory24
),
67 {ACPI_RSC_1BITFLAG
, ACPI_RS_OFFSET(data
.memory24
.write_protect
),
68 AML_OFFSET(memory24
.flags
),
71 * These fields are contiguous in both the source and destination:
72 * Minimum Base Address
73 * Maximum Base Address
74 * Address Base Alignment
77 {ACPI_RSC_MOVE16
, ACPI_RS_OFFSET(data
.memory24
.minimum
),
78 AML_OFFSET(memory24
.minimum
),
82 /*******************************************************************************
84 * acpi_rs_convert_memory32
86 ******************************************************************************/
88 struct acpi_rsconvert_info acpi_rs_convert_memory32
[4] = {
89 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_MEMORY32
,
90 ACPI_RS_SIZE(struct acpi_resource_memory32
),
91 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory32
)},
93 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_MEMORY32
,
94 sizeof(struct aml_resource_memory32
),
99 {ACPI_RSC_1BITFLAG
, ACPI_RS_OFFSET(data
.memory32
.write_protect
),
100 AML_OFFSET(memory32
.flags
),
103 * These fields are contiguous in both the source and destination:
104 * Minimum Base Address
105 * Maximum Base Address
106 * Address Base Alignment
109 {ACPI_RSC_MOVE32
, ACPI_RS_OFFSET(data
.memory32
.minimum
),
110 AML_OFFSET(memory32
.minimum
),
114 /*******************************************************************************
116 * acpi_rs_convert_fixed_memory32
118 ******************************************************************************/
120 struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32
[4] = {
121 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_FIXED_MEMORY32
,
122 ACPI_RS_SIZE(struct acpi_resource_fixed_memory32
),
123 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_memory32
)},
125 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_FIXED_MEMORY32
,
126 sizeof(struct aml_resource_fixed_memory32
),
131 {ACPI_RSC_1BITFLAG
, ACPI_RS_OFFSET(data
.fixed_memory32
.write_protect
),
132 AML_OFFSET(fixed_memory32
.flags
),
135 * These fields are contiguous in both the source and destination:
139 {ACPI_RSC_MOVE32
, ACPI_RS_OFFSET(data
.fixed_memory32
.address
),
140 AML_OFFSET(fixed_memory32
.address
),
144 /*******************************************************************************
146 * acpi_rs_get_vendor_small
148 ******************************************************************************/
150 struct acpi_rsconvert_info acpi_rs_get_vendor_small
[3] = {
151 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_VENDOR
,
152 ACPI_RS_SIZE(struct acpi_resource_vendor
),
153 ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_small
)},
155 /* Length of the vendor data (byte count) */
157 {ACPI_RSC_COUNT16
, ACPI_RS_OFFSET(data
.vendor
.byte_length
),
163 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.vendor
.byte_data
[0]),
164 sizeof(struct aml_resource_small_header
),
168 /*******************************************************************************
170 * acpi_rs_get_vendor_large
172 ******************************************************************************/
174 struct acpi_rsconvert_info acpi_rs_get_vendor_large
[3] = {
175 {ACPI_RSC_INITGET
, ACPI_RESOURCE_TYPE_VENDOR
,
176 ACPI_RS_SIZE(struct acpi_resource_vendor
),
177 ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_large
)},
179 /* Length of the vendor data (byte count) */
181 {ACPI_RSC_COUNT16
, ACPI_RS_OFFSET(data
.vendor
.byte_length
),
187 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.vendor
.byte_data
[0]),
188 sizeof(struct aml_resource_large_header
),
192 /*******************************************************************************
196 ******************************************************************************/
198 struct acpi_rsconvert_info acpi_rs_set_vendor
[7] = {
199 /* Default is a small vendor descriptor */
201 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_VENDOR_SMALL
,
202 sizeof(struct aml_resource_small_header
),
203 ACPI_RSC_TABLE_SIZE(acpi_rs_set_vendor
)},
205 /* Get the length and copy the data */
207 {ACPI_RSC_COUNT16
, ACPI_RS_OFFSET(data
.vendor
.byte_length
),
211 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.vendor
.byte_data
[0]),
212 sizeof(struct aml_resource_small_header
),
216 * All done if the Vendor byte length is 7 or less, meaning that it will
217 * fit within a small descriptor
219 {ACPI_RSC_EXIT_LE
, 0, 0, 7},
221 /* Must create a large vendor descriptor */
223 {ACPI_RSC_INITSET
, ACPI_RESOURCE_NAME_VENDOR_LARGE
,
224 sizeof(struct aml_resource_large_header
),
227 {ACPI_RSC_COUNT16
, ACPI_RS_OFFSET(data
.vendor
.byte_length
),
231 {ACPI_RSC_MOVE8
, ACPI_RS_OFFSET(data
.vendor
.byte_data
[0]),
232 sizeof(struct aml_resource_large_header
),