public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sami Mujawar" <sami.mujawar@arm.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	Hao A Wu <hao.a.wu@intel.com>, Ray Ni <ray.ni@intel.com>,
	"jian.j.wang@intel.com" <jian.j.wang@intel.com>,
	"hao.a.wu@intel.com" <hao.a.wu@intel.com>
Cc: Ard Biesheuvel <Ard.Biesheuvel@arm.com>,
	"leif@nuviainc.com" <leif@nuviainc.com>,
	"lersek@redhat.com" <lersek@redhat.com>,
	Alexandru Elisei <Alexandru.Elisei@arm.com>,
	Andre Przywara <Andre.Przywara@arm.com>,
	Matteo Carlini <Matteo.Carlini@arm.com>,
	Laura Moretta <Laura.Moretta@arm.com>, nd <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH v4 07/15] MdeModulePkg: Fix constructor invocation ordering
Date: Fri, 10 Jul 2020 17:34:15 +0000	[thread overview]
Message-ID: <DB7PR08MB30970677D02C9928E0D6719984650@DB7PR08MB3097.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <161F794363CF42EE.6803@groups.io>

Hi Hao, Jian,

Can you let me know your feedback for this patch, please?
Previous discussion on this patch can be seen at https://edk2.groups.io/g/devel/topic/75081484

Regards,

Sami Mujawar

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sami Mujawar via groups.io
Sent: 07 July 2020 01:48 PM
To: devel@edk2.groups.io
Cc: Sami Mujawar <Sami.Mujawar@arm.com>; Ard Biesheuvel <Ard.Biesheuvel@arm.com>; leif@nuviainc.com; lersek@redhat.com; jian.j.wang@intel.com; hao.a.wu@intel.com; Alexandru Elisei <Alexandru.Elisei@arm.com>; Andre Przywara <Andre.Przywara@arm.com>; Matteo Carlini <Matteo.Carlini@arm.com>; Laura Moretta <Laura.Moretta@arm.com>; nd <nd@arm.com>
Subject: [edk2-devel] [PATCH v4 07/15] 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>
---

Notes:
    v4:
      - No code change, resending patch with v4 series.               [Sami]
        Ref: https://edk2.groups.io/g/devel/topic/75081484

 MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c   | 17 +++++++++++++++++
 MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf |  3 +++
 2 files changed, 20 insertions(+)

diff --git a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
index 9cb50dd80d5634ab2aa6d68bf5ca7fb891463eef..0fd1382ee83c9de09d8250830bd9569056fcee2f 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,19 @@ 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 8b4ae3f1d4ee1e2e9a8b81eab4c900541ce8cfb6..92b7a8b7896a305d2ce22589f8a9593618d37bb7 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 @@ [Defines]
   MODULE_TYPE                    = BASE
   VERSION_STRING                 = 1.1
   LIBRARY_CLASS                  = SerialPortLib
+  CONSTRUCTOR                    = BaseSerialPortLib16550
 
 [Packages]
   MdePkg/MdePkg.dec
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'





      parent reply	other threads:[~2020-07-10 17:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 12:47 [PATCH v4 00/15] Kvmtool guest firmware support for Arm Sami Mujawar
2020-07-07 12:47 ` [PATCH v4 01/15] PcAtChipsetPkg: Add MMIO Support to RTC driver Sami Mujawar
2020-07-07 13:16   ` Ard Biesheuvel
2020-07-09 11:37     ` Sami Mujawar
2020-07-07 12:47 ` [PATCH v4 02/15] ArmVirtPkg: Add Kvmtool RTC Fdt Client Library Sami Mujawar
2020-07-07 13:19   ` Ard Biesheuvel
2020-07-09 11:34     ` [edk2-devel] " Sami Mujawar
2020-07-07 12:47 ` [PATCH v4 03/15] ArmPlatformPkg: Dynamic flash variable base Sami Mujawar
2020-07-07 12:47 ` [PATCH v4 04/15] ArmVirtPkg: Add kvmtool platform driver Sami Mujawar
2020-07-07 13:22   ` Ard Biesheuvel
2020-07-07 12:47 ` [PATCH v4 05/15] ArmVirtPkg: kvmtool platform memory map Sami Mujawar
2020-07-07 12:48 ` [PATCH v4 06/15] ArmVirtPkg: Add Kvmtool NOR flash lib Sami Mujawar
2020-07-07 13:26   ` Ard Biesheuvel
2020-07-07 12:48 ` [PATCH v4 07/15] MdeModulePkg: Fix constructor invocation ordering Sami Mujawar
2020-07-07 12:48 ` [PATCH v4 08/15] ArmVirtPkg: GUID Hob for 16550 UART base address Sami Mujawar
2020-07-07 12:48 ` [PATCH v4 09/15] ArmVirtPkg: 16550 UART Platform hook library Sami Mujawar
2020-07-07 12:48 ` [PATCH v4 10/15] ArmVirtPkg: Add Kvmtool Platform Pei Lib Sami Mujawar
2020-07-07 12:48 ` [PATCH v4 11/15] ArmVirtPkg: Support for kvmtool virtual platform Sami Mujawar
2020-07-07 13:27   ` Ard Biesheuvel
2020-07-07 12:48 ` [PATCH v4 12/15] ArmVirtPkg: Package dependency for MC146818 RTC Sami Mujawar
2020-07-07 12:48 ` [PATCH v4 13/15] ArmVirtPkg: Add kvmtool to package dictionary Sami Mujawar
2020-07-07 12:48 ` [PATCH v4 14/15] .python/SpellCheck: Add 'XIPFLAGS' to "words" section Sami Mujawar
2020-07-07 13:28   ` Ard Biesheuvel
2020-07-07 12:48 ` [PATCH v4 15/15] Maintainer.txt: Add Kvmtool platform reviewer Sami Mujawar
     [not found] ` <161F794363CF42EE.6803@groups.io>
2020-07-10 17:34   ` Sami Mujawar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB7PR08MB30970677D02C9928E0D6719984650@DB7PR08MB3097.eurprd08.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox