ReactOS 0.4.16-dev-1946-g52006dd
resources.h
Go to the documentation of this file.
1#pragma once
2
4#include <uacpi/resources.h>
5
6#ifndef UACPI_BAREBONES_MODE
7
10
11 // Small resources
21
22 // Large resources
42};
43
48};
49
53};
54
57
58 /*
59 * AML -> native:
60 * Take the mask at 'aml_offset' and convert to an array of uacpi_u8
61 * at 'native_offset' with the value corresponding to the bit index.
62 * The array size is written to the byte at offset 'arg2'.
63 *
64 * native -> AML:
65 * Walk each element of the array at 'native_offset' and set the
66 * corresponding bit in the mask at 'aml_offset' to 1. The array size is
67 * read from the byte at offset 'arg2'.
68 */
71
72 /*
73 * AML -> native:
74 * Grab the bits at the byte at 'aml_offset' + 'bit_index', and copy its
75 * value into the byte at 'native_offset'.
76 *
77 * native -> AML:
78 * Grab first N bits at 'native_offset' and copy to 'aml_offset' starting
79 * at the 'bit_index'.
80 *
81 * NOTE:
82 * These must be contiguous in this order.
83 */
89
90 /*
91 * AML -> native:
92 * Copy N bytes at 'aml_offset' to 'native_offset'.
93 *
94 * native -> AML:
95 * Copy N bytes at 'native_offset' to 'aml_offset'.
96 *
97 * 'imm' is added to the accumulator.
98 *
99 * NOTE: These are affected by the current value in the accumulator. If it's
100 * set to 0 at the time of evalution, this is executed once, N times
101 * otherwise. 0xFF is considered a special value, which resets the
102 * accumulator to 0 unconditionally.
103 */
108
109 /*
110 * If the length of the current resource is less than 'arg0', then skip
111 * 'imm' instructions.
112 */
114
115 /*
116 * Skip 'imm' instructions if 'arg0' is not equal to the value in the
117 * accumulator.
118 */
120
121 /*
122 * AML -> native:
123 * Set the byte at 'native_offset' to 'imm'.
124 *
125 * native -> AML:
126 * Set the byte at 'aml_offset' to 'imm'.
127 */
129
130 /*
131 * AML -> native:
132 * Load the AML resoruce length into the accumulator as well as the field at
133 * 'native_offset' of width N.
134 *
135 * native -> AML:
136 * Load the resource length into the accumulator.
137 */
139
140 /*
141 * AML -> native:
142 * Load the 8 bit field at 'aml_offset' into the accumulator and store at
143 * 'native_offset'.
144 *
145 * native -> AML:
146 * Load the 8 bit field at 'native_offset' into the accumulator and store
147 * at 'aml_offset'.
148 *
149 * The accumulator is multiplied by 'imm' unless it's set to zero.
150 */
152
153 /*
154 * Load the N bit field at 'native_offset' into the accumulator
155 */
158
159 /*
160 * Load 'imm' into the accumulator.
161 */
163
164 /*
165 * AML -> native:
166 * Load the resource source at offset = aml size + accumulator into the
167 * uacpi_resource_source struct at 'native_offset'. The string bytes are
168 * written to the offset at resource size + accumulator. The presence is
169 * detected by comparing the length of the resource to the offset,
170 * 'arg2' optionally specifies the offset to the upper bound of the string.
171 *
172 * native -> AML:
173 * Load the resource source from the uacpi_resource_source struct at
174 * 'native_offset' to aml_size + accumulator. aml_size + accumulator is
175 * optionally written to 'aml_offset' if it's specified.
176 */
180
181 /*
182 * AML -> native:
183 * Load the pin table with upper bound specified at 'aml_offset'.
184 * The table length is calculated by subtracting the upper bound from
185 * aml_size and is written into the accumulator.
186 *
187 * native -> AML:
188 * Load the pin table length from 'native_offset' and multiply by 2, store
189 * the result in the accumulator.
190 */
192
193 /*
194 * AML -> native:
195 * Store the accumulator divided by 2 at 'native_offset'.
196 * The table is copied to the offset at resource size from offset at
197 * aml_size with the pointer written to the offset at 'arg2'.
198 *
199 * native -> AML:
200 * Read the pin table from resource size offset, write aml_size to
201 * 'aml_offset'. Copy accumulator bytes to the offset at aml_size.
202 */
204
205 /*
206 * AML -> native:
207 * Load vendor data with offset stored at 'aml_offset'. The length is
208 * calculated as aml_size - aml_offset and is written to 'native_offset'.
209 * The data is written to offset - aml_size with the pointer written back
210 * to the offset at 'arg2'.
211 *
212 * native -> AML:
213 * Read vendor data from the pointer at offset 'arg2' and size at
214 * 'native_offset', the offset to write to is calculated as the difference
215 * between the data pointer and the native resource end pointer.
216 * offset + aml_size is written to 'aml_offset' and the data is copied
217 * there as well.
218 */
220
221 /*
222 * AML -> native:
223 * Read the serial type from the byte at 'aml_offset' and write it to the
224 * type field of the uacpi_resource_serial_bus_common structure. Convert
225 * the serial type to native and set the resource type to it. Copy the
226 * vendor data to the offset at native size, the length is calculated
227 * as type_data_length - extra-type-specific-size, and is written to
228 * vendor_data_length, as well as the accumulator. The data pointer is
229 * written to vendor_data.
230 *
231 * native -> AML:
232 * Set the serial type at 'aml_offset' to the value stored at
233 * 'native_offset'. Load the vendor data to the offset at aml_size,
234 * the length is read from 'vendor_data_length', and the data is copied from
235 * 'vendor_data'.
236 */
238
239 /*
240 * Produces an error if encountered in the instruction stream.
241 * Used to trap invalid/unexpected code flow.
242 */
244};
245
248
249 union {
252 };
253
254 union {
257 };
258
259 union {
263 };
264};
265
271
272 /*
273 * Size of the resource as appears in the AML byte stream, for variable
274 * length resources this is the minimum.
275 */
277
278 /*
279 * Size of the native human-readable uacpi resource, for variable length
280 * resources this is the minimum. The final length is this field plus the
281 * result of extra_size_for_native().
282 */
284
285 /*
286 * Calculate the amount of extra bytes that must be allocated for a specific
287 * native resource given the AML counterpart. This being NULL means no extra
288 * bytes are needed, aka native resources is always the same size.
289 */
291 const struct uacpi_resource_spec*, void*, uacpi_size
292 );
293
294 /*
295 * Calculate the number of bytes needed to represent a native resource as
296 * AML. The 'aml_size' field is used if this is NULL.
297 */
299 const struct uacpi_resource_spec*, uacpi_resource*
300 );
301
304};
305
307 void*, uacpi_u8 *data, uacpi_u16 resource_size,
308 const struct uacpi_resource_spec*
309);
310
313);
314
316 uacpi_data_view, uacpi_size *out_offset
317);
318
320 uacpi_data_view, uacpi_resources **out_resources
321);
322
324 uacpi_resources *resources, uacpi_object **out_template
325);
326
327#endif // !UACPI_BAREBONES_MODE
void user(int argc, const char *argv[])
Definition: cmds.c:1350
uacpi_aml_resource_kind
Definition: resources.h:50
@ UACPI_AML_RESOURCE_KIND_LARGE
Definition: resources.h:52
@ UACPI_AML_RESOURCE_KIND_SMALL
Definition: resources.h:51
uacpi_aml_resource
Definition: resources.h:8
@ UACPI_AML_RESOURCE_END_TAG
Definition: resources.h:20
@ UACPI_AML_RESOURCE_PIN_GROUP
Definition: resources.h:37
@ UACPI_AML_RESOURCE_FIXED_MEMORY32
Definition: resources.h:27
@ UACPI_AML_RESOURCE_ADDRESS32
Definition: resources.h:28
@ UACPI_AML_RESOURCE_PIN_CONFIGURATION
Definition: resources.h:36
@ UACPI_AML_RESOURCE_FIXED_IO
Definition: resources.h:17
@ UACPI_AML_RESOURCE_MEMORY24
Definition: resources.h:23
@ UACPI_AML_RESOURCE_TYPE_INVALID
Definition: resources.h:9
@ UACPI_AML_RESOURCE_VENDOR_TYPE0
Definition: resources.h:19
@ UACPI_AML_RESOURCE_PIN_FUNCTION
Definition: resources.h:34
@ UACPI_AML_RESOURCE_IO
Definition: resources.h:16
@ UACPI_AML_RESOURCE_FIXED_DMA
Definition: resources.h:18
@ UACPI_AML_RESOURCE_DMA
Definition: resources.h:13
@ UACPI_AML_RESOURCE_PIN_GROUP_FUNCTION
Definition: resources.h:38
@ UACPI_AML_RESOURCE_GPIO_CONNECTION
Definition: resources.h:33
@ UACPI_AML_RESOURCE_EXTENDED_IRQ
Definition: resources.h:30
@ UACPI_AML_RESOURCE_GENERIC_REGISTER
Definition: resources.h:24
@ UACPI_AML_RESOURCE_END_DEPENDENT
Definition: resources.h:15
@ UACPI_AML_RESOURCE_VENDOR_TYPE1
Definition: resources.h:25
@ UACPI_AML_RESOURCE_IRQ
Definition: resources.h:12
@ UACPI_AML_RESOURCE_ADDRESS64_EXTENDED
Definition: resources.h:32
@ UACPI_AML_RESOURCE_ADDRESS64
Definition: resources.h:31
@ UACPI_AML_RESOURCE_ADDRESS16
Definition: resources.h:29
@ UACPI_AML_RESOURCE_START_DEPENDENT
Definition: resources.h:14
@ UACPI_AML_RESOURCE_CLOCK_INPUT
Definition: resources.h:40
@ UACPI_AML_RESOURCE_SERIAL_CONNECTION
Definition: resources.h:35
@ UACPI_AML_RESOURCE_PIN_GROUP_CONFIGURATION
Definition: resources.h:39
@ UACPI_AML_RESOURCE_MEMORY32
Definition: resources.h:26
@ UACPI_AML_RESOURCE_MAX
Definition: resources.h:41
uacpi_status uacpi_for_each_aml_resource(uacpi_data_view, uacpi_aml_resource_iteration_callback cb, void *user)
Definition: resources.c:1423
uacpi_status uacpi_native_resources_to_aml(uacpi_resources *resources, uacpi_object **out_template)
Definition: resources.c:2491
uacpi_status uacpi_native_resources_from_aml(uacpi_data_view, uacpi_resources **out_resources)
Definition: resources.c:1978
uacpi_status uacpi_find_aml_resource_end_tag(uacpi_data_view, uacpi_size *out_offset)
Definition: resources.c:1526
uacpi_iteration_decision(* uacpi_aml_resource_iteration_callback)(void *, uacpi_u8 *data, uacpi_u16 resource_size, const struct uacpi_resource_spec *)
Definition: resources.h:306
uacpi_resource_convert_opcode
Definition: resources.h:55
@ UACPI_RESOURCE_CONVERT_OPCODE_FIELD_8
Definition: resources.h:104
@ UACPI_RESOURCE_CONVERT_OPCODE_PACKED_ARRAY_8
Definition: resources.h:69
@ UACPI_RESOURCE_CONVERT_OPCODE_BIT_FIELD_2
Definition: resources.h:85
@ UACPI_RESOURCE_CONVERT_OPCODE_FIELD_32
Definition: resources.h:106
@ UACPI_RESOURCE_CONVERT_OPCODE_UNREACHABLE
Definition: resources.h:243
@ UACPI_RESOURCE_CONVERT_OPCODE_LOAD_8_NATIVE
Definition: resources.h:156
@ UACPI_RESOURCE_CONVERT_OPCODE_PIN_TABLE
Definition: resources.h:203
@ UACPI_RESOURCE_CONVERT_OPCODE_FIELD_16
Definition: resources.h:105
@ UACPI_RESOURCE_CONVERT_OPCODE_SKIP_IF_AML_SIZE_LESS_THAN
Definition: resources.h:113
@ UACPI_RESOURCE_CONVERT_OPCODE_PACKED_ARRAY_16
Definition: resources.h:70
@ UACPI_RESOURCE_CONVERT_OPCODE_SET_TO_IMM
Definition: resources.h:128
@ UACPI_RESOURCE_CONVERT_OPCODE_BIT_FIELD_1
Definition: resources.h:84
@ UACPI_RESOURCE_CONVERT_OPCODE_FIELD_64
Definition: resources.h:107
@ UACPI_RESOURCE_CONVERT_OPCODE_SKIP_IF_NOT_EQUALS
Definition: resources.h:119
@ UACPI_RESOURCE_CONVERT_OPCODE_LOAD_8_STORE
Definition: resources.h:151
@ UACPI_RESOURCE_CONVERT_OPCODE_BIT_FIELD_3
Definition: resources.h:86
@ UACPI_RESOURCE_CONVERT_OPCODE_BIT_FIELD_6
Definition: resources.h:87
@ UACPI_RESOURCE_CONVERT_OPCODE_LOAD_AML_SIZE_32
Definition: resources.h:138
@ UACPI_RESOURCE_CONVERT_OPCODE_LOAD_IMM
Definition: resources.h:162
@ UACPI_RESOURCE_CONVERT_OPCODE_RESOURCE_LABEL
Definition: resources.h:179
@ UACPI_RESOURCE_CONVERT_OPCODE_LOAD_16_NATIVE
Definition: resources.h:157
@ UACPI_RESOURCE_CONVERT_OPCODE_RESOURCE_SOURCE_NO_INDEX
Definition: resources.h:178
@ UACPI_RESOURCE_CONVERT_OPCODE_LOAD_PIN_TABLE_LENGTH
Definition: resources.h:191
@ UACPI_RESOURCE_CONVERT_OPCODE_SERIAL_TYPE_SPECIFIC
Definition: resources.h:237
@ UACPI_RESOURCE_CONVERT_OPCODE_RESOURCE_SOURCE
Definition: resources.h:177
@ UACPI_RESOURCE_CONVERT_OPCODE_END
Definition: resources.h:56
@ UACPI_RESOURCE_CONVERT_OPCODE_VENDOR_DATA
Definition: resources.h:219
uacpi_aml_resource_size_kind
Definition: resources.h:44
@ UACPI_AML_RESOURCE_SIZE_KIND_FIXED
Definition: resources.h:45
@ UACPI_AML_RESOURCE_SIZE_KIND_FIXED_OR_ONE_LESS
Definition: resources.h:46
@ UACPI_AML_RESOURCE_SIZE_KIND_VARIABLE
Definition: resources.h:47
size_t uacpi_size
Definition: types.h:37
uint16_t uacpi_u16
Definition: types.h:20
uint8_t uacpi_u8
Definition: types.h:19
uacpi_status
Definition: status.h:10
uacpi_iteration_decision
Definition: types.h:28
FxCmResList * resources
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
uacpi_size(* size_for_aml)(const struct uacpi_resource_spec *, uacpi_resource *)
Definition: resources.h:298
uacpi_u8 native_type
Definition: resources.h:268
uacpi_u16 aml_size
Definition: resources.h:276
const struct uacpi_resource_convert_instruction * to_aml
Definition: resources.h:303
const struct uacpi_resource_convert_instruction * to_native
Definition: resources.h:302
uacpi_u16 native_size
Definition: resources.h:283
uacpi_u8 size_kind
Definition: resources.h:270
uacpi_size(* extra_size_for_native)(const struct uacpi_resource_spec *, void *, uacpi_size)
Definition: resources.h:290
uacpi_u8 resource_kind
Definition: resources.h:269