public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] console redirect after the shell is loaded
@ 2020-10-20  2:21 Heng Luo
  2020-10-20  2:21 ` [PATCH 1/2] BoardModulePkg: Add SerialPortTerminalLib Heng Luo
  2020-10-20  2:21 ` [PATCH 2/2] UpXtreme: console redirect after the shell is loaded Heng Luo
  0 siblings, 2 replies; 5+ messages in thread
From: Heng Luo @ 2020-10-20  2:21 UTC (permalink / raw)
  To: devel

*** BLURB HERE ***

Heng Luo (2):
  BoardModulePkg: Add SerialPortTerminalLib
  UpXtreme: console redirect after the shell is loaded

 Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c   | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h   | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf | 35 +++++++++++++++++++++++++++++++++++
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc                      |  9 ++++++++-
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.fdf                      |  2 ++
 5 files changed, 187 insertions(+), 1 deletion(-)
 create mode 100644 Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c
 create mode 100644 Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h
 create mode 100644 Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf

-- 
2.24.0.windows.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] BoardModulePkg: Add SerialPortTerminalLib
  2020-10-20  2:21 [PATCH 0/2] console redirect after the shell is loaded Heng Luo
@ 2020-10-20  2:21 ` Heng Luo
  2020-10-22  1:23   ` Dong, Eric
  2020-10-20  2:21 ` [PATCH 2/2] UpXtreme: console redirect after the shell is loaded Heng Luo
  1 sibling, 1 reply; 5+ messages in thread
From: Heng Luo @ 2020-10-20  2:21 UTC (permalink / raw)
  To: devel; +Cc: Eric Dong, Chasel Chiu, Nate DeSimone

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3014

Add the serial port terminal library to get console redirect
after the shell is loaded.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>

Signed-off-by: Heng Luo <heng.luo@intel.com>
---
 Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c   | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h   | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 177 insertions(+)

diff --git a/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c
new file mode 100644
index 0000000000..36c0e7110f
--- /dev/null
+++ b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c
@@ -0,0 +1,93 @@
+/** @file
+  Main file for NULL named library for Serial Port Deviceboard controller librarr.
+
+  INTEL CONFIDENTIAL
+  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SerialPortTerminalLib.h"
+
+GLOBAL_REMOVE_IF_UNREFERENCED SERIAL_DEVICE_PATH mSerialDevicePath = {
+  {
+    {
+      HARDWARE_DEVICE_PATH,
+      HW_VENDOR_DP,
+      {
+        (UINT8) sizeof (VENDOR_DEVICE_PATH),
+        (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+      }
+    },
+    EDKII_SERIAL_PORT_LIB_VENDOR_GUID
+  },
+  {
+    {
+      MESSAGING_DEVICE_PATH,
+      MSG_UART_DP,
+      {
+        (UINT8) sizeof (UART_DEVICE_PATH),
+        (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8)
+      }
+    },
+    0,                  // Reserved
+    115200,             // BaudRate
+    8,                  // DataBits
+    1,                  // Parity
+    1                   // StopBits
+  },
+  {
+    {
+      MESSAGING_DEVICE_PATH,
+      MSG_VENDOR_DP,
+      {
+        (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
+        (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
+      }
+    },
+    DEVICE_PATH_MESSAGING_PC_ANSI
+  },
+  gEndEntire
+};
+
+/**
+  Updates the ConOut, ConIn, ErrOut variables with the serial terminal device path
+  @param                        none
+  @retval                       none
+**/
+VOID
+AddSerialTerminal (
+  VOID
+  )
+{
+  DEBUG ((DEBUG_INFO, "[AddSerialPortTerminal]\n"));
+
+  //
+  // Append Serial Terminal into "ConIn"
+  //
+  EfiBootManagerUpdateConsoleVariable (ConOut, (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ConIn, (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL);
+  EfiBootManagerUpdateConsoleVariable (ErrOut, (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL);
+}
+
+
+/**
+  Constructor for the Serial Port Device controller library.
+
+  @param ImageHandle    the image handle of the process
+  @param SystemTable    the EFI System Table pointer
+
+  @retval EFI_SUCCESS        the shell command handlers were installed sucessfully
+  @retval EFI_UNSUPPORTED    the shell level required was not found.
+**/
+EFI_STATUS
+EFIAPI
+SerialPortTerminalLibConstructor (
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  AddSerialTerminal();
+
+  return EFI_SUCCESS;
+}
diff --git a/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h
new file mode 100644
index 0000000000..afb3eb2cb3
--- /dev/null
+++ b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h
@@ -0,0 +1,49 @@
+/** @file
+  Header file for NULL named library for Ps2 keyboard controller library.
+
+  INTEL CONFIDENTIAL
+  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _PS2_KBC_LIB_H
+#define _PS2_KBC_LIB_H
+
+#include <Uefi.h>
+#include <Guid/SerialPortLibVendor.h>
+#include <Library/UefiLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiBootManagerLib.h>
+
+//
+// Below is the platform console device path
+//
+typedef struct {
+  VENDOR_DEVICE_PATH        Guid;
+  UART_DEVICE_PATH          Uart;
+  VENDOR_DEVICE_PATH        TerminalType;
+  EFI_DEVICE_PATH_PROTOCOL  End;
+} SERIAL_DEVICE_PATH;
+
+#define gPciRootBridge \
+  { \
+    { \
+      ACPI_DEVICE_PATH, \
+      ACPI_DP, \
+      { \
+        (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
+        (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \
+      }, \
+    }, \
+    EISA_PNP_ID (0x0A03), \
+    0 \
+  }
+
+#define gEndEntire \
+  { \
+    END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, { END_DEVICE_PATH_LENGTH, 0 } \
+  }
+
+#endif
diff --git a/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf
new file mode 100644
index 0000000000..4f63d1626f
--- /dev/null
+++ b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf
@@ -0,0 +1,35 @@
+## @file
+# Component information file for Serial Port Terminal Redirection Library
+#
+# INTEL CONFIDENTIAL
+# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+[Defines]
+  INF_VERSION                    = 0x00010006
+  BASE_NAME                      = SerialPortTerminalLib
+  FILE_GUID                      = E12BFA46-95F2-4ADC-9774-7E38DE78741E
+  MODULE_TYPE                    = UEFI_DRIVER
+  VERSION_STRING                 = 1.2
+  LIBRARY_CLASS                  = NULL|UEFI_DRIVER
+  CONSTRUCTOR                    = SerialPortTerminalLibConstructor
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  BoardModulePkg/BoardModulePkg.dec
+
+[Sources]
+  SerialPortTerminalLib.c
+  SerialPortTerminalLib.h
+
+[LibraryClasses]
+  DevicePathLib
+  DebugLib
+  UefiDriverEntryPoint
+  UefiBootManagerLib
+  UefiLib
+
+[Pcd]
-- 
2.24.0.windows.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] UpXtreme: console redirect after the shell is loaded
  2020-10-20  2:21 [PATCH 0/2] console redirect after the shell is loaded Heng Luo
  2020-10-20  2:21 ` [PATCH 1/2] BoardModulePkg: Add SerialPortTerminalLib Heng Luo
