mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-26 07:04:28 +02:00
Correct DriverSample to produce the ConfigAccess protocol
And fix the bug in HiiDataBase to incorrectly free pool. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8321 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
d6e11f2230
commit
04da0b4a11
@ -362,13 +362,16 @@ ExtractConfig (
|
|||||||
// Try to get the current setting from variable.
|
// Try to get the current setting from variable.
|
||||||
//
|
//
|
||||||
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
||||||
gRT->GetVariable (
|
Status = gRT->GetVariable (
|
||||||
VariableName,
|
VariableName,
|
||||||
&mFormSetGuid,
|
&mFormSetGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&BufferSize,
|
&BufferSize,
|
||||||
&PrivateData->Configuration
|
&PrivateData->Configuration
|
||||||
);
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
if (Request == NULL) {
|
if (Request == NULL) {
|
||||||
//
|
//
|
||||||
@ -476,13 +479,16 @@ RouteConfig (
|
|||||||
// Get Buffer Storage data from EFI variable
|
// Get Buffer Storage data from EFI variable
|
||||||
//
|
//
|
||||||
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
||||||
gRT->GetVariable (
|
Status = gRT->GetVariable (
|
||||||
VariableName,
|
VariableName,
|
||||||
&mFormSetGuid,
|
&mFormSetGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&BufferSize,
|
&BufferSize,
|
||||||
&PrivateData->Configuration
|
&PrivateData->Configuration
|
||||||
);
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert <ConfigResp> to buffer data by helper function ConfigToBlock()
|
// Convert <ConfigResp> to buffer data by helper function ConfigToBlock()
|
||||||
@ -968,6 +974,17 @@ DriverSampleInit (
|
|||||||
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
|
||||||
Status = gRT->GetVariable (VariableName, &mFormSetGuid, NULL, &BufferSize, Configuration);
|
Status = gRT->GetVariable (VariableName, &mFormSetGuid, NULL, &BufferSize, Configuration);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// Store zero data Buffer Storage to EFI variable
|
||||||
|
//
|
||||||
|
Status = gRT->SetVariable(
|
||||||
|
VariableName,
|
||||||
|
&mFormSetGuid,
|
||||||
|
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||||
|
sizeof (DRIVER_SAMPLE_CONFIGURATION),
|
||||||
|
Configuration
|
||||||
|
);
|
||||||
|
ASSERT (Status == EFI_SUCCESS);
|
||||||
//
|
//
|
||||||
// EFI variable for NV config doesn't exit, we should build this variable
|
// EFI variable for NV config doesn't exit, we should build this variable
|
||||||
// based on default values stored in IFR
|
// based on default values stored in IFR
|
||||||
|
@ -873,9 +873,9 @@ ParseIfrData (
|
|||||||
LengthString = StrLen (GuidStr);
|
LengthString = StrLen (GuidStr);
|
||||||
LengthString = LengthString + StrLen (NameStr) + 1;
|
LengthString = LengthString + StrLen (NameStr) + 1;
|
||||||
TempStr = AllocateZeroPool (LengthString * sizeof (CHAR16));
|
TempStr = AllocateZeroPool (LengthString * sizeof (CHAR16));
|
||||||
FreePool (GuidStr);
|
|
||||||
FreePool (NameStr);
|
|
||||||
if (TempStr == NULL) {
|
if (TempStr == NULL) {
|
||||||
|
FreePool (GuidStr);
|
||||||
|
FreePool (NameStr);
|
||||||
FreePool (VarStoreName);
|
FreePool (VarStoreName);
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
@ -899,6 +899,8 @@ ParseIfrData (
|
|||||||
//
|
//
|
||||||
// Free alllocated temp string.
|
// Free alllocated temp string.
|
||||||
//
|
//
|
||||||
|
FreePool (GuidStr);
|
||||||
|
FreePool (NameStr);
|
||||||
FreePool (TempStr);
|
FreePool (TempStr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user