diff mbox

[edk2,4/4] Add PCD for selecting terminal type

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

Commit Message

Roy Franz June 22, 2015, 11:30 p.m. UTC
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, and building with the
"-D TTY_TERMINAL" option will configure the use of the TTY terminal type.

Signed-off-by: Roy Franz <roy.franz@cavium.com>
Contributed-under: TianoCore Contribution Agreement 1.0
---
 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

Roy Franz June 22, 2015, 11:33 p.m. UTC | #1
On Mon, Jun 22, 2015 at 4:30 PM, 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, and building with the
> "-D TTY_TERMINAL" option will configure the use of the TTY terminal type.
>
> Signed-off-by: Roy Franz <roy.franz@cavium.com>

Got the wrong email on this one...
Signed-off-by: Roy Franz <roy.franz@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.0
> ---
>  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 c6e684f..6ba8241 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -14,6 +14,7 @@
>
>  [Defines]
>    DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
> +  DEFINE TTY_TERMINAL            = FALSE
>
>  [LibraryClasses.common]
>  !if $(TARGET) == RELEASE
> @@ -354,6 +355,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 499cce5..a04d603 100644
> --- a/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
> +++ b/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
> @@ -34,7 +34,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 ()
> @@ -66,14 +66,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
> +    //
>    },
>
>    //
> @@ -385,6 +387,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 d8f8926..b9fb536 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
>

------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
Roy Franz June 23, 2015, 5:54 p.m. UTC | #2
On Tue, Jun 23, 2015 at 12:47 AM, Laszlo Ersek <lersek@redhat.com> wrote:
> (Sorry I could not reply to your email about the authorship tags last
> night, I was too tired and went offline pretty early.)
>
> On 06/23/15 01:30, Roy Franz 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, and building with the
>> "-D TTY_TERMINAL" option will configure the use of the TTY terminal type.
>>
>> Signed-off-by: Roy Franz <roy.franz@cavium.com>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>
> I propose:
> (a) keep the From: at the top (ie. git commit --author=lersek...),
> (b) the tags should look like, in this order:
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> [Roy Franz: 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>
>
> (Updated your email address from your followup message.)
>
> Then Ard should review the patch (because you and I can't, due to our
> authorships).

Thanks Laszlo - I'll fix this up in the next version.


>
> One more note below:
>
>> ---
>>  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 c6e684f..6ba8241 100644
>> --- a/ArmVirtPkg/ArmVirt.dsc.inc
>> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
>> @@ -14,6 +14,7 @@
>>
>>  [Defines]
>>    DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
>> +  DEFINE TTY_TERMINAL            = FALSE
>>
>>  [LibraryClasses.common]
>>  !if $(TARGET) == RELEASE
>> @@ -354,6 +355,11 @@
>>    gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
>>  !endif
>>
>> +!if $(TTY_TERMINAL) == TRUE
>> +  # Set terminal type to TtyTerm, the value encoded is EFI_TTY_TERM_GUID
>
> This depends on Feng's review, but I think EFI_TTY_TERM_GUID might not
> be the best name, as long as it is not standard. (I guess the EFI_
> prefix should simply be dropped.) Same for the "Efi" substring in
> "gEfiTtyTermGuid", elsewhere. Again, depends on what Feng says.

Yup, I was matching how the other terminals were defined, but that's likely
wrong since they are part of the spec, and the TtyTerm isn't.
>
> Thanks!
> Laszlo
>
>> +  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 499cce5..a04d603 100644
>> --- a/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
>> +++ b/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
>> @@ -34,7 +34,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 ()
>> @@ -66,14 +66,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
>> +    //
>>    },
>>
>>    //
>> @@ -385,6 +387,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 d8f8926..b9fb536 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
>>
>

------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
diff mbox

Patch

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index c6e684f..6ba8241 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -14,6 +14,7 @@ 
 
 [Defines]
   DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F
+  DEFINE TTY_TERMINAL            = FALSE
 
 [LibraryClasses.common]
 !if $(TARGET) == RELEASE
@@ -354,6 +355,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 499cce5..a04d603 100644
--- a/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
+++ b/ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c
@@ -34,7 +34,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 ()
@@ -66,14 +66,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
+    //
   },
 
   //
@@ -385,6 +387,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 d8f8926..b9fb536 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