public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: "Borzeszkowski, Alan" <alan.borzeszkowski@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Albecki, Mateusz" <mateusz.albecki@intel.com>,
	"Gao, Zhichao" <zhichao.gao@intel.com>,
	"Ni, Ray" <ray.ni@intel.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/1] MdeModulePkg: Load Serial driver earlier in DXE
Date: Wed, 21 Feb 2024 20:59:30 +0000	[thread overview]
Message-ID: <SJ0PR11MB49440328C372C17C70894482D2572@SJ0PR11MB4944.namprd11.prod.outlook.com> (raw)
In-Reply-To: <MN0PR11MB59866A6AD618C2572ACEC91888572@MN0PR11MB5986.namprd11.prod.outlook.com>

DXE env is not UEFI conformant.  UEFI Drivers can not be executed
until the UEFI env is fully established which is at end of DXE
after all DXE Arch Protocols are produced and DXE Core supports the
full set of requires UEFI services. Running a UEFI Driver or UEFI
Application before all DXE Arch Protocols are produced has many 
risks. 

What do you mean by "UEFI Debug Prints" in the patch?  What service 
is being used to print and what components in DXE Phase before BDS
are using a UEFI print service?

I may have incorrectly assumed that "UEFI Debug Print" was the 
use of DEBUG() macro.

Mike