@ 2020-10-20  2:21 ` Heng Luo
  1 sibling, 0 replies; 5+ messages in thread
From: Heng Luo @ 2020-10-20  2:21 UTC (permalink / raw)
  To: devel; +Cc: Eric Dong, Chasel Chiu, Nate DeSimone

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3014

Use SerialPortTerminalLib to get console redirect after the shell is
loaded:
1. Add SerialPortTerminalLib to BdsDxe driver, to add the serial device to
 ConIn and ConOut variables
2. Include SerialDxe and TerminalDxe to the Up Xtreme's OpenBoardPkg.dsc
 and OpenBoardPkg.fdf

Cc: Eric Dong <eric.dong@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Heng Luo <heng.luo@intel.com>
---
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc | 9 ++++++++-
 Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.fdf | 2 ++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
index fb493973e2..6eb7eb1d90 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
@@ -39,7 +39,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -82,6 +83,12 @@
 [Components.X64]
 !include $(PLATFORM_PACKAGE)/Include/Dsc/CoreDxeInclude.dsc
 !include $(PLATFORM_SI_PACKAGE)/SiPkgDxe.dsc
+MdeModulePkg/Universal/BdsDxe/BdsDxe.inf{
+<LibraryClasses>
+  NULL|BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf
+}
+MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
+MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
 
 #######################################
 # Build Option Includes
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.fdf
index 0d99114961..e15cb7dfa9 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.fdf
@@ -342,6 +342,8 @@ INF  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
 INF  MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf
 INF  MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
 INF  MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
+INF  MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
+INF  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
 INF  MdeModulePkg/Universal/Console/GraphicsOutputDxe/GraphicsOutputDxe.inf
 INF  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
 INF  BoardModulePkg/LegacySioDxe/LegacySioDxe.inf
-- 
2.24.0.windows.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] BoardModulePkg: Add SerialPortTerminalLib
  2020-10-20  2:21 ` [PATCH 1/2] BoardModulePkg: Add SerialPortTerminalLib Heng Luo
