diff options
author | Joey Gouly <joey.gouly@arm.com> | 2021-04-09 13:00:58 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-04-13 10:38:14 +0000 |
commit | 16136f218d546f458afb8037482962242e95aed4 (patch) | |
tree | 0c457b11a25a79fcafdeda9663d8725381d3a4b5 /DynamicTablesPkg/Include | |
parent | 54211ab10fcd8532b49f4024ebdb601a8eb07e3e (diff) | |
download | edk2-16136f218d546f458afb8037482962242e95aed4.tar.gz edk2-16136f218d546f458afb8037482962242e95aed4.tar.bz2 edk2-16136f218d546f458afb8037482962242e95aed4.zip |
DynamicTablesPkg: add validation for PcdNonBsaCompliant16550SerialHid
According to ACPI 6.4, 6.1.5 _HID states:
- 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 a digit ('0'-'9') and # is a hex digit.
Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Diffstat (limited to 'DynamicTablesPkg/Include')
-rw-r--r-- | DynamicTablesPkg/Include/Library/TableHelperLib.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/DynamicTablesPkg/Include/Library/TableHelperLib.h b/DynamicTablesPkg/Include/Library/TableHelperLib.h index 099a0a4544..0f93cdbf08 100644 --- a/DynamicTablesPkg/Include/Library/TableHelperLib.h +++ b/DynamicTablesPkg/Include/Library/TableHelperLib.h @@ -1,6 +1,6 @@ /** @file
- Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -12,6 +12,18 @@ #ifndef TABLE_HELPER_LIB_H_
#define TABLE_HELPER_LIB_H_
+/** Is a character upper case
+*/
+#define IS_UPPER_CHAR(x) ((x >= 'A') && (x <= 'Z'))
+
+/** Is a character a decimal digit
+*/
+#define IS_DIGIT(x) ((x >= '0') && (x <= '9'))
+
+/** Is a character an upper case hexadecimal digit
+*/
+#define IS_UPPER_HEX(x) (((x >= 'A') && (x <= 'F')) || IS_DIGIT (x))
+
/** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO
object from the Configuration Manager.
@@ -120,4 +132,28 @@ AsciiFromHex ( IN UINT8 x
);
+/** Check if a HID is a valid PNP ID.
+
+ @param [in] Hid The Hid to validate.
+
+ @retval TRUE The Hid is a valid PNP ID.
+ @retval FALSE The Hid is not a valid PNP ID.
+**/
+BOOLEAN
+IsValidPnpId (
+ IN CONST CHAR8 * Hid
+ );
+
+/** Check if a HID is a valid ACPI ID.
+
+ @param [in] Hid The Hid to validate.
+
+ @retval TRUE The Hid is a valid ACPI ID.
+ @retval FALSE The Hid is not a valid ACPI ID.
+**/
+BOOLEAN
+IsValidAcpiId (
+ IN CONST CHAR8 * Hid
+ );
+
#endif // TABLE_HELPER_LIB_H_
|