aboutsummaryrefslogtreecommitdiff
path: root/source/tools/acpixtract/axutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/tools/acpixtract/axutils.c')
-rw-r--r--source/tools/acpixtract/axutils.c75
1 files changed, 75 insertions, 0 deletions
diff --git a/source/tools/acpixtract/axutils.c b/source/tools/acpixtract/axutils.c
index 6af8cdc29a3c9..6d1d0d88346ce 100644
--- a/source/tools/acpixtract/axutils.c
+++ b/source/tools/acpixtract/axutils.c
@@ -46,6 +46,81 @@
/*******************************************************************************
*
+ * FUNCTION: AcpiIsValidSignature
+ *
+ * PARAMETERS: Signature - Sig string to be validated
+ *
+ * RETURN: TRUE if signature is has 4 valid ACPI characters
+ *
+ * DESCRIPTION: Validate an ACPI table signature.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiIsValidSignature (
+ char *Signature)
+{
+ UINT32 i;
+
+
+ /* Validate each character in the signature */
+
+ for (i = 0; i < ACPI_NAME_SIZE; i++)
+ {
+ if (!AcpiUtValidAcpiChar (Signature[i], i))
+ {
+ return (FALSE);
+ }
+ }
+
+ return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtValidAcpiChar
+ *
+ * PARAMETERS: Char - The character to be examined
+ * Position - Byte position (0-3)
+ *
+ * RETURN: TRUE if the character is valid, FALSE otherwise
+ *
+ * DESCRIPTION: Check for a valid ACPI character. Must be one of:
+ * 1) Upper case alpha
+ * 2) numeric
+ * 3) underscore
+ *
+ * We allow a '!' as the last character because of the ASF! table
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiUtValidAcpiChar (
+ char Character,
+ UINT32 Position)
+{
+
+ if (!((Character >= 'A' && Character <= 'Z') ||
+ (Character >= '0' && Character <= '9') ||
+ (Character == '_')))
+ {
+ /* Allow a '!' in the last position */
+
+ if (Character == '!' && Position == 3)
+ {
+ return (TRUE);
+ }
+
+ return (FALSE);
+ }
+
+ return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AxCheckAscii
*
* PARAMETERS: Name - Ascii string, at least as long as Count