temporary roll back changing on gEfiHotPlugDevice.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7640 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff
2009-02-24 08:03:42 +00:00
parent d5893e0b04
commit 4986c56135
8 changed files with 157 additions and 166 deletions

View File

@ -0,0 +1,24 @@
/** @file
This guid is used to specify the device is the hot plug device.
If the device is the hot plug device, this guid as the protocol guid
will be installed into this device handle.
Copyright (c) 2006 - 2008, 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
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __HOT_PLUG_DEVICE_H__
#define __HOT_PLUG_DEVICE_H__
#define HOT_PLUG_DEVICE_GUID \
{ 0x220ac432, 0x1d43, 0x49e5, {0xa7, 0x4f, 0x4c, 0x9d, 0xa6, 0x7a, 0xd2, 0x3b } }
extern EFI_GUID gEfiHotPlugDeviceGuid;
#endif

View File

@ -226,6 +226,8 @@
## Protocol Guid specify the Simple TextIn Notify handle. ## Protocol Guid specify the Simple TextIn Notify handle.
## Include/Protocol/SimpleTextInExNotify.h ## Include/Protocol/SimpleTextInExNotify.h
gSimpleTextInExNotifyGuid = { 0x856f2def, 0x4e93, 0x4d6b, { 0x94, 0xce, 0x1c, 0xfe, 0x47, 0x01, 0x3e, 0xa5 }} gSimpleTextInExNotifyGuid = { 0x856f2def, 0x4e93, 0x4d6b, { 0x94, 0xce, 0x1c, 0xfe, 0x47, 0x01, 0x3e, 0xa5 }}
## Protocol Guid specify the device is the hot plug device.
gEfiHotPlugDeviceGuid = { 0x220AC432, 0x1D43, 0x49E5, { 0xA7, 0x4F, 0x4C, 0x9D, 0xA6, 0x7A, 0xD2, 0x3B }}
[PcdsFeatureFlag.common] [PcdsFeatureFlag.common]
## Indicate whether platform can support update capsule across a system reset ## Indicate whether platform can support update capsule across a system reset

View File

@ -256,12 +256,12 @@ ConPlatformTextInDriverBindingStart (
return Status; return Status;
} }
// //
// Check the device path, if it is a hot plug device, // Check the device handle, if it is a hot plug device,
// do not put the device path into ConInDev, and install // do not put the device path into ConInDev, and install
// gEfiConsoleInDeviceGuid to the device handle directly. // gEfiConsoleInDeviceGuid to the device handle directly.
// The policy is, make hot plug device plug in and play immediately. // The policy is, make hot plug device plug in and play immediately.
// //
if (IsHotPlugDevice (DevicePath)) { if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
gBS->InstallMultipleProtocolInterfaces ( gBS->InstallMultipleProtocolInterfaces (
&ControllerHandle, &ControllerHandle,
&gEfiConsoleInDeviceGuid, &gEfiConsoleInDeviceGuid,
@ -373,12 +373,12 @@ ConPlatformTextOutDriverBindingStart (
return Status; return Status;
} }
// //
// Check the device path, if it is a hot plug device, // Check the device handle, if it is a hot plug device,
// do not put the device path into ConOutDev and ErrOutDev, // do not put the device path into ConOutDev and ErrOutDev,
// and install gEfiConsoleOutDeviceGuid to the device handle directly. // and install gEfiConsoleOutDeviceGuid to the device handle directly.
// The policy is, make hot plug device plug in and play immediately. // The policy is, make hot plug device plug in and play immediately.
// //
if (IsHotPlugDevice (DevicePath)) { if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
gBS->InstallMultipleProtocolInterfaces ( gBS->InstallMultipleProtocolInterfaces (
&ControllerHandle, &ControllerHandle,
&gEfiConsoleOutDeviceGuid, &gEfiConsoleOutDeviceGuid,
@ -482,7 +482,11 @@ ConPlatformTextInDriverBindingStop (
EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *DevicePath;
// //
// Get the Device Path Protocol firstly // If it is not a hot-plug device, first delete it from the ConInDev variable.
//
if (!IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
//
// Get the Device Path Protocol so the environment variables can be updated
// //
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
ControllerHandle, ControllerHandle,
@ -492,15 +496,7 @@ ConPlatformTextInDriverBindingStop (
ControllerHandle, ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL EFI_OPEN_PROTOCOL_GET_PROTOCOL
); );
if (!EFI_ERROR (Status)) {
if (EFI_ERROR (Status)) {
return Status;
}
//
// If it is not a hot-plug device, first delete it from the ConInDev variable.
//
if (!IsHotPlugDevice (DevicePath)) {
// //
// Remove DevicePath from ConInDev // Remove DevicePath from ConInDev
// //
@ -510,7 +506,7 @@ ConPlatformTextInDriverBindingStop (
DELETE DELETE
); );
} }
}
// //
// Uninstall the Console Device GUIDs from Controller Handle // Uninstall the Console Device GUIDs from Controller Handle
// //
@ -561,7 +557,11 @@ ConPlatformTextOutDriverBindingStop (
EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *DevicePath;
// //
// Get the Device Path Protocol firstly // If it is not a hot-plug device, first delete it from the ConOutDev and ErrOutDev variable.
//
if (!IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
//
// Get the Device Path Protocol so the environment variables can be updated
// //
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
ControllerHandle, ControllerHandle,
@ -571,15 +571,7 @@ ConPlatformTextOutDriverBindingStop (
ControllerHandle, ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL EFI_OPEN_PROTOCOL_GET_PROTOCOL
); );
if (!EFI_ERROR (Status)) {
if (EFI_ERROR (Status)) {
return Status;
}
//
// If it is not a hot-plug device, first delete it from the ConOutDev and ErrOutDev variable.
//
if (!IsHotPlugDevice (DevicePath)) {
// //
// Remove DevicePath from ConOutDev, and ErrOutDev // Remove DevicePath from ConOutDev, and ErrOutDev
// //
@ -594,7 +586,7 @@ ConPlatformTextOutDriverBindingStop (
DELETE DELETE
); );
} }
}
// //
// Uninstall the Console Device GUIDs from Controller Handle // Uninstall the Console Device GUIDs from Controller Handle
// //
@ -937,12 +929,10 @@ ConPlatformUpdateDeviceVariable (
} }
/** /**
Check if the device supports hot-plug through its device path. Check if the device supports hot-plug.
This function could be updated to check more types of Hot Plug devices. @param DriverBindingHandle Protocol instance pointer.
Currently, it checks USB and PCCard device. @param ControllerHandle Handle of device to check.
@param DevicePath Pointer to device's device path.
@retval TRUE The devcie is a hot-plug device @retval TRUE The devcie is a hot-plug device
@retval FALSE The devcie is not a hot-plug device. @retval FALSE The devcie is not a hot-plug device.
@ -950,35 +940,26 @@ ConPlatformUpdateDeviceVariable (
**/ **/
BOOLEAN BOOLEAN
IsHotPlugDevice ( IsHotPlugDevice (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath EFI_HANDLE DriverBindingHandle,
EFI_HANDLE ControllerHandle
) )
{ {
EFI_DEVICE_PATH_PROTOCOL *CheckDevicePath; EFI_STATUS Status;
CheckDevicePath = DevicePath;
while (!IsDevicePathEnd (CheckDevicePath)) {
// //
// Check device whether is hot plug device or not throught Device Path // HotPlugDeviceGuid indicates ControllerHandle stands for a hot plug device.
// //
if ((DevicePathType (CheckDevicePath) == MESSAGING_DEVICE_PATH) && Status = gBS->OpenProtocol (
(DevicePathSubType (CheckDevicePath) == MSG_USB_DP || ControllerHandle,
DevicePathSubType (CheckDevicePath) == MSG_USB_CLASS_DP || &gEfiHotPlugDeviceGuid,
DevicePathSubType (CheckDevicePath) == MSG_USB_WWID_DP)) { NULL,
// DriverBindingHandle,
// If Device is USB device ControllerHandle,
// EFI_OPEN_PROTOCOL_TEST_PROTOCOL
return TRUE; );
} if (EFI_ERROR (Status)) {
if ((DevicePathType (CheckDevicePath) == HARDWARE_DEVICE_PATH) &&
(DevicePathSubType (CheckDevicePath) == HW_PCCARD_DP)) {
//
// If Device is PCCard
//
return TRUE;
}
CheckDevicePath = NextDevicePathNode (CheckDevicePath);
}
return FALSE; return FALSE;
}
return TRUE;
} }

View File

@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/SimpleTextOut.h> #include <Protocol/SimpleTextOut.h>
#include <Protocol/DevicePath.h> #include <Protocol/DevicePath.h>
#include <Protocol/SimpleTextIn.h> #include <Protocol/SimpleTextIn.h>
#include <Protocol/HotPlugDevice.h>
#include <Guid/GlobalVariable.h> #include <Guid/GlobalVariable.h>
#include <Guid/ConsoleInDevice.h> #include <Guid/ConsoleInDevice.h>
@ -292,12 +293,10 @@ ConPlatformUpdateDeviceVariable (
); );
/** /**
Check if the device supports hot-plug through its device path. Check if the device supports hot-plug.
This function could be updated to check more types of Hot Plug devices. @param DriverBindingHandle Protocol instance pointer.
Currently, it checks USB and PCCard device. @param ControllerHandle Handle of device to check.
@param DevicePath Pointer to device's device path.
@retval TRUE The devcie is a hot-plug device @retval TRUE The devcie is a hot-plug device
@retval FALSE The devcie is not a hot-plug device. @retval FALSE The devcie is not a hot-plug device.
@ -305,7 +304,8 @@ ConPlatformUpdateDeviceVariable (
**/ **/
BOOLEAN BOOLEAN
IsHotPlugDevice ( IsHotPlugDevice (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath EFI_HANDLE DriverBindingHandle,
EFI_HANDLE ControllerHandle
); );
// //

View File

@ -87,4 +87,5 @@
gEfiDevicePathProtocolGuid ## TO_START gEfiDevicePathProtocolGuid ## TO_START
gEfiSimpleTextInProtocolGuid ## TO_START gEfiSimpleTextInProtocolGuid ## TO_START
gEfiSimpleTextOutProtocolGuid ## TO_START gEfiSimpleTextOutProtocolGuid ## TO_START
gEfiHotPlugDeviceGuid ## SOMETIMES_CONSUMES (Used to check if it's a hot-plug device)

View File

@ -300,12 +300,19 @@ TerminalDriverBindingStart (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto Error; goto Error;
} }
if (IsHotPlugDevice (ParentDevicePath)) {
// //
// if the serial device is a hot plug device, do not update the // if the serial device is a hot plug device, do not update the
// ConInDev, ConOutDev, and StdErrDev variables. // ConInDev, ConOutDev, and StdErrDev variables.
// //
Status = gBS->OpenProtocol (
Controller,
&gEfiHotPlugDeviceGuid,
NULL,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
);
if (EFI_ERROR (Status)) {
TerminalUpdateConsoleDevVariable (L"ConInDev", ParentDevicePath); TerminalUpdateConsoleDevVariable (L"ConInDev", ParentDevicePath);
TerminalUpdateConsoleDevVariable (L"ConOutDev", ParentDevicePath); TerminalUpdateConsoleDevVariable (L"ConOutDev", ParentDevicePath);
TerminalUpdateConsoleDevVariable (L"ErrOutDev", ParentDevicePath); TerminalUpdateConsoleDevVariable (L"ErrOutDev", ParentDevicePath);
@ -620,7 +627,26 @@ TerminalDriverBindingStart (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
goto Error; goto Error;
} }
//
// if the serial device is a hot plug device, attaches the HotPlugGuid
// onto the terminal device handle.
//
Status = gBS->OpenProtocol (
Controller,
&gEfiHotPlugDeviceGuid,
NULL,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
);
if (!EFI_ERROR (Status)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&TerminalDevice->Handle,
&gEfiHotPlugDeviceGuid,
NULL,
NULL
);
}
// //
// Register the Parent-Child relationship via // Register the Parent-Child relationship via
// EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. // EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
@ -860,6 +886,25 @@ TerminalDriverBindingStop (
FreeUnicodeStringTable (TerminalDevice->ControllerNameTable); FreeUnicodeStringTable (TerminalDevice->ControllerNameTable);
} }
Status = gBS->OpenProtocol (
ChildHandleBuffer[Index],
&gEfiHotPlugDeviceGuid,
NULL,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
);
if (!EFI_ERROR (Status)) {
Status = gBS->UninstallMultipleProtocolInterfaces (
ChildHandleBuffer[Index],
&gEfiHotPlugDeviceGuid,
NULL,
NULL
);
} else {
Status = EFI_SUCCESS;
}
gBS->CloseEvent (TerminalDevice->TwoSecondTimeOut); gBS->CloseEvent (TerminalDevice->TwoSecondTimeOut);
gBS->CloseEvent (TerminalDevice->SimpleInput.WaitForKey); gBS->CloseEvent (TerminalDevice->SimpleInput.WaitForKey);
gBS->CloseEvent (TerminalDevice->SimpleInputEx.WaitForKeyEx); gBS->CloseEvent (TerminalDevice->SimpleInputEx.WaitForKeyEx);
@ -1277,50 +1322,3 @@ InitializeTerminal(
return Status; return Status;
} }
/**
Check if the device supports hot-plug through its device path.
This function could be updated to check more types of Hot Plug devices.
Currently, it checks USB and PCCard device.
@param DevicePath Pointer to device's device path.
@retval TRUE The devcie is a hot-plug device
@retval FALSE The devcie is not a hot-plug device.
**/
BOOLEAN
IsHotPlugDevice (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
EFI_DEVICE_PATH_PROTOCOL *CheckDevicePath;
CheckDevicePath = DevicePath;
while (!IsDevicePathEnd (CheckDevicePath)) {
//
// Check device whether is hot plug device or not throught Device Path
//
if ((DevicePathType (CheckDevicePath) == MESSAGING_DEVICE_PATH) &&
(DevicePathSubType (CheckDevicePath) == MSG_USB_DP ||
DevicePathSubType (CheckDevicePath) == MSG_USB_CLASS_DP ||
DevicePathSubType (CheckDevicePath) == MSG_USB_WWID_DP)) {
//
// If Device is USB device
//
return TRUE;
}
if ((DevicePathType (CheckDevicePath) == HARDWARE_DEVICE_PATH) &&
(DevicePathSubType (CheckDevicePath) == HW_PCCARD_DP)) {
//
// If Device is PCCard
//
return TRUE;
}
CheckDevicePath = NextDevicePathNode (CheckDevicePath);
}
return FALSE;
}

