From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8389381B2D for ; Mon, 9 Jan 2017 22:37:45 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP; 09 Jan 2017 22:37:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,342,1477983600"; d="scan'208";a="920783967" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga003.jf.intel.com with ESMTP; 09 Jan 2017 22:37:44 -0800 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 9 Jan 2017 22:37:44 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 9 Jan 2017 22:37:44 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0248.002; Tue, 10 Jan 2017 14:37:42 +0800 From: "Gao, Liming" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: Dandan Bi Thread-Topic: [edk2] [PATCH] MdeModulePkg/BootMaintenanceManagerUiLib: Support NT32 terminals Thread-Index: AQHSah6zdXx/AhwHpkab2NMzRqNem6ExQ47w Date: Tue, 10 Jan 2017 06:37:41 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D6CB84A@shsmsx102.ccr.corp.intel.com> References: <20170109021831.116788-1-ruiyu.ni@intel.com> In-Reply-To: <20170109021831.116788-1-ruiyu.ni@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/BootMaintenanceManagerUiLib: Support NT32 terminals X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2017 06:37:45 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ray: There is other code in this library to consume HID COM value. Could you c= lean up them together? Thanks Liming >-----Original Message----- >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >Ruiyu Ni >Sent: Monday, January 09, 2017 10:19 AM >To: edk2-devel@lists.01.org >Cc: Dandan Bi ; Gao, Liming >Subject: [edk2] [PATCH] MdeModulePkg/BootMaintenanceManagerUiLib: >Support NT32 terminals > >The patch enhances Boot Maintenance Manager to recognize >the terminal consoles in NT32 platform. > >Contributed-under: TianoCore Contribution Agreement 1.0 >Signed-off-by: Ruiyu Ni >Cc: Dandan Bi >Cc: Liming Gao >--- > .../BootMaintenanceManagerUiLib/ConsoleOption.c | 213 ++++++----------= - >---- > 1 file changed, 59 insertions(+), 154 deletions(-) > >diff --git >a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c >b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c >index a145a77..11b77a6 100644 >--- >a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c >+++ >b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c >@@ -1,7 +1,7 @@ > /** @file > handles console redirection from boot manager > >-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
>+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD >License > which accompanies this distribution. The full text of the license may be= found >at >@@ -379,8 +379,6 @@ SortedUartHandle ( > > > @param DevicePath DevicePath to be checked >- @param Termi If DevicePath is valid Terminal, terminal type i= s returned. >- @param Com If DevicePath is valid Terminal, Com Port type i= s >returned. > > @retval TRUE If DevicePath point to a Terminal. > @retval FALSE If DevicePath does not point to a Terminal. >@@ -388,9 +386,7 @@ SortedUartHandle ( > **/ > BOOLEAN > IsTerminalDevicePath ( >- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, >- OUT TYPE_OF_TERMINAL *Termi, >- OUT UINTN *Com >+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath > ); > > /** >@@ -411,10 +407,8 @@ LocateSerialIo ( > UINTN NoHandles; > EFI_HANDLE *Handles; > EFI_STATUS Status; >- ACPI_HID_DEVICE_PATH *Acpi; > EFI_DEVICE_PATH_PROTOCOL *DevicePath; > EFI_SERIAL_IO_PROTOCOL *SerialIo; >- EFI_DEVICE_PATH_PROTOCOL *Node; > EFI_DEVICE_PATH_PROTOCOL *OutDevicePath; > EFI_DEVICE_PATH_PROTOCOL *InpDevicePath; > EFI_DEVICE_PATH_PROTOCOL *ErrDevicePath; >@@ -458,76 +452,63 @@ LocateSerialIo ( > (VOID **) &DevicePath > ); > >- Acpi =3D NULL; >- for (Node =3D DevicePath; !IsDevicePathEnd (Node); Node =3D >NextDevicePathNode (Node)) { >- if ((DevicePathType (Node) =3D=3D MESSAGING_DEVICE_PATH) && >(DevicePathSubType (Node) =3D=3D MSG_UART_DP)) { >- break; >- } >- // >- // Acpi points to the node before Uart node >- // >- Acpi =3D (ACPI_HID_DEVICE_PATH *) Node; >+ NewMenuEntry =3D BOpt_CreateMenuEntry >(BM_TERMINAL_CONTEXT_SELECT); >+ if (NewMenuEntry =3D=3D NULL) { >+ FreePool (Handles); >+ return EFI_OUT_OF_RESOURCES; > } > >- if ((Acpi !=3D NULL) && IsIsaSerialNode (Acpi)) { >- NewMenuEntry =3D BOpt_CreateMenuEntry >(BM_TERMINAL_CONTEXT_SELECT); >- if (NewMenuEntry =3D=3D NULL) { >- FreePool (Handles); >- return EFI_OUT_OF_RESOURCES; >- } >+ NewTerminalContext =3D (BM_TERMINAL_CONTEXT *) NewMenuEntry- >>VariableContext; >+ NewMenuEntry->OptionNumber =3D TerminalMenu.MenuNumber; >+ NewTerminalContext->DevicePath =3D DuplicateDevicePath (DevicePath); >+ // >+ // BugBug: I have no choice, calling EfiLibStrFromDatahub will hang t= he >system! >+ // coz' the misc data for each platform is not correct, actually it's= the device >path stored in >+ // datahub which is not completed, so a searching for end of device p= ath >will enter a >+ // dead-loop. >+ // >+ NewMenuEntry->DisplayString =3D EfiLibStrFromDatahub (DevicePath); >+ if (NULL =3D=3D NewMenuEntry->DisplayString) { >+ NewMenuEntry->DisplayString =3D UiDevicePathToStr (DevicePath); >+ } > >- NewTerminalContext =3D (BM_TERMINAL_CONTEXT *) NewMenuEntry- >>VariableContext; >- CopyMem (&NewMenuEntry->OptionNumber, &Acpi->UID, sizeof >(UINT32)); >- NewTerminalContext->DevicePath =3D DuplicateDevicePath (DevicePath)= ; >- // >- // BugBug: I have no choice, calling EfiLibStrFromDatahub will hang= the >system! >- // coz' the misc data for each platform is not correct, actually it= 's the device >path stored in >- // datahub which is not completed, so a searching for end of device= path >will enter a >- // dead-loop. >- // >- NewMenuEntry->DisplayString =3D EfiLibStrFromDatahub (DevicePath); >- if (NULL =3D=3D NewMenuEntry->DisplayString) { >- NewMenuEntry->DisplayString =3D UiDevicePathToStr (DevicePath); >- } >+ NewMenuEntry->HelpString =3D NULL; > >- NewMenuEntry->HelpString =3D NULL; >+ NewMenuEntry->DisplayStringToken =3D HiiSetString (mBmmCallbackInfo- >>BmmHiiHandle, 0, NewMenuEntry->DisplayString, NULL); > >- NewMenuEntry->DisplayStringToken =3D HiiSetString (mBmmCallbackInfo= - >>BmmHiiHandle, 0, NewMenuEntry->DisplayString, NULL); >+ NewMenuEntry->HelpStringToken =3D NewMenuEntry->DisplayStringToken; > >- NewMenuEntry->HelpStringToken =3D NewMenuEntry->DisplayStringToken; >- >- gBS->HandleProtocol ( >- Handles[Index], >- &gEfiSerialIoProtocolGuid, >- (VOID **) &SerialIo >- ); >+ gBS->HandleProtocol ( >+ Handles[Index], >+ &gEfiSerialIoProtocolGuid, >+ (VOID **) &SerialIo >+ ); > >- CopyMem ( >- &NewTerminalContext->BaudRate, >- &SerialIo->Mode->BaudRate, >- sizeof (UINT64) >- ); >+ CopyMem ( >+ &NewTerminalContext->BaudRate, >+ &SerialIo->Mode->BaudRate, >+ sizeof (UINT64) >+ ); > >- CopyMem ( >- &NewTerminalContext->DataBits, >- &SerialIo->Mode->DataBits, >- sizeof (UINT8) >- ); >+ CopyMem ( >+ &NewTerminalContext->DataBits, >+ &SerialIo->Mode->DataBits, >+ sizeof (UINT8) >+ ); > >- CopyMem ( >- &NewTerminalContext->Parity, >- &SerialIo->Mode->Parity, >- sizeof (UINT8) >- ); >+ CopyMem ( >+ &NewTerminalContext->Parity, >+ &SerialIo->Mode->Parity, >+ sizeof (UINT8) >+ ); > >- CopyMem ( >- &NewTerminalContext->StopBits, >- &SerialIo->Mode->StopBits, >- sizeof (UINT8) >- ); >- InsertTailList (&TerminalMenu.Head, &NewMenuEntry->Link); >- TerminalMenu.MenuNumber++; >- } >+ CopyMem ( >+ &NewTerminalContext->StopBits, >+ &SerialIo->Mode->StopBits, >+ sizeof (UINT8) >+ ); >+ InsertTailList (&TerminalMenu.Head, &NewMenuEntry->Link); >+ TerminalMenu.MenuNumber++; > } > if (Handles !=3D NULL) { > FreePool (Handles); >@@ -753,8 +734,6 @@ GetConsoleMenu ( > UINTN Index2; > BM_MENU_ENTRY *NewMenuEntry; > BM_CONSOLE_CONTEXT *NewConsoleContext; >- TYPE_OF_TERMINAL Terminal; >- UINTN Com; > BM_MENU_OPTION *ConsoleMenu; > > DevicePath =3D NULL; >@@ -822,11 +801,7 @@ GetConsoleMenu ( > NewMenuEntry->HelpStringToken =3D HiiSetString (mBmmCallbackInfo- >>BmmHiiHandle, 0, NewMenuEntry->HelpString, NULL); > } > >- NewConsoleContext->IsTerminal =3D IsTerminalDevicePath ( >- NewConsoleContext->DevicePath, >- &Terminal, >- &Com >- ); >+ NewConsoleContext->IsTerminal =3D IsTerminalDevicePath >(NewConsoleContext->DevicePath); > > NewConsoleContext->IsActive =3D MatchDevicePaths ( > DevicePath, >@@ -884,8 +859,6 @@ FreeAllConsoles ( > > > @param DevicePath DevicePath to be checked >- @param Termi If DevicePath is valid Terminal, terminal type i= s returned. >- @param Com If DevicePath is valid Terminal, Com Port type i= s >returned. > > @retval TRUE If DevicePath point to a Terminal. > @retval FALSE If DevicePath does not point to a Terminal. >@@ -893,90 +866,22 @@ FreeAllConsoles ( > **/ > BOOLEAN > IsTerminalDevicePath ( >- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, >- OUT TYPE_OF_TERMINAL *Termi, >- OUT UINTN *Com >+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath > ) > { >- BOOLEAN IsTerminal; >+ EFI_STATUS Status; > EFI_DEVICE_PATH_PROTOCOL *Node; >- VENDOR_DEVICE_PATH *Vendor; >- UART_DEVICE_PATH *Uart; >- ACPI_HID_DEVICE_PATH *Acpi; >- >- IsTerminal =3D FALSE; >- >- Uart =3D NULL; >- Vendor =3D NULL; >- Acpi =3D NULL; >- for (Node =3D DevicePath; !IsDevicePathEnd (Node); Node =3D >NextDevicePathNode (Node)) { >- // >- // Vendor points to the node before the End node >- // >- Vendor =3D (VENDOR_DEVICE_PATH *) Node; >- >- if ((DevicePathType (Node) =3D=3D MESSAGING_DEVICE_PATH) && >(DevicePathSubType (Node) =3D=3D MSG_UART_DP)) { >- Uart =3D (UART_DEVICE_PATH *) Node; >- } >- >- if (Uart =3D=3D NULL) { >- // >- // Acpi points to the node before the UART node >- // >- Acpi =3D (ACPI_HID_DEVICE_PATH *) Node; >- } >- } >- >- if (Vendor =3D=3D NULL || >- DevicePathType (Vendor) !=3D MESSAGING_DEVICE_PATH || >- DevicePathSubType (Vendor) !=3D MSG_VENDOR_DP || >- Uart =3D=3D NULL) { >- return FALSE; >- } >+ EFI_HANDLE SerialHandle; > >- // >- // There are four kinds of Terminal types >- // check to see whether this devicepath >- // is one of that type >- // >- if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[0])) { >- *Termi =3D TerminalTypePcAnsi; >- IsTerminal =3D TRUE; >- } else { >- if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[1])) { >- *Termi =3D TerminalTypeVt100; >- IsTerminal =3D TRUE; >- } else { >- if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[2])) { >- *Termi =3D TerminalTypeVt100Plus; >- IsTerminal =3D TRUE; >- } else { >- if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[3])) { >- *Termi =3D TerminalTypeVtUtf8; >- IsTerminal =3D TRUE; >- } else { >- if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[4])) { >- *Termi =3D TerminalTypeTtyTerm; >- IsTerminal =3D TRUE; >- } else { >- IsTerminal =3D FALSE; >- } >- } >- } >- } >- } >- >- if (!IsTerminal) { >- return FALSE; >- } >- >- if ((Acpi !=3D NULL) && IsIsaSerialNode (Acpi)) { >- CopyMem (Com, &Acpi->UID, sizeof (UINT32)); >- } else { >+ Node =3D DevicePath; >+ Status =3D gBS->LocateDevicePath (&gEfiSerialIoProtocolGuid, &Node, >&SerialHandle); >+ if (EFI_ERROR (Status)) { > return FALSE; > } > >- return TRUE; >+ return (BOOLEAN) ( >+ (DevicePathType (Node) =3D=3D MESSAGING_DEVICE_PATH) && >+ (DevicePathSubType (Node) =3D=3D MSG_VENDOR_DP)); > } > > /** >-- >2.9.0.windows.1 > >_______________________________________________ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel