summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library
diff options
context:
space:
mode:
authorSami Mujawar <sami.mujawar@arm.com>2020-10-02 22:14:01 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-10-16 17:21:04 +0000
commit1c03498a25dede9cb24481c5e2b9dc0c463f8414 (patch)
tree2ed8b2ee0a8ebd6896c6ae6a9cb746f7b966ff25 /MdeModulePkg/Library
parent69f8ef04a8c30dee5775ea1e23a9f4edc7c0e41d (diff)
downloadedk2-1c03498a25dede9cb24481c5e2b9dc0c463f8414.tar.gz
edk2-1c03498a25dede9cb24481c5e2b9dc0c463f8414.tar.bz2
edk2-1c03498a25dede9cb24481c5e2b9dc0c463f8414.zip
MdeModulePkg: Fix constructor invocation ordering
The BaseSerialPortLib16550 library does not implement a constructor. This prevents the correct constructor invocation order for dependent libraries. e.g. A PlatformHookLib (for the Serial Port) may have a dependency on retrieving data from a Hob. A Hob library implementation may configure its initial state in the HobLib constructor. Since BaseSerialPortLib16550 does not implement a constructor, the Basetools do not resolve the correct order for constructor invocation. To fix this, add an empty constructor to the serial port library BaseSerialPortLib16550. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Acked-by: Ard Biesheuvel <Ard.Biesheuvel@arm.com> Acked-by: Hao A Wu <hao.a.wu@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r--MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c16
-rw-r--r--MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf3
2 files changed, 19 insertions, 0 deletions
diff --git a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
index 9cb50dd80d..10e053076a 100644
--- a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
+++ b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
@@ -4,6 +4,7 @@
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2018, AMD Incorporated. All rights reserved.<BR>
+ Copyright (c) 2020, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -1102,3 +1103,18 @@ SerialPortSetAttributes (
return RETURN_SUCCESS;
}
+/** Base Serial Port 16550 Library Constructor
+
+ @retval RETURN_SUCCESS Success.
+**/
+EFI_STATUS
+EFIAPI
+BaseSerialPortLib16550 (
+ VOID
+ )
+{
+ // Nothing to do here. This constructor is added to
+ // enable the chain of constructor invocation for
+ // dependent libraries.
+ return RETURN_SUCCESS;
+}
diff --git a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
index 8b4ae3f1d4..92b7a8b789 100644
--- a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
+++ b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
@@ -2,6 +2,8 @@
# SerialPortLib instance for 16550 UART.
#
# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2020, ARM Limited. All rights reserved.
+#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
@@ -14,6 +16,7 @@
MODULE_TYPE = BASE
VERSION_STRING = 1.1
LIBRARY_CLASS = SerialPortLib
+ CONSTRUCTOR = BaseSerialPortLib16550
[Packages]
MdePkg/MdePkg.dec