ReactOS 0.4.15-dev-7953-g1f49173
rsmemory.c
Go to the documentation of this file.
1/*******************************************************************************
2 *
3 * Module Name: rsmem24 - Memory resource descriptors
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2022, 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 MERCHANTABILITY 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.h"
45#include "accommon.h"
46#include "acresrc.h"
47
48#define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME ("rsmemory")
50
51
52/*******************************************************************************
53 *
54 * AcpiRsConvertMemory24
55 *
56 ******************************************************************************/
57
59{
63
65 sizeof (AML_RESOURCE_MEMORY24),
66 0},
67
68 /* Read/Write bit */
69
70 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Memory24.WriteProtect),
71 AML_OFFSET (Memory24.Flags),
72 0},
73 /*
74 * These fields are contiguous in both the source and destination:
75 * Minimum Base Address
76 * Maximum Base Address
77 * Address Base Alignment
78 * Range Length
79 */
80 {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Memory24.Minimum),
81 AML_OFFSET (Memory24.Minimum),
82 4}
83};
84
85
86/*******************************************************************************
87 *
88 * AcpiRsConvertMemory32
89 *
90 ******************************************************************************/
91
93{
97
99 sizeof (AML_RESOURCE_MEMORY32),
100 0},
101
102 /* Read/Write bit */
103
104 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Memory32.WriteProtect),
105 AML_OFFSET (Memory32.Flags),
106 0},
107 /*
108 * These fields are contiguous in both the source and destination:
109 * Minimum Base Address
110 * Maximum Base Address
111 * Address Base Alignment
112 * Range Length
113 */
114 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.Memory32.Minimum),
115 AML_OFFSET (Memory32.Minimum),
116 4}
117};
118
119
120/*******************************************************************************
121 *
122 * AcpiRsConvertFixedMemory32
123 *
124 ******************************************************************************/
125
127{
131
134 0},
135
136 /* Read/Write bit */
137
138 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.FixedMemory32.WriteProtect),
139 AML_OFFSET (FixedMemory32.Flags),
140 0},
141 /*
142 * These fields are contiguous in both the source and destination:
143 * Base Address
144 * Range Length
145 */
146 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.FixedMemory32.Address),
147 AML_OFFSET (FixedMemory32.Address),
148 2}
149};
150
151
152/*******************************************************************************
153 *
154 * AcpiRsGetVendorSmall
155 *
156 ******************************************************************************/
157
159{
163
164 /* Length of the vendor data (byte count) */
165
166 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength),
167 0,
168 sizeof (UINT8)},
169
170 /* Vendor data */
171
172 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]),
174 0}
175};
176
177
178/*******************************************************************************
179 *
180 * AcpiRsGetVendorLarge
181 *
182 ******************************************************************************/
183
185{
189
190 /* Length of the vendor data (byte count) */
191
192 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength),
193 0,
194 sizeof (UINT8)},
195
196 /* Vendor data */
197
198 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]),
200 0}
201};
202
203
204/*******************************************************************************
205 *
206 * AcpiRsSetVendor
207 *
208 ******************************************************************************/
209
211{
212 /* Default is a small vendor descriptor */
213
217
218 /* Get the length and copy the data */
219
220 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength),
221 0,
222 0},
223
224 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]),
226 0},
227
228 /*
229 * All done if the Vendor byte length is 7 or less, meaning that it will
230 * fit within a small descriptor
231 */
232 {ACPI_RSC_EXIT_LE, 0, 0, 7},
233
234 /* Must create a large vendor descriptor */
235
238 0},
239
240 {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength),
241 0,
242 0},
243
244 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]),
246 0}
247};
unsigned char UINT8
#define ACPI_RESOURCE_NAME_VENDOR_LARGE
Definition: aclocal.h:1332
#define ACPI_RESOURCE_NAME_VENDOR_SMALL
Definition: aclocal.h:1322
#define ACPI_RESOURCE_NAME_MEMORY32
Definition: aclocal.h:1333
#define ACPI_RESOURCE_NAME_FIXED_MEMORY32
Definition: aclocal.h:1334
#define ACPI_RESOURCE_NAME_MEMORY24
Definition: aclocal.h:1329
#define ACPI_MODULE_NAME(Name)
Definition: acoutput.h:216
@ ACPI_RSC_INITSET
Definition: acresrc.h:81
@ ACPI_RSC_EXIT_LE
Definition: acresrc.h:99
@ ACPI_RSC_MOVE8
Definition: acresrc.h:106
@ ACPI_RSC_COUNT16
Definition: acresrc.h:91
@ ACPI_RSC_MOVE16
Definition: acresrc.h:107
@ ACPI_RSC_MOVE32
Definition: acresrc.h:108
@ ACPI_RSC_1BITFLAG
Definition: acresrc.h:83
@ ACPI_RSC_INITGET
Definition: acresrc.h:80
#define ACPI_RSC_TABLE_SIZE(d)
Definition: acresrc.h:121
#define ACPI_RS_OFFSET(f)
Definition: acresrc.h:123
#define AML_OFFSET(f)
Definition: acresrc.h:124
#define ACPI_RESOURCE_TYPE_MEMORY32
Definition: acrestyp.h:732
#define ACPI_RESOURCE_TYPE_MEMORY24
Definition: acrestyp.h:731
#define ACPI_RESOURCE_TYPE_VENDOR
Definition: acrestyp.h:729
#define ACPI_RS_SIZE(Type)
Definition: acrestyp.h:808
#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32
Definition: acrestyp.h:733
struct aml_resource_small_header AML_RESOURCE_SMALL_HEADER
struct aml_resource_large_header AML_RESOURCE_LARGE_HEADER
struct aml_resource_memory32 AML_RESOURCE_MEMORY32
struct aml_resource_fixed_memory32 AML_RESOURCE_FIXED_MEMORY32
struct aml_resource_memory24 AML_RESOURCE_MEMORY24
ACPI_RSCONVERT_INFO AcpiRsSetVendor[7]
Definition: rsmemory.c:210
ACPI_RSCONVERT_INFO AcpiRsGetVendorLarge[3]
Definition: rsmemory.c:184
ACPI_RSCONVERT_INFO AcpiRsConvertMemory32[4]
Definition: rsmemory.c:92
ACPI_RSCONVERT_INFO AcpiRsConvertFixedMemory32[4]
Definition: rsmemory.c:126
ACPI_RSCONVERT_INFO AcpiRsConvertMemory24[4]
Definition: rsmemory.c:58
ACPI_RSCONVERT_INFO AcpiRsGetVendorSmall[3]
Definition: rsmemory.c:158