@ 2020-10-22  1:23   ` Dong, Eric
  2020-10-23  4:08     ` Heng Luo
  0 siblings, 1 reply; 5+ messages in thread
From: Dong, Eric @ 2020-10-22  1:23 UTC (permalink / raw)
  To: Luo, Heng, devel@edk2.groups.io; +Cc: Chiu, Chasel, Desimone, Nathaniel L

Hi Heng,

Seems like it is a common feature not related to board scope, I think Features folder is a better place to hold it.

Thanks,
Eric

-----Original Message-----
From: Luo, Heng <heng.luo@intel.com> 
Sent: Tuesday, October 20, 2020 10:22 AM
To: devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
Subject: [PATCH 1/2] BoardModulePkg: Add SerialPortTerminalLib

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3014

Add the serial port terminal library to get console redirect
after the shell is loaded.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>

Signed-off-by: Heng Luo <heng.luo@intel.com>
---
 Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c   | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h   | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 177 insertions(+)

diff --git a/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c
new file mode 100644
index 0000000000..36c0e7110f
--- /dev/null
+++ b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.c
@@ -0,0 +1,93 @@
+/** @file

+  Main file for NULL named library for Serial Port Deviceboard controller librarr.

+

+  INTEL CONFIDENTIAL

+  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+

+**/

+

+#include "SerialPortTerminalLib.h"

+

+GLOBAL_REMOVE_IF_UNREFERENCED SERIAL_DEVICE_PATH mSerialDevicePath = {

+  {

+    {

+      HARDWARE_DEVICE_PATH,

+      HW_VENDOR_DP,

+      {

+        (UINT8) sizeof (VENDOR_DEVICE_PATH),

+        (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)

+      }

+    },

+    EDKII_SERIAL_PORT_LIB_VENDOR_GUID

+  },

+  {

+    {

+      MESSAGING_DEVICE_PATH,

+      MSG_UART_DP,

+      {

+        (UINT8) sizeof (UART_DEVICE_PATH),

+        (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8)

+      }

+    },

+    0,                  // Reserved

+    115200,             // BaudRate

+    8,                  // DataBits

+    1,                  // Parity

+    1                   // StopBits

+  },

+  {

+    {

+      MESSAGING_DEVICE_PATH,

+      MSG_VENDOR_DP,

+      {

+        (UINT8) (sizeof (VENDOR_DEVICE_PATH)),

+        (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),

+      }

+    },

+    DEVICE_PATH_MESSAGING_PC_ANSI

+  },

+  gEndEntire

+};

+

+/**

+  Updates the ConOut, ConIn, ErrOut variables with the serial terminal device path

+  @param                        none

+  @retval                       none

+**/

+VOID

+AddSerialTerminal (

+  VOID

+  )

