From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 53B5574003E for ; Tue, 7 May 2024 13:11:28 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=XaugPksz6cOXz6KKCpJz/V1dNSlQMcxviQj5FG0wREI=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20240206; t=1715087486; v=1; b=RMl9YQXPQ8SelcRmD/KyA+lzfleyNQ/wQicsF+RcT0jfqX+7MclLVXAHhW+RyHN50G7FcGLS 9fIZwAZ/3rWd1QAd8CpPSozkPZLzcjJr5PA2VteDD6M32V1veWLYaEHWJUqbYb2trfwyxeurp4k D1vCoO6X6UbTAf7t6dBvYoqoUVZHH9ofqNtgo5lEqiqQw5WafY3B8PAoX2F5BpUCG8ZtmqUHJ2Z hn5FM2JxF40u+UBiyP98gDl8zCWznwqFcOB9DhbgwhP8kwzxg8tE/PhlQw0AUKPHfuU2xcCu4Lw hxZdoL7nYFW0AWa57Qr5DrxS3XYPuRc1sZV8zXrIuq+1Q== X-Received: by 127.0.0.2 with SMTP id 1TbUYY7687511xKOqnHCot8J; Tue, 07 May 2024 06:11:26 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by mx.groups.io with SMTP id smtpd.web10.11250.1715087485876717440 for ; Tue, 07 May 2024 06:11:25 -0700 X-CSE-ConnectionGUID: Zk7VC4SfR1uYPk/L4/X17w== X-CSE-MsgGUID: GqVNV0LVSRizMLZreHXjcA== X-IronPort-AV: E=McAfee;i="6600,9927,11065"; a="21549009" X-IronPort-AV: E=Sophos;i="6.08,261,1712646000"; d="scan'208";a="21549009" X-Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2024 06:11:25 -0700 X-CSE-ConnectionGUID: Gftf092iTjCkNydaphRUPQ== X-CSE-MsgGUID: kXWVy2tkTFKT8cMKs9EGXw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,261,1712646000"; d="scan'208";a="59373655" X-Received: from unknown (HELO aborzesz-Virtual-Machine.igk.intel.com) ([10.91.48.212]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2024 06:11:24 -0700 From: "Borzeszkowski, Alan" To: devel@edk2.groups.io Cc: Alan Borzeszkowski , Zhichao Gao , Ray Ni , Michael D Kinney Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg: Load Serial driver in early DXE Date: Tue, 7 May 2024 15:09:40 +0200 Message-Id: <640b9bf1b87b9a47f43bc5f231540b8f64a75945.1715087162.git.alan.borzeszkowski@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Tue, 07 May 2024 06:11:26 -0700 Resent-From: alan.borzeszkowski@intel.com Reply-To: devel@edk2.groups.io,alan.borzeszkowski@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: f59Xk5XRzmFAzI5VpbOrhDfTx7686176AA= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=RMl9YQXP; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io For the purpose of UEFI debug prints enablement in early DXE, Serial driver should load earlier. To comply with EDK2 specification and maximize code reuse, new driver entrypoint was created and separate .inf file was added. Cc: Zhichao Gao Cc: Ray Ni Cc: Michael D Kinney Signed-off-by: Alan Borzeszkowski --- .../PciSioSerialDxe/PciSioSerialDxeEarly.inf | 81 ++++++++ MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c | 184 ++++++++++++++---- .../Bus/Pci/PciSioSerialDxe/SerialIo.c | 16 +- MdeModulePkg/MdeModulePkg.dsc | 1 + 4 files changed, 245 insertions(+), 37 deletions(-) create mode 100644 MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEar= ly.inf diff --git a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf = b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf new file mode 100644 index 0000000000..1b88f7a1cc --- /dev/null +++ b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf @@ -0,0 +1,81 @@ +## @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 P= CI I/O. +# +# This is Early DXE version of Serial driver. It's intended use is for deb= ug purposes +# in early DXE. There is added dependency on either Super I/O Protocol or = PCI I/O Protocol. +# +# Copyright (c) 2007 - 2024, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D PciSioSerialDxeEarly + MODULE_UNI_FILE =3D PciSioSerialDxe.uni + FILE_GUID =3D E47C4BFB-9CCC-47B6-A3C1-79C3FBF8B6C8 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D DxePciSioSerialDriverEntrypoint + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 EBC +# +# DRIVER_BINDING =3D gSerialControllerDriver +# COMPONENT_NAME =3D gPciSioSerialComponentName +# COMPONENT_NAME2 =3D gPciSioSerialComponentName2 +# + +[Sources] + ComponentName.c + SerialIo.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 ## CONS= UMES + +[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] + gEfiSioProtocolGuid OR gEfiPciIoProtocolGuid diff --git a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c b/MdeModulePkg/B= us/Pci/PciSioSerialDxe/Serial.c index 8b1ce70118..cc77d12748 100644 --- a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c +++ b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c @@ -156,6 +156,7 @@ InitializePciSioSerial ( /** Return whether the controller is a SIO serial controller. =20 + @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instan= ce. @param Controller The controller handle. =20 @retval EFI_SUCCESS The controller is a SIO serial controller. @@ -163,7 +164,8 @@ InitializePciSioSerial ( **/ EFI_STATUS IsSioSerialController ( - EFI_HANDLE Controller + IN EFI_DRIVER_BINDING_PROTOCOL *This, + EFI_HANDLE Controller ) { EFI_STATUS Status; @@ -178,7 +180,7 @@ IsSioSerialController ( Controller, &gEfiSioProtocolGuid, (VOID **)&Sio, - gSerialControllerDriver.DriverBindingHandle, + This->DriverBindingHandle, Controller, EFI_OPEN_PROTOCOL_BY_DRIVER ); @@ -193,7 +195,7 @@ IsSioSerialController ( gBS->CloseProtocol ( Controller, &gEfiSioProtocolGuid, - gSerialControllerDriver.DriverBindingHandle, + This->DriverBindingHandle, Controller ); =20 @@ -201,7 +203,7 @@ IsSioSerialController ( Controller, &gEfiDevicePathProtocolGuid, (VOID **)&DevicePath, - gSerialControllerDriver.DriverBindingHandle, + This->DriverBindingHandle, Controller, EFI_OPEN_PROTOCOL_BY_DRIVER ); @@ -228,7 +230,7 @@ IsSioSerialController ( gBS->CloseProtocol ( Controller, &gEfiDevicePathProtocolGuid, - gSerialControllerDriver.DriverBindingHandle, + This->DriverBindingHandle, Controller ); } @@ -239,14 +241,16 @@ IsSioSerialController ( /** Return whether the controller is a PCI serial controller. =20 - @param Controller The controller handle. + @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL ins= tance. + @param Controller The controller handle. =20 @retval EFI_SUCCESS The controller is a PCI serial controller. @retval others The controller is not a PCI serial controller. **/ EFI_STATUS IsPciSerialController ( - EFI_HANDLE Controller + IN EFI_DRIVER_BINDING_PROTOCOL *This, + EFI_HANDLE Controller ) { EFI_STATUS Status; @@ -262,7 +266,7 @@ IsPciSerialController ( Controller, &gEfiPciIoProtocolGuid, (VOID **)&PciIo, - gSerialControllerDriver.DriverBindingHandle, + This->DriverBindingHandle, Controller, EFI_OPEN_PROTOCOL_BY_DRIVER ); @@ -301,7 +305,7 @@ IsPciSerialController ( gBS->CloseProtocol ( Controller, &gEfiPciIoProtocolGuid, - gSerialControllerDriver.DriverBindingHandle, + This->DriverBindingHandle, Controller ); } @@ -317,7 +321,7 @@ IsPciSerialController ( Controller, &gEfiDevicePathProtocolGuid, (VOID **)&DevicePath, - gSerialControllerDriver.DriverBindingHandle, + This->DriverBindingHandle, Controller, EFI_OPEN_PROTOCOL_BY_DRIVER ); @@ -329,7 +333,7 @@ IsPciSerialController ( gBS->CloseProtocol ( Controller, &gEfiDevicePathProtocolGuid, - gSerialControllerDriver.DriverBindingHandle, + This->DriverBindingHandle, Controller ); =20 @@ -348,12 +352,11 @@ IsPciSerialController ( **/ EFI_STATUS EFIAPI -SerialControllerDriverSupported ( +SerialDriverSupported ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) - { EFI_STATUS Status; UART_DEVICE_PATH *Uart; @@ -393,17 +396,40 @@ SerialControllerDriverSupported ( } } =20 - Status =3D IsSioSerialController (Controller); + Status =3D IsSioSerialController (This, Controller); if (EFI_ERROR (Status)) { - Status =3D IsPciSerialController (Controller); + Status =3D IsPciSerialController (This, Controller); } =20 return Status; } =20 +/** + Check to see if this driver supports the given controller + + @param This A pointer to the EFI_DRIVER_BINDING_PROTOCO= L instance. + @param Controller The handle of the controller to test. + @param RemainingDevicePath A pointer to the remaining portion of a dev= ice path. + + @return EFI_SUCCESS This driver can support the given controlle= r + +**/ +EFI_STATUS +EFIAPI +SerialControllerDriverSupported ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ) + +{ + return SerialDriverSupported (This, Controller, RemainingDevicePath); +} + /** Create the child serial device instance. =20 + @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL= instance. @param Controller The parent controller handle. @param Uart Pointer to the UART device path node in Rema= iningDevicePath, or NULL if RemainingDevicePath is NULL. @@ -423,14 +449,15 @@ SerialControllerDriverSupported ( **/ EFI_STATUS CreateSerialDevice ( - IN EFI_HANDLE Controller, - IN UART_DEVICE_PATH *Uart, - IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath, - IN BOOLEAN CreateControllerNode, - IN UINT32 Instance, - IN PARENT_IO_PROTOCOL_PTR ParentIo, - IN PCI_SERIAL_PARAMETER *PciSerialParameter OPTIONAL, - IN PCI_DEVICE_INFO *PciDeviceInfo OPTIONAL + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN UART_DEVICE_PATH *Uart, + IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath, + IN BOOLEAN CreateControllerNode, + IN UINT32 Instance, + IN PARENT_IO_PROTOCOL_PTR ParentIo, + IN PCI_SERIAL_PARAMETER *PciSerialParameter OPTIONAL, + IN PCI_DEVICE_INFO *PciDeviceInfo OPTIONAL ) { EFI_STATUS Status; @@ -685,7 +712,7 @@ CreateSerialDevice ( Controller, PciSerialParameter !=3D NULL ? &gEfiPciIoProtocolGuid : = &gEfiSioProtocolGuid, (VOID **)&ParentIo, - gSerialControllerDriver.DriverBindingHandle, + This->DriverBindingHandle, SerialDevice->Handle, EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER ); @@ -720,6 +747,7 @@ CreateError: /** Returns an array of pointers containing all the child serial device poin= ters. =20 + @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL inst= ance. @param Controller The parent controller handle. @param IoProtocolGuid The protocol GUID, either equals to gEfiSioProtoc= olGuid or equals to gEfiPciIoProtocolGuid. @@ -729,9 +757,10 @@ CreateError: **/ SERIAL_DEV ** GetChildSerialDevices ( - IN EFI_HANDLE Controller, - IN EFI_GUID *IoProtocolGuid, - OUT UINTN *Count + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_GUID *IoProtocolGuid, + OUT UINTN *Count ) { EFI_STATUS Status; @@ -768,7 +797,7 @@ GetChildSerialDevices ( OpenInfoBuffer[Index].ControllerHandle, &gEfiSerialIoProtocolGuid, (VOID **)&SerialIo, - gSerialControllerDriver.DriverBindingHandle, + This->DriverBindingHandle, Controller, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); @@ -778,7 +807,7 @@ GetChildSerialDevices ( } =20 if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != =3D 0) { - ASSERT (OpenInfoBuffer[Index].AgentHandle =3D=3D gSerialControllerDr= iver.DriverBindingHandle); + ASSERT (OpenInfoBuffer[Index].AgentHandle =3D=3D This->DriverBinding= Handle); OpenByDriver =3D TRUE; } } @@ -793,7 +822,7 @@ GetChildSerialDevices ( } =20 /** - Start to management the controller passed in + Start to manage the controller passed in =20 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCO= L instance. @param Controller The handle of the controller to test. @@ -803,7 +832,7 @@ GetChildSerialDevices ( **/ EFI_STATUS EFIAPI -SerialControllerDriverStart ( +SerialDriverStart ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath @@ -890,7 +919,7 @@ SerialControllerDriverStart ( =20 ControllerNumber =3D 0; ContainsControllerNode =3D FALSE; - SerialDevices =3D GetChildSerialDevices (Controller, IoProtocol= Guid, &SerialDeviceCount); + SerialDevices =3D GetChildSerialDevices (This, Controller, IoPr= otocolGuid, &SerialDeviceCount); =20 if (SerialDeviceCount !=3D 0) { if (RemainingDevicePath =3D=3D NULL) { @@ -991,7 +1020,7 @@ SerialControllerDriverStart ( Node =3D NextDevicePathNode (Node); } while (!IsDevicePathEnd (Node)); =20 - Status =3D CreateSerialDevice (Controller, Uart, ParentDevicePath, F= ALSE, Acpi->UID, ParentIo, NULL, NULL); + Status =3D CreateSerialDevice (This, Controller, Uart, ParentDeviceP= ath, FALSE, Acpi->UID, ParentIo, NULL, NULL); DEBUG ((DEBUG_INFO, "PciSioSerial: Create SIO child serial device - = %r\n", Status)); } } else { @@ -1073,7 +1102,7 @@ SerialControllerDriverStart ( PciSerialParameter =3D PcdGetPtr (PcdPciSerialParameters); } =20 - Status =3D CreateSerialDevice (Controller, Uart, ParentDevicePat= h, FALSE, 0, ParentIo, PciSerialParameter, PciDeviceInfo); + Status =3D CreateSerialDevice (This, Controller, Uart, ParentDev= icePath, FALSE, 0, ParentIo, PciSerialParameter, PciDeviceInfo); DEBUG ((DEBUG_INFO, "PciSioSerial: Create PCI child serial devic= e (single) - %r\n", Status)); if (!EFI_ERROR (Status)) { PciDeviceInfo->ChildCount++; @@ -1094,7 +1123,7 @@ SerialControllerDriverStart ( // // Create controller node when PCI serial device contains mu= ltiple UARTs // - Status =3D CreateSerialDevice (Controller, Uart, ParentDevic= ePath, TRUE, PciSerialCount, ParentIo, PciSerialParameter, PciDeviceInfo); + Status =3D CreateSerialDevice (This, Controller, Uart, Paren= tDevicePath, TRUE, PciSerialCount, ParentIo, PciSerialParameter, PciDeviceI= nfo); PciSerialCount++; DEBUG ((DEBUG_INFO, "PciSioSerial: Create PCI child serial d= evice (multiple) - %r\n", Status)); if (!EFI_ERROR (Status)) { @@ -1147,6 +1176,91 @@ SerialControllerDriverStart ( return Status; } =20 +/** + Start to manage the controller passed in + + @param This A pointer to the EFI_DRIVER_BINDING_PROTOCO= L instance. + @param Controller The handle of the controller to test. + @param RemainingDevicePath A pointer to the remaining portion of a dev= ice path. + + @return EFI_SUCCESS Driver is started successfully +**/ +EFI_STATUS +EFIAPI +SerialControllerDriverStart ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ) +{ + return SerialDriverStart (This, Controller, RemainingDevicePath); +} + +/** + Initialize Serial driver in DXE phase + + @param ImageHandle Handle for the image of this driver. + @param SystemTable Pointer to the EFI System Table. + + @return EFI_SUCCESS Driver is started successfully +**/ +EFI_STATUS +EFIAPI +DxePciSioSerialDriverEntrypoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_DEVICE_PATH_PROTOCOL *EfiDevicePath; + EFI_HANDLE *HandleBuffer; + UINTN NumberOfHandles; + EFI_DRIVER_BINDING_PROTOCOL *SerialControllerDriver; + UINTN Index; + + EfiDevicePath =3D NULL; + HandleBuffer =3D NULL; + // + // Initialize the serial controller instance + // + SerialControllerDriver =3D AllocateCopyPool (sizeof (EFI_DRIVER_BINDING_= PROTOCOL), &gSerialControllerDriver); + ASSERT (SerialControllerDriver !=3D NULL); + + SerialControllerDriver->DriverBindingHandle =3D ImageHandle; + // + // Initialize UART default setting in gSerialDevTemplate + // + gSerialDevTemplate.SerialMode.BaudRate =3D PcdGet64 (PcdUartDefaultB= audRate); + gSerialDevTemplate.SerialMode.DataBits =3D PcdGet8 (PcdUartDefaultDa= taBits); + gSerialDevTemplate.SerialMode.Parity =3D PcdGet8 (PcdUartDefaultPa= rity); + gSerialDevTemplate.SerialMode.StopBits =3D PcdGet8 (PcdUartDefaultSt= opBits); + gSerialDevTemplate.UartDevicePath.BaudRate =3D PcdGet64 (PcdUartDefaultB= audRate); + gSerialDevTemplate.UartDevicePath.DataBits =3D PcdGet8 (PcdUartDefaultDa= taBits); + gSerialDevTemplate.UartDevicePath.Parity =3D PcdGet8 (PcdUartDefaultPa= rity); + gSerialDevTemplate.UartDevicePath.StopBits =3D PcdGet8 (PcdUartDefaultSt= opBits); + gSerialDevTemplate.ClockRate =3D PcdGet32 (PcdSerialClockR= ate); + + // Check all handles for compatible Device Path and appropriate I/O Prot= ocol + Status =3D gBS->LocateHandleBuffer (ByProtocol, &gEfiDevicePathProtocolG= uid, NULL, &NumberOfHandles, &HandleBuffer); + if (EFI_ERROR (Status)) { + return Status; + } + + for (Index =3D 0; Index < NumberOfHandles; Index++) { + EfiDevicePath =3D DevicePathFromHandle (HandleBuffer[Index]); + Status =3D SerialDriverSupported (SerialControllerDriver, Handl= eBuffer[Index], EfiDevicePath); + DEBUG ((DEBUG_INFO, "SerialDriverSupported status: %r\n", Status)); + if (EFI_ERROR (Status)) { + continue; + } + + Status =3D SerialDriverStart (SerialControllerDriver, HandleBuffer[Ind= ex], EfiDevicePath); + DEBUG ((DEBUG_INFO, "SerialDriverStart status: %r\n", Status)); + } + + return EFI_SUCCESS; +} + /** Disconnect this driver with the controller, uninstall related protocol i= nstance =20 diff --git a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/SerialIo.c b/MdeModulePkg= /Bus/Pci/PciSioSerialDxe/SerialIo.c index 8a85a6c3b8..c052d43b84 100644 --- a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/SerialIo.c +++ b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/SerialIo.c @@ -1367,7 +1367,13 @@ SerialReadRegister ( EFI_STATUS Status; =20 if (SerialDev->PciDeviceInfo =3D=3D NULL) { - return IoRead8 ((UINTN)SerialDev->BaseAddress + Offset * SerialDev->Re= gisterStride); + if (SerialDev->MmioAccess) + { + return MmioRead8((UINTN)SerialDev->BaseAddress + Offset * SerialDev-= >RegisterStride); + } + else { + return IoRead8 ((UINTN)SerialDev->BaseAddress + Offset * SerialDev->= RegisterStride); + } } else { if (SerialDev->MmioAccess) { Status =3D SerialDev->PciDeviceInfo->PciIo->Mem.Read ( @@ -1411,7 +1417,13 @@ SerialWriteRegister ( EFI_STATUS Status; =20 if (SerialDev->PciDeviceInfo =3D=3D NULL) { - IoWrite8 ((UINTN)SerialDev->BaseAddress + Offset * SerialDev->Register= Stride, Data); + if (SerialDev->MmioAccess) + { + MmioWrite8((UINTN)SerialDev->BaseAddress + Offset * SerialDev->Regis= terStride, Data); + } + else { + IoWrite8 ((UINTN)SerialDev->BaseAddress + Offset * SerialDev->Regist= erStride, Data); + } } else { if (SerialDev->MmioAccess) { Status =3D SerialDev->PciDeviceInfo->PciIo->Mem.Write ( diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index c0f1df3bfb..b209fe2696 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -240,6 +240,7 @@ =20 MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf + MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxeEarly.inf MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDevi= ceSupportDxe.inf MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf --=20 2.34.1 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydz= ial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-31= 6 | Kapital zakladowy 200.000 PLN. Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu usta= wy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w trans= akcjach handlowych. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata= i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wi= adomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiek= olwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). If you are not the intended recipient= , please contact the sender and delete all copies; any review or distributi= on by others is strictly prohibited. -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118644): https://edk2.groups.io/g/devel/message/118644 Mute This Topic: https://groups.io/mt/105959587/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-