mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
Code scrub.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5471 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
23a36779f8
commit
7b9ff69833
@ -37,8 +37,8 @@ EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding = {
|
|||||||
/**
|
/**
|
||||||
The user Entry Point for module ConPlatform. The user code starts with this function.
|
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 ImageHandle The firmware allocated handle for the EFI image.
|
||||||
@param[in] SystemTable A pointer to the EFI System Table.
|
@param SystemTable A pointer to the EFI System Table.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The entry point is executed successfully.
|
@retval EFI_SUCCESS The entry point is executed successfully.
|
||||||
@retval other Some error occurs when executing this entry point.
|
@retval other Some error occurs when executing this entry point.
|
||||||
@ -89,8 +89,8 @@ InitializeConPlatform(
|
|||||||
@param RemainingDevicePath Optional parameter use to pick a specific child
|
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||||
device to start.
|
device to start.
|
||||||
|
|
||||||
@retval EFI_SUCCESS This driver supports this device
|
@retval EFI_SUCCESS This driver supports this device.
|
||||||
@retval other This driver does not support this device
|
@retval other This driver does not support this device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -118,8 +118,8 @@ ConPlatformTextInDriverBindingSupported (
|
|||||||
@param RemainingDevicePath Optional parameter use to pick a specific child
|
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||||
device to start.
|
device to start.
|
||||||
|
|
||||||
@retval EFI_SUCCESS This driver supports this device
|
@retval EFI_SUCCESS This driver supports this device.
|
||||||
@retval other This driver does not support this device
|
@retval other This driver does not support this device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -140,7 +140,7 @@ ConPlatformTextOutDriverBindingSupported (
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test to see if specific Protocol could be supported on the ControllerHandle.
|
Test to see if the specified Protocol could be supported on the ControllerHandle.
|
||||||
|
|
||||||
@param This Protocol instance pointer.
|
@param This Protocol instance pointer.
|
||||||
@param ControllerHandle Handle of device to test.
|
@param ControllerHandle Handle of device to test.
|
||||||
@ -148,8 +148,8 @@ ConPlatformTextOutDriverBindingSupported (
|
|||||||
device to start.
|
device to start.
|
||||||
@param ProtocolGuid The specfic protocol.
|
@param ProtocolGuid The specfic protocol.
|
||||||
|
|
||||||
@retval EFI_SUCCESS This driver supports this device
|
@retval EFI_SUCCESS This driver supports this device.
|
||||||
@retval other This driver does not support this device
|
@retval other This driver does not support this device.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -164,8 +164,8 @@ ConPlatformDriverBindingSupported (
|
|||||||
VOID *Interface;
|
VOID *Interface;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test to see if this is a physical device by checking to see if
|
// Test to see if this is a physical device by checking if
|
||||||
// it has a Device Path Protocol
|
// it has a Device Path Protocol.
|
||||||
//
|
//
|
||||||
Status = gBS->OpenProtocol (
|
Status = gBS->OpenProtocol (
|
||||||
ControllerHandle,
|
ControllerHandle,
|
||||||
@ -179,7 +179,7 @@ ConPlatformDriverBindingSupported (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Test to see if this device supports the specific Protocol
|
// Test to see if this device supports the specified Protocol.
|
||||||
//
|
//
|
||||||
Status = gBS->OpenProtocol (
|
Status = gBS->OpenProtocol (
|
||||||
ControllerHandle,
|
ControllerHandle,
|
||||||
@ -620,11 +620,11 @@ ConPlatformTextOutDriverBindingStop (
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Unstall the specific protocol.
|
Uninstall the specified protocol.
|
||||||
|
|
||||||
@param This Protocol instance pointer.
|
@param This Protocol instance pointer.
|
||||||
@param Handle Handle of device to unstall protocol on.
|
@param Handle Handle of device to uninstall protocol on.
|
||||||
@param ProtocolGuid The specific protocol need to be uninstalled.
|
@param ProtocolGuid The specified protocol need to be uninstalled.
|
||||||
|
|
||||||
@return None.
|
@return None.
|
||||||
|
|
||||||
@ -663,12 +663,11 @@ ConPlatformUnInstallProtocol (
|
|||||||
Read the EFI variable (Name) and return a dynamically allocated
|
Read the EFI variable (Name) and return a dynamically allocated
|
||||||
buffer, and the size of the buffer. On failure return NULL.
|
buffer, and the size of the buffer. On failure return NULL.
|
||||||
|
|
||||||
|
|
||||||
@param Name String part of EFI variable name
|
@param Name String part of EFI variable name
|
||||||
|
|
||||||
@return Dynamically allocated memory that contains a copy of the EFI variable.
|
@return Dynamically allocated memory that contains a copy of the EFI variable.
|
||||||
Caller is repsoncible freeing the buffer.
|
Caller is repsoncible freeing the buffer. Return NULL means Variable
|
||||||
NULL - Variable was not read
|
was not read.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID *
|
VOID *
|
||||||
@ -684,7 +683,7 @@ ConPlatformGetVariable (
|
|||||||
Buffer = NULL;
|
Buffer = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test to see if the variable exists. If it doesn't reuturn NULL
|
// Test to see if the variable exists. If it doesn't, reuturn NULL.
|
||||||
//
|
//
|
||||||
Status = gRT->GetVariable (
|
Status = gRT->GetVariable (
|
||||||
Name,
|
Name,
|
||||||
@ -714,6 +713,9 @@ ConPlatformGetVariable (
|
|||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
FreePool (Buffer);
|
FreePool (Buffer);
|
||||||
|
//
|
||||||
|
// To make sure Buffer is NULL if any error occurs.
|
||||||
|
//
|
||||||
Buffer = NULL;
|
Buffer = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -735,20 +737,21 @@ ConPlatformGetVariable (
|
|||||||
If FALSE, the routine just check whether Single matches
|
If FALSE, the routine just check whether Single matches
|
||||||
with any instance in Multi.
|
with any instance in Multi.
|
||||||
|
|
||||||
@return The function returns EFI_SUCCESS if the Single is contained within Multi.
|
@retval EFI_SUCCESS If the Single is contained within Multi.
|
||||||
Otherwise, EFI_NOT_FOUND is returned.
|
@retval EFI_NOT_FOUND If the Single is not contained within Multi.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ConPlatformMatchDevicePaths (
|
ConPlatformMatchDevicePaths (
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *Multi,
|
IN EFI_DEVICE_PATH_PROTOCOL *Multi,
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *Single,
|
IN EFI_DEVICE_PATH_PROTOCOL *Single,
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,
|
OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,
|
||||||
IN BOOLEAN Delete
|
IN BOOLEAN Delete
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath1;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath2;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
|
EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
|
|
||||||
@ -758,29 +761,42 @@ ConPlatformMatchDevicePaths (
|
|||||||
if ((Multi == NULL) || (Single == NULL)) {
|
if ((Multi == NULL) || (Single == NULL)) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// if performing Delete operation, the NewDevicePath must not be NULL.
|
// If performing Delete operation, the NewDevicePath must not be NULL.
|
||||||
//
|
//
|
||||||
TempDevicePath = NULL;
|
if (Delete) {
|
||||||
|
ASSERT (NewDevicePath != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
TempDevicePath1 = NULL;
|
||||||
|
|
||||||
DevicePath = Multi;
|
DevicePath = Multi;
|
||||||
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
|
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
|
||||||
|
|
||||||
//
|
//
|
||||||
// search for the match of 'Single' in 'Multi'
|
// Search for the match of 'Single' in 'Multi'
|
||||||
//
|
//
|
||||||
while (DevicePathInst != NULL) {
|
while (DevicePathInst != NULL) {
|
||||||
if (CompareMem (Single, DevicePathInst, Size) == 0) {
|
if (CompareMem (Single, DevicePathInst, Size) == 0) {
|
||||||
if (!Delete) {
|
if (!Delete) {
|
||||||
|
//
|
||||||
|
// If Delete is FALSE, return EFI_SUCCESS if Single is found in Multi.
|
||||||
|
//
|
||||||
FreePool (DevicePathInst);
|
FreePool (DevicePathInst);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Delete) {
|
if (Delete) {
|
||||||
TempDevicePath = AppendDevicePathInstance (
|
//
|
||||||
NULL,
|
// Append the mis-matched devcie path into remaining device path.
|
||||||
|
//
|
||||||
|
TempDevicePath2 = AppendDevicePathInstance (
|
||||||
|
TempDevicePath1,
|
||||||
DevicePathInst
|
DevicePathInst
|
||||||
);
|
);
|
||||||
|
SafeFreePool (TempDevicePath1);
|
||||||
|
TempDevicePath1 = TempDevicePath2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -789,7 +805,10 @@ ConPlatformMatchDevicePaths (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Delete) {
|
if (Delete) {
|
||||||
*NewDevicePath = TempDevicePath;
|
//
|
||||||
|
// Return the remaining device path data structure
|
||||||
|
//
|
||||||
|
*NewDevicePath = TempDevicePath1;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -797,7 +816,7 @@ ConPlatformMatchDevicePaths (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Update console devicein console environment variables.
|
Update console environment variables.
|
||||||
|
|
||||||
@param VariableName Console environment variables, ConOutDev, ConInDev
|
@param VariableName Console environment variables, ConOutDev, ConInDev
|
||||||
StdErrDev, ConIn or ConOut.
|
StdErrDev, ConIn or ConOut.
|
||||||
@ -831,7 +850,9 @@ ConPlatformUpdateDeviceVariable (
|
|||||||
VariableDevicePath = ConPlatformGetVariable (VariableName);
|
VariableDevicePath = ConPlatformGetVariable (VariableName);
|
||||||
|
|
||||||
if (Operation != DELETE) {
|
if (Operation != DELETE) {
|
||||||
|
//
|
||||||
|
// Match specified DevicePath in Console Variable.
|
||||||
|
//
|
||||||
Status = ConPlatformMatchDevicePaths (
|
Status = ConPlatformMatchDevicePaths (
|
||||||
VariableDevicePath,
|
VariableDevicePath,
|
||||||
DevicePath,
|
DevicePath,
|
||||||
@ -884,6 +905,9 @@ ConPlatformUpdateDeviceVariable (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (NewVariableDevicePath != NULL) {
|
if (NewVariableDevicePath != NULL) {
|
||||||
|
//
|
||||||
|
// Update Console Environment Variable.
|
||||||
|
//
|
||||||
Status = gRT->SetVariable (
|
Status = gRT->SetVariable (
|
||||||
VariableName,
|
VariableName,
|
||||||
&gEfiGlobalVariableGuid,
|
&gEfiGlobalVariableGuid,
|
||||||
|
@ -15,14 +15,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#ifndef _CON_PLATFORM_H_
|
#ifndef _CON_PLATFORM_H_
|
||||||
#define _CON_PLATFORM_H_
|
#define _CON_PLATFORM_H_
|
||||||
|
|
||||||
#include <Uefi.h>
|
#include <PiDxe.h>
|
||||||
|
|
||||||
#include <Protocol/SimpleTextOut.h>
|
#include <Protocol/SimpleTextOut.h>
|
||||||
|
#include <Protocol/DevicePath.h>
|
||||||
|
#include <Protocol/SimpleTextIn.h>
|
||||||
|
|
||||||
#include <Guid/GlobalVariable.h>
|
#include <Guid/GlobalVariable.h>
|
||||||
#include <Guid/ConsoleInDevice.h>
|
#include <Guid/ConsoleInDevice.h>
|
||||||
#include <Guid/StandardErrorDevice.h>
|
#include <Guid/StandardErrorDevice.h>
|
||||||
#include <Guid/ConsoleOutDevice.h>
|
#include <Guid/ConsoleOutDevice.h>
|
||||||
#include <Protocol/DevicePath.h>
|
|
||||||
#include <Protocol/SimpleTextIn.h>
|
|
||||||
#include <Guid/HotPlugDevice.h>
|
#include <Guid/HotPlugDevice.h>
|
||||||
|
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
@ -210,11 +212,11 @@ ConPlatformTextOutDriverBindingStop (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Unstall the specific protocol.
|
Uninstall the specified protocol.
|
||||||
|
|
||||||
@param This Protocol instance pointer.
|
@param This Protocol instance pointer.
|
||||||
@param Handle Handle of device to unstall protocol on.
|
@param Handle Handle of device to uninstall protocol on.
|
||||||
@param ProtocolGuid The specific protocol need to be uninstalled.
|
@param ProtocolGuid The specified protocol need to be uninstalled.
|
||||||
|
|
||||||
@return None.
|
@return None.
|
||||||
|
|
||||||
@ -230,12 +232,11 @@ ConPlatformUnInstallProtocol (
|
|||||||
Read the EFI variable (Name) and return a dynamically allocated
|
Read the EFI variable (Name) and return a dynamically allocated
|
||||||
buffer, and the size of the buffer. On failure return NULL.
|
buffer, and the size of the buffer. On failure return NULL.
|
||||||
|
|
||||||
|
|
||||||
@param Name String part of EFI variable name
|
@param Name String part of EFI variable name
|
||||||
|
|
||||||
@return Dynamically allocated memory that contains a copy of the EFI variable.
|
@return Dynamically allocated memory that contains a copy of the EFI variable.
|
||||||
Caller is repsoncible freeing the buffer.
|
Caller is repsoncible freeing the buffer. Return NULL means Variable
|
||||||
NULL - Variable was not read
|
was not read.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID *
|
VOID *
|
||||||
@ -257,8 +258,8 @@ ConPlatformGetVariable (
|
|||||||
If FALSE, the routine just check whether Single matches
|
If FALSE, the routine just check whether Single matches
|
||||||
with any instance in Multi.
|
with any instance in Multi.
|
||||||
|
|
||||||
@return The function returns EFI_SUCCESS if the Single is contained within Multi.
|
@retval EFI_SUCCESS If the Single is contained within Multi.
|
||||||
Otherwise, EFI_NOT_FOUND is returned.
|
@retval EFI_NOT_FOUND If the Single is not contained within Multi.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -270,7 +271,7 @@ ConPlatformMatchDevicePaths (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Update console devicein console environment variables.
|
Update console environment variables.
|
||||||
|
|
||||||
@param VariableName Console environment variables, ConOutDev, ConInDev
|
@param VariableName Console environment variables, ConOutDev, ConInDev
|
||||||
StdErrDev, ConIn or ConOut.
|
StdErrDev, ConIn or ConOut.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user