[edk2,V2,4/4] Add PCD for selecting terminal type at build time

Message ID 1436223879-27956-5-git-send-email-roy.franz@linaro.org
State New
Headers show

Commit Message

Roy Franz July 6, 2015, 11:04 p.m.
From: Laszlo Ersek <lersek@redhat.com>

Add a fixed pointer PCD to allow build-time selection of VT100 or TTY terminal
type.  The default remains VT100 emulation.
Add support for building the ARM QEMU platforms with the TTY terminal
with the "-D TTY_TERMINAL" build option.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
[Roy Franz: minor edits: add TtyTerminal GUID, rename LINUX_TERMINAL to TTY_TERMINAL]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Roy Franz <roy.franz@linaro.org>
---
 ArmVirtPkg/ArmVirt.dsc.inc                                     |  6 ++++++
 ArmVirtPkg/ArmVirtPkg.dec                                      |  7 +++++++
 ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c      | 12 ++++++++----
 ArmVirtPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf |  4 ++++
 4 files changed, 25 insertions(+), 4 deletions(-)

Comments

Ard Biesheuvel July 7, 2015, 1:05 p.m. | #1
On 7 July 2015 at 01:04, Roy Franz <roy.franz@linaro.org> wrote:
> From: Laszlo Ersek <lersek@redhat.com>
>
> Add a fixed pointer PCD to allow build-time selection of VT100 or TTY terminal
> type.  The default remains VT100 emulation.
> Add support for building the ARM QEMU platforms with the TTY terminal
> with the "-D TTY_TERMINAL" build option.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> [Roy Franz: minor edits: add TtyTerminal GUID, rename LINUX_TERMINAL to TTY_TERMINAL]
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Roy Franz <roy.franz@linaro.org>

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  ArmVirtPkg/ArmVirt.dsc.inc                                     |  6 ++++++
>  ArmVirtPkg/ArmVirtPkg.dec                                      |  7 +++++++
>  ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c      | 12 ++++++++----
>  ArmVirtPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf |  4 ++++
>  4 files changed, 25 insertions(+), 4 deletions(-)
>
> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> index 7ec0de4..2feebd3 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -15,6 +15,7 @@
>
>  [Defines]
>    DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
> +  DEFINE TTY_TERMINAL            = FALSE
>
>  [LibraryClasses.common]
>  !if $(TARGET) == RELEASE
> @@ -359,6 +360,11 @@
>    gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
>  !endif
>
> +!if $(TTY_TERMINAL) == TRUE
> +  # Set terminal type to TtyTerm, the value encoded is EFI_TTY_TERM_GUID
> +  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d, 0x91, 0x7d, 0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94}
> +!endif
> +
>  [Components.common]
>    #
>    # Networking stack
> diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
> index 7bbd9ff..9833c5a 100644
> --- a/ArmVirtPkg/ArmVirtPkg.dec
> +++ b/ArmVirtPkg/ArmVirtPkg.dec
> @@ -49,6 +49,13 @@
>    #
>    gArmVirtTokenSpaceGuid.PcdDeviceTreeAllocationPadding|256|UINT32|0x00000002
>
> +  #
> +  # Binary representation of the GUID that determines the terminal type. The
> +  # size must be exactly 16 bytes. The default value corresponds to
> +  # EFI_VT_100_GUID.
> +  #
> +  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x65, 0x60, 0xA6, 0xDF, 0x19, 0xB4, 0xD3, 0x11, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D}|VOID*|0x00000007
> +
>  [PcdsDynamic, PcdsFixedAtBuild]
>    #
>    # ARM PSCI function invocations can be done either through hypervisor
> diff --git a/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c b/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
> index 13830cb..b242a29 100644
> --- a/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
> +++ b/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
> @@ -35,7 +35,7 @@
>  typedef struct {
>    VENDOR_DEVICE_PATH         SerialDxe;
>    UART_DEVICE_PATH           Uart;
> -  VENDOR_DEFINED_DEVICE_PATH Vt100;
> +  VENDOR_DEFINED_DEVICE_PATH TermType;
>    EFI_DEVICE_PATH_PROTOCOL   End;
>  } PLATFORM_SERIAL_CONSOLE;
>  #pragma pack ()
> @@ -67,14 +67,16 @@ STATIC PLATFORM_SERIAL_CONSOLE mSerialConsole = {
>    },
>
>    //
> -  // VENDOR_DEFINED_DEVICE_PATH Vt100
> +  // VENDOR_DEFINED_DEVICE_PATH TermType
>    //
>    {
>      {
>        MESSAGING_DEVICE_PATH, MSG_VENDOR_DP,
>        DP_NODE_LEN (VENDOR_DEFINED_DEVICE_PATH)
> -    },
> -    EFI_VT_100_GUID
> +    }
> +    //
> +    // Guid to be filled in dynamically
> +    //
>    },
>
>    //
> @@ -421,6 +423,8 @@ PlatformBdsPolicyBehavior (
>    //
>    // Add the hardcoded serial console device path to ConIn, ConOut, ErrOut.
>    //
> +  CopyGuid (&mSerialConsole.TermType.Guid,
> +    PcdGetPtr (PcdTerminalTypeGuidBuffer));
>    BdsLibUpdateConsoleVariable (L"ConIn",
>      (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL);
>    BdsLibUpdateConsoleVariable (L"ConOut",
> diff --git a/ArmVirtPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf b/ArmVirtPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
> index d998216..9a3cfcd 100644
> --- a/ArmVirtPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
> +++ b/ArmVirtPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
> @@ -39,6 +39,7 @@
>    MdeModulePkg/MdeModulePkg.dec
>    MdePkg/MdePkg.dec
>    OvmfPkg/OvmfPkg.dec
> +  ArmVirtPkg/ArmVirtPkg.dec
>
>  [LibraryClasses]
>    BaseLib
> @@ -61,6 +62,9 @@
>    gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
>    gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits
>
> +[Pcd]
> +  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer
> +
>  [Guids]
>    gEfiFileInfoGuid
>    gEfiFileSystemInfoGuid
> --
> 2.1.4
>

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/

Patch hide | download patch | download mbox

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 7ec0de4..2feebd3 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -15,6 +15,7 @@ 
 
 [Defines]
   DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
+  DEFINE TTY_TERMINAL            = FALSE
 
 [LibraryClasses.common]
 !if $(TARGET) == RELEASE
@@ -359,6 +360,11 @@ 
   gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
 !endif
 
+!if $(TTY_TERMINAL) == TRUE
+  # Set terminal type to TtyTerm, the value encoded is EFI_TTY_TERM_GUID
+  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d, 0x91, 0x7d, 0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94}
+!endif
+
 [Components.common]
   #
   # Networking stack
diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
index 7bbd9ff..9833c5a 100644
--- a/ArmVirtPkg/ArmVirtPkg.dec
+++ b/ArmVirtPkg/ArmVirtPkg.dec
@@ -49,6 +49,13 @@ 
   #
   gArmVirtTokenSpaceGuid.PcdDeviceTreeAllocationPadding|256|UINT32|0x00000002
 
+  #
+  # Binary representation of the GUID that determines the terminal type. The
+  # size must be exactly 16 bytes. The default value corresponds to
+  # EFI_VT_100_GUID.
+  #
+  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x65, 0x60, 0xA6, 0xDF, 0x19, 0xB4, 0xD3, 0x11, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D}|VOID*|0x00000007
+
 [PcdsDynamic, PcdsFixedAtBuild]
   #
   # ARM PSCI function invocations can be done either through hypervisor
diff --git a/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c b/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
index 13830cb..b242a29 100644
--- a/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
+++ b/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
@@ -35,7 +35,7 @@ 
 typedef struct {
   VENDOR_DEVICE_PATH         SerialDxe;
   UART_DEVICE_PATH           Uart;
-  VENDOR_DEFINED_DEVICE_PATH Vt100;
+  VENDOR_DEFINED_DEVICE_PATH TermType;
   EFI_DEVICE_PATH_PROTOCOL   End;
 } PLATFORM_SERIAL_CONSOLE;
 #pragma pack ()
@@ -67,14 +67,16 @@  STATIC PLATFORM_SERIAL_CONSOLE mSerialConsole = {
   },
 
   //
-  // VENDOR_DEFINED_DEVICE_PATH Vt100
+  // VENDOR_DEFINED_DEVICE_PATH TermType
   //
   {
     {
       MESSAGING_DEVICE_PATH, MSG_VENDOR_DP,
       DP_NODE_LEN (VENDOR_DEFINED_DEVICE_PATH)
-    },
-    EFI_VT_100_GUID
+    }
+    //
+    // Guid to be filled in dynamically
+    //
   },
 
   //
@@ -421,6 +423,8 @@  PlatformBdsPolicyBehavior (
   //
   // Add the hardcoded serial console device path to ConIn, ConOut, ErrOut.
   //
+  CopyGuid (&mSerialConsole.TermType.Guid,
+    PcdGetPtr (PcdTerminalTypeGuidBuffer));
   BdsLibUpdateConsoleVariable (L"ConIn",
     (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL);
   BdsLibUpdateConsoleVariable (L"ConOut",
diff --git a/ArmVirtPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf b/ArmVirtPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
index d998216..9a3cfcd 100644
--- a/ArmVirtPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
+++ b/ArmVirtPkg/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
@@ -39,6 +39,7 @@ 
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
+  ArmVirtPkg/ArmVirtPkg.dec
 
 [LibraryClasses]
   BaseLib
@@ -61,6 +62,9 @@ 
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits
 
+[Pcd]
+  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer
+
 [Guids]
   gEfiFileInfoGuid
   gEfiFileSystemInfoGuid