summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/rsio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/rsio.c')
-rw-r--r--sys/contrib/dev/acpica/rsio.c130
1 files changed, 59 insertions, 71 deletions
diff --git a/sys/contrib/dev/acpica/rsio.c b/sys/contrib/dev/acpica/rsio.c
index 9244f58..c979585 100644
--- a/sys/contrib/dev/acpica/rsio.c
+++ b/sys/contrib/dev/acpica/rsio.c
@@ -1,12 +1,7 @@
/*******************************************************************************
*
- * Module Name: rsio - AcpiRsIoResource
- * AcpiRsFixedIoResource
- * AcpiRsIoStream
- * AcpiRsFixedIoStream
- * AcpiRsDmaResource
- * AcpiRsDmaStream
- * $Revision: 12 $
+ * Module Name: rsio - IO and DMA resource descriptors
+ * $Revision: 14 $
*
******************************************************************************/
@@ -124,7 +119,7 @@
#include "acpi.h"
#include "acresrc.h"
-#define _COMPONENT RESOURCE_MANAGER
+#define _COMPONENT ACPI_RESOURCES
MODULE_NAME ("rsio")
@@ -133,20 +128,20 @@
* FUNCTION: AcpiRsIoResource
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
+ * stream
* BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
+ * the number of bytes consumed from
+ * the ByteStreamBuffer
* OutputBuffer - Pointer to the user's return buffer
* StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * the number of bytes in the filled
+ * in structure
*
- * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN: Status
*
* DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
*
******************************************************************************/
@@ -158,21 +153,21 @@ AcpiRsIoResource (
UINT32 *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
- RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer;
+ ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
- UINT32 StructSize = sizeof (IO_RESOURCE) +
- RESOURCE_LENGTH_NO_DATA;
+ UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_IO);
FUNCTION_TRACE ("RsIoResource");
+
/*
* The number of bytes consumed are Constant
*/
*BytesConsumed = 8;
- OutputStruct->Id = Io;
+ OutputStruct->Id = ACPI_RSTYPE_IO;
/*
* Check Decode
@@ -223,7 +218,6 @@ AcpiRsIoResource (
* Return the final size of the structure
*/
*StructureSize = StructSize;
-
return_ACPI_STATUS (AE_OK);
}
@@ -233,20 +227,20 @@ AcpiRsIoResource (
* FUNCTION: AcpiRsFixedIoResource
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
+ * stream
* BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
+ * the number of bytes consumed from
+ * the ByteStreamBuffer
* OutputBuffer - Pointer to the user's return buffer
* StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * the number of bytes in the filled
+ * in structure
*
- * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN: Status
*
* DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
*
******************************************************************************/
@@ -258,21 +252,21 @@ AcpiRsFixedIoResource (
UINT32 *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
- RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer;
+ ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
UINT16 Temp16 = 0;
UINT8 Temp8 = 0;
- UINT32 StructSize = sizeof (FIXED_IO_RESOURCE) +
- RESOURCE_LENGTH_NO_DATA;
+ UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO);
FUNCTION_TRACE ("RsFixedIoResource");
+
/*
* The number of bytes consumed are Constant
*/
*BytesConsumed = 4;
- OutputStruct->Id = FixedIo;
+ OutputStruct->Id = ACPI_RSTYPE_FIXED_IO;
/*
* Check Range Base Address
@@ -299,7 +293,6 @@ AcpiRsFixedIoResource (
* Return the final size of the structure
*/
*StructureSize = StructSize;
-
return_ACPI_STATUS (AE_OK);
}
@@ -311,19 +304,19 @@ AcpiRsFixedIoResource (
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
* BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * the number of bytes of the
+ * OutputBuffer used
*
- * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN: Status
*
* DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * the appropriate bytes in a byte stream
*
******************************************************************************/
ACPI_STATUS
AcpiRsIoStream (
- RESOURCE *LinkedList,
+ ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
UINT32 *BytesConsumed)
{
@@ -334,6 +327,7 @@ AcpiRsIoStream (
FUNCTION_TRACE ("RsIoStream");
+
/*
* The descriptor field is static
*/
@@ -383,9 +377,7 @@ AcpiRsIoStream (
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer -
- (NATIVE_UINT) *OutputBuffer);
-
+ *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
@@ -397,19 +389,19 @@ AcpiRsIoStream (
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
* BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * the number of bytes of the
+ * OutputBuffer used
*
- * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN: Status
*
* DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * the appropriate bytes in a byte stream
*
******************************************************************************/
ACPI_STATUS
AcpiRsFixedIoStream (
- RESOURCE *LinkedList,
+ ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
UINT32 *BytesConsumed)
{
@@ -420,6 +412,7 @@ AcpiRsFixedIoStream (
FUNCTION_TRACE ("RsFixedIoStream");
+
/*
* The descriptor field is static
*/
@@ -446,9 +439,7 @@ AcpiRsFixedIoStream (
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer -
- (NATIVE_UINT) *OutputBuffer);
-
+ *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
@@ -458,20 +449,20 @@ AcpiRsFixedIoStream (
* FUNCTION: AcpiRsDmaResource
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
+ * stream
* BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes consumed from
- * the ByteStreamBuffer
+ * the number of bytes consumed from
+ * the ByteStreamBuffer
* OutputBuffer - Pointer to the user's return buffer
* StructureSize - UINT32 pointer that is filled with
- * the number of bytes in the filled
- * in structure
+ * the number of bytes in the filled
+ * in structure
*
- * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN: Status
*
* DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * structure pointed to by the OutputBuffer. Return the
+ * number of bytes consumed from the byte stream.
*
******************************************************************************/
@@ -483,21 +474,21 @@ AcpiRsDmaResource (
UINT32 *StructureSize)
{
UINT8 *Buffer = ByteStreamBuffer;
- RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer;
+ ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer;
UINT8 Temp8 = 0;
UINT8 Index;
UINT8 i;
- UINT32 StructSize = sizeof(DMA_RESOURCE) +
- RESOURCE_LENGTH_NO_DATA;
+ UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_DMA);
FUNCTION_TRACE ("RsDmaResource");
+
/*
* The number of bytes consumed are Constant
*/
*BytesConsumed = 3;
- OutputStruct->Id = Dma;
+ OutputStruct->Id = ACPI_RSTYPE_DMA;
/*
* Point to the 8-bits of Byte 1
@@ -558,7 +549,6 @@ AcpiRsDmaResource (
* Return the final size of the structure
*/
*StructureSize = StructSize;
-
return_ACPI_STATUS (AE_OK);
}
@@ -570,19 +560,19 @@ AcpiRsDmaResource (
* PARAMETERS: LinkedList - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's return buffer
* BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
+ * the number of bytes of the
+ * OutputBuffer used
*
- * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN: Status
*
* DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * the appropriate bytes in a byte stream
*
******************************************************************************/
ACPI_STATUS
AcpiRsDmaStream (
- RESOURCE *LinkedList,
+ ACPI_RESOURCE *LinkedList,
UINT8 **OutputBuffer,
UINT32 *BytesConsumed)
{
@@ -629,9 +619,7 @@ AcpiRsDmaStream (
/*
* Return the number of bytes consumed in this operation
*/
- *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer -
- (NATIVE_UINT) *OutputBuffer);
-
+ *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer);
return_ACPI_STATUS (AE_OK);
}
OpenPOWER on IntegriCloud