> -----Original Message-----
> From: Borzeszkowski, Alan <alan.borzeszkowski@intel.com>
> Sent: Wednesday, February 21, 2024 9:16 AM
> To: Kinney, Michael D <michael.d.kinney@intel.com>;
> devel@edk2.groups.io
> Cc: Albecki, Mateusz <mateusz.albecki@intel.com>; Gao, Zhichao
> <zhichao.gao@intel.com>; Ni, Ray <ray.ni@intel.com>
> Subject: RE: [edk2-devel] [PATCH 1/1] MdeModulePkg: Load Serial driver
> earlier in DXE
> 
> > It does not make sense to have a UEFI Driver active in early DXE
> because it will not be connected yet and has dependencies on other UEFI
> drivers that will not be connected yet.
> 
> With suggested change, we connect to this driver successfully in early
> DXE using ConnectController(). We did not observe any issues when
> Serial driver came online, debug messages are printed and console
> redirection works just fine.
> 
> > Did you consider the use of the SerialPortLib for early DXE that can
> use PCI serial devices with PcdSerialPciDeviceInfo that can be used for
> DEBUG() messages.
> 
> That's the opposite of what we are trying to accomplish, this way
> additional maintenance cost is required and on top of that, management
> of PCI device from library level is complicated (e.g., checking device
> state).
> 
> > The other option is to map the PCI UART into Report Status Code.
> 
> Could you elaborate on that?
> 
> Also, could you please explain why DXE drivers cannot use Driver
> Binding?
> 
> Regards,
> Alan
> 
> 
> 
> -----Original Message-----
> From: Kinney, Michael D <michael.d.kinney@intel.com>
> Sent: Tuesday, February 20, 2024 6:12 PM
> To: devel@edk2.groups.io; Borzeszkowski, Alan
> <alan.borzeszkowski@intel.com>
> Cc: Albecki, Mateusz <mateusz.albecki@intel.com>; Gao, Zhichao
> <zhichao.gao@intel.com>; Ni, Ray <ray.ni@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>
> Subject: RE: [edk2-devel] [PATCH 1/1] MdeModulePkg: Load Serial driver
> earlier in DXE
> 
> This is a UEFI Driver that depends on the Driver Binding Protocol and
> use of ConnectController(). These drivers cannot be used until the BDS
> phase when the active consoles and boot devices are evaluated and the
> smallest set of drivers required to boot are connected.
> 
> It does not make sense to have a UEFI Driver active in early DXE
> because it will not be connected yet and has dependencies on other UEFI
> drivers that will not be connected yet.
> 
> Did you consider the use of the SerialPortLib for early DXE that can
> use PCI serial devices with PcdSerialPciDeviceInfo that can be used for
> DEBUG() messages.
> 
> The other option is to map the PCI UART into Report Status Code.
> 
> Best regards,
> 
> Mike
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> > Borzeszkowski, Alan
> > Sent: Tuesday, February 20, 2024 4:11 AM
> > To: devel@edk2.groups.io
> > Cc: Albecki, Mateusz <mateusz.albecki@intel.com>; Gao, Zhichao
> > <zhichao.gao@intel.com>; Ni, Ray <ray.ni@intel.com>; Borzeszkowski,
> > Alan <alan.borzeszkowski@intel.com>
> > Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg: Load Serial driver
> > earlier in DXE
> >
> > For the purpose of UEFI debug prints enablement in DXE phase, Serial
> > driver should load earlier. Separate .inf file is created in order to
> > make minimal changes to current implementation.
> >
> > Signed-off-by: Alan Borzeszkowski <alan.borzeszkowski@intel.com>
> > ---
> >  .../PciSioSerialDxe/PciSioSerialDxeEarly.inf  | 80
> > +++++++++++++++++++
> >  1 file changed, 80 insertions(+)
> >  create mode 100644
> > MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf
> >
> > diff --git
> > a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf
> > b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf
> > new file mode 100644
> > index 0000000000..2ead654898
> > --- /dev/null
> > +++ b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf
> > @@ -0,0 +1,80 @@
> > +## @file
> > +# Serial driver for standard UARTS on a SIO chip or PCI/PCIE card.
> > +#
> > +# Produces the Serial I/O protocol for standard UARTS using Super
> I/O
> > or PCI I/O.
> > +# This version is used shortly after DXE Core is invoked # #
> > +Copyright (c) 2007 - 2018, Intel Corporation. All rights
> > reserved.<BR>
> > +#
> > +# SPDX-License-Identifier: BSD-2-Clause-Patent # ##
> > +
> > +[Defines]
> > +  INF_VERSION                    = 0x00010005
> > +  BASE_NAME                      = PciSioSerialDxeEarly
> > +  MODULE_UNI_FILE                = PciSioSerialDxe.uni
> > +  FILE_GUID                      = 8BCC425E-585F-4E66-ADA5-
> > FEA9A635F911
> > +  MODULE_TYPE                    = DXE_DRIVER
> > +  VERSION_STRING                 = 1.0
> > +  ENTRY_POINT                    = InitializePciSioSerial
> > +
> > +#
> > +# The following information is for reference only and not required
> by
> > the build tools.
> > +#
> > +#  VALID_ARCHITECTURES           = IA32 X64 EBC
> > +#
> > +#  DRIVER_BINDING                =  gSerialControllerDriver
> > +#  COMPONENT_NAME                =  gPciSioSerialComponentName
> > +#  COMPONENT_NAME2               =  gPciSioSerialComponentName2
> > +#
> > +
> > +[Sources]
> > +  ComponentName.c
> > +  SerialIo.c
> > +  SerialIoCommon.c
> > +  Serial.h
> > +  Serial.c
> > +
> > +[Packages]
> > +  MdePkg/MdePkg.dec
> > +  MdeModulePkg/MdeModulePkg.dec
> > +
> > +[LibraryClasses]
> > +  PcdLib
> > +  ReportStatusCodeLib
> > +  UefiBootServicesTableLib
> > +  MemoryAllocationLib
> > +  BaseMemoryLib
> > +  DevicePathLib
> > +  UefiLib
> > +  UefiDriverEntryPoint
> > +  DebugLib
> > +  IoLib
> > +
> > +[Guids]
> > +  gEfiUartDevicePathGuid                        ##
> SOMETIMES_CONSUMES
> > ## GUID
> > +
> > +[Protocols]
> > +  gEfiSioProtocolGuid                           ## TO_START
> > +  gEfiDevicePathProtocolGuid                    ## TO_START
> > +  gEfiPciIoProtocolGuid                         ## TO_START
> > +  gEfiSerialIoProtocolGuid                      ## BY_START
> > +  gEfiDevicePathProtocolGuid                    ## BY_START
> > +
> > +[FeaturePcd]
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHalfHandshake|FALSE
> ##
> > CONSUMES
> > +
> > +[Pcd]
> > +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200    ##
> > CONSUMES
> > +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|8         ##
> > CONSUMES
> > +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|1           ##
> > CONSUMES
> > +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits|1         ##
> > CONSUMES
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|1843200 ##
> > CONSUMES
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdPciSerialParameters     ##
> > CONSUMES
> > +
> > +[UserExtensions.TianoCore."ExtraFiles"]
> > +  PciSioSerialDxeExtra.uni
> > +
> > +[Depex]
> > +  TRUE
> > --
> > 2.34.1
> >
> > ---------------------------------------------------------------------
> > Intel Technology Poland sp. z o.o.
> > ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc |
> VII
> > Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP
> > 957-
> > 07-52-316 | Kapital zakladowy 200.000 PLN.
> > Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w
> rozumieniu
> > ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym
> > opoznieniom w transakcjach handlowych.
> >
> > Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego
> > adresata i moze zawierac informacje poufne. W razie przypadkowego
> > otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz
> trwale
> > jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest
> > zabronione.
> > This e-mail and any attachments may contain confidential material for
> > the sole use of the intended recipient(s). If you are not the
> intended
> > recipient, please contact the sender and delete all copies; any
> review
> > or distribution by others is strictly prohibited.
> >
> >
> >
> > 
> >



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115742): https://edk2.groups.io/g/devel/message/115742
Mute This Topic: https://groups.io/mt/104469297/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2024-02-21 20:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 12:10 [edk2-devel] [PATCH 0/1] EDK2 Serial driver UART debug print enablement Borzeszkowski, Alan
2024-02-20 12:10 ` [edk2-devel] [PATCH 1/1] MdeModulePkg: Load Serial driver earlier in DXE Borzeszkowski, Alan
2024-02-20 17:11   ` Michael D Kinney
2024-02-21 17:15     ` Borzeszkowski, Alan
2024-02-21 20:59       ` Michael D Kinney [this message]
2024-02-21 21:59       ` Laszlo Ersek
2024-02-23 15:50         ` Albecki, Mateusz
2024-02-23 22:30           ` Michael D Kinney
2024-02-25 16:18           ` Laszlo Ersek
2024-02-25 16:31             ` Laszlo Ersek
2024-02-26 15:13               ` Albecki, Mateusz
2024-02-26 15:37                 ` Laszlo Ersek
2024-02-27 17:15                   ` Albecki, Mateusz
2024-02-28 10:12                     ` Laszlo Ersek
2024-02-28 16:27                       ` Albecki, Mateusz
2024-02-29  7:48                         ` Laszlo Ersek

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=SJ0PR11MB49440328C372C17C70894482D2572@SJ0PR11MB4944.namprd11.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