]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Fix constructor invocation ordering
authorSami Mujawar <sami.mujawar@arm.com>
Fri, 2 Oct 2020 21:14:01 +0000 (22:14 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 16 Oct 2020 17:21:04 +0000 (17:21 +0000)
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>
MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf

index 9cb50dd80d5634ab2aa6d68bf5ca7fb891463eef..10e053076a80bb86ae1d6dd88a663e15b98dddf5 100644 (file)
@@ -4,6 +4,7 @@
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
   Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
   Copyright (c) 2018, AMD Incorporated. All rights reserved.<BR>\r
+  Copyright (c) 2020, ARM Limited. All rights reserved.\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -1102,3 +1103,18 @@ SerialPortSetAttributes (
   return RETURN_SUCCESS;\r
 }\r
 \r
+/** Base Serial Port 16550 Library Constructor\r
+\r
+  @retval RETURN_SUCCESS  Success.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BaseSerialPortLib16550 (\r
+  VOID\r
+  )\r
+{\r
+  // Nothing to do here. This constructor is added to\r
+  // enable the chain of constructor invocation for\r
+  // dependent libraries.\r
+  return RETURN_SUCCESS;\r
+}\r
index 8b4ae3f1d4ee1e2e9a8b81eab4c900541ce8cfb6..92b7a8b7896a305d2ce22589f8a9593618d37bb7 100644 (file)
@@ -2,6 +2,8 @@
 #  SerialPortLib instance for 16550 UART.\r
 #\r
 #  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2020, ARM Limited. All rights reserved.\r
+#\r
 #  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
 ##\r
@@ -14,6 +16,7 @@
   MODULE_TYPE                    = BASE\r
   VERSION_STRING                 = 1.1\r
   LIBRARY_CLASS                  = SerialPortLib\r
+  CONSTRUCTOR                    = BaseSerialPortLib16550\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r