Refine some code to make the code run safely.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10863 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2010-09-10 01:04:00 +00:00
parent 18bd7f34e9
commit e009609938
15 changed files with 60 additions and 59 deletions

View File

@ -193,7 +193,7 @@ F2UCreateTextOpCode (
ZeroMem (&UTextOpCode, sizeof(UTextOpCode));
UTextOpCode.Header.OpCode = EFI_IFR_TEXT_OP;
UTextOpCode.Header.Length = sizeof (EFI_IFR_TEXT);
UTextOpCode.Header.Length = (UINT8) sizeof (EFI_IFR_TEXT);
UTextOpCode.Statement.Help = FwOpcode->Help;
@ -229,7 +229,7 @@ F2UCreateReferenceOpCode (
ZeroMem (&UOpcode, sizeof(UOpcode));
UOpcode.Header.Length = sizeof(UOpcode);
UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
UOpcode.Header.OpCode = EFI_IFR_REF_OP;
UOpcode.Question.Header.Prompt = FwOpcode->Prompt;
@ -269,7 +269,7 @@ F2UCreateOneOfOptionOpCode (
ZeroMem (&UOpcode, sizeof(UOpcode));
UOpcode.Header.Length = sizeof(UOpcode);
UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
UOpcode.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
UOpcode.Option = FwOpcode->Option;
@ -374,7 +374,7 @@ F2UCreateOneOfOpCode (
ZeroMem (&UOpcode, sizeof(UOpcode));
*OpcodeCount = 0;
UOpcode.Header.Length = sizeof(UOpcode);
UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
UOpcode.Header.OpCode = EFI_IFR_ONE_OF_OP;
UOpcode.Header.Scope = 1;
@ -491,7 +491,7 @@ F2UCreateOrderedListOpCode (
ZeroMem (&UOpcode, sizeof(UOpcode));
*OpcodeCount = 0;
UOpcode.Header.Length = sizeof(UOpcode);
UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
UOpcode.Header.OpCode = EFI_IFR_ORDERED_LIST_OP;
UOpcode.Header.Scope = 1;
@ -587,7 +587,7 @@ F2UCreateCheckBoxOpCode (
ZeroMem (&UOpcode, sizeof(UOpcode));
UOpcode.Header.Length = sizeof(UOpcode);
UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
UOpcode.Header.OpCode = EFI_IFR_CHECKBOX_OP;
UOpcode.Question.Header.Prompt = FwOpcode->Prompt;
@ -667,7 +667,7 @@ F2UCreateNumericOpCode (
UOpcode.Question.QuestionId = FwOpcode->Key;
}
UOpcode.Header.Length = sizeof(UOpcode);
UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
UOpcode.Header.OpCode = EFI_IFR_NUMERIC_OP;
//
// We need to create a nested default value for the UEFI Numeric Opcode.
@ -786,7 +786,7 @@ F2UCreateStringOpCode (
UOpcode.Question.QuestionId = FwOpcode->Key;
}
UOpcode.Header.Length = sizeof(UOpcode);
UOpcode.Header.Length = (UINT8) sizeof (UOpcode);
UOpcode.Header.OpCode = EFI_IFR_STRING_OP;
UOpcode.Question.Header.Prompt = FwOpcode->Prompt;

View File

@ -805,7 +805,7 @@ ParseOpCodes (
CurrentStatement->Minimum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MinValue;
CurrentStatement->Maximum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MaxValue;
CurrentStatement->Step = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.Step;
CurrentStatement->StorageWidth = sizeof (UINT8);
CurrentStatement->StorageWidth = (UINT16) sizeof (UINT8);
Value->Type = EFI_IFR_TYPE_NUM_SIZE_8;
break;

View File

@ -58,7 +58,7 @@ Abstract:
#define SetDevicePathEndNode(a) { \
(a)->Type = END_DEVICE_PATH_TYPE; \
(a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \
(a)->Length[0] = sizeof(EFI_DEVICE_PATH_PROTOCOL); \
(a)->Length[0] = (UINT8) sizeof (EFI_DEVICE_PATH_PROTOCOL); \
(a)->Length[1] = 0; \
}

View File

@ -51,7 +51,7 @@ Returns:
EFI_IFR_SUBTITLE Subtitle;
Subtitle.Header.OpCode = EFI_IFR_SUBTITLE_OP;
Subtitle.Header.Length = sizeof (EFI_IFR_SUBTITLE);
Subtitle.Header.Length = (UINT8) sizeof (EFI_IFR_SUBTITLE);
Subtitle.SubTitle = StringToken;
EfiCopyMem (FormBuffer, &Subtitle, sizeof (EFI_IFR_SUBTITLE));
@ -100,7 +100,7 @@ Returns:
EFI_IFR_TEXT Text;
Text.Header.OpCode = EFI_IFR_TEXT_OP;
Text.Header.Length = sizeof (EFI_IFR_TEXT);
Text.Header.Length = (UINT8) sizeof (EFI_IFR_TEXT);
Text.Text = StringToken;
Text.TextTwo = StringTokenTwo;
@ -155,7 +155,7 @@ Returns:
EFI_IFR_REF Hyperlink;
Hyperlink.Header.OpCode = EFI_IFR_REF_OP;
Hyperlink.Header.Length = sizeof (EFI_IFR_REF);
Hyperlink.Header.Length = (UINT8) sizeof (EFI_IFR_REF);
Hyperlink.FormId = FormId;
Hyperlink.Prompt = StringToken;
Hyperlink.Help = StringTokenTwo;
@ -228,7 +228,7 @@ Returns:
}
OneOf.Header.OpCode = EFI_IFR_ONE_OF_OP;
OneOf.Header.Length = sizeof (EFI_IFR_ONE_OF);
OneOf.Header.Length = (UINT8) sizeof (EFI_IFR_ONE_OF);
OneOf.QuestionId = QuestionId;
OneOf.Width = DataWidth;
OneOf.Prompt = PromptToken;
@ -316,7 +316,7 @@ Returns:
UINT8 *LocalBuffer;
OrderedList.Header.OpCode = EFI_IFR_ORDERED_LIST_OP;
OrderedList.Header.Length = sizeof (EFI_IFR_ORDERED_LIST);
OrderedList.Header.Length = (UINT8) sizeof (EFI_IFR_ORDERED_LIST);
OrderedList.QuestionId = QuestionId;
OrderedList.MaxEntries = MaxEntries;
OrderedList.Prompt = PromptToken;
@ -406,7 +406,7 @@ Returns:
}
CheckBox.Header.OpCode = EFI_IFR_CHECKBOX_OP;
CheckBox.Header.Length = sizeof (EFI_IFR_CHECK_BOX);
CheckBox.Header.Length = (UINT8) sizeof (EFI_IFR_CHECK_BOX);
CheckBox.QuestionId = QuestionId;
CheckBox.Width = DataWidth;
CheckBox.Prompt = PromptToken;
@ -486,7 +486,7 @@ Returns:
}
Numeric.Header.OpCode = EFI_IFR_NUMERIC_OP;
Numeric.Header.Length = sizeof (EFI_IFR_NUMERIC);
Numeric.Header.Length = (UINT8) sizeof (EFI_IFR_NUMERIC);
Numeric.QuestionId = QuestionId;
Numeric.Width = DataWidth;
Numeric.Prompt = PromptToken;
@ -555,7 +555,7 @@ Returns:
EFI_IFR_STRING String;
String.Header.OpCode = EFI_IFR_STRING_OP;
String.Header.Length = sizeof (EFI_IFR_STRING);
String.Header.Length = (UINT8) sizeof (EFI_IFR_STRING);
String.QuestionId = QuestionId;
String.Width = DataWidth;
String.Prompt = PromptToken;
@ -604,7 +604,7 @@ Returns:
EFI_IFR_BANNER Banner;
Banner.Header.OpCode = EFI_IFR_BANNER_OP;
Banner.Header.Length = sizeof (EFI_IFR_BANNER);
Banner.Header.Length = (UINT8) sizeof (EFI_IFR_BANNER);
EfiCopyMem (&Banner.Title, &Title, sizeof (UINT16));
EfiCopyMem (&Banner.LineNumber, &LineNumber, sizeof (UINT16));
Banner.Alignment = Alignment;

View File

@ -84,7 +84,7 @@ CreateEndOpCode (
return EFI_BUFFER_TOO_SMALL;
}
End.Header.Length = sizeof (EFI_IFR_END);
End.Header.Length = (UINT8) sizeof (EFI_IFR_END);
End.Header.OpCode = EFI_IFR_END_OP;
End.Header.Scope = 0;
@ -116,7 +116,7 @@ CreateDefaultOpCode (
}
Default.Header.OpCode = EFI_IFR_DEFAULT_OP;
Default.Header.Length = sizeof (EFI_IFR_DEFAULT);
Default.Header.Length = (UINT8) sizeof (EFI_IFR_DEFAULT);
Default.Header.Scope = 0;
Default.Type = Type;
Default.DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
@ -153,7 +153,7 @@ CreateActionOpCode (
}
Action.Header.OpCode = EFI_IFR_ACTION_OP;
Action.Header.Length = sizeof (EFI_IFR_ACTION);
Action.Header.Length = (UINT8) sizeof (EFI_IFR_ACTION);
Action.Header.Scope = 0;
Action.Question.QuestionId = QuestionId;
Action.Question.Header.Prompt = Prompt;
@ -188,7 +188,7 @@ CreateSubTitleOpCode (
}
Subtitle.Header.OpCode = EFI_IFR_SUBTITLE_OP;
Subtitle.Header.Length = sizeof (EFI_IFR_SUBTITLE);
Subtitle.Header.Length = (UINT8) sizeof (EFI_IFR_SUBTITLE);
Subtitle.Header.Scope = Scope;
Subtitle.Statement.Prompt = Prompt;
Subtitle.Statement.Help = Help;
@ -220,7 +220,7 @@ CreateTextOpCode (
}
Text.Header.OpCode = EFI_IFR_TEXT_OP;
Text.Header.Length = sizeof (EFI_IFR_TEXT);
Text.Header.Length = (UINT8) sizeof (EFI_IFR_TEXT);
Text.Header.Scope = 0;
Text.Statement.Prompt = Prompt;
Text.Statement.Help = Help;
@ -257,7 +257,7 @@ CreateGotoOpCode (
}
Goto.Header.OpCode = EFI_IFR_REF_OP;
Goto.Header.Length = sizeof (EFI_IFR_REF);
Goto.Header.Length = (UINT8) sizeof (EFI_IFR_REF);
Goto.Header.Scope = 0;
Goto.Question.Header.Prompt = Prompt;
Goto.Question.Header.Help = Help;
@ -297,7 +297,7 @@ CreateOneOfOptionOpCode (
for (Index = 0; Index < OptionCount; Index++) {
OneOfOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
OneOfOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);
OneOfOption.Header.Length = (UINT8) sizeof (EFI_IFR_ONE_OF_OPTION);
OneOfOption.Header.Scope = 0;
OneOfOption.Option = OptionsList[Index].StringToken;
@ -345,7 +345,7 @@ CreateOneOfOpCode (
}
OneOf.Header.OpCode = EFI_IFR_ONE_OF_OP;
OneOf.Header.Length = sizeof (EFI_IFR_ONE_OF);
OneOf.Header.Length = (UINT8) sizeof (EFI_IFR_ONE_OF);
OneOf.Header.Scope = 1;
OneOf.Question.Header.Prompt = Prompt;
OneOf.Question.Header.Help = Help;
@ -406,7 +406,7 @@ CreateOrderedListOpCode (
}
OrderedList.Header.OpCode = EFI_IFR_ORDERED_LIST_OP;
OrderedList.Header.Length = sizeof (EFI_IFR_ORDERED_LIST);
OrderedList.Header.Length = (UINT8) sizeof (EFI_IFR_ORDERED_LIST);
OrderedList.Header.Scope = 1;
OrderedList.Question.Header.Prompt = Prompt;
OrderedList.Question.Header.Help = Help;
@ -454,7 +454,7 @@ CreateCheckBoxOpCode (
}
CheckBox.Header.OpCode = EFI_IFR_CHECKBOX_OP;
CheckBox.Header.Length = sizeof (EFI_IFR_CHECKBOX);
CheckBox.Header.Length = (UINT8) sizeof (EFI_IFR_CHECKBOX);
CheckBox.Header.Scope = 0;
CheckBox.Question.QuestionId = QuestionId;
CheckBox.Question.VarStoreId = VarStoreId;
@ -506,7 +506,7 @@ CreateNumericOpCode (
}
Numeric.Header.OpCode = EFI_IFR_NUMERIC_OP;
Numeric.Header.Length = sizeof (EFI_IFR_NUMERIC);
Numeric.Header.Length = (UINT8) sizeof (EFI_IFR_NUMERIC);
Numeric.Header.Scope = 1;
Numeric.Question.QuestionId = QuestionId;
Numeric.Question.VarStoreId = VarStoreId;
@ -587,7 +587,7 @@ CreateStringOpCode (
}
String.Header.OpCode = EFI_IFR_STRING_OP;
String.Header.Length = sizeof (EFI_IFR_STRING);
String.Header.Length = (UINT8) sizeof (EFI_IFR_STRING);
String.Header.Scope = 0;
String.Question.Header.Prompt = Prompt;
String.Question.Header.Help = Help;
@ -624,7 +624,7 @@ CreateBannerOpCode (
}
Banner.Header.OpCode = EFI_IFR_GUID_OP;
Banner.Header.Length = sizeof (EFI_IFR_GUID_BANNER);
Banner.Header.Length = (UINT8) sizeof (EFI_IFR_GUID_BANNER);
Banner.Header.Scope = 0;
EfiCopyMem (&Banner.Guid, &mIfrVendorGuid, sizeof (EFI_IFR_GUID));
Banner.ExtendOpCode = EFI_IFR_EXTEND_OP_BANNER;

View File

@ -489,6 +489,7 @@ Returns:
EFI_HII_HANDLE *HiiHandleBuffer;
EFI_GUID Guid;
HiiHandleBuffer = NULL;
Status = GetHiiHandles (&HandleBufferLen, &HiiHandleBuffer);
if (EFI_ERROR(Status)) {
return Status;

View File

@ -49,8 +49,8 @@ InternalMathDivRemS64x64 (
INT64 Quot;
Quot = InternalMathDivRemU64x64 (
Dividend >= 0 ? Dividend : -Dividend,
Divisor >= 0 ? Divisor : -Divisor,
(UINT64) (Dividend >= 0 ? Dividend : -Dividend),
(UINT64) (Divisor >= 0 ? Divisor : -Divisor),
(UINT64 *) Remainder
);
if (Remainder != NULL && Dividend < 0) {

View File

@ -45,5 +45,5 @@ MultS64x64 (
IN INT64 Multiplier
)
{
return (INT64)MultU64x64 (Multiplicand, Multiplier);
return (INT64)MultU64x64 ((UINT64) Multiplicand, (UINT64) Multiplier);
}

View File

@ -353,7 +353,7 @@ InterlockedCompareExchangePointer (
{
UINT8 SizeOfValue;
SizeOfValue = sizeof (*Value);
SizeOfValue = (UINT8) sizeof (*Value);
switch (SizeOfValue) {
case sizeof (UINT32):

View File

@ -512,7 +512,7 @@ GlueReportStatusCodeEx (
//
// Fill in the extended data header
//
StatusCodeData->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);
StatusCodeData->HeaderSize = (UINT16) sizeof (EFI_STATUS_CODE_DATA);
StatusCodeData->Size = (UINT16)ExtendedDataSize;
if (ExtendedDataGuid == NULL) {
ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid;

View File

@ -254,7 +254,7 @@ GlueBuildModuleHob (
{
EFI_HOB_MEMORY_ALLOCATION_MODULE *Hob;
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));
CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModuleGuid);
Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule;
@ -295,7 +295,7 @@ BuildResourceDescriptorHob (
{
EFI_HOB_RESOURCE_DESCRIPTOR *Hob;
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16) sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
Hob->ResourceType = ResourceType;
Hob->ResourceAttribute = ResourceAttribute;
@ -402,7 +402,7 @@ BuildFvHob (
// Check FV Signature
//
ASSERT (((EFI_FIRMWARE_VOLUME_HEADER*)((UINTN)BaseAddress))->Signature == EFI_FVH_SIGNATURE);
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FIRMWARE_VOLUME));
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME));
Hob->BaseAddress = BaseAddress;
Hob->Length = Length;
@ -429,7 +429,7 @@ BuildCvHob (
{
EFI_HOB_CAPSULE_VOLUME *Hob;
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CV, sizeof (EFI_HOB_CAPSULE_VOLUME));
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CV, (UINT16) sizeof (EFI_HOB_CAPSULE_VOLUME));
Hob->BaseAddress = BaseAddress;
Hob->Length = Length;
@ -456,7 +456,7 @@ BuildCpuHob (
{
EFI_HOB_CPU *Hob;
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CPU, sizeof (EFI_HOB_CPU));
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CPU, (UINT16) sizeof (EFI_HOB_CPU));
Hob->SizeOfMemorySpace = SizeOfMemorySpace;
Hob->SizeOfIoSpace = SizeOfIoSpace;
@ -488,7 +488,7 @@ BuildStackHob (
{
EFI_HOB_MEMORY_ALLOCATION_STACK *Hob;
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK));
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK));
CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocStackGuid);
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
@ -524,7 +524,7 @@ BuildBspStoreHob (
{
EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *Hob;
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE));
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE));
CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocBspStoreGuid);
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
@ -560,7 +560,7 @@ GlueBuildMemoryAllocationHob (
{
EFI_HOB_MEMORY_ALLOCATION *Hob;
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION));
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION));
ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID));
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;

