FreeBSD/sys/contrib/dev/acpica/components/namespace/nsrepair2.c
/******************************************************************************
 *
 * FUNCTION:    AcpiNsRepair_HID
 *
 * PARAMETERS:  Info                - Method execution information block
 *              ReturnObjectPtr     - Pointer to the object returned from the
 *                                    evaluation of a method or object
 *
 * RETURN:      Status. AE_OK if object is OK or was repaired successfully
 *
 * DESCRIPTION: Repair for the _HID object. If a string, ensure that all
 *              letters are uppercase and that there is no leading asterisk.
 *
 *****************************************************************************/
AcpiNsRepair_HID
PARAMETERS:  Info                - Method execution information block
ReturnObjectPtr     - Pointer to the object returned from the
evaluation of a method or object

Status. AE_OK if object is OK or was repaired successfully

Repair for the _HID object. If a string, ensure that all
letters are uppercase and that there is no leading asterisk.
AcpiNsRepair_HID PARAMETERS : Info - Method execution information block ReturnObjectPtr - Pointer to the object returned from the evaluation of a method or object Status . AE_OK if object is OK or was repaired successfully Repair for the _HID object . If a string ensure that all letters are uppercase and that there is no leading asterisk .
static ACPI_STATUS
AcpiNsRepair_HID (
    ACPI_EVALUATE_INFO      *Info,
    ACPI_OPERAND_OBJECT     **ReturnObjectPtr)
{
    ACPI_OPERAND_OBJECT     *ReturnObject = *ReturnObjectPtr;
    ACPI_OPERAND_OBJECT     *NewString;
    char                    *Source;
    char                    *Dest;
    ACPI_FUNCTION_NAME (NsRepair_HID);
    if (ReturnObject->Common.Type != ACPI_TYPE_STRING)
    {
        return (AE_OK);
    }
    if (ReturnObject->String.Length == 0)
    {
        ACPI_WARN_PREDEFINED ((AE_INFO,
            Info->FullPathname, Info->NodeFlags,
            "Invalid zero-length _HID or _CID string"));
        Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
        return (AE_OK);
    }
    NewString = AcpiUtCreateStringObject (ReturnObject->String.Length);
    if (!NewString)
    {
        return (AE_NO_MEMORY);
    }
    Source = ReturnObject->String.Pointer;
    if (*Source == '*')
    {
        Source++;
        NewString->String.Length--;
        ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
            "%s: Removed invalid leading asterisk\n", Info->FullPathname));
    }
    for (Dest = NewString->String.Pointer; *Source; Dest++, Source++)
    {
        *Dest = (char) toupper ((int) *Source);
    }
    AcpiUtRemoveReference (ReturnObject);
    *ReturnObjectPtr = NewString;
    return (AE_OK);
}
static ACPI_STATUS AcpiNsRepair_HID ( ACPI_EVALUATE_INFO * Info , ACPI_OPERAND_OBJECT * * ReturnObjectPtr ) { ACPI_OPERAND_OBJECT * ReturnObject = * ReturnObjectPtr ; ACPI_OPERAND_OBJECT * NewString ; char * Source ; char * Dest ; ACPI_FUNCTION_NAME ( NsRepair_HID ) ; if ( ReturnObject -> Common . Type != ACPI_TYPE_STRING ) { return ( AE_OK ) ; } if ( ReturnObject -> String . Length == 0 ) { ACPI_WARN_PREDEFINED ( ( AE_INFO , Info -> FullPathname , Info -> NodeFlags , " " ) ) ; Info -> ReturnFlags |= ACPI_OBJECT_REPAIRED ; return ( AE_OK ) ; } NewString = AcpiUtCreateStringObject ( ReturnObject -> String . Length ) ; if ( ! NewString ) { return ( AE_NO_MEMORY ) ; } Source = ReturnObject -> String . Pointer ; if ( * Source == ' ' ) { Source ++ ; NewString -> String . Length -- ; ACPI_DEBUG_PRINT ( ( ACPI_DB_REPAIR , " \n " , Info -> FullPathname ) ) ; } for ( Dest = NewString -> String . Pointer ; * Source ; Dest ++ , Source ++ ) { * Dest = ( char ) toupper ( ( int ) * Source ) ; } AcpiUtRemoveReference ( ReturnObject ) ; * ReturnObjectPtr = NewString ; return ( AE_OK ) ; }
FUNCTION:    AcpiNsRepair_HID
 PARAMETERS:  Info                - Method execution information block
              ReturnObjectPtr     - Pointer to the object returned from the
                                    evaluation of a method or object
FUNCTION : AcpiNsRepair_HID PARAMETERS : Info - Method execution information block ReturnObjectPtr - Pointer to the object returned from the evaluation of a method or object
/* We only care about string _HID objects (not integers) */ /* Return AE_OK anyway, let driver handle it */ /* It is simplest to always create a new string object */ /*
     * Remove a leading asterisk if present. For some unknown reason, there
     * are many machines in the field that contains IDs like this.
     *
     * Examples: "*PNP0C03", "*ACPI0003"
     */ /*
     * Copy and uppercase the string. From the ACPI 5.0 specification:
     *
     * A valid PNP ID must be of the form "AAA####" where A is an uppercase
     * letter and # is a hex digit. A valid ACPI ID must be of the form
     * "NNNN####" where N is an uppercase letter or decimal digit, and
     * # is a hex digit.
     */