View File

@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Guid/PcAnsi.h> #include <Guid/PcAnsi.h>
#include <Protocol/SimpleTextInExNotify.h> #include <Protocol/SimpleTextInExNotify.h>
#include <Protocol/HotPlugDevice.h>
#include <Protocol/SimpleTextOut.h> #include <Protocol/SimpleTextOut.h>
#include <Protocol/SerialIo.h> #include <Protocol/SerialIo.h>
#include <Protocol/DevicePath.h> #include <Protocol/DevicePath.h>
@ -1346,21 +1347,4 @@ TerminalIsValidEfiCntlChar (
IN CHAR16 CharC IN CHAR16 CharC
); );
/**
Check if the device supports hot-plug through its device path.
This function could be updated to check more types of Hot Plug devices.
Currently, it checks USB and PCCard device.
@param DevicePath Pointer to device's device path.
@retval TRUE The devcie is a hot-plug device
@retval FALSE The devcie is not a hot-plug device.
**/
BOOLEAN
IsHotPlugDevice (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
#endif #endif

View File

@ -73,6 +73,7 @@
gEfiSimpleTextInputExProtocolGuid ## BY_START gEfiSimpleTextInputExProtocolGuid ## BY_START
gEfiSimpleTextOutProtocolGuid ## BY_START gEfiSimpleTextOutProtocolGuid ## BY_START
gSimpleTextInExNotifyGuid ## SOMETIMES_CONSUMES gSimpleTextInExNotifyGuid ## SOMETIMES_CONSUMES
gEfiHotPlugDeviceGuid ## SOMETIMES_CONSUMES
[Pcd] [Pcd]
gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueRemoteConsoleError gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueRemoteConsoleError