Loading...
1/*******************************************************************************
2 *
3 * Module Name: rsmem24 - Memory resource descriptors
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2011, Intel Corp.
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 "accommon.h"
46#include "acresrc.h"
47
48#define _COMPONENT ACPI_RESOURCES
49ACPI_MODULE_NAME("rsmemory")
50
51/*******************************************************************************
52 *
53 * acpi_rs_convert_memory24
54 *
55 ******************************************************************************/
56struct 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)},
60
61 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24,
62 sizeof(struct aml_resource_memory24),
63 0},
64
65 /* Read/Write bit */
66
67 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory24.write_protect),
68 AML_OFFSET(memory24.flags),
69 0},
70 /*
71 * These fields are contiguous in both the source and destination:
72 * Minimum Base Address
73 * Maximum Base Address
74 * Address Base Alignment
75 * Range Length
76 */
77 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.memory24.minimum),
78 AML_OFFSET(memory24.minimum),
79 4}
80};
81
82/*******************************************************************************
83 *
84 * acpi_rs_convert_memory32
85 *
86 ******************************************************************************/
87
88struct 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)},
92
93 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32,
94 sizeof(struct aml_resource_memory32),
95 0},
96
97 /* Read/Write bit */
98
99 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory32.write_protect),
100 AML_OFFSET(memory32.flags),
101 0},
102 /*
103 * These fields are contiguous in both the source and destination:
104 * Minimum Base Address
105 * Maximum Base Address
106 * Address Base Alignment
107 * Range Length
108 */
109 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.memory32.minimum),
110 AML_OFFSET(memory32.minimum),
111 4}
112};
113
114/*******************************************************************************
115 *
116 * acpi_rs_convert_fixed_memory32
117 *
118 ******************************************************************************/
119
120struct 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)},
124
125 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32,
126 sizeof(struct aml_resource_fixed_memory32),
127 0},
128
129 /* Read/Write bit */
130
131 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.fixed_memory32.write_protect),
132 AML_OFFSET(fixed_memory32.flags),
133 0},
134 /*
135 * These fields are contiguous in both the source and destination:
136 * Base Address
137 * Range Length
138 */
139 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.fixed_memory32.address),
140 AML_OFFSET(fixed_memory32.address),
141 2}
142};
143
144/*******************************************************************************
145 *
146 * acpi_rs_get_vendor_small
147 *
148 ******************************************************************************/
149
150struct 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)},
154
155 /* Length of the vendor data (byte count) */
156
157 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
158 0,
159 sizeof(u8)}
160 ,
161
162 /* Vendor data */
163
164 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
165 sizeof(struct aml_resource_small_header),
166 0}
167};
168
169/*******************************************************************************
170 *
171 * acpi_rs_get_vendor_large
172 *
173 ******************************************************************************/
174
175struct acpi_rsconvert_info acpi_rs_get_vendor_large[3] = {
176 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR,
177 ACPI_RS_SIZE(struct acpi_resource_vendor),
178 ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_large)},
179
180 /* Length of the vendor data (byte count) */
181
182 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
183 0,
184 sizeof(u8)}
185 ,
186
187 /* Vendor data */
188
189 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
190 sizeof(struct aml_resource_large_header),
191 0}
192};
193
194/*******************************************************************************
195 *
196 * acpi_rs_set_vendor
197 *
198 ******************************************************************************/
199
200struct acpi_rsconvert_info acpi_rs_set_vendor[7] = {
201 /* Default is a small vendor descriptor */
202
203 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL,
204 sizeof(struct aml_resource_small_header),
205 ACPI_RSC_TABLE_SIZE(acpi_rs_set_vendor)},
206
207 /* Get the length and copy the data */
208
209 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
210 0,
211 0},
212
213 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
214 sizeof(struct aml_resource_small_header),
215 0},
216
217 /*
218 * All done if the Vendor byte length is 7 or less, meaning that it will
219 * fit within a small descriptor
220 */
221 {ACPI_RSC_EXIT_LE, 0, 0, 7},
222
223 /* Must create a large vendor descriptor */
224
225 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE,
226 sizeof(struct aml_resource_large_header),
227 0},
228
229 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
230 0,
231 0},
232
233 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
234 sizeof(struct aml_resource_large_header),
235 0}
236};
1// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2/*******************************************************************************
3 *
4 * Module Name: rsmem24 - Memory resource descriptors
5 *
6 ******************************************************************************/
7
8#include <acpi/acpi.h>
9#include "accommon.h"
10#include "acresrc.h"
11
12#define _COMPONENT ACPI_RESOURCES
13ACPI_MODULE_NAME("rsmemory")
14
15/*******************************************************************************
16 *
17 * acpi_rs_convert_memory24
18 *
19 ******************************************************************************/
20struct acpi_rsconvert_info acpi_rs_convert_memory24[4] = {
21 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY24,
22 ACPI_RS_SIZE(struct acpi_resource_memory24),
23 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory24)},
24
25 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24,
26 sizeof(struct aml_resource_memory24),
27 0},
28
29 /* Read/Write bit */
30
31 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory24.write_protect),
32 AML_OFFSET(memory24.flags),
33 0},
34 /*
35 * These fields are contiguous in both the source and destination:
36 * Minimum Base Address
37 * Maximum Base Address
38 * Address Base Alignment
39 * Range Length
40 */
41 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.memory24.minimum),
42 AML_OFFSET(memory24.minimum),
43 4}
44};
45
46/*******************************************************************************
47 *
48 * acpi_rs_convert_memory32
49 *
50 ******************************************************************************/
51
52struct acpi_rsconvert_info acpi_rs_convert_memory32[4] = {
53 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY32,
54 ACPI_RS_SIZE(struct acpi_resource_memory32),
55 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_memory32)},
56
57 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32,
58 sizeof(struct aml_resource_memory32),
59 0},
60
61 /* Read/Write bit */
62
63 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory32.write_protect),
64 AML_OFFSET(memory32.flags),
65 0},
66 /*
67 * These fields are contiguous in both the source and destination:
68 * Minimum Base Address
69 * Maximum Base Address
70 * Address Base Alignment
71 * Range Length
72 */
73 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.memory32.minimum),
74 AML_OFFSET(memory32.minimum),
75 4}
76};
77
78/*******************************************************************************
79 *
80 * acpi_rs_convert_fixed_memory32
81 *
82 ******************************************************************************/
83
84struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[4] = {
85 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_MEMORY32,
86 ACPI_RS_SIZE(struct acpi_resource_fixed_memory32),
87 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_fixed_memory32)},
88
89 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32,
90 sizeof(struct aml_resource_fixed_memory32),
91 0},
92
93 /* Read/Write bit */
94
95 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.fixed_memory32.write_protect),
96 AML_OFFSET(fixed_memory32.flags),
97 0},
98 /*
99 * These fields are contiguous in both the source and destination:
100 * Base Address
101 * Range Length
102 */
103 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.fixed_memory32.address),
104 AML_OFFSET(fixed_memory32.address),
105 2}
106};
107
108/*******************************************************************************
109 *
110 * acpi_rs_get_vendor_small
111 *
112 ******************************************************************************/
113
114struct acpi_rsconvert_info acpi_rs_get_vendor_small[3] = {
115 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR,
116 ACPI_RS_SIZE(struct acpi_resource_vendor),
117 ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_small)},
118
119 /* Length of the vendor data (byte count) */
120
121 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
122 0,
123 sizeof(u8)},
124
125 /* Vendor data */
126
127 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
128 sizeof(struct aml_resource_small_header),
129 0}
130};
131
132/*******************************************************************************
133 *
134 * acpi_rs_get_vendor_large
135 *
136 ******************************************************************************/
137
138struct acpi_rsconvert_info acpi_rs_get_vendor_large[3] = {
139 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR,
140 ACPI_RS_SIZE(struct acpi_resource_vendor),
141 ACPI_RSC_TABLE_SIZE(acpi_rs_get_vendor_large)},
142
143 /* Length of the vendor data (byte count) */
144
145 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
146 0,
147 sizeof(u8)},
148
149 /* Vendor data */
150
151 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
152 sizeof(struct aml_resource_large_header),
153 0}
154};
155
156/*******************************************************************************
157 *
158 * acpi_rs_set_vendor
159 *
160 ******************************************************************************/
161
162struct acpi_rsconvert_info acpi_rs_set_vendor[7] = {
163 /* Default is a small vendor descriptor */
164
165 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL,
166 sizeof(struct aml_resource_small_header),
167 ACPI_RSC_TABLE_SIZE(acpi_rs_set_vendor)},
168
169 /* Get the length and copy the data */
170
171 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
172 0,
173 0},
174
175 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
176 sizeof(struct aml_resource_small_header),
177 0},
178
179 /*
180 * All done if the Vendor byte length is 7 or less, meaning that it will
181 * fit within a small descriptor
182 */
183 {ACPI_RSC_EXIT_LE, 0, 0, 7},
184
185 /* Must create a large vendor descriptor */
186
187 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE,
188 sizeof(struct aml_resource_large_header),
189 0},
190
191 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length),
192 0,
193 0},
194
195 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]),
196 sizeof(struct aml_resource_large_header),
197 0}
198};