]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /******************************************************************************* |
2 | * | |
3 | * Module Name: rsmem24 - Memory resource descriptors | |
4 | * | |
5 | ******************************************************************************/ | |
6 | ||
7 | /* | |
a8357b0c | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
1da177e4 LT |
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 | ||
1da177e4 | 44 | #include <acpi/acpi.h> |
e2f7a777 LB |
45 | #include "accommon.h" |
46 | #include "acresrc.h" | |
1da177e4 LT |
47 | |
48 | #define _COMPONENT ACPI_RESOURCES | |
4be44fcd | 49 | ACPI_MODULE_NAME("rsmemory") |
1da177e4 LT |
50 | |
51 | /******************************************************************************* | |
52 | * | |
0897831b | 53 | * acpi_rs_convert_memory24 |
1da177e4 LT |
54 | * |
55 | ******************************************************************************/ | |
0897831b BM |
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)}, | |
1da177e4 | 60 | |
0897831b BM |
61 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24, |
62 | sizeof(struct aml_resource_memory24), | |
63 | 0}, | |
1da177e4 | 64 | |
0897831b | 65 | /* Read/Write bit */ |
44f6c012 | 66 | |
0897831b BM |
67 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory24.write_protect), |
68 | AML_OFFSET(memory24.flags), | |
69 | 0}, | |
50eca3eb | 70 | /* |
0897831b | 71 | * These fields are contiguous in both the source and destination: |
50eca3eb BM |
72 | * Minimum Base Address |
73 | * Maximum Base Address | |
74 | * Address Base Alignment | |
75 | * Range Length | |
76 | */ | |
0897831b BM |
77 | {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.memory24.minimum), |
78 | AML_OFFSET(memory24.minimum), | |
79 | 4} | |
80 | }; | |
1da177e4 | 81 | |
1da177e4 LT |
82 | /******************************************************************************* |
83 | * | |
0897831b | 84 | * acpi_rs_convert_memory32 |
1da177e4 LT |
85 | * |
86 | ******************************************************************************/ | |
87 | ||
0897831b BM |
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)}, | |
1da177e4 | 92 | |
0897831b BM |
93 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32, |
94 | sizeof(struct aml_resource_memory32), | |
95 | 0}, | |
44f6c012 | 96 | |
0897831b | 97 | /* Read/Write bit */ |
44f6c012 | 98 | |
0897831b BM |
99 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory32.write_protect), |
100 | AML_OFFSET(memory32.flags), | |
101 | 0}, | |
50eca3eb | 102 | /* |
0897831b | 103 | * These fields are contiguous in both the source and destination: |
50eca3eb BM |
104 | * Minimum Base Address |
105 | * Maximum Base Address | |
106 | * Address Base Alignment | |
107 | * Range Length | |
108 | */ | |
0897831b BM |
109 | {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.memory32.minimum), |
110 | AML_OFFSET(memory32.minimum), | |
111 | 4} | |
112 | }; | |
1da177e4 | 113 | |
1da177e4 LT |
114 | /******************************************************************************* |
115 | * | |
0897831b | 116 | * acpi_rs_convert_fixed_memory32 |
1da177e4 LT |
117 | * |
118 | ******************************************************************************/ | |
119 | ||
0897831b BM |
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)}, | |
1da177e4 | 124 | |
0897831b BM |
125 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32, |
126 | sizeof(struct aml_resource_fixed_memory32), | |
127 | 0}, | |
44f6c012 | 128 | |
0897831b | 129 | /* Read/Write bit */ |
1da177e4 | 130 | |
0897831b BM |
131 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.fixed_memory32.write_protect), |
132 | AML_OFFSET(fixed_memory32.flags), | |
133 | 0}, | |
1da177e4 | 134 | /* |
0897831b BM |
135 | * These fields are contiguous in both the source and destination: |
136 | * Base Address | |
50eca3eb | 137 | * Range Length |
1da177e4 | 138 | */ |
0897831b BM |
139 | {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.fixed_memory32.address), |
140 | AML_OFFSET(fixed_memory32.address), | |
141 | 2} | |
142 | }; | |
1da177e4 | 143 | |
1da177e4 LT |
144 | /******************************************************************************* |
145 | * | |
0897831b | 146 | * acpi_rs_get_vendor_small |
1da177e4 LT |
147 | * |
148 | ******************************************************************************/ | |
149 | ||
0897831b BM |
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)}, | |
1da177e4 | 154 | |
0897831b | 155 | /* Length of the vendor data (byte count) */ |
44f6c012 | 156 | |
0897831b BM |
157 | {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), |
158 | 0, | |
159 | sizeof(u8)} | |
160 | , | |
1da177e4 | 161 | |
0897831b | 162 | /* Vendor data */ |
44f6c012 | 163 | |
0897831b BM |
164 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), |
165 | sizeof(struct aml_resource_small_header), | |
166 | 0} | |
167 | }; | |
1da177e4 | 168 | |
1da177e4 LT |
169 | /******************************************************************************* |
170 | * | |
0897831b | 171 | * acpi_rs_get_vendor_large |
1da177e4 LT |
172 | * |
173 | ******************************************************************************/ | |
174 | ||
0897831b BM |
175 | struct 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)}, | |
44f6c012 | 179 | |
0897831b | 180 | /* Length of the vendor data (byte count) */ |
1da177e4 | 181 | |
0897831b BM |
182 | {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), |
183 | 0, | |
184 | sizeof(u8)} | |
185 | , | |
1da177e4 | 186 | |
0897831b | 187 | /* Vendor data */ |
44f6c012 | 188 | |
0897831b BM |
189 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), |
190 | sizeof(struct aml_resource_large_header), | |
191 | 0} | |
192 | }; | |
1da177e4 | 193 | |
1da177e4 LT |
194 | /******************************************************************************* |
195 | * | |
0897831b | 196 | * acpi_rs_set_vendor |
1da177e4 LT |
197 | * |
198 | ******************************************************************************/ | |
199 | ||
0897831b BM |
200 | struct 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 */ | |
1da177e4 | 208 | |
0897831b BM |
209 | {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), |
210 | 0, | |
211 | 0}, | |
44f6c012 | 212 | |
0897831b BM |
213 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.vendor.byte_data[0]), |
214 | sizeof(struct aml_resource_small_header), | |
215 | 0}, | |
1da177e4 | 216 | |
50eca3eb | 217 | /* |
0897831b BM |
218 | * All done if the Vendor byte length is 7 or less, meaning that it will |
219 | * fit within a small descriptor | |
50eca3eb | 220 | */ |
0897831b BM |
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 | }; |