[edk2-devel] [PATCH v1 1/8] ShellPkg: acpiview: RSDP: Remove redundant forward declarations
Krzysztof Koch
krzysztof.koch at arm.com
Thu Jul 18 10:04:55 UTC 2019
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.
Signed-off-by: Krzysztof Koch <krzysztof.koch at arm.com>
---
Notes:
v1:
- remove redundant forward function declarations [Krzysztof]
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c | 116 ++++++++------------
1 file changed, 43 insertions(+), 73 deletions(-)
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
index 586de7cbfb12f856c0c735b6e295c1cc32eb2ceb..4bf928139a507d0b8f203ed0cbf0863cc2ec5de5 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
@@ -1,7 +1,7 @@
/** @file
RSDP table parser
- Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -28,7 +28,27 @@ EFIAPI
ValidateRsdtAddress (
IN UINT8* Ptr,
IN VOID* Context
- );
+ )
+{
+#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+ // Reference: Server Base Boot Requirements System Software on ARM Platforms
+ // Section: 4.2.1.1 RSDP
+ // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
+ // - Within the RSDP, the RsdtAddress field must be null (zero) and the
+ // XsdtAddresss MUST be a valid, non-null, 64-bit value.
+ UINT32 RsdtAddr;
+
+ RsdtAddr = *(UINT32*)Ptr;
+
+ if (RsdtAddr != 0) {
+ IncrementErrorCount ();
+ Print (
+ L"\nERROR: Rsdt Address = 0x%p. This must be NULL on ARM Platforms.",
+ RsdtAddr
+ );
+ }
+#endif
+}
/**
This function validates the XSDT Address.
@@ -43,7 +63,27 @@ EFIAPI
ValidateXsdtAddress (
IN UINT8* Ptr,
IN VOID* Context
- );
+ )
+{
+#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
+ // Reference: Server Base Boot Requirements System Software on ARM Platforms
+ // Section: 4.2.1.1 RSDP
+ // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
+ // - Within the RSDP, the RsdtAddress field must be null (zero) and the
+ // XsdtAddresss MUST be a valid, non-null, 64-bit value.
+ UINT64 XsdtAddr;
+
+ XsdtAddr = *(UINT64*)Ptr;
+
+ if (XsdtAddr == 0) {
+ IncrementErrorCount ();
+ Print (
+ L"\nERROR: Xsdt Address = 0x%p. This must not be NULL on ARM Platforms.",
+ XsdtAddr
+ );
+ }
+#endif
+}
/**
An array describing the ACPI RSDP Table.
@@ -61,76 +101,6 @@ STATIC CONST ACPI_PARSER RsdpParser[] = {
{L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}
};
-/**
- This function validates the RSDT Address.
-
- @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
-ValidateRsdtAddress (
- IN UINT8* Ptr,
- IN VOID* Context
- )
-{
-#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
- // Reference: Server Base Boot Requirements System Software on ARM Platforms
- // Section: 4.2.1.1 RSDP
- // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
- // - Within the RSDP, the RsdtAddress field must be null (zero) and the
- // XsdtAddresss MUST be a valid, non-null, 64-bit value.
- UINT32 RsdtAddr;
-
- RsdtAddr = *(UINT32*)Ptr;
-
- if (RsdtAddr != 0) {
- IncrementErrorCount ();
- Print (
- L"\nERROR: Rsdt Address = 0x%p. This must be NULL on ARM Platforms.",
- RsdtAddr
- );
- }
-#endif
-}
-
-/**
- This function validates the XSDT Address.
-
- @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
-ValidateXsdtAddress (
- IN UINT8* Ptr,
- IN VOID* Context
- )
-{
-#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
- // Reference: Server Base Boot Requirements System Software on ARM Platforms
- // Section: 4.2.1.1 RSDP
- // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
- // - Within the RSDP, the RsdtAddress field must be null (zero) and the
- // XsdtAddresss MUST be a valid, non-null, 64-bit value.
- UINT64 XsdtAddr;
-
- XsdtAddr = *(UINT64*)Ptr;
-
- if (XsdtAddr == 0) {
- IncrementErrorCount ();
- Print (
- L"\nERROR: Xsdt Address = 0x%p. This must not be NULL on ARM Platforms.",
- XsdtAddr
- );
- }
-#endif
-}
-
/**
This function parses the ACPI RSDP table.
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#43926): https://edk2.groups.io/g/devel/message/43926
Mute This Topic: https://groups.io/mt/32513485/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list