blob: 4fd611ad02b48d9d706cfe886d347c345f2bbdda [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*******************************************************************************
2 *
3 * Module Name: rsmem24 - Memory resource descriptors
4 *
5 ******************************************************************************/
6
7/*
Bob Moore77848132012-01-12 13:27:23 +08008 * Copyright (C) 2000 - 2012, Intel Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * 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
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#include <acpi/acpi.h>
Len Browne2f7a772009-01-09 00:30:03 -050045#include "accommon.h"
46#include "acresrc.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
48#define _COMPONENT ACPI_RESOURCES
Len Brown4be44fc2005-08-05 00:44:28 -040049ACPI_MODULE_NAME("rsmemory")
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
51/*******************************************************************************
52 *
Bob Moore08978312005-10-21 00:00:00 -040053 * acpi_rs_convert_memory24
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 *
55 ******************************************************************************/
Bob Moore08978312005-10-21 00:00:00 -040056struct 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)},
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
Bob Moore08978312005-10-21 00:00:00 -040061 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24,
62 sizeof(struct aml_resource_memory24),
63 0},
Linus Torvalds1da177e2005-04-16 15:20:36 -070064
Bob Moore08978312005-10-21 00:00:00 -040065 /* Read/Write bit */
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
Bob Moore08978312005-10-21 00:00:00 -040067 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory24.write_protect),
68 AML_OFFSET(memory24.flags),
69 0},
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 /*
Bob Moore08978312005-10-21 00:00:00 -040071 * These fields are contiguous in both the source and destination:
Bob Moore50eca3e2005-09-30 19:03:00 -040072 * Minimum Base Address
73 * Maximum Base Address
74 * Address Base Alignment
75 * Range Length
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 */
Bob Moore08978312005-10-21 00:00:00 -040077 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.memory24.minimum),
78 AML_OFFSET(memory24.minimum),
79 4}
80};
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
Linus Torvalds1da177e2005-04-16 15:20:36 -070082/*******************************************************************************
83 *
Bob Moore08978312005-10-21 00:00:00 -040084 * acpi_rs_convert_memory32
Linus Torvalds1da177e2005-04-16 15:20:36 -070085 *
86 ******************************************************************************/
87
Bob Moore08978312005-10-21 00:00:00 -040088struct 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)},
Linus Torvalds1da177e2005-04-16 15:20:36 -070092
Bob Moore08978312005-10-21 00:00:00 -040093 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32,
94 sizeof(struct aml_resource_memory32),
95 0},
Robert Moore44f6c012005-04-18 22:49:35 -040096
Bob Moore08978312005-10-21 00:00:00 -040097 /* Read/Write bit */
Linus Torvalds1da177e2005-04-16 15:20:36 -070098
Bob Moore08978312005-10-21 00:00:00 -040099 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.memory32.write_protect),
100 AML_OFFSET(memory32.flags),
101 0},
Bob Moore50eca3e2005-09-30 19:03:00 -0400102 /*
Bob Moore08978312005-10-21 00:00:00 -0400103 * These fields are contiguous in both the source and destination:
Bob Moore50eca3e2005-09-30 19:03:00 -0400104 * Minimum Base Address
105 * Maximum Base Address
106 * Address Base Alignment
107 * Range Length
108 */
Bob Moore08978312005-10-21 00:00:00 -0400109 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.memory32.minimum),
110 AML_OFFSET(memory32.minimum),
111 4}
112};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114/*******************************************************************************
115 *
Bob Moore08978312005-10-21 00:00:00 -0400116 * acpi_rs_convert_fixed_memory32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117 *
118 ******************************************************************************/
119
Bob Moore08978312005-10-21 00:00:00 -0400120struct 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)},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124
Bob Moore08978312005-10-21 00:00:00 -0400125 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32,
126 sizeof(struct aml_resource_fixed_memory32),
127 0},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128
Bob Moore08978312005-10-21 00:00:00 -0400129 /* Read/Write bit */
Robert Moore44f6c012005-04-18 22:49:35 -0400130
Bob Moore08978312005-10-21 00:00:00 -0400131 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.fixed_memory32.write_protect),
132 AML_OFFSET(fixed_memory32.flags),
133 0},
Bob Moore50eca3e2005-09-30 19:03:00 -0400134 /*
Bob Moore08978312005-10-21 00:00:00 -0400135 * These fields are contiguous in both the source and destination:
Bob Moore50eca3e2005-09-30 19:03:00 -0400136 * Base Address
137 * Range Length
138 */
Bob Moore08978312005-10-21 00:00:00 -0400139 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.fixed_memory32.address),
140 AML_OFFSET(fixed_memory32.address),
141 2}
142};
Bob Moore50eca3e2005-09-30 19:03:00 -0400143
144/*******************************************************************************
145 *
Bob Moore08978312005-10-21 00:00:00 -0400146 * acpi_rs_get_vendor_small
Bob Moore50eca3e2005-09-30 19:03:00 -0400147 *
148 ******************************************************************************/
149
Bob Moore08978312005-10-21 00:00:00 -0400150struct 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)},
Bob Moore50eca3e2005-09-30 19:03:00 -0400154
Bob Moore08978312005-10-21 00:00:00 -0400155 /* Length of the vendor data (byte count) */
Bob Moore50eca3e2005-09-30 19:03:00 -0400156
Bob Moore08978312005-10-21 00:00:00 -0400157 {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},
Bob Moore50eca3e2005-09-30 19:03:00 -0400216
217 /*
Bob Moore08978312005-10-21 00:00:00 -0400218 * All done if the Vendor byte length is 7 or less, meaning that it will
219 * fit within a small descriptor
Bob Moore50eca3e2005-09-30 19:03:00 -0400220 */
Bob Moore08978312005-10-21 00:00:00 -0400221 {ACPI_RSC_EXIT_LE, 0, 0, 7},
Bob Moore50eca3e2005-09-30 19:03:00 -0400222
Bob Moore08978312005-10-21 00:00:00 -0400223 /* Must create a large vendor descriptor */
Bob Moore50eca3e2005-09-30 19:03:00 -0400224
Bob Moore08978312005-10-21 00:00:00 -0400225 {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};