mirror of https://github.com/acidanthera/audk.git
Add in HII enable support for PCD.
But the default value has not been enabled. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@498 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
7db4ab705a
commit
c0e96fed14
|
@ -95,10 +95,16 @@ GetWorker (
|
||||||
Name = &(StringTable[VariableHead->StringIndex]);
|
Name = &(StringTable[VariableHead->StringIndex]);
|
||||||
|
|
||||||
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
|
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
|
||||||
ASSERT_EFI_ERROR (Status);
|
if (Status == EFI_SUCCESS) {
|
||||||
ASSERT (DataSize >= (UINTN) (VariableHead->Offset + Size));
|
ASSERT (DataSize >= (UINTN) (VariableHead->Offset + Size));
|
||||||
|
|
||||||
return (UINT8 *) Data + VariableHead->Offset;
|
return (UINT8 *) Data + VariableHead->Offset;
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// BugBug: Need to support default value. The current implementation
|
||||||
|
// will return a memory buffer with ALL ZERO.
|
||||||
|
//
|
||||||
|
return AllocateZeroPool (Size);
|
||||||
|
}
|
||||||
|
|
||||||
case PCD_TYPE_STRING:
|
case PCD_TYPE_STRING:
|
||||||
StringTableIdx = (UINT16) *((UINT8 *) PcdDb + Offset);
|
StringTableIdx = (UINT16) *((UINT8 *) PcdDb + Offset);
|
||||||
|
@ -343,7 +349,7 @@ GetHiiVariable (
|
||||||
&Size,
|
&Size,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
ASSERT (Status == EFI_BUFFER_TOO_SMALL);
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
|
|
||||||
Buffer = AllocatePool (Size);
|
Buffer = AllocatePool (Size);
|
||||||
|
|
||||||
|
@ -357,6 +363,9 @@ GetHiiVariable (
|
||||||
Buffer
|
Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ASSERT (Status == EFI_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -470,6 +479,7 @@ SetWorker (
|
||||||
UINT16 *StringTable;
|
UINT16 *StringTable;
|
||||||
EFI_GUID *Guid;
|
EFI_GUID *Guid;
|
||||||
UINT16 *Name;
|
UINT16 *Name;
|
||||||
|
UINTN VariableOffset;
|
||||||
VOID *InternalData;
|
VOID *InternalData;
|
||||||
VARIABLE_HEAD *VariableHead;
|
VARIABLE_HEAD *VariableHead;
|
||||||
UINTN Offset;
|
UINTN Offset;
|
||||||
|
@ -519,7 +529,7 @@ SetWorker (
|
||||||
|
|
||||||
case PCD_TYPE_STRING:
|
case PCD_TYPE_STRING:
|
||||||
CopyMem (&StringTable[*((UINT16 *)InternalData)], Data, Size);
|
CopyMem (&StringTable[*((UINT16 *)InternalData)], Data, Size);
|
||||||
break;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
case PCD_TYPE_HII:
|
case PCD_TYPE_HII:
|
||||||
//
|
//
|
||||||
|
@ -532,8 +542,9 @@ SetWorker (
|
||||||
|
|
||||||
Guid = &(GuidTable[VariableHead->GuidTableIndex]);
|
Guid = &(GuidTable[VariableHead->GuidTableIndex]);
|
||||||
Name = &(StringTable[VariableHead->StringIndex]);
|
Name = &(StringTable[VariableHead->StringIndex]);
|
||||||
|
VariableOffset = VariableHead->Offset;
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return SetHiiVariable (Guid, Name, Data, Size, VariableOffset);
|
||||||
|
|
||||||
case PCD_TYPE_DATA:
|
case PCD_TYPE_DATA:
|
||||||
if (PtrType) {
|
if (PtrType) {
|
||||||
|
@ -638,7 +649,7 @@ SetHiiVariable (
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
ASSERT (Status == EFI_BUFFER_TOO_SMALL);
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
|
|
||||||
Buffer = AllocatePool (Size);
|
Buffer = AllocatePool (Size);
|
||||||
|
|
||||||
|
@ -652,9 +663,20 @@ SetHiiVariable (
|
||||||
Buffer
|
Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
CopyMem ((UINT8 *)Buffer + Offset, Data, DataSize);
|
CopyMem ((UINT8 *)Buffer + Offset, Data, DataSize);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Attribute = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
|
||||||
|
Size = DataSize + Offset;
|
||||||
|
Buffer = AllocateZeroPool (Size);
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
CopyMem ((UINT8 *)Buffer + Offset, Data, DataSize);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return EfiSetVariable (
|
return EfiSetVariable (
|
||||||
VariableName,
|
VariableName,
|
||||||
VariableGuid,
|
VariableGuid,
|
||||||
|
|
|
@ -96,6 +96,16 @@ GetHiiVariable (
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
SetHiiVariable (
|
||||||
|
IN EFI_GUID *VariableGuid,
|
||||||
|
IN UINT16 *VariableName,
|
||||||
|
IN CONST VOID *Data,
|
||||||
|
IN UINTN DataSize,
|
||||||
|
IN UINTN Offset
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
DxeRegisterCallBackWorker (
|
DxeRegisterCallBackWorker (
|
||||||
IN UINTN TokenNumber,
|
IN UINTN TokenNumber,
|
||||||
|
|
|
@ -148,7 +148,6 @@ GetHiiVariable (
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
Size = 0;
|
Size = 0;
|
||||||
|
|
||||||
Status = VariablePpi->PeiGetVariable (
|
Status = VariablePpi->PeiGetVariable (
|
||||||
GetPeiServicesTablePointer (),
|
GetPeiServicesTablePointer (),
|
||||||
VariableName,
|
VariableName,
|
||||||
|
@ -157,7 +156,8 @@ GetHiiVariable (
|
||||||
&Size,
|
&Size,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
ASSERT (Status == EFI_BUFFER_TOO_SMALL);
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
|
|
||||||
|
|
||||||
Status = PeiServicesAllocatePool (Size, &Buffer);
|
Status = PeiServicesAllocatePool (Size, &Buffer);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
@ -176,6 +176,10 @@ GetHiiVariable (
|
||||||
*VariableData = Buffer;
|
*VariableData = Buffer;
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
} else {
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -454,10 +458,17 @@ GetWorker (
|
||||||
Name = &StringTable[VariableHead->StringIndex];
|
Name = &StringTable[VariableHead->StringIndex];
|
||||||
|
|
||||||
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
|
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
ASSERT (DataSize >= (UINTN) (VariableHead->Offset + Size));
|
|
||||||
|
|
||||||
|
if (Status == EFI_SUCCESS) {
|
||||||
|
ASSERT (DataSize >= (UINTN) (VariableHead->Offset + Size));
|
||||||
return (VOID *) ((UINT8 *) Data + VariableHead->Offset);
|
return (VOID *) ((UINT8 *) Data + VariableHead->Offset);
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// BugBug: Need to support default value. The current implementation
|
||||||
|
// will return a memory buffer with ALL ZERO.
|
||||||
|
//
|
||||||
|
return AllocateZeroPool (Size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case PCD_TYPE_DATA:
|
case PCD_TYPE_DATA:
|
||||||
|
|
Loading…
Reference in New Issue