summaryrefslogtreecommitdiffstats
path: root/ShellPkg
diff options
context:
space:
mode:
authorKrzysztof Koch <krzysztof.koch@arm.com>2019-07-18 18:05:01 -0700
committerJaben Carsey <jaben.carsey@intel.com>2019-07-19 08:33:03 -0700
commit2a219e196d7cf6d6df5a6e8856549607e9c0e5ef (patch)
treeb1480309e7e5940390874eb6df97f453af51fac8 /ShellPkg
parent795e706f745670724c2aaf94e99236b0172aed05 (diff)
downloadedk2-2a219e196d7cf6d6df5a6e8856549607e9c0e5ef.tar.gz
edk2-2a219e196d7cf6d6df5a6e8856549607e9c0e5ef.tar.bz2
edk2-2a219e196d7cf6d6df5a6e8856549607e9c0e5ef.zip
ShellPkg: acpiview: GTDT: Remove redundant forward declarations
Remove redundant forward function declarations by repositioning blocks of code. This way the code structure is consistent across ACPI table parsers and the code becomes more concise. Replace multple use of literal values for GT Block Timer Frame count/number validation with a macro definition. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c91
1 files changed, 33 insertions, 58 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
index 3b05ff3015..1e5b5764f5 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
@@ -13,6 +13,9 @@
#include "AcpiParser.h"
#include "AcpiTableParser.h"
+// "The number of GT Block Timers must be less than or equal to 8"
+#define GT_BLOCK_TIMER_COUNT_MAX 8
+
// Local variables
STATIC CONST UINT32* GtdtPlatformTimerCount;
STATIC CONST UINT32* GtdtPlatformTimerOffset;
@@ -36,7 +39,21 @@ EFIAPI
ValidateGtBlockTimerCount (
IN UINT8* Ptr,
IN VOID* Context
- );
+ )
+{
+ UINT32 BlockTimerCount;
+
+ BlockTimerCount = *(UINT32*)Ptr;
+
+ if (BlockTimerCount > GT_BLOCK_TIMER_COUNT_MAX) {
+ IncrementErrorCount ();
+ Print (
+ L"\nERROR: Timer Count = %d. Max Timer Count is %d.",
+ BlockTimerCount,
+ GT_BLOCK_TIMER_COUNT_MAX
+ );
+ }
+}
/**
This function validates the GT Frame Number.
@@ -51,7 +68,21 @@ EFIAPI
ValidateGtFrameNumber (
IN UINT8* Ptr,
IN VOID* Context
- );
+ )
+{
+ UINT8 FrameNumber;
+
+ FrameNumber = *(UINT8*)Ptr;
+
+ if (FrameNumber >= GT_BLOCK_TIMER_COUNT_MAX) {
+ IncrementErrorCount ();
+ Print (
+ L"\nERROR: GT Frame Number = %d. GT Frame Number must be in range 0-%d.",
+ FrameNumber,
+ GT_BLOCK_TIMER_COUNT_MAX - 1
+ );
+ }
+}
/**
An ACPI_PARSER array describing the ACPI GTDT Table.
@@ -135,62 +166,6 @@ STATIC CONST ACPI_PARSER SBSAGenericWatchdogParser[] = {
};
/**
- This function validates the GT Block timer count.
-
- @param [in] Ptr Pointer to the start of the field data.
- @param [in] Context Pointer to context specific information e.g. this
- could be a pointer to the ACPI table header.
-**/
-STATIC
-VOID
-EFIAPI
-ValidateGtBlockTimerCount (
- IN UINT8* Ptr,
- IN VOID* Context
- )
-{
- UINT32 BlockTimerCount;
-
- BlockTimerCount = *(UINT32*)Ptr;
-
- if (BlockTimerCount > 8) {
- IncrementErrorCount ();
- Print (
- L"\nERROR: Timer Count = %d. Max Timer Count is 8.",
- BlockTimerCount
- );
- }
-}
-
-/**
- This function validates the GT Frame Number.
-
- @param [in] Ptr Pointer to the start of the field data.
- @param [in] Context Pointer to context specific information e.g. this
- could be a pointer to the ACPI table header.
-**/
-STATIC
-VOID
-EFIAPI
-ValidateGtFrameNumber (
- IN UINT8* Ptr,
- IN VOID* Context
- )
-{
- UINT8 FrameNumber;
-
- FrameNumber = *(UINT8*)Ptr;
-
- if (FrameNumber > 7) {
- IncrementErrorCount ();
- Print (
- L"\nERROR: GT Frame Number = %d. GT Frame Number must be in range 0-7.",
- FrameNumber
- );
- }
-}
-
-/**
This function parses the Platform GT Block.
@param [in] Ptr Pointer to the start of the GT Block data.