summaryrefslogtreecommitdiff
path: root/source/compiler/aslrestype2s.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler/aslrestype2s.c')
-rw-r--r--source/compiler/aslrestype2s.c109
1 files changed, 109 insertions, 0 deletions
diff --git a/source/compiler/aslrestype2s.c b/source/compiler/aslrestype2s.c
index 6c904d031..cdb467ff1 100644
--- a/source/compiler/aslrestype2s.c
+++ b/source/compiler/aslrestype2s.c
@@ -1708,6 +1708,115 @@ RsDoPinFunctionDescriptor (
return (Rnode);
}
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoClockInputDescriptor
+ *
+ * PARAMETERS: Info - Parse Op and resource template offset
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "ClockInput" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoClockInputDescriptor (
+ ASL_RESOURCE_INFO *Info)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ char *ResourceSourceString = NULL;
+ UINT8 *ResourceSourceIndex = NULL;
+ UINT16 ResSourceLength;
+ UINT16 DescriptorSize;
+ UINT32 i;
+ UINT32 CurrentByteOffset;
+
+ InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+ CurrentByteOffset = Info->CurrentByteOffset;
+
+ /*
+ * Calculate lengths for fields that have variable length:
+ * 1) Resource Source string
+ */
+ ResSourceLength = RsGetStringDataLength (InitializerOp);
+
+ DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_CLOCK_INPUT) + ResSourceLength + 1;
+
+ /* Allocate the local resource node and initialize */
+
+ Rnode = RsAllocateResourceNode (DescriptorSize +
+ sizeof (AML_RESOURCE_LARGE_HEADER));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->ClockInput.ResourceLength = DescriptorSize;
+ Descriptor->ClockInput.DescriptorType = ACPI_RESOURCE_NAME_CLOCK_INPUT;
+ Descriptor->ClockInput.RevisionId = AML_RESOURCE_CLOCK_INPUT_REVISION;
+
+ /* Build pointers to optional areas */
+
+ if (ResSourceLength){
+ ResourceSourceIndex = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_CLOCK_INPUT));
+ ResourceSourceString = ACPI_ADD_PTR (char, Descriptor, sizeof (AML_RESOURCE_CLOCK_INPUT) + 1);
+ }
+
+ /* Process all child initialization nodes */
+
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ Descriptor->ClockInput.FrequencyNumerator = (UINT32)InitializerOp->Asl.Value.Integer;
+ RsCreateDwordField (InitializerOp, ACPI_RESTAG_FQN,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ClockInput.FrequencyNumerator));
+
+ break;
+
+ case 1:
+ Descriptor->ClockInput.FrequencyDivisor = (UINT16)InitializerOp->Asl.Value.Integer;
+ RsCreateWordField (InitializerOp, ACPI_RESTAG_FQD,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ClockInput.FrequencyDivisor));
+
+ break;
+
+ case 2:
+ RsSetFlagBits16 (&Descriptor->ClockInput.Flags, InitializerOp, 1, 0);
+ break;
+
+ case 3:
+ RsSetFlagBits16 (&Descriptor->ClockInput.Flags, InitializerOp, 0, 0);
+ break;
+
+ case 4: /* ResSource String [Optional Field] */
+
+ if (ResourceSourceString)
+ {
+ /* Copy string to the descriptor */
+
+ strcpy (ResourceSourceString, InitializerOp->Asl.Value.String);
+ }
+ break;
+
+ case 5: /* ResSource Index [Optional Field] */
+ if (ResourceSourceIndex)
+ {
+ *ResourceSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ return (Rnode);
+}
+
/*******************************************************************************
*