Check in following modules,
DxeIpl ConPlatform ConSplitter GraphicsConsole Terminal DevicePath git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3069 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
54
MdeModulePkg/Universal/Console/ConPlatformDxe/CommonHeader.h
Normal file
54
MdeModulePkg/Universal/Console/ConPlatformDxe/CommonHeader.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/**@file
|
||||
Common header file shared by all source files.
|
||||
|
||||
This file includes package header files, library classes and protocol, PPI & GUID definitions.
|
||||
|
||||
Copyright (c) 2006 - 2007, 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 __COMMON_HEADER_H_
|
||||
#define __COMMON_HEADER_H_
|
||||
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <Uefi.h>
|
||||
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Protocol/SimpleTextOut.h>
|
||||
#include <Guid/GlobalVariable.h>
|
||||
#include <Guid/ConsoleInDevice.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/SimpleTextIn.h>
|
||||
#include <Guid/HotPlugDevice.h>
|
||||
#include <Guid/StandardErrorDevice.h>
|
||||
#include <Guid/ConsoleOutDevice.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
//
|
||||
// Driver Binding Externs
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;
|
||||
|
||||
#endif
|
146
MdeModulePkg/Universal/Console/ConPlatformDxe/ComponentName.c
Normal file
146
MdeModulePkg/Universal/Console/ConPlatformDxe/ComponentName.c
Normal file
@@ -0,0 +1,146 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, 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.
|
||||
|
||||
Module Name:
|
||||
|
||||
ComponentName.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
|
||||
|
||||
#include "ConPlatform.h"
|
||||
#include "ComponentName.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName = {
|
||||
ConPlatformComponentNameGetDriverName,
|
||||
ConPlatformComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
STATIC EFI_UNICODE_STRING_TABLE mConPlatformDriverNameTable[] = {
|
||||
{
|
||||
"eng",
|
||||
L"Platform Console Management Driver"
|
||||
},
|
||||
{
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
Language - A pointer to a three character ISO 639-2 language identifier.
|
||||
This is the language of the driver name that that the caller
|
||||
is requesting, and it must match one of the languages specified
|
||||
in SupportedLanguages. The number of languages supported by a
|
||||
driver is up to the driver writer.
|
||||
DriverName - A pointer to the Unicode string to return. This Unicode string
|
||||
is the name of the driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the Driver specified by This
|
||||
and the language specified by Language was returned
|
||||
in DriverName.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - DriverName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gConPlatformComponentName.SupportedLanguages,
|
||||
mConPlatformDriverNameTable,
|
||||
DriverName
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by an EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
ControllerHandle - The handle of a controller that the driver specified by
|
||||
This is managing. This handle specifies the controller
|
||||
whose name is to be returned.
|
||||
ChildHandle - The handle of the child controller to retrieve the name
|
||||
of. This is an optional parameter that may be NULL. It
|
||||
will be NULL for device drivers. It will also be NULL
|
||||
for a bus drivers that wish to retrieve the name of the
|
||||
bus controller. It will not be NULL for a bus driver
|
||||
that wishes to retrieve the name of a child controller.
|
||||
Language - A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the controller name
|
||||
that that the caller is requesting, and it must match one
|
||||
of the languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up to the
|
||||
driver writer.
|
||||
ControllerName - A pointer to the Unicode string to return. This Unicode
|
||||
string is the name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the language
|
||||
specified by Language from the point of view of the
|
||||
driver specified by This.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the user readable name in the
|
||||
language specified by Language for the driver
|
||||
specified by This was returned in DriverName.
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - ControllerName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, 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.
|
||||
|
||||
Module Name:
|
||||
|
||||
ComponentName.h
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef CON_MANAGE_COMPONENT_NAME_H_
|
||||
#define CON_MANAGE_COMPONENT_NAME_H_
|
||||
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
#endif
|
950
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
Normal file
950
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
Normal file
@@ -0,0 +1,950 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, 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.
|
||||
|
||||
Module Name:
|
||||
|
||||
ConPlatform.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
#include "ConPlatform.h"
|
||||
|
||||
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Protocol/SimpleTextOut.h>
|
||||
#include <Guid/GlobalVariable.h>
|
||||
#include <Guid/ConsoleInDevice.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/SimpleTextIn.h>
|
||||
#include <Guid/HotPlugDevice.h>
|
||||
#include <Guid/StandardErrorDevice.h>
|
||||
#include <Guid/ConsoleOutDevice.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
//
|
||||
// Driver Binding Externs
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding = {
|
||||
ConPlatformTextInDriverBindingSupported,
|
||||
ConPlatformTextInDriverBindingStart,
|
||||
ConPlatformTextInDriverBindingStop,
|
||||
0xa,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding = {
|
||||
ConPlatformTextOutDriverBindingSupported,
|
||||
ConPlatformTextOutDriverBindingStart,
|
||||
ConPlatformTextOutDriverBindingStop,
|
||||
0xa,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
The user Entry Point for module ConPlatform. The user code starts with this function.
|
||||
|
||||
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param[in] SystemTable A pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS The entry point is executed successfully.
|
||||
@retval other Some error occurs when executing this entry point.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeConPlatform(
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Install driver model protocol(s).
|
||||
//
|
||||
Status = EfiLibInstallAllDriverProtocols (
|
||||
ImageHandle,
|
||||
SystemTable,
|
||||
&gConPlatformTextInDriverBinding,
|
||||
ImageHandle,
|
||||
&gConPlatformComponentName,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = EfiLibInstallAllDriverProtocols (
|
||||
ImageHandle,
|
||||
SystemTable,
|
||||
&gConPlatformTextOutDriverBinding,
|
||||
NULL,
|
||||
&gConPlatformComponentName,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextInDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Supported
|
||||
|
||||
Arguments:
|
||||
(Standard DriverBinding Protocol Supported() function)
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
return ConPlatformDriverBindingSupported (
|
||||
This,
|
||||
ControllerHandle,
|
||||
RemainingDevicePath,
|
||||
&gEfiSimpleTextInProtocolGuid
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextOutDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Supported
|
||||
|
||||
Arguments:
|
||||
(Standard DriverBinding Protocol Supported() function)
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
return ConPlatformDriverBindingSupported (
|
||||
This,
|
||||
ControllerHandle,
|
||||
RemainingDevicePath,
|
||||
&gEfiSimpleTextOutProtocolGuid
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ConPlatformDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
|
||||
IN EFI_GUID *ProtocolGuid
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Supported
|
||||
|
||||
Arguments:
|
||||
(Standard DriverBinding Protocol Supported() function)
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *Interface;
|
||||
|
||||
//
|
||||
// Test to see if this is a physical device by checking to see if
|
||||
// it has a Device Path Protocol
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
NULL,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Test to see if this device supports the Simple Text Output Protocol
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
ProtocolGuid,
|
||||
(VOID **) &Interface,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
ProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextInDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Arguments:
|
||||
(Standard DriverBinding Protocol Start() function)
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn;
|
||||
|
||||
//
|
||||
// Get the Device Path Protocol so the environment variables can be updated
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &DevicePath,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Open the Simple Input Protocol BY_DRIVER
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleTextInProtocolGuid,
|
||||
(VOID **) &TextIn,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Check the device handle, if it is a hot plug device,
|
||||
// do not put the device path into ConInDev, and install
|
||||
// gEfiConsoleInDeviceGuid to the device handle directly.
|
||||
// The policy is, make hot plug device plug in and play immediately.
|
||||
//
|
||||
if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
|
||||
gBS->InstallMultipleProtocolInterfaces (
|
||||
&ControllerHandle,
|
||||
&gEfiConsoleInDeviceGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
} else {
|
||||
//
|
||||
// Append the device path to the ConInDev environment variable
|
||||
//
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
VarConsoleInpDev,
|
||||
DevicePath,
|
||||
APPEND
|
||||
);
|
||||
|
||||
//
|
||||
// If the device path is an instance in the ConIn environment variable,
|
||||
// then install EfiConsoleInDeviceGuid onto ControllerHandle
|
||||
//
|
||||
Status = ConPlatformUpdateDeviceVariable (
|
||||
VarConsoleInp,
|
||||
DevicePath,
|
||||
CHECK
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
gBS->InstallMultipleProtocolInterfaces (
|
||||
&ControllerHandle,
|
||||
&gEfiConsoleInDeviceGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
} else {
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleTextInProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextOutDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Arguments:
|
||||
(Standard DriverBinding Protocol Start() function)
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;
|
||||
BOOLEAN NeedClose;
|
||||
|
||||
NeedClose = TRUE;
|
||||
|
||||
//
|
||||
// Get the Device Path Protocol so the environment variables can be updated
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &DevicePath,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Open the Simple Text Output Protocol BY_DRIVER
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
(VOID **) &TextOut,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Check the device handle, if it is a hot plug device,
|
||||
// do not put the device path into ConOutDev and StdErrDev,
|
||||
// and install gEfiConsoleOutDeviceGuid to the device handle directly.
|
||||
// The policy is, make hot plug device plug in and play immediately.
|
||||
//
|
||||
if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
|
||||
gBS->InstallMultipleProtocolInterfaces (
|
||||
&ControllerHandle,
|
||||
&gEfiConsoleOutDeviceGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
} else {
|
||||
//
|
||||
// Append the device path to the ConOutDev environment variable
|
||||
//
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
VarConsoleOutDev,
|
||||
DevicePath,
|
||||
APPEND
|
||||
);
|
||||
//
|
||||
// Append the device path to the StdErrDev environment variable
|
||||
//
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
VarErrorOutDev,
|
||||
DevicePath,
|
||||
APPEND
|
||||
);
|
||||
|
||||
//
|
||||
// If the device path is an instance in the ConOut environment variable,
|
||||
// then install EfiConsoleOutDeviceGuid onto ControllerHandle
|
||||
//
|
||||
Status = ConPlatformUpdateDeviceVariable (
|
||||
VarConsoleOut,
|
||||
DevicePath,
|
||||
CHECK
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
NeedClose = FALSE;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&ControllerHandle,
|
||||
&gEfiConsoleOutDeviceGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
//
|
||||
// If the device path is an instance in the StdErr environment variable,
|
||||
// then install EfiStandardErrorDeviceGuid onto ControllerHandle
|
||||
//
|
||||
Status = ConPlatformUpdateDeviceVariable (
|
||||
VarErrorOut,
|
||||
DevicePath,
|
||||
CHECK
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
NeedClose = FALSE;
|
||||
gBS->InstallMultipleProtocolInterfaces (
|
||||
&ControllerHandle,
|
||||
&gEfiStandardErrorDeviceGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
if (NeedClose) {
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextInDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
(Standard DriverBinding Protocol Stop() function)
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
//
|
||||
// hot plug device is not included into the console associated variables,
|
||||
// so no need to check variable for those hot plug devices.
|
||||
//
|
||||
if (!IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
|
||||
//
|
||||
// Get the Device Path Protocol so the environment variables can be updated
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &DevicePath,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// Remove DevicePath from ConInDev
|
||||
//
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
VarConsoleInpDev,
|
||||
DevicePath,
|
||||
DELETE
|
||||
);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Uninstall the Console Device GUIDs from Controller Handle
|
||||
//
|
||||
ConPlatformUnInstallProtocol (
|
||||
This,
|
||||
ControllerHandle,
|
||||
&gEfiConsoleInDeviceGuid
|
||||
);
|
||||
|
||||
//
|
||||
// Close the Simple Input Protocol
|
||||
//
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleTextInProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextOutDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
(Standard DriverBinding Protocol Stop() function)
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
//
|
||||
// hot plug device is not included into the console associated variables,
|
||||
// so no need to check variable for those hot plug devices.
|
||||
//
|
||||
if (!IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
|
||||
//
|
||||
// Get the Device Path Protocol so the environment variables can be updated
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &DevicePath,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// Remove DevicePath from ConOutDev, and StdErrDev
|
||||
//
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
VarConsoleOutDev,
|
||||
DevicePath,
|
||||
DELETE
|
||||
);
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
VarErrorOutDev,
|
||||
DevicePath,
|
||||
DELETE
|
||||
);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Uninstall the Console Device GUIDs from Controller Handle
|
||||
//
|
||||
ConPlatformUnInstallProtocol (
|
||||
This,
|
||||
ControllerHandle,
|
||||
&gEfiConsoleOutDeviceGuid
|
||||
);
|
||||
|
||||
ConPlatformUnInstallProtocol (
|
||||
This,
|
||||
ControllerHandle,
|
||||
&gEfiStandardErrorDeviceGuid
|
||||
);
|
||||
|
||||
//
|
||||
// Close the Simple Text Output Protocol
|
||||
//
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
ConPlatformUnInstallProtocol (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_GUID *ProtocolGuid
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
Handle,
|
||||
ProtocolGuid,
|
||||
NULL,
|
||||
This->DriverBindingHandle,
|
||||
Handle,
|
||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
gBS->UninstallMultipleProtocolInterfaces (
|
||||
Handle,
|
||||
ProtocolGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
VOID *
|
||||
ConPlatformGetVariable (
|
||||
IN CHAR16 *Name
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Read the EFI variable (Name) and return a dynamically allocated
|
||||
buffer, and the size of the buffer. On failure return NULL.
|
||||
|
||||
Arguments:
|
||||
Name - String part of EFI variable name
|
||||
|
||||
Returns:
|
||||
Dynamically allocated memory that contains a copy of the EFI variable.
|
||||
Caller is repsoncible freeing the buffer.
|
||||
|
||||
NULL - Variable was not read
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *Buffer;
|
||||
UINTN BufferSize;
|
||||
|
||||
BufferSize = 0;
|
||||
Buffer = NULL;
|
||||
|
||||
//
|
||||
// Test to see if the variable exists. If it doesn't reuturn NULL
|
||||
//
|
||||
Status = gRT->GetVariable (
|
||||
Name,
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&BufferSize,
|
||||
Buffer
|
||||
);
|
||||
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
//
|
||||
// Allocate the buffer to return
|
||||
//
|
||||
Buffer = AllocatePool (BufferSize);
|
||||
if (Buffer == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
//
|
||||
// Read variable into the allocated buffer.
|
||||
//
|
||||
Status = gRT->GetVariable (
|
||||
Name,
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&BufferSize,
|
||||
Buffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreePool (Buffer);
|
||||
Buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ConPlatformMatchDevicePaths (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * Multi,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * Single,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,
|
||||
IN BOOLEAN Delete
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function compares a device path data structure to that of all the nodes of a
|
||||
second device path instance.
|
||||
|
||||
Arguments:
|
||||
Multi - A pointer to a multi-instance device path data structure.
|
||||
|
||||
Single - A pointer to a single-instance device path data structure.
|
||||
|
||||
NewDevicePath - If Delete is TRUE, this parameter must not be null, and it
|
||||
points to the remaining device path data structure.
|
||||
(remaining device path = Multi - Single.)
|
||||
|
||||
Delete - If TRUE, means removing Single from Multi.
|
||||
If FALSE, the routine just check whether Single matches
|
||||
with any instance in Multi.
|
||||
|
||||
Returns:
|
||||
|
||||
The function returns EFI_SUCCESS if the Single is contained within Multi.
|
||||
Otherwise, EFI_NOT_FOUND is returned.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath1;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath2;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
|
||||
UINTN Size;
|
||||
|
||||
//
|
||||
// The passed in DevicePath should not be NULL
|
||||
//
|
||||
if ((!Multi) || (!Single)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
//
|
||||
// if performing Delete operation, the NewDevicePath must not be NULL.
|
||||
//
|
||||
TempDevicePath1 = NULL;
|
||||
|
||||
DevicePath = Multi;
|
||||
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
|
||||
|
||||
//
|
||||
// search for the match of 'Single' in 'Multi'
|
||||
//
|
||||
while (DevicePathInst) {
|
||||
if (CompareMem (Single, DevicePathInst, Size) == 0) {
|
||||
if (!Delete) {
|
||||
FreePool (DevicePathInst);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
if (Delete) {
|
||||
TempDevicePath2 = AppendDevicePathInstance (
|
||||
TempDevicePath1,
|
||||
DevicePathInst
|
||||
);
|
||||
if (TempDevicePath1 != NULL) {
|
||||
FreePool (TempDevicePath1);
|
||||
}
|
||||
TempDevicePath1 = TempDevicePath2;
|
||||
}
|
||||
}
|
||||
|
||||
FreePool (DevicePathInst);
|
||||
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
|
||||
}
|
||||
|
||||
if (Delete) {
|
||||
*NewDevicePath = TempDevicePath1;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
IN CHAR16 *VariableName,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN CONPLATFORM_VAR_OPERATION Operation
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *VariableDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *NewVariableDevicePath;
|
||||
|
||||
VariableDevicePath = NULL;
|
||||
NewVariableDevicePath = NULL;
|
||||
|
||||
//
|
||||
// Get Variable according to variable name.
|
||||
// The memory for Variable is allocated within ConPlatformGetVarible(),
|
||||
// it is the caller's responsibility to free the memory before return.
|
||||
//
|
||||
VariableDevicePath = ConPlatformGetVariable (VariableName);
|
||||
|
||||
if (Operation != DELETE) {
|
||||
|
||||
Status = ConPlatformMatchDevicePaths (
|
||||
VariableDevicePath,
|
||||
DevicePath,
|
||||
NULL,
|
||||
FALSE
|
||||
);
|
||||
|
||||
if ((Operation == CHECK) || (!EFI_ERROR (Status))) {
|
||||
//
|
||||
// The device path is already in the variable
|
||||
//
|
||||
if (VariableDevicePath != NULL) {
|
||||
FreePool (VariableDevicePath);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// The device path is not in variable. Append DevicePath to the
|
||||
// environment variable that is a multi-instance device path.
|
||||
//
|
||||
Status = EFI_SUCCESS;
|
||||
NewVariableDevicePath = AppendDevicePathInstance (
|
||||
VariableDevicePath,
|
||||
DevicePath
|
||||
);
|
||||
if (NewVariableDevicePath == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
} else {
|
||||
//
|
||||
// Remove DevicePath from the environment variable that
|
||||
// is a multi-instance device path.
|
||||
//
|
||||
Status = ConPlatformMatchDevicePaths (
|
||||
VariableDevicePath,
|
||||
DevicePath,
|
||||
&NewVariableDevicePath,
|
||||
TRUE
|
||||
);
|
||||
}
|
||||
|
||||
if (VariableDevicePath != NULL) {
|
||||
FreePool (VariableDevicePath);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
VariableName,
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
GetDevicePathSize (NewVariableDevicePath),
|
||||
NewVariableDevicePath
|
||||
);
|
||||
|
||||
FreePool (NewVariableDevicePath);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsHotPlugDevice (
|
||||
EFI_HANDLE DriverBindingHandle,
|
||||
EFI_HANDLE ControllerHandle
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// HotPlugDeviceGuid indicates ControllerHandle stands for a hot plug device.
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiHotPlugDeviceGuid,
|
||||
NULL,
|
||||
DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
132
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
Normal file
132
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
Normal file
@@ -0,0 +1,132 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006, 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.
|
||||
|
||||
Module Name:
|
||||
|
||||
ConPlatform.h
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef CON_MANAGE_H_
|
||||
#define CON_MANAGE_H_
|
||||
|
||||
//
|
||||
// Include common header file for this module.
|
||||
//
|
||||
#include "CommonHeader.h"
|
||||
|
||||
#define VarConsoleInpDev L"ConInDev"
|
||||
#define VarConsoleInp L"ConIn"
|
||||
#define VarConsoleOutDev L"ConOutDev"
|
||||
#define VarConsoleOut L"ConOut"
|
||||
#define VarErrorOutDev L"ErrOutDev"
|
||||
#define VarErrorOut L"ErrOut"
|
||||
|
||||
typedef enum {
|
||||
CHECK,
|
||||
APPEND,
|
||||
DELETE
|
||||
} CONPLATFORM_VAR_OPERATION;
|
||||
|
||||
EFI_STATUS
|
||||
ConPlatformDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
|
||||
IN EFI_GUID *ProtocolGuid
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextInDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextOutDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextInDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextOutDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextInDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextOutDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
VOID
|
||||
ConPlatformUnInstallProtocol (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_GUID *ProtocolGuid
|
||||
);
|
||||
|
||||
VOID *
|
||||
ConPlatformGetVariable (
|
||||
IN CHAR16 *Name
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
ConPlatformMatchDevicePaths (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * Multi,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * Single,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,
|
||||
IN BOOLEAN Delete
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
IN CHAR16 *VariableName,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN CONPLATFORM_VAR_OPERATION Operation
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
IsHotPlugDevice (
|
||||
EFI_HANDLE DriverBindingHandle,
|
||||
EFI_HANDLE ControllerHandle
|
||||
);
|
||||
|
||||
#endif
|
112
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.inf
Normal file
112
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.inf
Normal file
@@ -0,0 +1,112 @@
|
||||
#/** @file
|
||||
# Console Platfrom Driver
|
||||
#
|
||||
# Console Platfrom DXE Driver, install Console protocols
|
||||
# Copyright (c) 2006 - 2007, 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.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Defines Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = ConPlatform
|
||||
FILE_GUID = 51ccf399-4fdf-4e55-a45b-e123f84d456a
|
||||
MODULE_TYPE = UEFI_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
ENTRY_POINT = InitializeConPlatform
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
# DRIVER_BINDING = gConPlatformTextInDriverBinding
|
||||
# COMPONENT_NAME = gConPlatformComponentName
|
||||
# DRIVER_BINDING = gConPlatformTextOutDriverBinding
|
||||
# COMPONENT_NAME = gConPlatformComponentName
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Sources Section - list of files that are required for the build to succeed.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Sources.common]
|
||||
ComponentName.c
|
||||
ComponentName.h
|
||||
ConPlatform.h
|
||||
ConPlatform.c
|
||||
CommonHeader.h
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Package Dependency Section - list of Package files that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Library Class Section - list of Library Classes that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[LibraryClasses]
|
||||
MemoryAllocationLib
|
||||
DevicePathLib
|
||||
UefiRuntimeServicesTableLib
|
||||
UefiBootServicesTableLib
|
||||
BaseMemoryLib
|
||||
UefiLib
|
||||
UefiDriverEntryPoint
|
||||
DebugLib
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Guid C Name Section - list of Guids that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Guids]
|
||||
gEfiGlobalVariableGuid # SOMETIMES_CONSUMED L"ErrOut"
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Protocol C Name Section - list of Protocol and Protocol Notify C Names
|
||||
# that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Protocols]
|
||||
gEfiHotPlugDeviceGuid # PROTOCOL TO_START
|
||||
gEfiDevicePathProtocolGuid # PROTOCOL TO_START
|
||||
gEfiSimpleTextInProtocolGuid # PROTOCOL TO_START
|
||||
gEfiSimpleTextOutProtocolGuid # PROTOCOL TO_START
|
||||
gEfiStandardErrorDeviceGuid # PROTOCOL BY_START
|
||||
gEfiConsoleOutDeviceGuid # PROTOCOL BY_START
|
||||
gEfiConsoleInDeviceGuid # PROTOCOL BY_START
|
||||
|
135
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.msa
Normal file
135
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.msa
Normal file
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>ConPlatform</ModuleName>
|
||||
<ModuleType>UEFI_DRIVER</ModuleType>
|
||||
<GuidValue>51ccf399-4fdf-4e55-a45b-e123f84d456a</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Console Platfrom Driver</Abstract>
|
||||
<Description>Console Platfrom DXE Driver, install Console protocols</Description>
|
||||
<Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
|
||||
<License>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.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>ConPlatform</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverModelLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiRuntimeServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DevicePathLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>ConPlatform.c</Filename>
|
||||
<Filename>ConPlatform.h</Filename>
|
||||
<Filename>ComponentName.h</Filename>
|
||||
<Filename>ComponentName.c</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="BY_START">
|
||||
<ProtocolCName>gEfiConsoleInDeviceGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="BY_START">
|
||||
<ProtocolCName>gEfiConsoleOutDeviceGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="BY_START">
|
||||
<ProtocolCName>gEfiStandardErrorDeviceGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiHotPlugDeviceGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<Variables>
|
||||
<Variable Usage="SOMETIMES_CONSUMED">
|
||||
<VariableName>0x0043 0x006F 0x006E 0x0049 0x006E 0x0044 0x0065 0x0076</VariableName>
|
||||
<GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
|
||||
<HelpText>L"ConInDev" global variable will be updated if the serial device is not a hot plug device.</HelpText>
|
||||
</Variable>
|
||||
<Variable Usage="SOMETIMES_CONSUMED">
|
||||
<VariableName>0x0043 0x006F 0x006E 0x0049 0x006E</VariableName>
|
||||
<GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
|
||||
<HelpText>L"ConIn" global variable will be updated if the serial device is not a hot plug device.</HelpText>
|
||||
</Variable>
|
||||
<Variable Usage="SOMETIMES_CONSUMED">
|
||||
<VariableName>0x0043 0x006F 0x006E 0x004F 0x0075 0x0074 0x0044 0x0065 0x0076</VariableName>
|
||||
<GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
|
||||
<HelpText>L"ConOutDev" global variable will be updated if the serial device is not a hot plug device.</HelpText>
|
||||
</Variable>
|
||||
<Variable Usage="SOMETIMES_CONSUMED">
|
||||
<VariableName>0x0043 0x006F 0x006E 0x004F 0x0075 0x0074</VariableName>
|
||||
<GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
|
||||
<HelpText>L"ConOut" global variable will be updated if the serial device is not a hot plug device.</HelpText>
|
||||
</Variable>
|
||||
<Variable Usage="SOMETIMES_CONSUMED">
|
||||
<VariableName>0x0045 0x0072 0x0072 0x004F 0x0075 0x0074 0x0044 0x0065 0x0076</VariableName>
|
||||
<GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
|
||||
<HelpText>L"ErrOutDev" global variable will be updated if the serial device is not a hot plug device.</HelpText>
|
||||
</Variable>
|
||||
<Variable Usage="SOMETIMES_CONSUMED">
|
||||
<VariableName>0x0045 0x0072 0x0072 0x004F 0x0075 0x0074</VariableName>
|
||||
<GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
|
||||
<HelpText>L"ErrOut" global variable will be updated if the serial device is not a hot plug device.</HelpText>
|
||||
</Variable>
|
||||
</Variables>
|
||||
<Guids>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gEfiGlobalVariableGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
<Extern>
|
||||
<DriverBinding>gConPlatformTextInDriverBinding</DriverBinding>
|
||||
<ComponentName>gConPlatformComponentName</ComponentName>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gConPlatformTextOutDriverBinding</DriverBinding>
|
||||
<ComponentName>gConPlatformComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
Reference in New Issue
Block a user