blob: 7a8a34e757f506a2c4d758b206bec6458b7c54bc [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*******************************************************************************
2 *
3 * Module Name: rsmisc - Miscellaneous resource descriptors
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#include <acpi/acpi.h>
45#include <acpi/acresrc.h>
46
47#define _COMPONENT ACPI_RESOURCES
Len Brown4be44fc2005-08-05 00:44:28 -040048ACPI_MODULE_NAME("rsmisc")
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
50/*******************************************************************************
51 *
52 * FUNCTION: acpi_rs_end_tag_resource
53 *
54 * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
55 * stream
56 * bytes_consumed - Pointer to where the number of bytes
57 * consumed the byte_stream_buffer is
58 * returned
59 * output_buffer - Pointer to the return data buffer
60 * structure_size - Pointer to where the number of bytes
61 * in the return data struct is returned
62 *
63 * RETURN: Status
64 *
65 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
66 * structure pointed to by the output_buffer. Return the
67 * number of bytes consumed from the byte stream.
68 *
69 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -070070acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -040071acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
72 acpi_size * bytes_consumed,
73 u8 ** output_buffer, acpi_size * structure_size)
Linus Torvalds1da177e2005-04-16 15:20:36 -070074{
Len Brown4be44fc2005-08-05 00:44:28 -040075 struct acpi_resource *output_struct = (void *)*output_buffer;
76 acpi_size struct_size = ACPI_RESOURCE_LENGTH;
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
Len Brown4be44fc2005-08-05 00:44:28 -040078 ACPI_FUNCTION_TRACE("rs_end_tag_resource");
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
Robert Moore44f6c012005-04-18 22:49:35 -040080 /* The number of bytes consumed is static */
81
Linus Torvalds1da177e2005-04-16 15:20:36 -070082 *bytes_consumed = 2;
83
Robert Moore44f6c012005-04-18 22:49:35 -040084 /* Fill out the structure */
85
Linus Torvalds1da177e2005-04-16 15:20:36 -070086 output_struct->id = ACPI_RSTYPE_END_TAG;
87
Robert Moore44f6c012005-04-18 22:49:35 -040088 /* Set the Length parameter */
89
Linus Torvalds1da177e2005-04-16 15:20:36 -070090 output_struct->length = 0;
91
Robert Moore44f6c012005-04-18 22:49:35 -040092 /* Return the final size of the structure */
93
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 *structure_size = struct_size;
Len Brown4be44fc2005-08-05 00:44:28 -040095 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -070096}
97
Linus Torvalds1da177e2005-04-16 15:20:36 -070098/*******************************************************************************
99 *
100 * FUNCTION: acpi_rs_end_tag_stream
101 *
102 * PARAMETERS: linked_list - Pointer to the resource linked list
103 * output_buffer - Pointer to the user's return buffer
104 * bytes_consumed - Pointer to where the number of bytes
105 * used in the output_buffer is returned
106 *
107 * RETURN: Status
108 *
109 * DESCRIPTION: Take the linked list resource structure and fills in the
110 * the appropriate bytes in a byte stream
111 *
112 ******************************************************************************/
113
114acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400115acpi_rs_end_tag_stream(struct acpi_resource *linked_list,
116 u8 ** output_buffer, acpi_size * bytes_consumed)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117{
Len Brown4be44fc2005-08-05 00:44:28 -0400118 u8 *buffer = *output_buffer;
119 u8 temp8 = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120
Len Brown4be44fc2005-08-05 00:44:28 -0400121 ACPI_FUNCTION_TRACE("rs_end_tag_stream");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122
Robert Moore44f6c012005-04-18 22:49:35 -0400123 /* The descriptor field is static */
124
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125 *buffer = 0x79;
126 buffer += 1;
127
128 /*
129 * Set the Checksum - zero means that the resource data is treated as if
130 * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8)
131 */
132 temp8 = 0;
133
134 *buffer = temp8;
135 buffer += 1;
136
Robert Moore44f6c012005-04-18 22:49:35 -0400137 /* Return the number of bytes consumed in this operation */
138
Len Brown4be44fc2005-08-05 00:44:28 -0400139 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
140 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141}
142
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143/*******************************************************************************
144 *
145 * FUNCTION: acpi_rs_vendor_resource
146 *
147 * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
148 * stream
149 * bytes_consumed - Pointer to where the number of bytes
150 * consumed the byte_stream_buffer is
151 * returned
152 * output_buffer - Pointer to the return data buffer
153 * structure_size - Pointer to where the number of bytes
154 * in the return data struct is returned
155 *
156 * RETURN: Status
157 *
158 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
159 * structure pointed to by the output_buffer. Return the
160 * number of bytes consumed from the byte stream.
161 *
162 ******************************************************************************/
163
164acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400165acpi_rs_vendor_resource(u8 * byte_stream_buffer,
166 acpi_size * bytes_consumed,
167 u8 ** output_buffer, acpi_size * structure_size)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168{
Len Brown4be44fc2005-08-05 00:44:28 -0400169 u8 *buffer = byte_stream_buffer;
170 struct acpi_resource *output_struct = (void *)*output_buffer;
171 u16 temp16 = 0;
172 u8 temp8 = 0;
173 u8 index;
174 acpi_size struct_size =
175 ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176
Len Brown4be44fc2005-08-05 00:44:28 -0400177 ACPI_FUNCTION_TRACE("rs_vendor_resource");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178
Robert Moore44f6c012005-04-18 22:49:35 -0400179 /* Dereference the Descriptor to find if this is a large or small item. */
180
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 temp8 = *buffer;
182
183 if (temp8 & 0x80) {
Robert Moore44f6c012005-04-18 22:49:35 -0400184 /* Large Item, point to the length field */
185
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186 buffer += 1;
187
188 /* Dereference */
189
Len Brown4be44fc2005-08-05 00:44:28 -0400190 ACPI_MOVE_16_TO_16(&temp16, buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191
192 /* Calculate bytes consumed */
193
194 *bytes_consumed = (acpi_size) temp16 + 3;
195
196 /* Point to the first vendor byte */
197
198 buffer += 2;
Len Brown4be44fc2005-08-05 00:44:28 -0400199 } else {
Robert Moore44f6c012005-04-18 22:49:35 -0400200 /* Small Item, dereference the size */
201
Len Brown4be44fc2005-08-05 00:44:28 -0400202 temp16 = (u8) (*buffer & 0x07);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203
204 /* Calculate bytes consumed */
205
206 *bytes_consumed = (acpi_size) temp16 + 1;
207
208 /* Point to the first vendor byte */
209
210 buffer += 1;
211 }
212
213 output_struct->id = ACPI_RSTYPE_VENDOR;
214 output_struct->data.vendor_specific.length = temp16;
215
216 for (index = 0; index < temp16; index++) {
217 output_struct->data.vendor_specific.reserved[index] = *buffer;
218 buffer += 1;
219 }
220
221 /*
222 * In order for the struct_size to fall on a 32-bit boundary,
223 * calculate the length of the vendor string and expand the
224 * struct_size to the next 32-bit boundary.
225 */
Len Brown4be44fc2005-08-05 00:44:28 -0400226 struct_size += ACPI_ROUND_UP_to_32_bITS(temp16);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227
Robert Moore44f6c012005-04-18 22:49:35 -0400228 /* Set the Length parameter */
229
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230 output_struct->length = (u32) struct_size;
231
Robert Moore44f6c012005-04-18 22:49:35 -0400232 /* Return the final size of the structure */
233
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234 *structure_size = struct_size;
Len Brown4be44fc2005-08-05 00:44:28 -0400235 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236}
237
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238/*******************************************************************************
239 *
240 * FUNCTION: acpi_rs_vendor_stream
241 *
242 * PARAMETERS: linked_list - Pointer to the resource linked list
243 * output_buffer - Pointer to the user's return buffer
244 * bytes_consumed - Pointer to where the number of bytes
245 * used in the output_buffer is returned
246 *
247 * RETURN: Status
248 *
249 * DESCRIPTION: Take the linked list resource structure and fills in the
250 * the appropriate bytes in a byte stream
251 *
252 ******************************************************************************/
253
254acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400255acpi_rs_vendor_stream(struct acpi_resource *linked_list,
256 u8 ** output_buffer, acpi_size * bytes_consumed)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257{
Len Brown4be44fc2005-08-05 00:44:28 -0400258 u8 *buffer = *output_buffer;
259 u16 temp16 = 0;
260 u8 temp8 = 0;
261 u8 index;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262
Len Brown4be44fc2005-08-05 00:44:28 -0400263 ACPI_FUNCTION_TRACE("rs_vendor_stream");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264
Robert Moore44f6c012005-04-18 22:49:35 -0400265 /* Dereference the length to find if this is a large or small item. */
266
Len Brown4be44fc2005-08-05 00:44:28 -0400267 if (linked_list->data.vendor_specific.length > 7) {
Robert Moore44f6c012005-04-18 22:49:35 -0400268 /* Large Item, Set the descriptor field and length bytes */
269
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270 *buffer = 0x84;
271 buffer += 1;
272
273 temp16 = (u16) linked_list->data.vendor_specific.length;
274
Len Brown4be44fc2005-08-05 00:44:28 -0400275 ACPI_MOVE_16_TO_16(buffer, &temp16);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276 buffer += 2;
Len Brown4be44fc2005-08-05 00:44:28 -0400277 } else {
Robert Moore44f6c012005-04-18 22:49:35 -0400278 /* Small Item, Set the descriptor field */
279
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280 temp8 = 0x70;
281 temp8 |= (u8) linked_list->data.vendor_specific.length;
282
283 *buffer = temp8;
284 buffer += 1;
285 }
286
Robert Moore44f6c012005-04-18 22:49:35 -0400287 /* Loop through all of the Vendor Specific fields */
288
Len Brown4be44fc2005-08-05 00:44:28 -0400289 for (index = 0; index < linked_list->data.vendor_specific.length;
290 index++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291 temp8 = linked_list->data.vendor_specific.reserved[index];
292
293 *buffer = temp8;
294 buffer += 1;
295 }
296
Robert Moore44f6c012005-04-18 22:49:35 -0400297 /* Return the number of bytes consumed in this operation */
298
Len Brown4be44fc2005-08-05 00:44:28 -0400299 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
300 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301}
302
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303/*******************************************************************************
304 *
305 * FUNCTION: acpi_rs_start_depend_fns_resource
306 *
307 * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
308 * stream
309 * bytes_consumed - Pointer to where the number of bytes
310 * consumed the byte_stream_buffer is
311 * returned
312 * output_buffer - Pointer to the return data buffer
313 * structure_size - Pointer to where the number of bytes
314 * in the return data struct is returned
315 *
316 * RETURN: Status
317 *
318 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
319 * structure pointed to by the output_buffer. Return the
320 * number of bytes consumed from the byte stream.
321 *
322 ******************************************************************************/
323
324acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400325acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer,
326 acpi_size * bytes_consumed,
327 u8 ** output_buffer,
328 acpi_size * structure_size)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329{
Len Brown4be44fc2005-08-05 00:44:28 -0400330 u8 *buffer = byte_stream_buffer;
331 struct acpi_resource *output_struct = (void *)*output_buffer;
332 u8 temp8 = 0;
333 acpi_size struct_size =
334 ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335
Len Brown4be44fc2005-08-05 00:44:28 -0400336 ACPI_FUNCTION_TRACE("rs_start_depend_fns_resource");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337
Robert Moore44f6c012005-04-18 22:49:35 -0400338 /* The number of bytes consumed are found in the descriptor (Bits:0-1) */
339
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340 temp8 = *buffer;
341
342 *bytes_consumed = (temp8 & 0x01) + 1;
343
344 output_struct->id = ACPI_RSTYPE_START_DPF;
345
Robert Moore44f6c012005-04-18 22:49:35 -0400346 /* Point to Byte 1 if it is used */
347
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348 if (2 == *bytes_consumed) {
349 buffer += 1;
350 temp8 = *buffer;
351
Robert Moore44f6c012005-04-18 22:49:35 -0400352 /* Check Compatibility priority */
353
Len Brown4be44fc2005-08-05 00:44:28 -0400354 output_struct->data.start_dpf.compatibility_priority =
355 temp8 & 0x03;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356
357 if (3 == output_struct->data.start_dpf.compatibility_priority) {
Len Brown4be44fc2005-08-05 00:44:28 -0400358 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700359 }
360
Robert Moore44f6c012005-04-18 22:49:35 -0400361 /* Check Performance/Robustness preference */
362
Len Brown4be44fc2005-08-05 00:44:28 -0400363 output_struct->data.start_dpf.performance_robustness =
364 (temp8 >> 2) & 0x03;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365
366 if (3 == output_struct->data.start_dpf.performance_robustness) {
Len Brown4be44fc2005-08-05 00:44:28 -0400367 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368 }
Len Brown4be44fc2005-08-05 00:44:28 -0400369 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370 output_struct->data.start_dpf.compatibility_priority =
Len Brown4be44fc2005-08-05 00:44:28 -0400371 ACPI_ACCEPTABLE_CONFIGURATION;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372
373 output_struct->data.start_dpf.performance_robustness =
Len Brown4be44fc2005-08-05 00:44:28 -0400374 ACPI_ACCEPTABLE_CONFIGURATION;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375 }
376
Robert Moore44f6c012005-04-18 22:49:35 -0400377 /* Set the Length parameter */
378
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379 output_struct->length = (u32) struct_size;
380
Robert Moore44f6c012005-04-18 22:49:35 -0400381 /* Return the final size of the structure */
382
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383 *structure_size = struct_size;
Len Brown4be44fc2005-08-05 00:44:28 -0400384 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700385}
386
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387/*******************************************************************************
388 *
389 * FUNCTION: acpi_rs_end_depend_fns_resource
390 *
391 * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
392 * stream
393 * bytes_consumed - Pointer to where the number of bytes
394 * consumed the byte_stream_buffer is
395 * returned
396 * output_buffer - Pointer to the return data buffer
397 * structure_size - Pointer to where the number of bytes
398 * in the return data struct is returned
399 *
400 * RETURN: Status
401 *
402 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
403 * structure pointed to by the output_buffer. Return the
404 * number of bytes consumed from the byte stream.
405 *
406 ******************************************************************************/
407
408acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400409acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
410 acpi_size * bytes_consumed,
411 u8 ** output_buffer, acpi_size * structure_size)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700412{
Len Brown4be44fc2005-08-05 00:44:28 -0400413 struct acpi_resource *output_struct = (void *)*output_buffer;
414 acpi_size struct_size = ACPI_RESOURCE_LENGTH;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415
Len Brown4be44fc2005-08-05 00:44:28 -0400416 ACPI_FUNCTION_TRACE("rs_end_depend_fns_resource");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417
Robert Moore44f6c012005-04-18 22:49:35 -0400418 /* The number of bytes consumed is static */
419
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420 *bytes_consumed = 1;
421
Robert Moore44f6c012005-04-18 22:49:35 -0400422 /* Fill out the structure */
423
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 output_struct->id = ACPI_RSTYPE_END_DPF;
425
Robert Moore44f6c012005-04-18 22:49:35 -0400426 /* Set the Length parameter */
427
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 output_struct->length = (u32) struct_size;
429
Robert Moore44f6c012005-04-18 22:49:35 -0400430 /* Return the final size of the structure */
431
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432 *structure_size = struct_size;
Len Brown4be44fc2005-08-05 00:44:28 -0400433 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434}
435
Linus Torvalds1da177e2005-04-16 15:20:36 -0700436/*******************************************************************************
437 *
438 * FUNCTION: acpi_rs_start_depend_fns_stream
439 *
440 * PARAMETERS: linked_list - Pointer to the resource linked list
441 * output_buffer - Pointer to the user's return buffer
442 * bytes_consumed - u32 pointer that is filled with
443 * the number of bytes of the
444 * output_buffer used
445 *
446 * RETURN: Status
447 *
448 * DESCRIPTION: Take the linked list resource structure and fills in the
449 * the appropriate bytes in a byte stream
450 *
451 ******************************************************************************/
452
453acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400454acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
455 u8 ** output_buffer, acpi_size * bytes_consumed)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456{
Len Brown4be44fc2005-08-05 00:44:28 -0400457 u8 *buffer = *output_buffer;
458 u8 temp8 = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459
Len Brown4be44fc2005-08-05 00:44:28 -0400460 ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461
462 /*
463 * The descriptor field is set based upon whether a byte is needed
464 * to contain Priority data.
465 */
466 if (ACPI_ACCEPTABLE_CONFIGURATION ==
Len Brown4be44fc2005-08-05 00:44:28 -0400467 linked_list->data.start_dpf.compatibility_priority &&
468 ACPI_ACCEPTABLE_CONFIGURATION ==
469 linked_list->data.start_dpf.performance_robustness) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470 *buffer = 0x30;
Len Brown4be44fc2005-08-05 00:44:28 -0400471 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472 *buffer = 0x31;
473 buffer += 1;
474
Robert Moore44f6c012005-04-18 22:49:35 -0400475 /* Set the Priority Byte Definition */
476
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 temp8 = 0;
Len Brown4be44fc2005-08-05 00:44:28 -0400478 temp8 =
479 (u8) ((linked_list->data.start_dpf.
480 performance_robustness & 0x03) << 2);
481 temp8 |=
482 (linked_list->data.start_dpf.compatibility_priority & 0x03);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 *buffer = temp8;
484 }
485
486 buffer += 1;
487
Robert Moore44f6c012005-04-18 22:49:35 -0400488 /* Return the number of bytes consumed in this operation */
489
Len Brown4be44fc2005-08-05 00:44:28 -0400490 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
491 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492}
493
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494/*******************************************************************************
495 *
496 * FUNCTION: acpi_rs_end_depend_fns_stream
497 *
498 * PARAMETERS: linked_list - Pointer to the resource linked list
499 * output_buffer - Pointer to the user's return buffer
500 * bytes_consumed - Pointer to where the number of bytes
501 * used in the output_buffer is returned
502 *
503 * RETURN: Status
504 *
505 * DESCRIPTION: Take the linked list resource structure and fills in the
506 * the appropriate bytes in a byte stream
507 *
508 ******************************************************************************/
509
510acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400511acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list,
512 u8 ** output_buffer, acpi_size * bytes_consumed)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513{
Len Brown4be44fc2005-08-05 00:44:28 -0400514 u8 *buffer = *output_buffer;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515
Len Brown4be44fc2005-08-05 00:44:28 -0400516 ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517
Robert Moore44f6c012005-04-18 22:49:35 -0400518 /* The descriptor field is static */
519
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 *buffer = 0x38;
521 buffer += 1;
522
Robert Moore44f6c012005-04-18 22:49:35 -0400523 /* Return the number of bytes consumed in this operation */
524
Len Brown4be44fc2005-08-05 00:44:28 -0400525 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
526 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527}