+{

+  DEBUG ((DEBUG_INFO, "[AddSerialPortTerminal]\n"));

+

+  //

+  // Append Serial Terminal into "ConIn"

+  //

+  EfiBootManagerUpdateConsoleVariable (ConOut, (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL);

+  EfiBootManagerUpdateConsoleVariable (ConIn, (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL);

+  EfiBootManagerUpdateConsoleVariable (ErrOut, (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL);

+}

+

+

+/**

+  Constructor for the Serial Port Device controller library.

+

+  @param ImageHandle    the image handle of the process

+  @param SystemTable    the EFI System Table pointer

+

+  @retval EFI_SUCCESS        the shell command handlers were installed sucessfully

+  @retval EFI_UNSUPPORTED    the shell level required was not found.

+**/

+EFI_STATUS

+EFIAPI

+SerialPortTerminalLibConstructor (

+  IN EFI_HANDLE        ImageHandle,

+  IN EFI_SYSTEM_TABLE  *SystemTable

+  )

+{

+  AddSerialTerminal();

+

+  return EFI_SUCCESS;

+}

diff --git a/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h
new file mode 100644
index 0000000000..afb3eb2cb3
--- /dev/null
+++ b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.h
@@ -0,0 +1,49 @@
+/** @file

+  Header file for NULL named library for Ps2 keyboard controller library.

+

+  INTEL CONFIDENTIAL

+  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+

+**/

+

+#ifndef _PS2_KBC_LIB_H

+#define _PS2_KBC_LIB_H

+

+#include <Uefi.h>

+#include <Guid/SerialPortLibVendor.h>

+#include <Library/UefiLib.h>

+#include <Library/DevicePathLib.h>

+#include <Library/DebugLib.h>

+#include <Library/UefiBootManagerLib.h>

+

+//

+// Below is the platform console device path

+//

+typedef struct {

+  VENDOR_DEVICE_PATH        Guid;

+  UART_DEVICE_PATH          Uart;

+  VENDOR_DEVICE_PATH        TerminalType;

+  EFI_DEVICE_PATH_PROTOCOL  End;

+} SERIAL_DEVICE_PATH;

+

+#define gPciRootBridge \

+  { \

+    { \

+      ACPI_DEVICE_PATH, \

+      ACPI_DP, \

+      { \

+        (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \

+        (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \

+      }, \

+    }, \

+    EISA_PNP_ID (0x0A03), \

+    0 \

+  }

+

+#define gEndEntire \

+  { \

+    END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, { END_DEVICE_PATH_LENGTH, 0 } \

+  }

+

+#endif

diff --git a/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf
new file mode 100644
index 0000000000..4f63d1626f
--- /dev/null
+++ b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTerminalLib.inf
@@ -0,0 +1,35 @@
+## @file

+# Component information file for Serial Port Terminal Redirection Library

+#

+# INTEL CONFIDENTIAL

+# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>

+#

+# SPDX-License-Identifier: BSD-2-Clause-Patent

+#

+##

+[Defines]

+  INF_VERSION                    = 0x00010006

+  BASE_NAME                      = SerialPortTerminalLib

+  FILE_GUID                      = E12BFA46-95F2-4ADC-9774-7E38DE78741E

+  MODULE_TYPE                    = UEFI_DRIVER

+  VERSION_STRING                 = 1.2

+  LIBRARY_CLASS                  = NULL|UEFI_DRIVER

+  CONSTRUCTOR                    = SerialPortTerminalLibConstructor

+

+[Packages]

+  MdePkg/MdePkg.dec

+  MdeModulePkg/MdeModulePkg.dec

+  BoardModulePkg/BoardModulePkg.dec

+

+[Sources]

+  SerialPortTerminalLib.c

+  SerialPortTerminalLib.h

+

+[LibraryClasses]

+  DevicePathLib

+  DebugLib

+  UefiDriverEntryPoint

+  UefiBootManagerLib

+  UefiLib

+

+[Pcd]

-- 
2.24.0.windows.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] BoardModulePkg: Add SerialPortTerminalLib
  2020-10-22  1:23   ` Dong, Eric
@ 2020-10-23  4:08     ` Heng Luo
  0 siblings, 0 replies; 5+ messages in thread
From: Heng Luo @ 2020-10-23  4:08 UTC (permalink / raw)
  To: Dong, Eric, devel@edk2.groups.io; +Cc: Chiu, Chasel, Desimone, Nathaniel L

Hi Eric,
Chaganty, Rangasai V <rangasai.v.chaganty@intel.com> suggest to move it to Features\Intel\Debugging, do you agree?

Thanks,
heng

> -----Original Message-----
> From: Dong, Eric <eric.dong@intel.com>
> Sent: Thursday, October 22, 2020 9:23 AM
> To: Luo, Heng <heng.luo@intel.com>; devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>
> Subject: RE: [PATCH 1/2] BoardModulePkg: Add SerialPortTerminalLib
> 
> Hi Heng,
> 
> Seems like it is a common feature not related to board scope, I think
> Features folder is a better place to hold it.
> 
> Thanks,
> Eric
> 
> -----Original Message-----
> From: Luo, Heng <heng.luo@intel.com>
> Sent: Tuesday, October 20, 2020 10:22 AM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>;
> Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
> Subject: [PATCH 1/2] BoardModulePkg: Add SerialPortTerminalLib
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3014
> 
> Add the serial port terminal library to get console redirect after the shell is
> loaded.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> 
> Signed-off-by: Heng Luo <heng.luo@intel.com>
> ---
> 
> Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTer
> minalLib.c   | 93
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++++++++++++++
> 
> Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTer
> minalLib.h   | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
> 
> Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortTer
> minalLib.inf | 35 +++++++++++++++++++++++++++++++++++
>  3 files changed, 177 insertions(+)
> 
> diff --git
> a/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortT
> erminalLib.c
> b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortT
> erminalLib.c
> new file mode 100644
> index 0000000000..36c0e7110f
> --- /dev/null
> +++ b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/Serial
> +++ PortTerminalLib.c
> @@ -0,0 +1,93 @@
> +/** @file
> 
> +  Main file for NULL named library for Serial Port Deviceboard controller
> librarr.
> 
> +
> 
> +  INTEL CONFIDENTIAL
> 
> +  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +
> 
> +**/
> 
> +
> 
> +#include "SerialPortTerminalLib.h"
> 
> +
> 
> +GLOBAL_REMOVE_IF_UNREFERENCED SERIAL_DEVICE_PATH
> mSerialDevicePath = {
> 
> +  {
> 
> +    {
> 
> +      HARDWARE_DEVICE_PATH,
> 
> +      HW_VENDOR_DP,
> 
> +      {
> 
> +        (UINT8) sizeof (VENDOR_DEVICE_PATH),
> 
> +        (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
> 
> +      }
> 
> +    },
> 
> +    EDKII_SERIAL_PORT_LIB_VENDOR_GUID
> 
> +  },
> 
> +  {
> 
> +    {
> 
> +      MESSAGING_DEVICE_PATH,
> 
> +      MSG_UART_DP,
> 
> +      {
> 
> +        (UINT8) sizeof (UART_DEVICE_PATH),
> 
> +        (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8)
> 
> +      }
> 
> +    },
> 
> +    0,                  // Reserved
> 
> +    115200,             // BaudRate
> 
> +    8,                  // DataBits
> 
> +    1,                  // Parity
> 
> +    1                   // StopBits
> 
> +  },
> 
> +  {
> 
> +    {
> 
> +      MESSAGING_DEVICE_PATH,
> 
> +      MSG_VENDOR_DP,
> 
> +      {
> 
> +        (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
> 
> +        (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
> 
> +      }
> 
> +    },
> 
> +    DEVICE_PATH_MESSAGING_PC_ANSI
> 
> +  },
> 
> +  gEndEntire
> 
> +};
> 
> +
> 
> +/**
> 
> +  Updates the ConOut, ConIn, ErrOut variables with the serial terminal
> + device path
> 
> +  @param                        none
> 
> +  @retval                       none
> 
> +**/
> 
> +VOID
> 
> +AddSerialTerminal (
> 
> +  VOID
> 
> +  )
> 
> +{
> 
> +  DEBUG ((DEBUG_INFO, "[AddSerialPortTerminal]\n"));
> 
> +
> 
> +  //
> 
> +  // Append Serial Terminal into "ConIn"
> 
> +  //
> 
> +  EfiBootManagerUpdateConsoleVariable (ConOut,
> + (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL);
> 
> +  EfiBootManagerUpdateConsoleVariable (ConIn,
> (EFI_DEVICE_PATH_PROTOCOL
> + *) &mSerialDevicePath, NULL);
> 
> +  EfiBootManagerUpdateConsoleVariable (ErrOut,
> + (EFI_DEVICE_PATH_PROTOCOL *) &mSerialDevicePath, NULL);
> 
> +}
> 
> +
> 
> +
> 
> +/**
> 
> +  Constructor for the Serial Port Device controller library.
> 
> +
> 
> +  @param ImageHandle    the image handle of the process
> 
> +  @param SystemTable    the EFI System Table pointer
> 
> +
> 
> +  @retval EFI_SUCCESS        the shell command handlers were installed
> sucessfully
> 
> +  @retval EFI_UNSUPPORTED    the shell level required was not found.
> 
> +**/
> 
> +EFI_STATUS
> 
> +EFIAPI
> 
> +SerialPortTerminalLibConstructor (
> 
> +  IN EFI_HANDLE        ImageHandle,
> 
> +  IN EFI_SYSTEM_TABLE  *SystemTable
> 
> +  )
> 
> +{
> 
> +  AddSerialTerminal();
> 
> +
> 
> +  return EFI_SUCCESS;
> 
> +}
> 
> diff --git
> a/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortT
> erminalLib.h
> b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortT
> erminalLib.h
> new file mode 100644
> index 0000000000..afb3eb2cb3
> --- /dev/null
> +++ b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/Serial
> +++ PortTerminalLib.h
> @@ -0,0 +1,49 @@
> +/** @file
> 
> +  Header file for NULL named library for Ps2 keyboard controller library.
> 
> +
> 
> +  INTEL CONFIDENTIAL
> 
> +  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +
> 
> +**/
> 
> +
> 
> +#ifndef _PS2_KBC_LIB_H
> 
> +#define _PS2_KBC_LIB_H
> 
> +
> 
> +#include <Uefi.h>
> 
> +#include <Guid/SerialPortLibVendor.h>
> 
> +#include <Library/UefiLib.h>
> 
> +#include <Library/DevicePathLib.h>
> 
> +#include <Library/DebugLib.h>
> 
> +#include <Library/UefiBootManagerLib.h>
> 
> +
> 
> +//
> 
> +// Below is the platform console device path
> 
> +//
> 
> +typedef struct {
> 
> +  VENDOR_DEVICE_PATH        Guid;
> 
> +  UART_DEVICE_PATH          Uart;
> 
> +  VENDOR_DEVICE_PATH        TerminalType;
> 
> +  EFI_DEVICE_PATH_PROTOCOL  End;
> 
> +} SERIAL_DEVICE_PATH;
> 
> +
> 
> +#define gPciRootBridge \
> 
> +  { \
> 
> +    { \
> 
> +      ACPI_DEVICE_PATH, \
> 
> +      ACPI_DP, \
> 
> +      { \
> 
> +        (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
> 
> +        (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \
> 
> +      }, \
> 
> +    }, \
> 
> +    EISA_PNP_ID (0x0A03), \
> 
> +    0 \
> 
> +  }
> 
> +
> 
> +#define gEndEntire \
> 
> +  { \
> 
> +    END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, {
> + END_DEVICE_PATH_LENGTH, 0 } \
> 
> +  }
> 
> +
> 
> +#endif
> 
> diff --git
> a/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortT
> erminalLib.inf
> b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/SerialPortT
> erminalLib.inf
> new file mode 100644
> index 0000000000..4f63d1626f
> --- /dev/null
> +++ b/Platform/Intel/BoardModulePkg/Library/SerialPortTerminalLib/Serial
> +++ PortTerminalLib.inf
> @@ -0,0 +1,35 @@
> +## @file
> 
> +# Component information file for Serial Port Terminal Redirection
> +Library
> 
> +#
> 
> +# INTEL CONFIDENTIAL
> 
> +# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
> 
> +#
> 
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +#
> 
> +##
> 
> +[Defines]
> 
> +  INF_VERSION                    = 0x00010006
> 
> +  BASE_NAME                      = SerialPortTerminalLib
> 
> +  FILE_GUID                      = E12BFA46-95F2-4ADC-9774-7E38DE78741E
> 
> +  MODULE_TYPE                    = UEFI_DRIVER
> 
> +  VERSION_STRING                 = 1.2
> 
> +  LIBRARY_CLASS                  = NULL|UEFI_DRIVER
> 
> +  CONSTRUCTOR                    = SerialPortTerminalLibConstructor
> 
> +
> 
> +[Packages]
> 
> +  MdePkg/MdePkg.dec
> 
> +  MdeModulePkg/MdeModulePkg.dec
> 
> +  BoardModulePkg/BoardModulePkg.dec
> 
> +
> 
> +[Sources]
> 
> +  SerialPortTerminalLib.c
> 
> +  SerialPortTerminalLib.h
> 
> +
> 
> +[LibraryClasses]
> 
> +  DevicePathLib
> 
> +  DebugLib
> 
> +  UefiDriverEntryPoint
> 
> +  UefiBootManagerLib
> 
> +  UefiLib
> 
> +
> 
> +[Pcd]
> 
> --
> 2.24.0.windows.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-23  4:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-20  2:21 [PATCH 0/2] console redirect after the shell is loaded Heng Luo
2020-10-20  2:21 ` [PATCH 1/2] BoardModulePkg: Add SerialPortTerminalLib Heng Luo
2020-10-22  1:23   ` Dong, Eric
2020-10-23  4:08     ` Heng Luo
2020-10-20  2:21 ` [PATCH 2/2] UpXtreme: console redirect after the shell is loaded Heng Luo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox