FreeBSD/sys/contrib/dev/acpica/compiler/aslrestype2e.c
/*******************************************************************************
 *
 * FUNCTION:    RsDoExtendedSpaceDescriptor
 *
 * PARAMETERS:  Info                - Parse Op and resource template offset
 *
 * RETURN:      Completed resource node
 *
 * DESCRIPTION: Construct a long "ExtendedSpace" descriptor
 *
 ******************************************************************************/
RsDoExtendedSpaceDescriptor
PARAMETERS:  Info                - Parse Op and resource template offset

Completed resource node

Construct a long "ExtendedSpace" descriptor
RsDoExtendedSpaceDescriptor PARAMETERS : Info - Parse Op and resource template offset Completed resource node Construct a long " ExtendedSpace " descriptor
ASL_RESOURCE_NODE *
RsDoExtendedSpaceDescriptor (
    ASL_RESOURCE_INFO       *Info)
{
    AML_RESOURCE            *Descriptor;
    ACPI_PARSE_OBJECT       *InitializerOp;
    ACPI_PARSE_OBJECT       *MinOp = NULL;
    ACPI_PARSE_OBJECT       *MaxOp = NULL;
    ACPI_PARSE_OBJECT       *LengthOp = NULL;
    ACPI_PARSE_OBJECT       *GranOp = NULL;
    ASL_RESOURCE_NODE       *Rnode;
    UINT16                  StringLength = 0;
    UINT32                  CurrentByteOffset;
    UINT32                  i;
    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
    StringLength = RsGetStringDataLength (InitializerOp);
    CurrentByteOffset = Info->CurrentByteOffset;
    Rnode = RsAllocateResourceNode (
        sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
    Descriptor = Rnode->Buffer;
    Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
    Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
    Descriptor->ExtAddress64.ResourceLength = (UINT16)
        (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
         sizeof (AML_RESOURCE_LARGE_HEADER));
    for (i = 0; InitializerOp; i++)
    {
        switch (i)
        {
        case 0: 
            Descriptor->ExtAddress64.ResourceType =
                (UINT8) InitializerOp->Asl.Value.Integer;
            break;
        case 1: 
            RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
            break;
        case 2: 
            RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
            RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
            break;
        case 3: 
            RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
            break;
        case 4: 
            RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
            break;
        case 5: 
            Descriptor->ExtAddress64.SpecificFlags =
                (UINT8) InitializerOp->Asl.Value.Integer;
            break;
        case 6: 
            Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
            RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
            GranOp = InitializerOp;
            break;
        case 7: 
            Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
            RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
            MinOp = InitializerOp;
            break;
        case 8: 
            Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
            RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
            MaxOp = InitializerOp;
            break;
        case 9: 
            Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
            RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
            break;
        case 10: 
            Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
            RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
            LengthOp = InitializerOp;
            break;
        case 11: 
            Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
            RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
            break;
        case 12: 
            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
            break;
        default:
            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
            break;
        }
        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
    }
    RsLargeAddressCheck (
        Descriptor->ExtAddress64.Minimum,
        Descriptor->ExtAddress64.Maximum,
        Descriptor->ExtAddress64.AddressLength,
        Descriptor->ExtAddress64.Granularity,
        Descriptor->ExtAddress64.Flags,
        MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
    Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) +
        StringLength;
    return (Rnode);
}
ASL_RESOURCE_NODE * RsDoExtendedSpaceDescriptor ( ASL_RESOURCE_INFO * Info ) { AML_RESOURCE * Descriptor ; ACPI_PARSE_OBJECT * InitializerOp ; ACPI_PARSE_OBJECT * MinOp = NULL ; ACPI_PARSE_OBJECT * MaxOp = NULL ; ACPI_PARSE_OBJECT * LengthOp = NULL ; ACPI_PARSE_OBJECT * GranOp = NULL ; ASL_RESOURCE_NODE * Rnode ; UINT16 StringLength = 0 ; UINT32 CurrentByteOffset ; UINT32 i ; InitializerOp = Info -> DescriptorTypeOp -> Asl . Child ; StringLength = RsGetStringDataLength ( InitializerOp ) ; CurrentByteOffset = Info -> CurrentByteOffset ; Rnode = RsAllocateResourceNode ( sizeof ( AML_RESOURCE_EXTENDED_ADDRESS64 ) + 1 + StringLength ) ; Descriptor = Rnode -> Buffer ; Descriptor -> ExtAddress64 . DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 ; Descriptor -> ExtAddress64 . RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION ; Descriptor -> ExtAddress64 . ResourceLength = ( UINT16 ) ( sizeof ( AML_RESOURCE_EXTENDED_ADDRESS64 ) - sizeof ( AML_RESOURCE_LARGE_HEADER ) ) ; for ( i = 0 ; InitializerOp ; i ++ ) { switch ( i ) { case 0 : Descriptor -> ExtAddress64 . ResourceType = ( UINT8 ) InitializerOp -> Asl . Value . Integer ; break ; case 1 : RsSetFlagBits ( & Descriptor -> ExtAddress64 . Flags , InitializerOp , 0 , 1 ) ; break ; case 2 : RsSetFlagBits ( & Descriptor -> ExtAddress64 . Flags , InitializerOp , 1 , 0 ) ; RsCreateBitField ( InitializerOp , ACPI_RESTAG_DECODE , CurrentByteOffset + ASL_RESDESC_OFFSET ( ExtAddress64 . Flags ) , 1 ) ; break ; case 3 : RsSetFlagBits ( & Descriptor -> ExtAddress64 . Flags , InitializerOp , 2 , 0 ) ; RsCreateBitField ( InitializerOp , ACPI_RESTAG_MINTYPE , CurrentByteOffset + ASL_RESDESC_OFFSET ( ExtAddress64 . Flags ) , 2 ) ; break ; case 4 : RsSetFlagBits ( & Descriptor -> ExtAddress64 . Flags , InitializerOp , 3 , 0 ) ; RsCreateBitField ( InitializerOp , ACPI_RESTAG_MAXTYPE , CurrentByteOffset + ASL_RESDESC_OFFSET ( ExtAddress64 . Flags ) , 3 ) ; break ; case 5 : Descriptor -> ExtAddress64 . SpecificFlags = ( UINT8 ) InitializerOp -> Asl . Value . Integer ; break ; case 6 : Descriptor -> ExtAddress64 . Granularity = InitializerOp -> Asl . Value . Integer ; RsCreateQwordField ( InitializerOp , ACPI_RESTAG_GRANULARITY , CurrentByteOffset + ASL_RESDESC_OFFSET ( ExtAddress64 . Granularity ) ) ; GranOp = InitializerOp ; break ; case 7 : Descriptor -> ExtAddress64 . Minimum = InitializerOp -> Asl . Value . Integer ; RsCreateQwordField ( InitializerOp , ACPI_RESTAG_MINADDR , CurrentByteOffset + ASL_RESDESC_OFFSET ( ExtAddress64 . Minimum ) ) ; MinOp = InitializerOp ; break ; case 8 : Descriptor -> ExtAddress64 . Maximum = InitializerOp -> Asl . Value . Integer ; RsCreateQwordField ( InitializerOp , ACPI_RESTAG_MAXADDR , CurrentByteOffset + ASL_RESDESC_OFFSET ( ExtAddress64 . Maximum ) ) ; MaxOp = InitializerOp ; break ; case 9 : Descriptor -> ExtAddress64 . TranslationOffset = InitializerOp -> Asl . Value . Integer ; RsCreateQwordField ( InitializerOp , ACPI_RESTAG_TRANSLATION , CurrentByteOffset + ASL_RESDESC_OFFSET ( ExtAddress64 . TranslationOffset ) ) ; break ; case 10 : Descriptor -> ExtAddress64 . AddressLength = InitializerOp -> Asl . Value . Integer ; RsCreateQwordField ( InitializerOp , ACPI_RESTAG_LENGTH , CurrentByteOffset + ASL_RESDESC_OFFSET ( ExtAddress64 . AddressLength ) ) ; LengthOp = InitializerOp ; break ; case 11 : Descriptor -> ExtAddress64 . TypeSpecific = InitializerOp -> Asl . Value . Integer ; RsCreateQwordField ( InitializerOp , ACPI_RESTAG_TYPESPECIFICATTRIBUTES , CurrentByteOffset + ASL_RESDESC_OFFSET ( ExtAddress64 . TypeSpecific ) ) ; break ; case 12 : UtAttachNamepathToOwner ( Info -> DescriptorTypeOp , InitializerOp ) ; break ; default : AslError ( ASL_ERROR , ASL_MSG_RESOURCE_LIST , InitializerOp , NULL ) ; break ; } InitializerOp = RsCompleteNodeAndGetNext ( InitializerOp ) ; } RsLargeAddressCheck ( Descriptor -> ExtAddress64 . Minimum , Descriptor -> ExtAddress64 . Maximum , Descriptor -> ExtAddress64 . AddressLength , Descriptor -> ExtAddress64 . Granularity , Descriptor -> ExtAddress64 . Flags , MinOp , MaxOp , LengthOp , GranOp , Info -> DescriptorTypeOp ) ; Rnode -> BufferLength = sizeof ( AML_RESOURCE_EXTENDED_ADDRESS64 ) + StringLength ; return ( Rnode ) ; }
FUNCTION:    RsDoExtendedSpaceDescriptor
 PARAMETERS:  Info                - Parse Op and resource template offset
FUNCTION : RsDoExtendedSpaceDescriptor PARAMETERS : Info - Parse Op and resource template offset
/* Process all child initialization nodes */ /* Resource Type */ /* Resource Usage */ /* DecodeType */ /* MinType */ /* MaxType */ /* Type-Specific flags */ /* Address Granularity */ /* Min Address */ /* Max Address */ /* Translation Offset */ /* Address Length */ /* Type-Specific Attributes */ /* ResourceTag */ /* Validate the Min/Max/Len/Gran values */