public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pankaj Bansal" <pankaj.bansal@nxp.com>
To: "'Ni, Ray'" <ray.ni@intel.com>,
	'Ard Biesheuvel' <ard.biesheuvel@linaro.org>,
	'Leif Lindholm' <leif@nuviainc.com>
Cc: "'Jiang, Guomin'" <guomin.jiang@intel.com>,
	"'devel@edk2.groups.io'" <devel@edk2.groups.io>,
	"'Wang, Jian J'" <jian.j.wang@intel.com>,
	"'Wu, Hao A'" <hao.a.wu@intel.com>,
	"'Ma, Maurice'" <maurice.ma@intel.com>,
	"'Dong, Guo'" <guo.dong@intel.com>,
	"'You, Benjamin'" <benjamin.you@intel.com>,
	Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>,
	Varun Sethi <V.Sethi@nxp.com>,
	'Samer El-Haj-Mahmoud' <Samer.El-Haj-Mahmoud@arm.com>,
	"Pankaj Bansal (OSS)" <pankaj.bansal@oss.nxp.com>
Subject: Re: [edk2-devel] [PATCH 1/1] MdeModulePkg: UART Dynamic clock freq Support
Date: Sat, 11 Apr 2020 11:54:57 +0000	[thread overview]
Message-ID: <VI1PR04MB5933DA54C01484D294227A64F1DF0@VI1PR04MB5933.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C4CD51C@SHSMSX104.ccr.corp.intel.com>

> 
> Leif,
> Please understand that the concern of this change is all the platforms that uses
> this serial port lib must be changed otherwise build breaks.
> 
> Ard,
> Using Guided HOB sounds a good idea to me: )
> The benefits of using HOB is:
>   Length field in the HOB header can be used for extension if more parameters
> are needed.

This sounds really appealing to me as well. Because in the past we had received request
from our customers about changing the UART baud rate in production system, without
having to recompile the firmware.
Up until now, the only method we have is UEFI shell, whose changes would take effect
after BDS phase. With GUID HOB, we can update the baud rate as early as PEI phase.

>   DXE can have the HOB access as well.
> 
> EFI_SEC_HOB_DATA_PPI can be used to return the new Guided HOB from SEC
> phase if needed.

So I made changes that pass EFI_SEC_HOB_DATA_PPI from SEC to PEI core.
I had to remove SerialPortInitialize call from SEC phase, as in SEC phase we don't have HOB support.

I am able to get the clock in PEI phase. However this fails in DXE phase.
This is happening because the dependency of SerialPortConstructor on HobLibConstructor.
This is the Autogen.h file of PcdDxe:

VOID
EFIAPI
ProcessLibraryConstructorList (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE  *SystemTable
  )
{
  EFI_STATUS  Status;

  Status = BaseDebugLibSerialPortConstructor ();
  ASSERT_RETURN_ERROR (Status);

  Status = UefiBootServicesTableLibConstructor (ImageHandle, SystemTable);
  ASSERT_EFI_ERROR (Status);

  Status = UefiRuntimeServicesTableLibConstructor (ImageHandle, SystemTable);
  ASSERT_EFI_ERROR (Status);

  Status = UefiLibConstructor (ImageHandle, SystemTable);
  ASSERT_EFI_ERROR (Status);

  Status = HobLibConstructor (ImageHandle, SystemTable);
  ASSERT_EFI_ERROR (Status);

}

As you can see, the SerialPortConstructor is called first, which tries to retrieve the Guided HOB.
This in turn calls the EfiGetSystemConfigurationTable(&gEfiHobListGuid, &mHobList),
Which relies on gST pointer being set. Which would be set in UefiBootServicesTableLibConstructor.
How can we ensure that the SerialPortConstructor is called after HobLibConstructor ?

> 
> Thanks,
> Ray
> 

      parent reply	other threads:[~2020-04-11 11:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19 13:31 [PATCH 0/1] UART Dynamic clock freq Support Pankaj Bansal
2020-02-19 13:31 ` [PATCH 1/1] MdeModulePkg: " Pankaj Bansal
2020-03-19 13:40   ` [edk2-devel] " Samer El-Haj-Mahmoud
2020-03-19 15:09   ` Ni, Ray
2020-03-19 15:30     ` Leif Lindholm
2020-03-23  5:31       ` Pankaj Bansal
2020-03-26 14:13         ` [edk2-devel] " Guomin Jiang
2020-03-28 12:36           ` Pankaj Bansal
2020-03-30  1:20             ` Guomin Jiang
2020-03-30  7:35               ` Leif Lindholm
2020-03-30  7:44                 ` Ard Biesheuvel
2020-03-31  1:53                   ` Ni, Ray
2020-03-31  9:22                     ` [edk2-devel] API breakages and their implications. Was: " Leif Lindholm
2020-03-31 12:11                       ` Ni, Ray
2020-03-31 12:59                         ` Leif Lindholm
2020-03-31 13:23                       ` Laszlo Ersek
2020-04-01 12:55                         ` Leif Lindholm
2020-04-11 11:54                     ` Pankaj Bansal [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=VI1PR04MB5933DA54C01484D294227A64F1DF0@VI1PR04MB5933.eurprd04.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