diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-07-15 08:16:24 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-07-15 08:16:24 +0000 |
commit | 7b9ff69833122a340cc56968ead1065e2c242ac1 (patch) | |
tree | d4444814ccc7e947a7845f0022b1fb11a21fb859 /MdeModulePkg | |
parent | 23a36779f8f0d4ae88be584ac60b6a89d42c21fa (diff) | |
download | edk2-7b9ff69833122a340cc56968ead1065e2c242ac1.zip edk2-7b9ff69833122a340cc56968ead1065e2c242ac1.tar.gz edk2-7b9ff69833122a340cc56968ead1065e2c242ac1.tar.bz2 |
Code scrub.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5471 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c | 86 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h | 25 |
2 files changed, 68 insertions, 43 deletions
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c index 56bdd11..c254079 100644 --- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c +++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c @@ -37,8 +37,8 @@ EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding = { /**
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.
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param 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.
@@ -89,8 +89,8 @@ InitializeConPlatform( @param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
- @retval EFI_SUCCESS This driver supports this device
- @retval other This driver does not support this device
+ @retval EFI_SUCCESS This driver supports this device.
+ @retval other This driver does not support this device.
**/
EFI_STATUS
@@ -118,8 +118,8 @@ ConPlatformTextInDriverBindingSupported ( @param RemainingDevicePath Optional parameter use to pick a specific child
device to start.
- @retval EFI_SUCCESS This driver supports this device
- @retval other This driver does not support this device
+ @retval EFI_SUCCESS This driver supports this device.
+ @retval other This driver does not support this device.
**/
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 ControllerHandle Handle of device to test.
@@ -148,8 +148,8 @@ ConPlatformTextOutDriverBindingSupported ( device to start.
@param ProtocolGuid The specfic protocol.
- @retval EFI_SUCCESS This driver supports this device
- @retval other This driver does not support this device
+ @retval EFI_SUCCESS This driver supports this device.
+ @retval other This driver does not support this device.
**/
EFI_STATUS
@@ -164,8 +164,8 @@ ConPlatformDriverBindingSupported ( VOID *Interface;
//
- // Test to see if this is a physical device by checking to see if
- // it has a Device Path Protocol
+ // Test to see if this is a physical device by checking if
+ // it has a Device Path Protocol.
//
Status = gBS->OpenProtocol (
ControllerHandle,
@@ -179,7 +179,7 @@ ConPlatformDriverBindingSupported ( 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 (
ControllerHandle,
@@ -620,11 +620,11 @@ ConPlatformTextOutDriverBindingStop ( /**
- Unstall the specific protocol.
+ Uninstall the specified protocol.
@param This Protocol instance pointer.
- @param Handle Handle of device to unstall protocol on.
- @param ProtocolGuid The specific protocol need to be uninstalled.
+ @param Handle Handle of device to uninstall protocol on.
+ @param ProtocolGuid The specified protocol need to be uninstalled.
@return None.
@@ -663,12 +663,11 @@ ConPlatformUnInstallProtocol ( Read the EFI variable (Name) and return a dynamically allocated
buffer, and the size of the buffer. On failure return NULL.
-
@param Name String part of EFI variable name
@return Dynamically allocated memory that contains a copy of the EFI variable.
- Caller is repsoncible freeing the buffer.
- NULL - Variable was not read
+ Caller is repsoncible freeing the buffer. Return NULL means Variable
+ was not read.
**/
VOID *
@@ -684,7 +683,7 @@ ConPlatformGetVariable ( 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 (
Name,
@@ -714,6 +713,9 @@ ConPlatformGetVariable ( );
if (EFI_ERROR (Status)) {
FreePool (Buffer);
+ //
+ // To make sure Buffer is NULL if any error occurs.
+ //
Buffer = NULL;
}
}
@@ -735,20 +737,21 @@ ConPlatformGetVariable ( If FALSE, the routine just check whether Single matches
with any instance in Multi.
- @return The function returns EFI_SUCCESS if the Single is contained within Multi.
- Otherwise, EFI_NOT_FOUND is returned.
+ @retval EFI_SUCCESS If the Single is contained within Multi.
+ @retval EFI_NOT_FOUND If the Single is not contained within Multi.
**/
EFI_STATUS
ConPlatformMatchDevicePaths (
IN EFI_DEVICE_PATH_PROTOCOL *Multi,
IN EFI_DEVICE_PATH_PROTOCOL *Single,
- IN EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,
+ OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,
IN BOOLEAN Delete
)
{
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;
UINTN Size;
@@ -758,29 +761,42 @@ ConPlatformMatchDevicePaths ( if ((Multi == NULL) || (Single == NULL)) {
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;
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
//
- // search for the match of 'Single' in 'Multi'
+ // Search for the match of 'Single' in 'Multi'
//
while (DevicePathInst != NULL) {
if (CompareMem (Single, DevicePathInst, Size) == 0) {
if (!Delete) {
+ //
+ // If Delete is FALSE, return EFI_SUCCESS if Single is found in Multi.
+ //
FreePool (DevicePathInst);
return EFI_SUCCESS;
}
} else {
if (Delete) {
- TempDevicePath = AppendDevicePathInstance (
- NULL,
+ //
+ // Append the mis-matched devcie path into remaining device path.
+ //
+ TempDevicePath2 = AppendDevicePathInstance (
+ TempDevicePath1,
DevicePathInst
);
+ SafeFreePool (TempDevicePath1);
+ TempDevicePath1 = TempDevicePath2;
}
}
@@ -789,7 +805,10 @@ ConPlatformMatchDevicePaths ( }
if (Delete) {
- *NewDevicePath = TempDevicePath;
+ //
+ // Return the remaining device path data structure
+ //
+ *NewDevicePath = TempDevicePath1;
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
StdErrDev, ConIn or ConOut.
@@ -831,7 +850,9 @@ ConPlatformUpdateDeviceVariable ( VariableDevicePath = ConPlatformGetVariable (VariableName);
if (Operation != DELETE) {
-
+ //
+ // Match specified DevicePath in Console Variable.
+ //
Status = ConPlatformMatchDevicePaths (
VariableDevicePath,
DevicePath,
@@ -884,6 +905,9 @@ ConPlatformUpdateDeviceVariable ( }
if (NewVariableDevicePath != NULL) {
+ //
+ // Update Console Environment Variable.
+ //
Status = gRT->SetVariable (
VariableName,
&gEfiGlobalVariableGuid,
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h index 1ec31a1..eccb18b 100644 --- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h +++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h @@ -15,14 +15,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #ifndef _CON_PLATFORM_H_
#define _CON_PLATFORM_H_
-#include <Uefi.h>
+#include <PiDxe.h>
+
#include <Protocol/SimpleTextOut.h>
+#include <Protocol/DevicePath.h>
+#include <Protocol/SimpleTextIn.h>
+
#include <Guid/GlobalVariable.h>
#include <Guid/ConsoleInDevice.h>
#include <Guid/StandardErrorDevice.h>
#include <Guid/ConsoleOutDevice.h>
-#include <Protocol/DevicePath.h>
-#include <Protocol/SimpleTextIn.h>
#include <Guid/HotPlugDevice.h>
#include <Library/DebugLib.h>
@@ -210,11 +212,11 @@ ConPlatformTextOutDriverBindingStop ( );
/**
- Unstall the specific protocol.
+ Uninstall the specified protocol.
@param This Protocol instance pointer.
- @param Handle Handle of device to unstall protocol on.
- @param ProtocolGuid The specific protocol need to be uninstalled.
+ @param Handle Handle of device to uninstall protocol on.
+ @param ProtocolGuid The specified protocol need to be uninstalled.
@return None.
@@ -230,12 +232,11 @@ ConPlatformUnInstallProtocol ( Read the EFI variable (Name) and return a dynamically allocated
buffer, and the size of the buffer. On failure return NULL.
-
@param Name String part of EFI variable name
@return Dynamically allocated memory that contains a copy of the EFI variable.
- Caller is repsoncible freeing the buffer.
- NULL - Variable was not read
+ Caller is repsoncible freeing the buffer. Return NULL means Variable
+ was not read.
**/
VOID *
@@ -257,8 +258,8 @@ ConPlatformGetVariable ( If FALSE, the routine just check whether Single matches
with any instance in Multi.
- @return The function returns EFI_SUCCESS if the Single is contained within Multi.
- Otherwise, EFI_NOT_FOUND is returned.
+ @retval EFI_SUCCESS If the Single is contained within Multi.
+ @retval EFI_NOT_FOUND If the Single is not contained within Multi.
**/
EFI_STATUS
@@ -270,7 +271,7 @@ ConPlatformMatchDevicePaths ( );
/**
- Update console devicein console environment variables.
+ Update console environment variables.
@param VariableName Console environment variables, ConOutDev, ConInDev
StdErrDev, ConIn or ConOut.
|