diff options
Diffstat (limited to 'sys/contrib/dev/acpica/rsirq.c')
-rw-r--r-- | sys/contrib/dev/acpica/rsirq.c | 167 |
1 files changed, 81 insertions, 86 deletions
diff --git a/sys/contrib/dev/acpica/rsirq.c b/sys/contrib/dev/acpica/rsirq.c index 7944046..46087ac 100644 --- a/sys/contrib/dev/acpica/rsirq.c +++ b/sys/contrib/dev/acpica/rsirq.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsirq - IRQ resource descriptors - * $Revision: 19 $ + * $Revision: 24 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp. * All rights reserved. * * 2. License @@ -120,7 +120,7 @@ #include "acresrc.h" #define _COMPONENT ACPI_RESOURCES - MODULE_NAME ("rsirq") + ACPI_MODULE_NAME ("rsirq") /******************************************************************************* @@ -129,13 +129,12 @@ * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte * stream - * BytesConsumed - UINT32 pointer that is filled with - * 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 + * BytesConsumed - Pointer to where the number of bytes + * consumed the ByteStreamBuffer is + * returned + * OutputBuffer - Pointer to the return data buffer + * StructureSize - Pointer to where the number of bytes + * in the return data struct is returned * * RETURN: Status * @@ -148,9 +147,9 @@ ACPI_STATUS AcpiRsIrqResource ( UINT8 *ByteStreamBuffer, - UINT32 *BytesConsumed, + ACPI_SIZE *BytesConsumed, UINT8 **OutputBuffer, - UINT32 *StructureSize) + ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; @@ -158,10 +157,10 @@ AcpiRsIrqResource ( UINT8 Temp8 = 0; UINT8 Index; UINT8 i; - UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_IRQ); + ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IRQ); - FUNCTION_TRACE ("RsIrqResource"); + ACPI_FUNCTION_TRACE ("RsIrqResource"); /* @@ -176,7 +175,7 @@ AcpiRsIrqResource ( * Point to the 16-bits of Bytes 1 and 2 */ Buffer += 1; - MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); OutputStruct->Data.Irq.NumberOfInterrupts = 0; @@ -210,15 +209,15 @@ AcpiRsIrqResource ( */ if (Temp8 & 0x01) { - OutputStruct->Data.Irq.EdgeLevel = EDGE_SENSITIVE; - OutputStruct->Data.Irq.ActiveHighLow = ACTIVE_HIGH; + OutputStruct->Data.Irq.EdgeLevel = ACPI_EDGE_SENSITIVE; + OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_HIGH; } else { if (Temp8 & 0x8) { - OutputStruct->Data.Irq.EdgeLevel = LEVEL_SENSITIVE; - OutputStruct->Data.Irq.ActiveHighLow = ACTIVE_LOW; + OutputStruct->Data.Irq.EdgeLevel = ACPI_LEVEL_SENSITIVE; + OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_LOW; } else { @@ -242,9 +241,9 @@ AcpiRsIrqResource ( * Assume Edge Sensitive, Active High, Non-Sharable * per ACPI Specification */ - OutputStruct->Data.Irq.EdgeLevel = EDGE_SENSITIVE; - OutputStruct->Data.Irq.ActiveHighLow = ACTIVE_HIGH; - OutputStruct->Data.Irq.SharedExclusive = EXCLUSIVE; + OutputStruct->Data.Irq.EdgeLevel = ACPI_EDGE_SENSITIVE; + OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_HIGH; + OutputStruct->Data.Irq.SharedExclusive = ACPI_EXCLUSIVE; } /* @@ -266,9 +265,8 @@ AcpiRsIrqResource ( * * 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 + * BytesConsumed - Pointer to where the number of bytes + * used in the OutputBuffer is returned * * RETURN: Status * @@ -281,7 +279,7 @@ ACPI_STATUS AcpiRsIrqStream ( ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, - UINT32 *BytesConsumed) + ACPI_SIZE *BytesConsumed) { UINT8 *Buffer = *OutputBuffer; UINT16 Temp16 = 0; @@ -290,16 +288,16 @@ AcpiRsIrqStream ( BOOLEAN IRQInfoByteNeeded; - FUNCTION_TRACE ("RsIrqStream"); + ACPI_FUNCTION_TRACE ("RsIrqStream"); /* * The descriptor field is set based upon whether a third byte is * needed to contain the IRQ Information. */ - if (EDGE_SENSITIVE == LinkedList->Data.Irq.EdgeLevel && - ACTIVE_HIGH == LinkedList->Data.Irq.ActiveHighLow && - EXCLUSIVE == LinkedList->Data.Irq.SharedExclusive) + if (ACPI_EDGE_SENSITIVE == LinkedList->Data.Irq.EdgeLevel && + ACPI_ACTIVE_HIGH == LinkedList->Data.Irq.ActiveHighLow && + ACPI_EXCLUSIVE == LinkedList->Data.Irq.SharedExclusive) { *Buffer = 0x22; IRQInfoByteNeeded = FALSE; @@ -324,7 +322,7 @@ AcpiRsIrqStream ( Temp16 |= 0x1 << Temp8; } - MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16); + ACPI_MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16); Buffer += 2; /* @@ -336,8 +334,8 @@ AcpiRsIrqStream ( Temp8 = (UINT8) ((LinkedList->Data.Irq.SharedExclusive & 0x01) << 4); - if (LEVEL_SENSITIVE == LinkedList->Data.Irq.EdgeLevel && - ACTIVE_LOW == LinkedList->Data.Irq.ActiveHighLow) + if (ACPI_LEVEL_SENSITIVE == LinkedList->Data.Irq.EdgeLevel && + ACPI_ACTIVE_LOW == LinkedList->Data.Irq.ActiveHighLow) { Temp8 |= 0x08; } @@ -353,7 +351,7 @@ AcpiRsIrqStream ( /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); + *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); return_ACPI_STATUS (AE_OK); } @@ -364,13 +362,12 @@ AcpiRsIrqStream ( * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte * stream - * BytesConsumed - UINT32 pointer that is filled with - * 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 + * BytesConsumed - Pointer to where the number of bytes + * consumed the ByteStreamBuffer is + * returned + * OutputBuffer - Pointer to the return data buffer + * StructureSize - Pointer to where the number of bytes + * in the return data struct is returned * * RETURN: Status * @@ -383,9 +380,9 @@ AcpiRsIrqStream ( ACPI_STATUS AcpiRsExtendedIrqResource ( UINT8 *ByteStreamBuffer, - UINT32 *BytesConsumed, + ACPI_SIZE *BytesConsumed, UINT8 **OutputBuffer, - UINT32 *StructureSize) + ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; @@ -393,17 +390,17 @@ AcpiRsExtendedIrqResource ( UINT8 Temp8 = 0; NATIVE_CHAR *TempPtr; UINT8 Index; - UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ); + ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ); - FUNCTION_TRACE ("RsExtendedIrqResource"); + ACPI_FUNCTION_TRACE ("RsExtendedIrqResource"); /* * Point past the Descriptor to get the number of bytes consumed */ Buffer += 1; - MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); *BytesConsumed = Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_EXT_IRQ; @@ -417,30 +414,20 @@ AcpiRsExtendedIrqResource ( OutputStruct->Data.ExtendedIrq.ProducerConsumer = Temp8 & 0x01; /* - * Check for HE, LL or HL + * Check for Interrupt Mode + * + * The definition of an Extended IRQ changed between ACPI spec v1.0b + * and ACPI spec 2.0 (section 6.4.3.6 in both). + * + * - Edge/Level are defined opposite in the table vs the headers */ - if(Temp8 & 0x02) - { - OutputStruct->Data.ExtendedIrq.EdgeLevel = EDGE_SENSITIVE; - OutputStruct->Data.ExtendedIrq.ActiveHighLow = ACTIVE_HIGH; - } - else - { - if(Temp8 & 0x4) - { - OutputStruct->Data.ExtendedIrq.EdgeLevel = LEVEL_SENSITIVE; - OutputStruct->Data.ExtendedIrq.ActiveHighLow = ACTIVE_LOW; - } - else - { - /* - * Only _LL and _HE polarity/trigger interrupts - * are allowed (ACPI spec v1.0b ection 6.4.2.1), - * so an error will occur if we reach this point - */ - return_ACPI_STATUS (AE_BAD_DATA); - } - } + OutputStruct->Data.ExtendedIrq.EdgeLevel = + (Temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; + + /* + * Check Interrupt Polarity + */ + OutputStruct->Data.ExtendedIrq.ActiveHighLow = (Temp8 >> 2) & 0x1; /* * Check for sharable @@ -530,7 +517,7 @@ AcpiRsExtendedIrqResource ( * StructSize to the next 32-bit boundary. */ Temp8 = (UINT8) (Index + 1); - StructSize += ROUND_UP_TO_32BITS (Temp8); + StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8); } else { @@ -558,9 +545,8 @@ AcpiRsExtendedIrqResource ( * * 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 + * BytesConsumed - Pointer to where the number of bytes + * used in the OutputBuffer is returned * * RETURN: Status * @@ -573,7 +559,7 @@ ACPI_STATUS AcpiRsExtendedIrqStream ( ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, - UINT32 *BytesConsumed) + ACPI_SIZE *BytesConsumed) { UINT8 *Buffer = *OutputBuffer; UINT16 *LengthField; @@ -582,7 +568,7 @@ AcpiRsExtendedIrqStream ( NATIVE_CHAR *TempPointer = NULL; - FUNCTION_TRACE ("RsExtendedIrqStream"); + ACPI_FUNCTION_TRACE ("RsExtendedIrqStream"); /* @@ -603,16 +589,25 @@ AcpiRsExtendedIrqStream ( Temp8 = (UINT8)(LinkedList->Data.ExtendedIrq.ProducerConsumer & 0x01); Temp8 |= ((LinkedList->Data.ExtendedIrq.SharedExclusive & 0x01) << 3); - if (LEVEL_SENSITIVE == LinkedList->Data.ExtendedIrq.EdgeLevel && - ACTIVE_LOW == LinkedList->Data.ExtendedIrq.ActiveHighLow) - { - Temp8 |= 0x04; - } - else + /* + * Set the Interrupt Mode + * + * The definition of an Extended IRQ changed between ACPI spec v1.0b + * and ACPI spec 2.0 (section 6.4.3.6 in both). This code does not + * implement the more restrictive definition of 1.0b + * + * - Edge/Level are defined opposite in the table vs the headers + */ + if (ACPI_EDGE_SENSITIVE == LinkedList->Data.ExtendedIrq.EdgeLevel) { - Temp8 |= 0x02; + Temp8 |= 0x2; } + /* + * Set the Interrupt Polarity + */ + Temp8 |= ((LinkedList->Data.ExtendedIrq.ActiveHighLow & 0x1) << 2); + *Buffer = Temp8; Buffer += 1; @@ -627,7 +622,7 @@ AcpiRsExtendedIrqStream ( for (Index = 0; Index < LinkedList->Data.ExtendedIrq.NumberOfInterrupts; Index++) { - MOVE_UNALIGNED32_TO_32 (Buffer, + ACPI_MOVE_UNALIGNED32_TO_32 (Buffer, &LinkedList->Data.ExtendedIrq.Interrupts[Index]); Buffer += 4; } @@ -645,20 +640,20 @@ AcpiRsExtendedIrqStream ( /* * Copy the string */ - STRCPY (TempPointer, + ACPI_STRCPY (TempPointer, LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - Buffer += (STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1); + Buffer += (ACPI_STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1); } /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); + *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer); /* * Set the length field to the number of bytes consumed |