From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 093D08194A for ; Mon, 9 Jan 2017 01:32:25 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP; 09 Jan 2017 01:32:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,339,1477983600"; d="scan'208";a="50839950" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga005.jf.intel.com with ESMTP; 09 Jan 2017 01:32:22 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 9 Jan 2017 01:32:22 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.59]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.132]) with mapi id 14.03.0248.002; Mon, 9 Jan 2017 17:32:20 +0800 From: "Ni, Ruiyu" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Gao, Liming" Thread-Topic: [edk2] [PATCH] MdeModulePkg/BootMaintenanceManagerUiLib: Support NT32 terminals Thread-Index: AQHSah6x5o2dq4hpg0Gg+XbB7fCp5qEv4jEQ Date: Mon, 9 Jan 2017 09:32:20 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5B87905D@SHSMSX104.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, zh-CN 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: Mon, 09 Jan 2017 09:32:25 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Send to correct mail address. Thanks/Ray > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Ruiyu Ni > Sent: Monday, January 9, 2017 10:19 AM > To: edk2-devel@lists.01.org > Cc: Dandan Bi ; Gao, Liming > Subject: [edk2] [PATCH] MdeModulePkg/BootMaintenanceManagerUiLib: > Support NT32 terminals >=20 > The patch enhances Boot Maintenance Manager to recognize the terminal > consoles in NT32 platform. >=20 > 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(-) >=20 > 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 >=20 > -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 ( >=20 >=20 > @param DevicePath DevicePath to be checked > - @param Termi If DevicePath is valid Terminal, terminal type = is > returned. > - @param Com If DevicePath is valid Terminal, Com Port type = is > returned. >=20 > @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 > ); >=20 > /** > @@ -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 > ); >=20 > - 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; > } >=20 > - 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 = 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); > + } >=20 > - 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 han= g the > system! > - // coz' the misc data for each platform is not correct, actually i= t's the > device path stored in > - // datahub which is not completed, so a searching for end of devic= e 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; >=20 > - NewMenuEntry->HelpString =3D NULL; > + NewMenuEntry->DisplayStringToken =3D HiiSetString > + (mBmmCallbackInfo->BmmHiiHandle, 0, NewMenuEntry->DisplayString, > + NULL); >=20 > - NewMenuEntry->DisplayStringToken =3D HiiSetString (mBmmCallbackInf= o- > >BmmHiiHandle, 0, NewMenuEntry->DisplayString, NULL); > + NewMenuEntry->HelpStringToken =3D NewMenuEntry- > >DisplayStringToken; >=20 > - NewMenuEntry->HelpStringToken =3D NewMenuEntry- > >DisplayStringToken; > - > - gBS->HandleProtocol ( > - Handles[Index], > - &gEfiSerialIoProtocolGuid, > - (VOID **) &SerialIo > - ); > + gBS->HandleProtocol ( > + Handles[Index], > + &gEfiSerialIoProtocolGuid, > + (VOID **) &SerialIo > + ); >=20 > - CopyMem ( > - &NewTerminalContext->BaudRate, > - &SerialIo->Mode->BaudRate, > - sizeof (UINT64) > - ); > + CopyMem ( > + &NewTerminalContext->BaudRate, > + &SerialIo->Mode->BaudRate, > + sizeof (UINT64) > + ); >=20 > - CopyMem ( > - &NewTerminalContext->DataBits, > - &SerialIo->Mode->DataBits, > - sizeof (UINT8) > - ); > + CopyMem ( > + &NewTerminalContext->DataBits, > + &SerialIo->Mode->DataBits, > + sizeof (UINT8) > + ); >=20 > - CopyMem ( > - &NewTerminalContext->Parity, > - &SerialIo->Mode->Parity, > - sizeof (UINT8) > - ); > + CopyMem ( > + &NewTerminalContext->Parity, > + &SerialIo->Mode->Parity, > + sizeof (UINT8) > + ); >=20 > - 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; >=20 > DevicePath =3D NULL; > @@ -822,11 +801,7 @@ GetConsoleMenu ( > NewMenuEntry->HelpStringToken =3D HiiSetString (mBmmCallbackInfo- > >BmmHiiHandle, 0, NewMenuEntry->HelpString, NULL); > } >=20 > - NewConsoleContext->IsTerminal =3D IsTerminalDevicePath ( > - NewConsoleContext->DevicePath, > - &Terminal, > - &Com > - ); > + NewConsoleContext->IsTerminal =3D IsTerminalDevicePath > + (NewConsoleContext->DevicePath); >=20 > NewConsoleContext->IsActive =3D MatchDevicePaths ( > DevicePath, @@ -884,8 +859,6 @@ Free= AllConsoles ( >=20 >=20 > @param DevicePath DevicePath to be checked > - @param Termi If DevicePath is valid Terminal, terminal type = is > returned. > - @param Com If DevicePath is valid Terminal, Com Port type = is > returned. >=20 > @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; >=20 > - // > - // 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; > } >=20 > - return TRUE; > + return (BOOLEAN) ( > + (DevicePathType (Node) =3D=3D MESSAGING_DEVICE_PATH) && > + (DevicePathSubType (Node) =3D=3D MSG_VENDOR_DP)); > } >=20 > /** > -- > 2.9.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel