version 1.3.2.5, 2017/02/05 13:40:50 |
version 1.4, 2015/04/13 17:23:15 |
|
|
*****************************************************************************/ |
*****************************************************************************/ |
|
|
/* |
/* |
* Copyright (C) 2000 - 2017, Intel Corp. |
* Copyright (C) 2000 - 2015, Intel Corp. |
* All rights reserved. |
* All rights reserved. |
* |
* |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
|
|
|
|
/****************************************************************************** |
/****************************************************************************** |
* |
* |
|
* FUNCTION: DtStrtoul64 |
|
* |
|
* PARAMETERS: String - Null terminated string |
|
* ReturnInteger - Where the converted integer is returned |
|
* |
|
* RETURN: Status |
|
* |
|
* DESCRIPTION: Simple conversion of a string hex integer constant to unsigned |
|
* value. Assumes no leading "0x" for the constant. |
|
* |
|
* Portability note: The reason this function exists is because a 64-bit |
|
* sscanf is not available in all environments. |
|
* |
|
*****************************************************************************/ |
|
|
|
ACPI_STATUS |
|
DtStrtoul64 ( |
|
char *String, |
|
UINT64 *ReturnInteger) |
|
{ |
|
char *ThisChar = String; |
|
UINT32 ThisDigit; |
|
UINT64 ReturnValue = 0; |
|
int DigitCount = 0; |
|
|
|
|
|
/* Skip over any white space in the buffer */ |
|
|
|
while ((*ThisChar == ' ') || (*ThisChar == '\t')) |
|
{ |
|
ThisChar++; |
|
} |
|
|
|
/* Skip leading zeros */ |
|
|
|
while ((*ThisChar) == '0') |
|
{ |
|
ThisChar++; |
|
} |
|
|
|
/* Convert character-by-character */ |
|
|
|
while (*ThisChar) |
|
{ |
|
if (ACPI_IS_DIGIT (*ThisChar)) |
|
{ |
|
/* Convert ASCII 0-9 to Decimal value */ |
|
|
|
ThisDigit = ((UINT8) *ThisChar) - '0'; |
|
} |
|
else /* Letter */ |
|
{ |
|
ThisDigit = (UINT32) ACPI_TOUPPER (*ThisChar); |
|
if (!ACPI_IS_XDIGIT ((char) ThisDigit)) |
|
{ |
|
/* Not A-F */ |
|
|
|
return (AE_BAD_CHARACTER); |
|
} |
|
|
|
/* Convert ASCII Hex char (A-F) to value */ |
|
|
|
ThisDigit = (ThisDigit - 'A') + 10; |
|
} |
|
|
|
/* Insert the 4-bit hex digit */ |
|
|
|
ReturnValue <<= 4; |
|
ReturnValue += ThisDigit; |
|
|
|
ThisChar++; |
|
DigitCount++; |
|
if (DigitCount > 16) |
|
{ |
|
/* Value is too large (> 64 bits/8 bytes/16 hex digits) */ |
|
|
|
return (AE_LIMIT); |
|
} |
|
} |
|
|
|
*ReturnInteger = ReturnValue; |
|
return (AE_OK); |
|
} |
|
|
|
|
|
/****************************************************************************** |
|
* |
* FUNCTION: DtGetFieldValue |
* FUNCTION: DtGetFieldValue |
* |
* |
* PARAMETERS: Field - Current field list pointer |
* PARAMETERS: Field - Current field list pointer |
Line 280 DtGetFieldType ( |
|
Line 367 DtGetFieldType ( |
|
case ACPI_DMT_RAW_BUFFER: |
case ACPI_DMT_RAW_BUFFER: |
case ACPI_DMT_BUF7: |
case ACPI_DMT_BUF7: |
case ACPI_DMT_BUF10: |
case ACPI_DMT_BUF10: |
case ACPI_DMT_BUF12: |
|
case ACPI_DMT_BUF16: |
case ACPI_DMT_BUF16: |
case ACPI_DMT_BUF128: |
case ACPI_DMT_BUF128: |
case ACPI_DMT_PCI_PATH: |
case ACPI_DMT_PCI_PATH: |
Line 290 DtGetFieldType ( |
|
Line 376 DtGetFieldType ( |
|
|
|
case ACPI_DMT_GAS: |
case ACPI_DMT_GAS: |
case ACPI_DMT_HESTNTFY: |
case ACPI_DMT_HESTNTFY: |
case ACPI_DMT_IORTMEM: |
|
|
|
Type = DT_FIELD_TYPE_INLINE_SUBTABLE; |
Type = DT_FIELD_TYPE_INLINE_SUBTABLE; |
break; |
break; |
Line 435 DtGetFieldLength ( |
|
Line 520 DtGetFieldLength ( |
|
case ACPI_DMT_UINT16: |
case ACPI_DMT_UINT16: |
case ACPI_DMT_DMAR: |
case ACPI_DMT_DMAR: |
case ACPI_DMT_HEST: |
case ACPI_DMT_HEST: |
case ACPI_DMT_NFIT: |
|
case ACPI_DMT_PCI_PATH: |
case ACPI_DMT_PCI_PATH: |
|
|
ByteLength = 2; |
ByteLength = 2; |
Line 482 DtGetFieldLength ( |
|
Line 566 DtGetFieldLength ( |
|
Value = DtGetFieldValue (Field); |
Value = DtGetFieldValue (Field); |
if (Value) |
if (Value) |
{ |
{ |
ByteLength = strlen (Value) + 1; |
ByteLength = ACPI_STRLEN (Value) + 1; |
} |
} |
else |
else |
{ /* At this point, this is a fatal error */ |
{ /* At this point, this is a fatal error */ |
Line 503 DtGetFieldLength ( |
|
Line 587 DtGetFieldLength ( |
|
ByteLength = sizeof (ACPI_HEST_NOTIFY); |
ByteLength = sizeof (ACPI_HEST_NOTIFY); |
break; |
break; |
|
|
case ACPI_DMT_IORTMEM: |
|
|
|
ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS); |
|
break; |
|
|
|
case ACPI_DMT_BUFFER: |
case ACPI_DMT_BUFFER: |
case ACPI_DMT_RAW_BUFFER: |
case ACPI_DMT_RAW_BUFFER: |
|
|
Line 530 DtGetFieldLength ( |
|
Line 609 DtGetFieldLength ( |
|
ByteLength = 10; |
ByteLength = 10; |
break; |
break; |
|
|
case ACPI_DMT_BUF12: |
|
|
|
ByteLength = 12; |
|
break; |
|
|
|
case ACPI_DMT_BUF16: |
case ACPI_DMT_BUF16: |
case ACPI_DMT_UUID: |
case ACPI_DMT_UUID: |
|
|
Line 552 DtGetFieldLength ( |
|
Line 626 DtGetFieldLength ( |
|
|
|
/* TBD: error if Value is NULL? (as below?) */ |
/* TBD: error if Value is NULL? (as below?) */ |
|
|
ByteLength = (strlen (Value) + 1) * sizeof(UINT16); |
ByteLength = (ACPI_STRLEN (Value) + 1) * sizeof(UINT16); |
break; |
break; |
|
|
default: |
default: |