patch-2.4.22 linux-2.4.22/drivers/acpi/resources/rsaddr.c
Next file: linux-2.4.22/drivers/acpi/resources/rscalc.c
Previous file: linux-2.4.22/drivers/acpi/resources/Makefile
Back to the patch index
Back to the overall index
- Lines: 1170
- Date:
2003-08-25 04:44:41.000000000 -0700
- Orig file:
linux-2.4.21/drivers/acpi/resources/rsaddr.c
- Orig date:
2001-09-23 09:42:32.000000000 -0700
diff -urN linux-2.4.21/drivers/acpi/resources/rsaddr.c linux-2.4.22/drivers/acpi/resources/rsaddr.c
@@ -1,81 +1,98 @@
/*******************************************************************************
*
* Module Name: rsaddr - Address resource descriptors (16/32/64)
- * $Revision: 19 $
*
******************************************************************************/
/*
- * Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
*/
-#include "acpi.h"
-#include "acresrc.h"
+#include <acpi/acpi.h>
+#include <acpi/acresrc.h>
#define _COMPONENT ACPI_RESOURCES
- MODULE_NAME ("rsaddr")
+ ACPI_MODULE_NAME ("rsaddr")
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_address16_resource
+ * FUNCTION: acpi_rs_address16_resource
*
- * PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
+ * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * bytes_consumed - Pointer to where the number of bytes
+ * consumed the byte_stream_buffer is
+ * returned
+ * output_buffer - Pointer to the return data buffer
+ * structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
* DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the Output_buffer. Return the
+ * structure pointed to by the output_buffer. Return the
* number of bytes consumed from the byte stream.
*
******************************************************************************/
acpi_status
acpi_rs_address16_resource (
- u8 *byte_stream_buffer,
- u32 *bytes_consumed,
- u8 **output_buffer,
- u32 *structure_size)
+ u8 *byte_stream_buffer,
+ acpi_size *bytes_consumed,
+ u8 **output_buffer,
+ acpi_size *structure_size)
{
- u8 *buffer = byte_stream_buffer;
- acpi_resource *output_struct = (acpi_resource *) *output_buffer;
- NATIVE_CHAR *temp_ptr;
- u32 struct_size = SIZEOF_RESOURCE (acpi_resource_address16);
- u32 index;
- u16 temp16;
- u8 temp8;
+ u8 *buffer = byte_stream_buffer;
+ struct acpi_resource *output_struct = (void *) *output_buffer;
+ u8 *temp_ptr;
+ acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16);
+ u32 index;
+ u16 temp16;
+ u8 temp8;
- FUNCTION_TRACE ("Rs_address16_resource");
+ ACPI_FUNCTION_TRACE ("rs_address16_resource");
/*
* Point past the Descriptor to get the number of bytes consumed
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_16_TO_16 (&temp16, buffer);
*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS16;
@@ -87,6 +104,7 @@
temp8 = *buffer;
/* Values 0-2 are valid */
+
if (temp8 > 2) {
return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
}
@@ -99,24 +117,20 @@
buffer += 1;
temp8 = *buffer;
- /*
- * Producer / Consumer
- */
+ /* Producer / Consumer */
+
output_struct->data.address16.producer_consumer = temp8 & 0x01;
- /*
- * Decode
- */
+ /* Decode */
+
output_struct->data.address16.decode = (temp8 >> 1) & 0x01;
- /*
- * Min Address Fixed
- */
+ /* Min Address Fixed */
+
output_struct->data.address16.min_address_fixed = (temp8 >> 2) & 0x01;
- /*
- * Max Address Fixed
- */
+ /* Max Address Fixed */
+
output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01;
/*
@@ -125,21 +139,21 @@
buffer += 1;
temp8 = *buffer;
- if (MEMORY_RANGE == output_struct->data.address16.resource_type) {
+ if (ACPI_MEMORY_RANGE == output_struct->data.address16.resource_type) {
output_struct->data.address16.attribute.memory.read_write_attribute =
(u16) (temp8 & 0x01);
output_struct->data.address16.attribute.memory.cache_attribute =
(u16) ((temp8 >> 1) & 0x0F);
}
-
else {
- if (IO_RANGE == output_struct->data.address16.resource_type) {
+ if (ACPI_IO_RANGE == output_struct->data.address16.resource_type) {
output_struct->data.address16.attribute.io.range_attribute =
(u16) (temp8 & 0x03);
+ output_struct->data.address16.attribute.io.translation_attribute =
+ (u16) ((temp8 >> 4) & 0x03);
}
-
else {
- /* BUS_NUMBER_RANGE == Address16.Data->Resource_type */
+ /* BUS_NUMBER_RANGE == Address16.Data->resource_type */
/* Nothing needs to be filled in */
}
}
@@ -148,36 +162,31 @@
* Get Granularity (Bytes 6-7)
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.granularity,
- buffer);
+ ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer);
/*
- * Get Min_address_range (Bytes 8-9)
+ * Get min_address_range (Bytes 8-9)
*/
buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.min_address_range,
- buffer);
+ ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer);
/*
- * Get Max_address_range (Bytes 10-11)
+ * Get max_address_range (Bytes 10-11)
*/
buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.max_address_range,
- buffer);
+ ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer);
/*
- * Get Address_translation_offset (Bytes 12-13)
+ * Get address_translation_offset (Bytes 12-13)
*/
buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.address_translation_offset,
- buffer);
+ ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, buffer);
/*
- * Get Address_length (Bytes 14-15)
+ * Get address_length (Bytes 14-15)
*/
buffer += 2;
- MOVE_UNALIGNED16_TO_16 (&output_struct->data.address16.address_length,
- buffer);
+ ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer);
/*
* Resource Source Index (if present)
@@ -204,9 +213,9 @@
/* Point the String pointer to the end of this structure */
output_struct->data.address16.resource_source.string_ptr =
- (NATIVE_CHAR *)((u8 * )output_struct + struct_size);
+ (char *)((u8 * )output_struct + struct_size);
- temp_ptr = output_struct->data.address16.resource_source.string_ptr;
+ temp_ptr = (u8 *) output_struct->data.address16.resource_source.string_ptr;
/* Copy the string into the buffer */
@@ -228,14 +237,13 @@
output_struct->data.address16.resource_source.string_length = index + 1;
/*
- * In order for the Struct_size to fall on a 32-bit boundary,
+ * In order for the struct_size to fall on a 32-bit boundary,
* calculate the length of the string and expand the
- * Struct_size to the next 32-bit boundary.
+ * struct_size to the next 32-bit boundary.
*/
temp8 = (u8) (index + 1);
- struct_size += ROUND_UP_TO_32_bITS (temp8);
+ struct_size += ACPI_ROUND_UP_to_32_bITS (temp8);
}
-
else {
output_struct->data.address16.resource_source.index = 0x00;
output_struct->data.address16.resource_source.string_length = 0;
@@ -245,7 +253,7 @@
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
@@ -257,13 +265,12 @@
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_address16_stream
+ * FUNCTION: acpi_rs_address16_stream
*
- * PARAMETERS: Linked_list - Pointer to the resource linked list
- * Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * PARAMETERS: linked_list - Pointer to the resource linked list
+ * output_buffer - Pointer to the user's return buffer
+ * bytes_consumed - Pointer to where the number of bytes
+ * used in the output_buffer is returned
*
* RETURN: Status
*
@@ -274,18 +281,18 @@
acpi_status
acpi_rs_address16_stream (
- acpi_resource *linked_list,
- u8 **output_buffer,
- u32 *bytes_consumed)
+ struct acpi_resource *linked_list,
+ u8 **output_buffer,
+ acpi_size *bytes_consumed)
{
- u8 *buffer = *output_buffer;
- u8 *length_field;
- u8 temp8;
- NATIVE_CHAR *temp_pointer = NULL;
- u32 actual_bytes;
+ u8 *buffer = *output_buffer;
+ u8 *length_field;
+ u8 temp8;
+ char *temp_pointer = NULL;
+ acpi_size actual_bytes;
- FUNCTION_TRACE ("Rs_address16_stream");
+ ACPI_FUNCTION_TRACE ("rs_address16_stream");
/*
@@ -301,7 +308,7 @@
buffer += 2;
/*
- * Set the Resource Type (Memory, Io, Bus_number)
+ * Set the Resource Type (Memory, Io, bus_number)
*/
temp8 = (u8) (linked_list->data.address16.resource_type & 0x03);
*buffer = temp8;
@@ -324,7 +331,7 @@
*/
temp8 = 0;
- if (MEMORY_RANGE == linked_list->data.address16.resource_type) {
+ if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) {
temp8 = (u8)
(linked_list->data.address16.attribute.memory.read_write_attribute &
0x01);
@@ -333,11 +340,13 @@
(linked_list->data.address16.attribute.memory.cache_attribute &
0x0F) << 1;
}
-
- else if (IO_RANGE == linked_list->data.address16.resource_type) {
+ else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) {
temp8 = (u8)
(linked_list->data.address16.attribute.io.range_attribute &
0x03);
+ temp8 |=
+ (linked_list->data.address16.attribute.io.translation_attribute &
+ 0x03) << 4;
}
*buffer = temp8;
@@ -346,36 +355,31 @@
/*
* Set the address space granularity
*/
- MOVE_UNALIGNED16_TO_16 (buffer,
- &linked_list->data.address16.granularity);
+ ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity);
buffer += 2;
/*
* Set the address range minimum
*/
- MOVE_UNALIGNED16_TO_16 (buffer,
- &linked_list->data.address16.min_address_range);
+ ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range);
buffer += 2;
/*
* Set the address range maximum
*/
- MOVE_UNALIGNED16_TO_16 (buffer,
- &linked_list->data.address16.max_address_range);
+ ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range);
buffer += 2;
/*
* Set the address translation offset
*/
- MOVE_UNALIGNED16_TO_16 (buffer,
- &linked_list->data.address16.address_translation_offset);
+ ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_translation_offset);
buffer += 2;
/*
* Set the address length
*/
- MOVE_UNALIGNED16_TO_16 (buffer,
- &linked_list->data.address16.address_length);
+ ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length);
buffer += 2;
/*
@@ -387,26 +391,25 @@
*buffer = temp8;
buffer += 1;
- temp_pointer = (NATIVE_CHAR *) buffer;
+ temp_pointer = (char *) buffer;
/*
* Copy the string
*/
- STRCPY (temp_pointer,
+ ACPI_STRCPY (temp_pointer,
linked_list->data.address16.resource_source.string_ptr);
/*
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- buffer += (STRLEN (linked_list->data.address16.resource_source.string_ptr)
- + 1);
+ buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address16.resource_source.string_ptr) + 1);
}
/*
* Return the number of bytes consumed in this operation
*/
- actual_bytes = POINTER_DIFF (buffer, *output_buffer);
+ actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer);
*bytes_consumed = actual_bytes;
/*
@@ -414,63 +417,59 @@
* minus the header size (3 bytes)
*/
actual_bytes -= 3;
- MOVE_UNALIGNED16_TO_16 (length_field, &actual_bytes);
+ ACPI_MOVE_SIZE_TO_16 (length_field, &actual_bytes);
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_address32_resource
+ * FUNCTION: acpi_rs_address32_resource
*
- * PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
+ * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * bytes_consumed - Pointer to where the number of bytes
+ * consumed the byte_stream_buffer is
+ * returned
+ * output_buffer - Pointer to the return data buffer
+ * structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
* DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the Output_buffer. Return the
+ * structure pointed to by the output_buffer. Return the
* number of bytes consumed from the byte stream.
*
******************************************************************************/
acpi_status
acpi_rs_address32_resource (
- u8 *byte_stream_buffer,
- u32 *bytes_consumed,
- u8 **output_buffer,
- u32 *structure_size)
+ u8 *byte_stream_buffer,
+ acpi_size *bytes_consumed,
+ u8 **output_buffer,
+ acpi_size *structure_size)
{
- u8 *buffer;
- acpi_resource *output_struct;
- u16 temp16;
- u8 temp8;
- NATIVE_CHAR *temp_ptr;
- u32 struct_size;
- u32 index;
+ u8 *buffer;
+ struct acpi_resource *output_struct= (void *) *output_buffer;
+ u16 temp16;
+ u8 temp8;
+ u8 *temp_ptr;
+ acpi_size struct_size;
+ u32 index;
- FUNCTION_TRACE ("Rs_address32_resource");
+ ACPI_FUNCTION_TRACE ("rs_address32_resource");
buffer = byte_stream_buffer;
- output_struct = (acpi_resource *) *output_buffer;
-
- struct_size = SIZEOF_RESOURCE (acpi_resource_address32);
+ struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32);
/*
* Point past the Descriptor to get the number of bytes consumed
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
-
+ ACPI_MOVE_16_TO_16 (&temp16, buffer);
*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS32;
@@ -520,22 +519,22 @@
buffer += 1;
temp8 = *buffer;
- if (MEMORY_RANGE == output_struct->data.address32.resource_type) {
+ if (ACPI_MEMORY_RANGE == output_struct->data.address32.resource_type) {
output_struct->data.address32.attribute.memory.read_write_attribute =
(u16) (temp8 & 0x01);
output_struct->data.address32.attribute.memory.cache_attribute =
(u16) ((temp8 >> 1) & 0x0F);
}
-
else {
- if (IO_RANGE == output_struct->data.address32.resource_type) {
+ if (ACPI_IO_RANGE == output_struct->data.address32.resource_type) {
output_struct->data.address32.attribute.io.range_attribute =
(u16) (temp8 & 0x03);
+ output_struct->data.address32.attribute.io.translation_attribute =
+ (u16) ((temp8 >> 4) & 0x03);
}
-
else {
- /* BUS_NUMBER_RANGE == Output_struct->Data.Address32.Resource_type */
+ /* BUS_NUMBER_RANGE == output_struct->Data.Address32.resource_type */
/* Nothing needs to be filled in */
}
}
@@ -544,36 +543,31 @@
* Get Granularity (Bytes 6-9)
*/
buffer += 1;
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.granularity,
- buffer);
+ ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer);
/*
- * Get Min_address_range (Bytes 10-13)
+ * Get min_address_range (Bytes 10-13)
*/
buffer += 4;
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.min_address_range,
- buffer);
+ ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer);
/*
- * Get Max_address_range (Bytes 14-17)
+ * Get max_address_range (Bytes 14-17)
*/
buffer += 4;
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.max_address_range,
- buffer);
+ ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer);
/*
- * Get Address_translation_offset (Bytes 18-21)
+ * Get address_translation_offset (Bytes 18-21)
*/
buffer += 4;
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.address_translation_offset,
- buffer);
+ ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, buffer);
/*
- * Get Address_length (Bytes 22-25)
+ * Get address_length (Bytes 22-25)
*/
buffer += 4;
- MOVE_UNALIGNED32_TO_32 (&output_struct->data.address32.address_length,
- buffer);
+ ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer);
/*
* Resource Source Index (if present)
@@ -599,14 +593,13 @@
/* Point the String pointer to the end of this structure */
output_struct->data.address32.resource_source.string_ptr =
- (NATIVE_CHAR *)((u8 *)output_struct + struct_size);
+ (char *)((u8 *)output_struct + struct_size);
- temp_ptr = output_struct->data.address32.resource_source.string_ptr;
+ temp_ptr = (u8 *) output_struct->data.address32.resource_source.string_ptr;
/* Copy the string into the buffer */
index = 0;
-
while (0x00 != *buffer) {
*temp_ptr = *buffer;
@@ -622,14 +615,13 @@
output_struct->data.address32.resource_source.string_length = index + 1;
/*
- * In order for the Struct_size to fall on a 32-bit boundary,
+ * In order for the struct_size to fall on a 32-bit boundary,
* calculate the length of the string and expand the
- * Struct_size to the next 32-bit boundary.
+ * struct_size to the next 32-bit boundary.
*/
temp8 = (u8) (index + 1);
- struct_size += ROUND_UP_TO_32_bITS (temp8);
+ struct_size += ACPI_ROUND_UP_to_32_bITS (temp8);
}
-
else {
output_struct->data.address32.resource_source.index = 0x00;
output_struct->data.address32.resource_source.string_length = 0;
@@ -639,7 +631,7 @@
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
@@ -651,13 +643,12 @@
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_address32_stream
+ * FUNCTION: acpi_rs_address32_stream
*
- * PARAMETERS: Linked_list - Pointer to the resource linked list
- * Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * PARAMETERS: linked_list - Pointer to the resource linked list
+ * output_buffer - Pointer to the user's return buffer
+ * bytes_consumed - Pointer to where the number of bytes
+ * used in the output_buffer is returned
*
* RETURN: Status
*
@@ -668,17 +659,17 @@
acpi_status
acpi_rs_address32_stream (
- acpi_resource *linked_list,
- u8 **output_buffer,
- u32 *bytes_consumed)
+ struct acpi_resource *linked_list,
+ u8 **output_buffer,
+ acpi_size *bytes_consumed)
{
- u8 *buffer;
- u16 *length_field;
- u8 temp8;
- NATIVE_CHAR *temp_pointer;
+ u8 *buffer;
+ u16 *length_field;
+ u8 temp8;
+ char *temp_pointer;
- FUNCTION_TRACE ("Rs_address32_stream");
+ ACPI_FUNCTION_TRACE ("rs_address32_stream");
buffer = *output_buffer;
@@ -692,12 +683,11 @@
/*
* Set a pointer to the Length field - to be filled in later
*/
-
- length_field = (u16 *) buffer;
+ length_field = ACPI_CAST_PTR (u16, buffer);
buffer += 2;
/*
- * Set the Resource Type (Memory, Io, Bus_number)
+ * Set the Resource Type (Memory, Io, bus_number)
*/
temp8 = (u8) (linked_list->data.address32.resource_type & 0x03);
@@ -720,7 +710,7 @@
*/
temp8 = 0;
- if(MEMORY_RANGE == linked_list->data.address32.resource_type) {
+ if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) {
temp8 = (u8)
(linked_list->data.address32.attribute.memory.read_write_attribute &
0x01);
@@ -729,11 +719,13 @@
(linked_list->data.address32.attribute.memory.cache_attribute &
0x0F) << 1;
}
-
- else if (IO_RANGE == linked_list->data.address32.resource_type) {
+ else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) {
temp8 = (u8)
(linked_list->data.address32.attribute.io.range_attribute &
0x03);
+ temp8 |=
+ (linked_list->data.address32.attribute.io.translation_attribute &
+ 0x03) << 4;
}
*buffer = temp8;
@@ -742,36 +734,31 @@
/*
* Set the address space granularity
*/
- MOVE_UNALIGNED32_TO_32 (buffer,
- &linked_list->data.address32.granularity);
+ ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity);
buffer += 4;
/*
* Set the address range minimum
*/
- MOVE_UNALIGNED32_TO_32 (buffer,
- &linked_list->data.address32.min_address_range);
+ ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range);
buffer += 4;
/*
* Set the address range maximum
*/
- MOVE_UNALIGNED32_TO_32 (buffer,
- &linked_list->data.address32.max_address_range);
+ ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range);
buffer += 4;
/*
* Set the address translation offset
*/
- MOVE_UNALIGNED32_TO_32 (buffer,
- &linked_list->data.address32.address_translation_offset);
+ ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_translation_offset);
buffer += 4;
/*
* Set the address length
*/
- MOVE_UNALIGNED32_TO_32 (buffer,
- &linked_list->data.address32.address_length);
+ ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length);
buffer += 4;
/*
@@ -783,25 +770,25 @@
*buffer = temp8;
buffer += 1;
- temp_pointer = (NATIVE_CHAR *) buffer;
+ temp_pointer = (char *) buffer;
/*
* Copy the string
*/
- STRCPY (temp_pointer,
+ ACPI_STRCPY (temp_pointer,
linked_list->data.address32.resource_source.string_ptr);
/*
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- buffer += (STRLEN (linked_list->data.address32.resource_source.string_ptr) + 1);
+ buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address32.resource_source.string_ptr) + 1);
}
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
/*
* Set the length field to the number of bytes consumed
@@ -814,55 +801,52 @@
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_address64_resource
+ * FUNCTION: acpi_rs_address64_resource
*
- * PARAMETERS: Byte_stream_buffer - Pointer to the resource input byte
+ * PARAMETERS: byte_stream_buffer - Pointer to the resource input byte
* stream
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes consumed from
- * the Byte_stream_buffer
- * Output_buffer - Pointer to the user's return buffer
- * Structure_size - u32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * bytes_consumed - Pointer to where the number of bytes
+ * consumed the byte_stream_buffer is
+ * returned
+ * output_buffer - Pointer to the return data buffer
+ * structure_size - Pointer to where the number of bytes
+ * in the return data struct is returned
*
* RETURN: Status
*
* DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the Output_buffer. Return the
+ * structure pointed to by the output_buffer. Return the
* number of bytes consumed from the byte stream.
*
******************************************************************************/
acpi_status
acpi_rs_address64_resource (
- u8 *byte_stream_buffer,
- u32 *bytes_consumed,
- u8 **output_buffer,
- u32 *structure_size)
+ u8 *byte_stream_buffer,
+ acpi_size *bytes_consumed,
+ u8 **output_buffer,
+ acpi_size *structure_size)
{
- u8 *buffer;
- acpi_resource *output_struct;
- u16 temp16;
- u8 temp8;
- NATIVE_CHAR *temp_ptr;
- u32 struct_size;
- u32 index;
+ u8 *buffer;
+ struct acpi_resource *output_struct = (void *) *output_buffer;
+ u16 temp16;
+ u8 temp8;
+ u8 *temp_ptr;
+ acpi_size struct_size;
+ u32 index;
- FUNCTION_TRACE ("Rs_address64_resource");
+ ACPI_FUNCTION_TRACE ("rs_address64_resource");
buffer = byte_stream_buffer;
- output_struct = (acpi_resource *) *output_buffer;
-
- struct_size = SIZEOF_RESOURCE (acpi_resource_address64);
+ struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64);
/*
* Point past the Descriptor to get the number of bytes consumed
*/
buffer += 1;
- MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
+ ACPI_MOVE_16_TO_16 (&temp16, buffer);
*bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS64;
@@ -874,6 +858,7 @@
temp8 = *buffer;
/* Values 0-2 are valid */
+
if(temp8 > 2) {
return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
}
@@ -912,22 +897,22 @@
buffer += 1;
temp8 = *buffer;
- if (MEMORY_RANGE == output_struct->data.address64.resource_type) {
+ if (ACPI_MEMORY_RANGE == output_struct->data.address64.resource_type) {
output_struct->data.address64.attribute.memory.read_write_attribute =
(u16) (temp8 & 0x01);
output_struct->data.address64.attribute.memory.cache_attribute =
(u16) ((temp8 >> 1) & 0x0F);
}
-
else {
- if (IO_RANGE == output_struct->data.address64.resource_type) {
+ if (ACPI_IO_RANGE == output_struct->data.address64.resource_type) {
output_struct->data.address64.attribute.io.range_attribute =
(u16) (temp8 & 0x03);
+ output_struct->data.address64.attribute.io.translation_attribute =
+ (u16) ((temp8 >> 4) & 0x03);
}
-
else {
- /* BUS_NUMBER_RANGE == Output_struct->Data.Address64.Resource_type */
+ /* BUS_NUMBER_RANGE == output_struct->Data.Address64.resource_type */
/* Nothing needs to be filled in */
}
}
@@ -936,36 +921,31 @@
* Get Granularity (Bytes 6-13)
*/
buffer += 1;
- MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.granularity,
- buffer);
+ ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer);
/*
- * Get Min_address_range (Bytes 14-21)
+ * Get min_address_range (Bytes 14-21)
*/
buffer += 8;
- MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.min_address_range,
- buffer);
+ ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer);
/*
- * Get Max_address_range (Bytes 22-29)
+ * Get max_address_range (Bytes 22-29)
*/
buffer += 8;
- MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.max_address_range,
- buffer);
+ ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer);
/*
- * Get Address_translation_offset (Bytes 30-37)
+ * Get address_translation_offset (Bytes 30-37)
*/
buffer += 8;
- MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.address_translation_offset,
- buffer);
+ ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, buffer);
/*
- * Get Address_length (Bytes 38-45)
+ * Get address_length (Bytes 38-45)
*/
buffer += 8;
- MOVE_UNALIGNED64_TO_64 (&output_struct->data.address64.address_length,
- buffer);
+ ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer);
/*
* Resource Source Index (if present)
@@ -993,14 +973,13 @@
/* Point the String pointer to the end of this structure */
output_struct->data.address64.resource_source.string_ptr =
- (NATIVE_CHAR *)((u8 *)output_struct + struct_size);
+ (char *)((u8 *)output_struct + struct_size);
- temp_ptr = output_struct->data.address64.resource_source.string_ptr;
+ temp_ptr = (u8 *) output_struct->data.address64.resource_source.string_ptr;
/* Copy the string into the buffer */
index = 0;
-
while (0x00 != *buffer) {
*temp_ptr = *buffer;
@@ -1017,14 +996,13 @@
output_struct->data.address64.resource_source.string_length = index + 1;
/*
- * In order for the Struct_size to fall on a 32-bit boundary,
+ * In order for the struct_size to fall on a 32-bit boundary,
* calculate the length of the string and expand the
- * Struct_size to the next 32-bit boundary.
+ * struct_size to the next 32-bit boundary.
*/
temp8 = (u8) (index + 1);
- struct_size += ROUND_UP_TO_32_bITS (temp8);
+ struct_size += ACPI_ROUND_UP_to_32_bITS (temp8);
}
-
else {
output_struct->data.address64.resource_source.index = 0x00;
output_struct->data.address64.resource_source.string_length = 0;
@@ -1034,7 +1012,7 @@
/*
* Set the Length parameter
*/
- output_struct->length = struct_size;
+ output_struct->length = (u32) struct_size;
/*
* Return the final size of the structure
@@ -1046,13 +1024,12 @@
/*******************************************************************************
*
- * FUNCTION: Acpi_rs_address64_stream
+ * FUNCTION: acpi_rs_address64_stream
*
- * PARAMETERS: Linked_list - Pointer to the resource linked list
- * Output_buffer - Pointer to the user's return buffer
- * Bytes_consumed - u32 pointer that is filled with
- * the number of bytes of the
- * Output_buffer used
+ * PARAMETERS: linked_list - Pointer to the resource linked list
+ * output_buffer - Pointer to the user's return buffer
+ * bytes_consumed - Pointer to where the number of bytes
+ * used in the output_buffer is returned
*
* RETURN: Status
*
@@ -1063,17 +1040,17 @@
acpi_status
acpi_rs_address64_stream (
- acpi_resource *linked_list,
- u8 **output_buffer,
- u32 *bytes_consumed)
+ struct acpi_resource *linked_list,
+ u8 **output_buffer,
+ acpi_size *bytes_consumed)
{
- u8 *buffer;
- u16 *length_field;
- u8 temp8;
- NATIVE_CHAR *temp_pointer;
+ u8 *buffer;
+ u16 *length_field;
+ u8 temp8;
+ char *temp_pointer;
- FUNCTION_TRACE ("Rs_address64_stream");
+ ACPI_FUNCTION_TRACE ("rs_address64_stream");
buffer = *output_buffer;
@@ -1088,11 +1065,11 @@
* Set a pointer to the Length field - to be filled in later
*/
- length_field = (u16 *)buffer;
+ length_field = ACPI_CAST_PTR (u16, buffer);
buffer += 2;
/*
- * Set the Resource Type (Memory, Io, Bus_number)
+ * Set the Resource Type (Memory, Io, bus_number)
*/
temp8 = (u8) (linked_list->data.address64.resource_type & 0x03);
@@ -1115,7 +1092,7 @@
*/
temp8 = 0;
- if(MEMORY_RANGE == linked_list->data.address64.resource_type) {
+ if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) {
temp8 = (u8)
(linked_list->data.address64.attribute.memory.read_write_attribute &
0x01);
@@ -1124,11 +1101,13 @@
(linked_list->data.address64.attribute.memory.cache_attribute &
0x0F) << 1;
}
-
- else if (IO_RANGE == linked_list->data.address64.resource_type) {
+ else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) {
temp8 = (u8)
(linked_list->data.address64.attribute.io.range_attribute &
0x03);
+ temp8 |=
+ (linked_list->data.address64.attribute.io.range_attribute &
+ 0x03) << 4;
}
*buffer = temp8;
@@ -1137,36 +1116,31 @@
/*
* Set the address space granularity
*/
- MOVE_UNALIGNED64_TO_64 (buffer,
- &linked_list->data.address64.granularity);
+ ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity);
buffer += 8;
/*
* Set the address range minimum
*/
- MOVE_UNALIGNED64_TO_64 (buffer,
- &linked_list->data.address64.min_address_range);
+ ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range);
buffer += 8;
/*
* Set the address range maximum
*/
- MOVE_UNALIGNED64_TO_64 (buffer,
- &linked_list->data.address64.max_address_range);
+ ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range);
buffer += 8;
/*
* Set the address translation offset
*/
- MOVE_UNALIGNED64_TO_64 (buffer,
- &linked_list->data.address64.address_translation_offset);
+ ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_translation_offset);
buffer += 8;
/*
* Set the address length
*/
- MOVE_UNALIGNED64_TO_64 (buffer,
- &linked_list->data.address64.address_length);
+ ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length);
buffer += 8;
/*
@@ -1178,24 +1152,24 @@
*buffer = temp8;
buffer += 1;
- temp_pointer = (NATIVE_CHAR *) buffer;
+ temp_pointer = (char *) buffer;
/*
* Copy the string
*/
- STRCPY (temp_pointer, linked_list->data.address64.resource_source.string_ptr);
+ ACPI_STRCPY (temp_pointer, linked_list->data.address64.resource_source.string_ptr);
/*
* Buffer needs to be set to the length of the sting + one for the
* terminating null
*/
- buffer += (STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1);
+ buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1);
}
/*
* Return the number of bytes consumed in this operation
*/
- *bytes_consumed = POINTER_DIFF (buffer, *output_buffer);
+ *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
/*
* Set the length field to the number of bytes consumed
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)