View File

@ -447,7 +447,7 @@ GlueReportStatusCodeEx (
return EFI_OUT_OF_RESOURCES;
}
StatusCodeData = (EFI_STATUS_CODE_DATA *)Buffer;
StatusCodeData->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);
StatusCodeData->HeaderSize = (UINT16) sizeof (EFI_STATUS_CODE_DATA);
StatusCodeData->Size = (UINT16)ExtendedDataSize;
if (ExtendedDataGuid == NULL) {
ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid;

View File

@ -319,7 +319,7 @@ InternalReportStatusCodeEx (
//
// Fill in the extended data header
//
mStatusCodeData->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);
mStatusCodeData->HeaderSize = (UINT16) sizeof (EFI_STATUS_CODE_DATA);
mStatusCodeData->Size = (UINT16)ExtendedDataSize;
if (ExtendedDataGuid == NULL) {
ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid;

View File

@ -49,7 +49,7 @@ Returns:
--*/
{
Data->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);
Data->HeaderSize = (UINT16) sizeof (EFI_STATUS_CODE_DATA);
Data->Size = (UINT16)(DataSize - sizeof (EFI_STATUS_CODE_DATA));
EfiCommonLibCopyMem (&Data->Type, TypeGuid, sizeof (EFI_GUID));

View File

@ -52,7 +52,7 @@ Returns:
Hob.Raw = HobStart;
Hob.Header->HobType = EFI_HOB_TYPE_END_OF_HOB_LIST;
Hob.Header->HobLength = sizeof(EFI_HOB_GENERIC_HEADER);
Hob.Header->HobLength = (UINT16) sizeof (EFI_HOB_GENERIC_HEADER);
Hob.Header++;
return Hob;
@ -102,7 +102,7 @@ Returns:
HandOffHob.Raw = HobStart;
Hob.Raw = HobStart;
Hob.Header->HobType = EFI_HOB_TYPE_HANDOFF;
Hob.Header->HobLength = sizeof(EFI_HOB_HANDOFF_INFO_TABLE);
Hob.Header->HobLength = (UINT16) sizeof (EFI_HOB_HANDOFF_INFO_TABLE);
Hob.HandoffInformationTable->Version = Version;
Hob.HandoffInformationTable->BootMode = BootMode;
@ -161,7 +161,7 @@ Returns:
Hob.Raw = (VOID*)(UINTN)(HandOffHob.HandoffInformationTable->EfiEndOfHobList);
Hob.Header->HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION;
Hob.Header->HobLength = sizeof(EFI_HOB_MEMORY_ALLOCATION_MODULE);
Hob.Header->HobLength = (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE);
CopyMem(&(Hob.MemoryAllocationModule->ModuleName), ModuleName, sizeof(EFI_GUID));
CopyMem(&(Hob.MemoryAllocationModule->MemoryAllocationHeader.Name), &gEfiHobMemeryAllocModuleGuid, sizeof(EFI_GUID));
@ -218,7 +218,7 @@ Returns:
Hob.Raw = (VOID *)(UINTN)(HandOffHob.HandoffInformationTable->EfiEndOfHobList);
Hob.Header->HobType = EFI_HOB_TYPE_RESOURCE_DESCRIPTOR;
Hob.Header->HobLength = sizeof(EFI_HOB_RESOURCE_DESCRIPTOR);
Hob.Header->HobLength = (UINT16) sizeof (EFI_HOB_RESOURCE_DESCRIPTOR);
Hob.ResourceDescriptor->ResourceType = ResourceType;
Hob.ResourceDescriptor->ResourceAttribute = ResourceAttribute;
@ -319,7 +319,7 @@ Returns:
Hob.Raw = (VOID*)(UINTN)(HandOffHob.HandoffInformationTable->EfiEndOfHobList);
Hob.Header->HobType = EFI_HOB_TYPE_FV;
Hob.Header->HobLength = sizeof(EFI_HOB_FIRMWARE_VOLUME);
Hob.Header->HobLength = (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME);
Hob.FirmwareVolume->BaseAddress = BaseAddress;
Hob.FirmwareVolume->Length = Length;
@ -368,7 +368,7 @@ Returns:
Hob.Raw = (VOID*)(UINTN)HandOffHob.HandoffInformationTable->EfiEndOfHobList;
Hob.Header->HobType = EFI_HOB_TYPE_CPU;
Hob.Header->HobLength = sizeof(EFI_HOB_CPU);
Hob.Header->HobLength = (UINT16) sizeof (EFI_HOB_CPU);
Hob.Cpu->SizeOfMemorySpace = SizeOfMemorySpace;
Hob.Cpu->SizeOfIoSpace = SizeOfIoSpace;
@ -416,7 +416,7 @@ Returns:
Hob.Raw = (VOID*)(UINTN)HandOffHob.HandoffInformationTable->EfiEndOfHobList;
Hob.Header->HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION;
Hob.Header->HobLength = sizeof(EFI_HOB_MEMORY_ALLOCATION_STACK);
Hob.Header->HobLength = (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK);
CopyMem(&(Hob.MemoryAllocationStack->AllocDescriptor.Name), &gEfiHobMemeryAllocStackGuid, sizeof(EFI_GUID));
(Hob.MemoryAllocationStack->AllocDescriptor).MemoryBaseAddress = BaseAddress;
@ -468,7 +468,7 @@ Returns:
HandOffHob.Raw = HobStart;
Hob.Raw = (VOID *)(UINTN)HandOffHob.HandoffInformationTable->EfiEndOfHobList;
Hob.Header->HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION;
Hob.Header->HobLength = sizeof(EFI_HOB_MEMORY_ALLOCATION_BSP_STORE);
Hob.Header->HobLength = (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE);
(Hob.MemoryAllocationBspStore->AllocDescriptor).MemoryBaseAddress = BaseAddress;
(Hob.MemoryAllocationBspStore->AllocDescriptor).MemoryLength = Length;
@ -525,12 +525,12 @@ Returns:
Hob.Raw = (VOID*)(UINTN)HandOffHob.HandoffInformationTable->EfiEndOfHobList;
Hob.Header->HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION;
Hob.Header->HobLength = sizeof(EFI_HOB_MEMORY_ALLOCATION);
Hob.Header->HobLength = (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION);
if (Name != NULL) {
CopyMem(&(Hob.MemoryAllocation->AllocDescriptor.Name), &Name, sizeof(EFI_GUID));
CopyMem (&(Hob.MemoryAllocation->AllocDescriptor.Name), &Name, sizeof (EFI_GUID));
} else {
ZeroMem(&Hob.MemoryAllocation->AllocDescriptor.Name, sizeof(EFI_GUID));
ZeroMem (&Hob.MemoryAllocation->AllocDescriptor.Name, sizeof (EFI_GUID));
}
(Hob.MemoryAllocation->AllocDescriptor).MemoryBaseAddress = BaseAddress;