blob: 418f1afb10a340f31d1dd93bd09803bc6d63dc83 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*******************************************************************************
2 *
3 * Module Name: rsmem24 - Memory 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("rsmemory")
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
50/*******************************************************************************
51 *
52 * FUNCTION: acpi_rs_memory24_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_memory24_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 u8 *buffer = byte_stream_buffer;
76 struct acpi_resource *output_struct = (void *)*output_buffer;
77 u16 temp16 = 0;
78 u8 temp8 = 0;
79 acpi_size struct_size =
80 ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24);
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
Len Brown4be44fc2005-08-05 00:44:28 -040082 ACPI_FUNCTION_TRACE("rs_memory24_resource");
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
Robert Moore44f6c012005-04-18 22:49:35 -040084 /* Point past the Descriptor to get the number of bytes consumed */
85
Linus Torvalds1da177e2005-04-16 15:20:36 -070086 buffer += 1;
Len Brown4be44fc2005-08-05 00:44:28 -040087 ACPI_MOVE_16_TO_16(&temp16, buffer);
Robert Moorebda663d2005-09-16 16:51:15 -040088
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 buffer += 2;
90 *bytes_consumed = (acpi_size) temp16 + 3;
Robert Moorebda663d2005-09-16 16:51:15 -040091 output_struct->type = ACPI_RSTYPE_MEM24;
Linus Torvalds1da177e2005-04-16 15:20:36 -070092
Robert Moore44f6c012005-04-18 22:49:35 -040093 /* Check Byte 3 the Read/Write bit */
94
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 temp8 = *buffer;
96 buffer += 1;
97 output_struct->data.memory24.read_write_attribute = temp8 & 0x01;
98
Robert Moore44f6c012005-04-18 22:49:35 -040099 /* Get min_base_address (Bytes 4-5) */
100
Len Brown4be44fc2005-08-05 00:44:28 -0400101 ACPI_MOVE_16_TO_16(&temp16, buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102 buffer += 2;
103 output_struct->data.memory24.min_base_address = temp16;
104
Robert Moore44f6c012005-04-18 22:49:35 -0400105 /* Get max_base_address (Bytes 6-7) */
106
Len Brown4be44fc2005-08-05 00:44:28 -0400107 ACPI_MOVE_16_TO_16(&temp16, buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 buffer += 2;
109 output_struct->data.memory24.max_base_address = temp16;
110
Robert Moore44f6c012005-04-18 22:49:35 -0400111 /* Get Alignment (Bytes 8-9) */
112
Len Brown4be44fc2005-08-05 00:44:28 -0400113 ACPI_MOVE_16_TO_16(&temp16, buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 buffer += 2;
115 output_struct->data.memory24.alignment = temp16;
116
Robert Moore44f6c012005-04-18 22:49:35 -0400117 /* Get range_length (Bytes 10-11) */
118
Len Brown4be44fc2005-08-05 00:44:28 -0400119 ACPI_MOVE_16_TO_16(&temp16, buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120 output_struct->data.memory24.range_length = temp16;
121
Robert Moore44f6c012005-04-18 22:49:35 -0400122 /* Set the Length parameter */
123
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124 output_struct->length = (u32) struct_size;
125
Robert Moore44f6c012005-04-18 22:49:35 -0400126 /* Return the final size of the structure */
127
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128 *structure_size = struct_size;
Len Brown4be44fc2005-08-05 00:44:28 -0400129 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130}
131
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132/*******************************************************************************
133 *
134 * FUNCTION: acpi_rs_memory24_stream
135 *
Robert Moorebda663d2005-09-16 16:51:15 -0400136 * PARAMETERS: Resource - Pointer to the resource linked list
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 * output_buffer - Pointer to the user's return buffer
138 * bytes_consumed - Pointer to where the number of bytes
139 * used in the output_buffer is returned
140 *
141 * RETURN: Status
142 *
143 * DESCRIPTION: Take the linked list resource structure and fills in the
144 * the appropriate bytes in a byte stream
145 *
146 ******************************************************************************/
147
148acpi_status
Robert Moorebda663d2005-09-16 16:51:15 -0400149acpi_rs_memory24_stream(struct acpi_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400150 u8 ** output_buffer, acpi_size * bytes_consumed)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151{
Len Brown4be44fc2005-08-05 00:44:28 -0400152 u8 *buffer = *output_buffer;
153 u16 temp16 = 0;
154 u8 temp8 = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155
Len Brown4be44fc2005-08-05 00:44:28 -0400156 ACPI_FUNCTION_TRACE("rs_memory24_stream");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157
Robert Moorebda663d2005-09-16 16:51:15 -0400158 /* The Descriptor Type field is static */
Robert Moore44f6c012005-04-18 22:49:35 -0400159
Robert Moorebda663d2005-09-16 16:51:15 -0400160 *buffer = ACPI_RDESC_TYPE_MEMORY_24;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161 buffer += 1;
162
Robert Moore44f6c012005-04-18 22:49:35 -0400163 /* The length field is static */
164
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 temp16 = 0x09;
Len Brown4be44fc2005-08-05 00:44:28 -0400166 ACPI_MOVE_16_TO_16(buffer, &temp16);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 buffer += 2;
168
Robert Moore44f6c012005-04-18 22:49:35 -0400169 /* Set the Information Byte */
170
Robert Moorebda663d2005-09-16 16:51:15 -0400171 temp8 = (u8) (resource->data.memory24.read_write_attribute & 0x01);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172 *buffer = temp8;
173 buffer += 1;
174
Robert Moore44f6c012005-04-18 22:49:35 -0400175 /* Set the Range minimum base address */
176
Robert Moorebda663d2005-09-16 16:51:15 -0400177 ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.min_base_address);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178 buffer += 2;
179
Robert Moore44f6c012005-04-18 22:49:35 -0400180 /* Set the Range maximum base address */
181
Robert Moorebda663d2005-09-16 16:51:15 -0400182 ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.max_base_address);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183 buffer += 2;
184
Robert Moore44f6c012005-04-18 22:49:35 -0400185 /* Set the base alignment */
186
Robert Moorebda663d2005-09-16 16:51:15 -0400187 ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.alignment);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 buffer += 2;
189
Robert Moore44f6c012005-04-18 22:49:35 -0400190 /* Set the range length */
191
Robert Moorebda663d2005-09-16 16:51:15 -0400192 ACPI_MOVE_32_TO_16(buffer, &resource->data.memory24.range_length);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193 buffer += 2;
194
Robert Moore44f6c012005-04-18 22:49:35 -0400195 /* Return the number of bytes consumed in this operation */
196
Len Brown4be44fc2005-08-05 00:44:28 -0400197 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
198 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199}
200
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201/*******************************************************************************
202 *
203 * FUNCTION: acpi_rs_memory32_range_resource
204 *
205 * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
206 * stream
207 * bytes_consumed - Pointer to where the number of bytes
208 * consumed the byte_stream_buffer is
209 * returned
210 * output_buffer - Pointer to the return data buffer
211 * structure_size - Pointer to where the number of bytes
212 * in the return data struct is returned
213 *
214 * RETURN: Status
215 *
216 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
217 * structure pointed to by the output_buffer. Return the
218 * number of bytes consumed from the byte stream.
219 *
220 ******************************************************************************/
221
222acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400223acpi_rs_memory32_range_resource(u8 * byte_stream_buffer,
224 acpi_size * bytes_consumed,
225 u8 ** output_buffer, acpi_size * structure_size)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226{
Len Brown4be44fc2005-08-05 00:44:28 -0400227 u8 *buffer = byte_stream_buffer;
228 struct acpi_resource *output_struct = (void *)*output_buffer;
229 u16 temp16 = 0;
230 u8 temp8 = 0;
231 acpi_size struct_size =
232 ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233
Len Brown4be44fc2005-08-05 00:44:28 -0400234 ACPI_FUNCTION_TRACE("rs_memory32_range_resource");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235
Robert Moore44f6c012005-04-18 22:49:35 -0400236 /* Point past the Descriptor to get the number of bytes consumed */
237
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 buffer += 1;
Len Brown4be44fc2005-08-05 00:44:28 -0400239 ACPI_MOVE_16_TO_16(&temp16, buffer);
Robert Moorebda663d2005-09-16 16:51:15 -0400240
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241 buffer += 2;
242 *bytes_consumed = (acpi_size) temp16 + 3;
Robert Moorebda663d2005-09-16 16:51:15 -0400243 output_struct->type = ACPI_RSTYPE_MEM32;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244
245 /*
246 * Point to the place in the output buffer where the data portion will
247 * begin.
248 * 1. Set the RESOURCE_DATA * Data to point to its own address, then
249 * 2. Set the pointer to the next address.
250 *
251 * NOTE: output_struct->Data is cast to u8, otherwise, this addition adds
252 * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(u8)
253 */
254
Robert Moore44f6c012005-04-18 22:49:35 -0400255 /* Check Byte 3 the Read/Write bit */
256
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257 temp8 = *buffer;
258 buffer += 1;
259
260 output_struct->data.memory32.read_write_attribute = temp8 & 0x01;
261
Robert Moore44f6c012005-04-18 22:49:35 -0400262 /* Get min_base_address (Bytes 4-7) */
263
Len Brown4be44fc2005-08-05 00:44:28 -0400264 ACPI_MOVE_32_TO_32(&output_struct->data.memory32.min_base_address,
265 buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266 buffer += 4;
267
Robert Moore44f6c012005-04-18 22:49:35 -0400268 /* Get max_base_address (Bytes 8-11) */
269
Len Brown4be44fc2005-08-05 00:44:28 -0400270 ACPI_MOVE_32_TO_32(&output_struct->data.memory32.max_base_address,
271 buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272 buffer += 4;
273
Robert Moore44f6c012005-04-18 22:49:35 -0400274 /* Get Alignment (Bytes 12-15) */
275
Len Brown4be44fc2005-08-05 00:44:28 -0400276 ACPI_MOVE_32_TO_32(&output_struct->data.memory32.alignment, buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277 buffer += 4;
278
Robert Moore44f6c012005-04-18 22:49:35 -0400279 /* Get range_length (Bytes 16-19) */
280
Len Brown4be44fc2005-08-05 00:44:28 -0400281 ACPI_MOVE_32_TO_32(&output_struct->data.memory32.range_length, buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282
Robert Moore44f6c012005-04-18 22:49:35 -0400283 /* Set the Length parameter */
284
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285 output_struct->length = (u32) struct_size;
286
Robert Moore44f6c012005-04-18 22:49:35 -0400287 /* Return the final size of the structure */
288
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289 *structure_size = struct_size;
Len Brown4be44fc2005-08-05 00:44:28 -0400290 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291}
292
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293/*******************************************************************************
294 *
295 * FUNCTION: acpi_rs_fixed_memory32_resource
296 *
297 * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
298 * stream
299 * bytes_consumed - Pointer to where the number of bytes
300 * consumed the byte_stream_buffer is
301 * returned
302 * output_buffer - Pointer to the return data buffer
303 * structure_size - Pointer to where the number of bytes
304 * in the return data struct is returned
305 *
306 * RETURN: Status
307 *
308 * DESCRIPTION: Take the resource byte stream and fill out the appropriate
309 * structure pointed to by the output_buffer. Return the
310 * number of bytes consumed from the byte stream.
311 *
312 ******************************************************************************/
313
314acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400315acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
316 acpi_size * bytes_consumed,
317 u8 ** output_buffer, acpi_size * structure_size)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318{
Len Brown4be44fc2005-08-05 00:44:28 -0400319 u8 *buffer = byte_stream_buffer;
320 struct acpi_resource *output_struct = (void *)*output_buffer;
321 u16 temp16 = 0;
322 u8 temp8 = 0;
323 acpi_size struct_size =
324 ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700325
Len Brown4be44fc2005-08-05 00:44:28 -0400326 ACPI_FUNCTION_TRACE("rs_fixed_memory32_resource");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327
Robert Moore44f6c012005-04-18 22:49:35 -0400328 /* Point past the Descriptor to get the number of bytes consumed */
329
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330 buffer += 1;
Len Brown4be44fc2005-08-05 00:44:28 -0400331 ACPI_MOVE_16_TO_16(&temp16, buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332
333 buffer += 2;
334 *bytes_consumed = (acpi_size) temp16 + 3;
Robert Moorebda663d2005-09-16 16:51:15 -0400335 output_struct->type = ACPI_RSTYPE_FIXED_MEM32;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336
Robert Moore44f6c012005-04-18 22:49:35 -0400337 /* Check Byte 3 the Read/Write bit */
338
Linus Torvalds1da177e2005-04-16 15:20:36 -0700339 temp8 = *buffer;
340 buffer += 1;
341 output_struct->data.fixed_memory32.read_write_attribute = temp8 & 0x01;
342
Robert Moore44f6c012005-04-18 22:49:35 -0400343 /* Get range_base_address (Bytes 4-7) */
344
Len Brown4be44fc2005-08-05 00:44:28 -0400345 ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.
346 range_base_address, buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347 buffer += 4;
348
Robert Moore44f6c012005-04-18 22:49:35 -0400349 /* Get range_length (Bytes 8-11) */
350
Len Brown4be44fc2005-08-05 00:44:28 -0400351 ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.range_length,
352 buffer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700353
Robert Moore44f6c012005-04-18 22:49:35 -0400354 /* Set the Length parameter */
355
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356 output_struct->length = (u32) struct_size;
357
Robert Moore44f6c012005-04-18 22:49:35 -0400358 /* Return the final size of the structure */
359
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360 *structure_size = struct_size;
Len Brown4be44fc2005-08-05 00:44:28 -0400361 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362}
363
Linus Torvalds1da177e2005-04-16 15:20:36 -0700364/*******************************************************************************
365 *
366 * FUNCTION: acpi_rs_memory32_range_stream
367 *
Robert Moorebda663d2005-09-16 16:51:15 -0400368 * PARAMETERS: Resource - Pointer to the resource linked list
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369 * output_buffer - Pointer to the user's return buffer
370 * bytes_consumed - Pointer to where the number of bytes
371 * used in the output_buffer is returned
372 *
373 * RETURN: Status
374 *
375 * DESCRIPTION: Take the linked list resource structure and fills in the
376 * the appropriate bytes in a byte stream
377 *
378 ******************************************************************************/
379
380acpi_status
Robert Moorebda663d2005-09-16 16:51:15 -0400381acpi_rs_memory32_range_stream(struct acpi_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400382 u8 ** output_buffer, acpi_size * bytes_consumed)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383{
Len Brown4be44fc2005-08-05 00:44:28 -0400384 u8 *buffer = *output_buffer;
385 u16 temp16 = 0;
386 u8 temp8 = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387
Len Brown4be44fc2005-08-05 00:44:28 -0400388 ACPI_FUNCTION_TRACE("rs_memory32_range_stream");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389
Robert Moorebda663d2005-09-16 16:51:15 -0400390 /* The Descriptor Type field is static */
Robert Moore44f6c012005-04-18 22:49:35 -0400391
Robert Moorebda663d2005-09-16 16:51:15 -0400392 *buffer = ACPI_RDESC_TYPE_MEMORY_32;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393 buffer += 1;
394
Robert Moore44f6c012005-04-18 22:49:35 -0400395 /* The length field is static */
396
Linus Torvalds1da177e2005-04-16 15:20:36 -0700397 temp16 = 0x11;
398
Len Brown4be44fc2005-08-05 00:44:28 -0400399 ACPI_MOVE_16_TO_16(buffer, &temp16);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400 buffer += 2;
401
Robert Moore44f6c012005-04-18 22:49:35 -0400402 /* Set the Information Byte */
403
Robert Moorebda663d2005-09-16 16:51:15 -0400404 temp8 = (u8) (resource->data.memory32.read_write_attribute & 0x01);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 *buffer = temp8;
406 buffer += 1;
407
Robert Moore44f6c012005-04-18 22:49:35 -0400408 /* Set the Range minimum base address */
409
Robert Moorebda663d2005-09-16 16:51:15 -0400410 ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.min_base_address);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411 buffer += 4;
412
Robert Moore44f6c012005-04-18 22:49:35 -0400413 /* Set the Range maximum base address */
414
Robert Moorebda663d2005-09-16 16:51:15 -0400415 ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.max_base_address);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416 buffer += 4;
417
Robert Moore44f6c012005-04-18 22:49:35 -0400418 /* Set the base alignment */
419
Robert Moorebda663d2005-09-16 16:51:15 -0400420 ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.alignment);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421 buffer += 4;
422
Robert Moore44f6c012005-04-18 22:49:35 -0400423 /* Set the range length */
424
Robert Moorebda663d2005-09-16 16:51:15 -0400425 ACPI_MOVE_32_TO_32(buffer, &resource->data.memory32.range_length);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426 buffer += 4;
427
Robert Moore44f6c012005-04-18 22:49:35 -0400428 /* Return the number of bytes consumed in this operation */
429
Len Brown4be44fc2005-08-05 00:44:28 -0400430 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
431 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432}
433
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434/*******************************************************************************
435 *
436 * FUNCTION: acpi_rs_fixed_memory32_stream
437 *
Robert Moorebda663d2005-09-16 16:51:15 -0400438 * PARAMETERS: Resource - Pointer to the resource linked list
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439 * output_buffer - Pointer to the user's return buffer
440 * bytes_consumed - Pointer to where the number of bytes
441 * used in the output_buffer is returned
442 *
443 * RETURN: Status
444 *
445 * DESCRIPTION: Take the linked list resource structure and fills in the
446 * the appropriate bytes in a byte stream
447 *
448 ******************************************************************************/
449
450acpi_status
Robert Moorebda663d2005-09-16 16:51:15 -0400451acpi_rs_fixed_memory32_stream(struct acpi_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400452 u8 ** output_buffer, acpi_size * bytes_consumed)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700453{
Len Brown4be44fc2005-08-05 00:44:28 -0400454 u8 *buffer = *output_buffer;
455 u16 temp16 = 0;
456 u8 temp8 = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457
Len Brown4be44fc2005-08-05 00:44:28 -0400458 ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459
Robert Moorebda663d2005-09-16 16:51:15 -0400460 /* The Descriptor Type field is static */
Robert Moore44f6c012005-04-18 22:49:35 -0400461
Robert Moorebda663d2005-09-16 16:51:15 -0400462 *buffer = ACPI_RDESC_TYPE_FIXED_MEMORY_32;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463 buffer += 1;
464
Robert Moore44f6c012005-04-18 22:49:35 -0400465 /* The length field is static */
466
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467 temp16 = 0x09;
468
Len Brown4be44fc2005-08-05 00:44:28 -0400469 ACPI_MOVE_16_TO_16(buffer, &temp16);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470 buffer += 2;
471
Robert Moore44f6c012005-04-18 22:49:35 -0400472 /* Set the Information Byte */
473
Len Brown4be44fc2005-08-05 00:44:28 -0400474 temp8 =
Robert Moorebda663d2005-09-16 16:51:15 -0400475 (u8) (resource->data.fixed_memory32.read_write_attribute & 0x01);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 *buffer = temp8;
477 buffer += 1;
478
Robert Moore44f6c012005-04-18 22:49:35 -0400479 /* Set the Range base address */
480
Len Brown4be44fc2005-08-05 00:44:28 -0400481 ACPI_MOVE_32_TO_32(buffer,
Robert Moorebda663d2005-09-16 16:51:15 -0400482 &resource->data.fixed_memory32.range_base_address);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 buffer += 4;
484
Robert Moore44f6c012005-04-18 22:49:35 -0400485 /* Set the range length */
486
Robert Moorebda663d2005-09-16 16:51:15 -0400487 ACPI_MOVE_32_TO_32(buffer, &resource->data.fixed_memory32.range_length);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488 buffer += 4;
489
Robert Moore44f6c012005-04-18 22:49:35 -0400490 /* Return the number of bytes consumed in this operation */
491
Len Brown4be44fc2005-08-05 00:44:28 -0400492 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
493 return_ACPI_STATUS(AE_OK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494}