vendorcode/intel/fsp1_0: Don't break GCC strict aliasing

Change-Id: I6b345670db7df652b8b712b721dfe2905373e0d5
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: https://review.coreboot.org/14630
Tested-by: build bot (Jenkins)
Reviewed-by: Leroy P Leahy <leroy.p.leahy@intel.com>
Reviewed-by: York Yang <york.yang@intel.com>
This commit is contained in:
Stefan Reinauer 2016-05-05 20:21:47 -07:00 committed by Martin Roth
parent 1eaf58be2c
commit 0b4db13994
12 changed files with 67 additions and 67 deletions

View File

@ -313,7 +313,7 @@ typedef union {
**/ **/
#define GET_HOB_TYPE(HobStart) \ #define GET_HOB_TYPE(HobStart) \
((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobType) (((EFI_HOB_GENERIC_HEADER *)(HobStart))->HobType)
/** /**
Returns the length, in bytes, of a HOB. Returns the length, in bytes, of a HOB.
@ -327,7 +327,7 @@ typedef union {
**/ **/
#define GET_HOB_LENGTH(HobStart) \ #define GET_HOB_LENGTH(HobStart) \
((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobLength) (((EFI_HOB_GENERIC_HEADER *)(HobStart))->HobLength)
/** /**
Returns a pointer to the next HOB in the HOB list. Returns a pointer to the next HOB in the HOB list.
@ -341,7 +341,7 @@ typedef union {
**/ **/
#define GET_NEXT_HOB(HobStart) \ #define GET_NEXT_HOB(HobStart) \
(VOID *)(*(UINT8 **)&(HobStart) + GET_HOB_LENGTH (HobStart)) (VOID *)((UINT8 *)(HobStart) + GET_HOB_LENGTH(HobStart))
/** /**
Determines if a HOB is the last HOB in the HOB list. Determines if a HOB is the last HOB in the HOB list.
@ -356,7 +356,7 @@ typedef union {
@retval FALSE The HOB specified by HobStart is not the last HOB in the HOB list. @retval FALSE The HOB specified by HobStart is not the last HOB in the HOB list.
**/ **/
#define END_OF_HOB_LIST(HobStart) (GET_HOB_TYPE (HobStart) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST) #define END_OF_HOB_LIST(HobStart) (GET_HOB_TYPE(HobStart) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST)
/** /**
Returns a pointer to data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION. Returns a pointer to data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
@ -370,7 +370,7 @@ typedef union {
**/ **/
#define GET_GUID_HOB_DATA(HobStart) \ #define GET_GUID_HOB_DATA(HobStart) \
(VOID *)(*(UINT8 **)&(HobStart) + sizeof (EFI_HOB_GUID_TYPE)) (VOID *)((UINT8 *)(HobStart) + sizeof(EFI_HOB_GUID_TYPE))
/** /**
Returns the size of the data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION. Returns the size of the data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
@ -383,7 +383,7 @@ typedef union {
@return The size of the data buffer. @return The size of the data buffer.
**/ **/
#define GET_GUID_HOB_DATA_SIZE(HobStart) \ #define GET_GUID_HOB_DATA_SIZE(HobStart) \
(UINT16)(GET_HOB_LENGTH (HobStart) - sizeof (EFI_HOB_GUID_TYPE)) (UINT16)(GET_HOB_LENGTH(HobStart) - sizeof(EFI_HOB_GUID_TYPE))
/** /**
Returns the pointer to the HOB list. Returns the pointer to the HOB list.

View File

@ -54,7 +54,7 @@ GetLowMemorySize (
// //
// Collect memory ranges // Collect memory ranges
// //
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) { if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
// //
@ -66,7 +66,7 @@ GetLowMemorySize (
} }
} }
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return; return;
@ -89,7 +89,7 @@ GetHighMemorySize (
// //
// Collect memory ranges // Collect memory ranges
// //
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) { if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
// //
@ -100,7 +100,7 @@ GetHighMemorySize (
} }
} }
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return; return;
@ -125,7 +125,7 @@ GetFspReservedMemoryFromGuid (
// //
// Collect memory ranges // Collect memory ranges
// //
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) { if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) {
if (CompareGuid(&Hob.ResourceDescriptor->Owner, &FspReservedMemoryGuid)) { if (CompareGuid(&Hob.ResourceDescriptor->Owner, &FspReservedMemoryGuid)) {
@ -135,7 +135,7 @@ GetFspReservedMemoryFromGuid (
} }
} }
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return; return;

View File

@ -136,11 +136,11 @@ GetNextHob (
// //
// Parse the HOB list until end of list or matching type is found. // Parse the HOB list until end of list or matching type is found.
// //
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == Type) { if (Hob.Header->HobType == Type) {
return Hob.Raw; return Hob.Raw;
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return NULL; return NULL;
} }
@ -177,7 +177,7 @@ GetNextGuidHob (
if (CompareGuid (Guid, &GuidHob.Guid->Name)) { if (CompareGuid (Guid, &GuidHob.Guid->Name)) {
break; break;
} }
GuidHob.Raw = GET_NEXT_HOB (GuidHob); GuidHob.Raw = GET_NEXT_HOB(GuidHob.Raw);
} }
return GuidHob.Raw; return GuidHob.Raw;
} }

View File

@ -313,7 +313,7 @@ typedef union {
**/ **/
#define GET_HOB_TYPE(HobStart) \ #define GET_HOB_TYPE(HobStart) \
((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobType) (((EFI_HOB_GENERIC_HEADER *)(HobStart))->HobType)
/** /**
Returns the length, in bytes, of a HOB. Returns the length, in bytes, of a HOB.
@ -327,7 +327,7 @@ typedef union {
**/ **/
#define GET_HOB_LENGTH(HobStart) \ #define GET_HOB_LENGTH(HobStart) \
((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobLength) (((EFI_HOB_GENERIC_HEADER *)(HobStart))->HobLength)
/** /**
Returns a pointer to the next HOB in the HOB list. Returns a pointer to the next HOB in the HOB list.
@ -341,7 +341,7 @@ typedef union {
**/ **/
#define GET_NEXT_HOB(HobStart) \ #define GET_NEXT_HOB(HobStart) \
(VOID *)(*(UINT8 **)&(HobStart) + GET_HOB_LENGTH (HobStart)) (VOID *)((UINT8 *)(HobStart) + GET_HOB_LENGTH(HobStart))
/** /**
Determines if a HOB is the last HOB in the HOB list. Determines if a HOB is the last HOB in the HOB list.
@ -356,7 +356,7 @@ typedef union {
@retval FALSE The HOB specified by HobStart is not the last HOB in the HOB list. @retval FALSE The HOB specified by HobStart is not the last HOB in the HOB list.
**/ **/
#define END_OF_HOB_LIST(HobStart) (GET_HOB_TYPE (HobStart) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST) #define END_OF_HOB_LIST(HobStart) (GET_HOB_TYPE(HobStart) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST)
/** /**
Returns a pointer to data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION. Returns a pointer to data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
@ -370,7 +370,7 @@ typedef union {
**/ **/
#define GET_GUID_HOB_DATA(HobStart) \ #define GET_GUID_HOB_DATA(HobStart) \
(VOID *)(*(UINT8 **)&(HobStart) + sizeof (EFI_HOB_GUID_TYPE)) (VOID *)((UINT8 *)(HobStart) + sizeof(EFI_HOB_GUID_TYPE))
/** /**
Returns the size of the data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION. Returns the size of the data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
@ -383,7 +383,7 @@ typedef union {
@return The size of the data buffer. @return The size of the data buffer.
**/ **/
#define GET_GUID_HOB_DATA_SIZE(HobStart) \ #define GET_GUID_HOB_DATA_SIZE(HobStart) \
(UINT16)(GET_HOB_LENGTH (HobStart) - sizeof (EFI_HOB_GUID_TYPE)) (UINT16)(GET_HOB_LENGTH(HobStart) - sizeof(EFI_HOB_GUID_TYPE))
/** /**

View File

@ -114,11 +114,11 @@ GetNextHob (
/* /*
* Parse the HOB list until end of list or matching type is found. * Parse the HOB list until end of list or matching type is found.
*/ */
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == Type) { if (Hob.Header->HobType == Type) {
return Hob.Raw; return Hob.Raw;
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return NULL; return NULL;
@ -142,11 +142,11 @@ GetNextGuidHob (
EFI_PEI_HOB_POINTERS GuidHob; EFI_PEI_HOB_POINTERS GuidHob;
GuidHob.Raw = (UINT8 *) HobStart; GuidHob.Raw = (UINT8 *) HobStart;
while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) { while ((GuidHob.Raw = GetNextHob(EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) {
if (CompareGuid (Guid, &GuidHob.Guid->Name)) { if (CompareGuid (Guid, &GuidHob.Guid->Name)) {
break; break;
} }
GuidHob.Raw = GET_NEXT_HOB (GuidHob); GuidHob.Raw = GET_NEXT_HOB(GuidHob.Raw);
} }
return GuidHob.Raw; return GuidHob.Raw;
@ -175,7 +175,7 @@ GetUsableLowMemTop (
* Collect memory ranges * Collect memory ranges
*/ */
MemLen = 0x100000; MemLen = 0x100000;
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) { if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
/* /*
@ -187,7 +187,7 @@ GetUsableLowMemTop (
} }
} }
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return MemLen; return MemLen;
@ -219,7 +219,7 @@ GetPhysicalLowMemTop (
*/ */
MemBase = 0x100000; MemBase = 0x100000;
MemLen = 0; MemLen = 0;
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) || if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) ||
(Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED)) { (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED)) {
@ -233,7 +233,7 @@ GetPhysicalLowMemTop (
} }
} }
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return MemBase + MemLen; return MemBase + MemLen;
@ -262,7 +262,7 @@ GetUsableHighMemTop (
* Collect memory ranges * Collect memory ranges
*/ */
MemTop = 0x100000000; MemTop = 0x100000000;
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) { if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
/* /*
@ -273,7 +273,7 @@ GetUsableHighMemTop (
} }
} }
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return MemTop; return MemTop;
@ -306,7 +306,7 @@ GetFspReservedMemoryFromGuid (
/* /*
* Collect memory ranges * Collect memory ranges
*/ */
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) { if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) {
if (CompareGuid(&Hob.ResourceDescriptor->Owner, OwnerGuid)) { if (CompareGuid(&Hob.ResourceDescriptor->Owner, OwnerGuid)) {
@ -317,7 +317,7 @@ GetFspReservedMemoryFromGuid (
} }
} }
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return 0; return 0;

View File

@ -313,7 +313,7 @@ typedef union {
**/ **/
#define GET_HOB_TYPE(HobStart) \ #define GET_HOB_TYPE(HobStart) \
((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobType) (((EFI_HOB_GENERIC_HEADER *)(HobStart))->HobType)
/** /**
Returns the length, in bytes, of a HOB. Returns the length, in bytes, of a HOB.
@ -327,7 +327,7 @@ typedef union {
**/ **/
#define GET_HOB_LENGTH(HobStart) \ #define GET_HOB_LENGTH(HobStart) \
((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobLength) (((EFI_HOB_GENERIC_HEADER *)(HobStart))->HobLength)
/** /**
Returns a pointer to the next HOB in the HOB list. Returns a pointer to the next HOB in the HOB list.
@ -341,7 +341,7 @@ typedef union {
**/ **/
#define GET_NEXT_HOB(HobStart) \ #define GET_NEXT_HOB(HobStart) \
(VOID *)(*(UINT8 **)&(HobStart) + GET_HOB_LENGTH (HobStart)) (VOID *)((UINT8 *)(HobStart) + GET_HOB_LENGTH(HobStart))
/** /**
Determines if a HOB is the last HOB in the HOB list. Determines if a HOB is the last HOB in the HOB list.
@ -356,7 +356,7 @@ typedef union {
@retval FALSE The HOB specified by HobStart is not the last HOB in the HOB list. @retval FALSE The HOB specified by HobStart is not the last HOB in the HOB list.
**/ **/
#define END_OF_HOB_LIST(HobStart) (GET_HOB_TYPE (HobStart) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST) #define END_OF_HOB_LIST(HobStart) (GET_HOB_TYPE(HobStart) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST)
/** /**
Returns a pointer to data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION. Returns a pointer to data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
@ -370,7 +370,7 @@ typedef union {
**/ **/
#define GET_GUID_HOB_DATA(HobStart) \ #define GET_GUID_HOB_DATA(HobStart) \
(VOID *)(*(UINT8 **)&(HobStart) + sizeof (EFI_HOB_GUID_TYPE)) (VOID *)((UINT8 *)(HobStart) + sizeof(EFI_HOB_GUID_TYPE))
/** /**
Returns the size of the data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION. Returns the size of the data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
@ -383,7 +383,7 @@ typedef union {
@return The size of the data buffer. @return The size of the data buffer.
**/ **/
#define GET_GUID_HOB_DATA_SIZE(HobStart) \ #define GET_GUID_HOB_DATA_SIZE(HobStart) \
(UINT16)(GET_HOB_LENGTH (HobStart) - sizeof (EFI_HOB_GUID_TYPE)) (UINT16)(GET_HOB_LENGTH(HobStart) - sizeof(EFI_HOB_GUID_TYPE))
/** /**
Returns the pointer to the HOB list. Returns the pointer to the HOB list.

View File

@ -145,11 +145,11 @@ GetNextHob (
// //
// Parse the HOB list until end of list or matching type is found. // Parse the HOB list until end of list or matching type is found.
// //
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == Type) { if (Hob.Header->HobType == Type) {
return Hob.Raw; return Hob.Raw;
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return NULL; return NULL;
} }
@ -186,7 +186,7 @@ GetNextGuidHob (
if (CompareGuid (Guid, &GuidHob.Guid->Name)) { if (CompareGuid (Guid, &GuidHob.Guid->Name)) {
break; break;
} }
GuidHob.Raw = GET_NEXT_HOB (GuidHob); GuidHob.Raw = GET_NEXT_HOB(GuidHob.Raw);
} }
return GuidHob.Raw; return GuidHob.Raw;
} }

View File

@ -313,7 +313,7 @@ typedef union {
**/ **/
#define GET_HOB_TYPE(HobStart) \ #define GET_HOB_TYPE(HobStart) \
((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobType) (((EFI_HOB_GENERIC_HEADER *)(HobStart))->HobType)
/** /**
Returns the length, in bytes, of a HOB. Returns the length, in bytes, of a HOB.
@ -327,7 +327,7 @@ typedef union {
**/ **/
#define GET_HOB_LENGTH(HobStart) \ #define GET_HOB_LENGTH(HobStart) \
((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobLength) (((EFI_HOB_GENERIC_HEADER *)(HobStart))->HobLength)
/** /**
Returns a pointer to the next HOB in the HOB list. Returns a pointer to the next HOB in the HOB list.
@ -341,7 +341,7 @@ typedef union {
**/ **/
#define GET_NEXT_HOB(HobStart) \ #define GET_NEXT_HOB(HobStart) \
(VOID *)(*(UINT8 **)&(HobStart) + GET_HOB_LENGTH (HobStart)) (VOID *)((UINT8 *)(HobStart) + GET_HOB_LENGTH(HobStart))
/** /**
Determines if a HOB is the last HOB in the HOB list. Determines if a HOB is the last HOB in the HOB list.
@ -356,7 +356,7 @@ typedef union {
@retval FALSE The HOB specified by HobStart is not the last HOB in the HOB list. @retval FALSE The HOB specified by HobStart is not the last HOB in the HOB list.
**/ **/
#define END_OF_HOB_LIST(HobStart) (GET_HOB_TYPE (HobStart) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST) #define END_OF_HOB_LIST(HobStart) (GET_HOB_TYPE(HobStart) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST)
/** /**
Returns a pointer to data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION. Returns a pointer to data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
@ -370,7 +370,7 @@ typedef union {
**/ **/
#define GET_GUID_HOB_DATA(HobStart) \ #define GET_GUID_HOB_DATA(HobStart) \
(VOID *)(*(UINT8 **)&(HobStart) + sizeof (EFI_HOB_GUID_TYPE)) (VOID *)((UINT8 *)(HobStart) + sizeof(EFI_HOB_GUID_TYPE))
/** /**
Returns the size of the data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION. Returns the size of the data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
@ -383,7 +383,7 @@ typedef union {
@return The size of the data buffer. @return The size of the data buffer.
**/ **/
#define GET_GUID_HOB_DATA_SIZE(HobStart) \ #define GET_GUID_HOB_DATA_SIZE(HobStart) \
(UINT16)(GET_HOB_LENGTH (HobStart) - sizeof (EFI_HOB_GUID_TYPE)) (UINT16)(GET_HOB_LENGTH(HobStart) - sizeof(EFI_HOB_GUID_TYPE))
/** /**
Returns the pointer to the HOB list. Returns the pointer to the HOB list.

View File

@ -145,11 +145,11 @@ GetNextHob (
// //
// Parse the HOB list until end of list or matching type is found. // Parse the HOB list until end of list or matching type is found.
// //
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == Type) { if (Hob.Header->HobType == Type) {
return Hob.Raw; return Hob.Raw;
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return NULL; return NULL;
} }
@ -186,7 +186,7 @@ GetNextGuidHob (
if (CompareGuid (Guid, &GuidHob.Guid->Name)) { if (CompareGuid (Guid, &GuidHob.Guid->Name)) {
break; break;
} }
GuidHob.Raw = GET_NEXT_HOB (GuidHob); GuidHob.Raw = GET_NEXT_HOB(GuidHob.Raw);
} }
return GuidHob.Raw; return GuidHob.Raw;
} }

View File

@ -315,7 +315,7 @@ typedef union {
**/ **/
#define GET_HOB_TYPE(HobStart) \ #define GET_HOB_TYPE(HobStart) \
((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobType) (((EFI_HOB_GENERIC_HEADER *)(HobStart))->HobType)
/** /**
Returns the length, in bytes, of a HOB. Returns the length, in bytes, of a HOB.
@ -329,7 +329,7 @@ typedef union {
**/ **/
#define GET_HOB_LENGTH(HobStart) \ #define GET_HOB_LENGTH(HobStart) \
((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobLength) (((EFI_HOB_GENERIC_HEADER *)(HobStart))->HobLength)
/** /**
Returns a pointer to the next HOB in the HOB list. Returns a pointer to the next HOB in the HOB list.
@ -343,7 +343,7 @@ typedef union {
**/ **/
#define GET_NEXT_HOB(HobStart) \ #define GET_NEXT_HOB(HobStart) \
(VOID *)(*(UINT8 **)&(HobStart) + GET_HOB_LENGTH (HobStart)) (VOID *)((UINT8 *)(HobStart) + GET_HOB_LENGTH(HobStart))
/** /**
Determines if a HOB is the last HOB in the HOB list. Determines if a HOB is the last HOB in the HOB list.
@ -358,7 +358,7 @@ typedef union {
@retval FALSE The HOB specified by HobStart is not the last HOB in the HOB list. @retval FALSE The HOB specified by HobStart is not the last HOB in the HOB list.
**/ **/
#define END_OF_HOB_LIST(HobStart) (GET_HOB_TYPE (HobStart) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST) #define END_OF_HOB_LIST(HobStart) (GET_HOB_TYPE(HobStart) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST)
/** /**
Returns a pointer to data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION. Returns a pointer to data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
@ -372,7 +372,7 @@ typedef union {
**/ **/
#define GET_GUID_HOB_DATA(HobStart) \ #define GET_GUID_HOB_DATA(HobStart) \
(VOID *)(*(UINT8 **)&(HobStart) + sizeof (EFI_HOB_GUID_TYPE)) (VOID *)((UINT8 *)(HobStart) + sizeof(EFI_HOB_GUID_TYPE))
/** /**
Returns the size of the data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION. Returns the size of the data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
@ -385,7 +385,7 @@ typedef union {
@return The size of the data buffer. @return The size of the data buffer.
**/ **/
#define GET_GUID_HOB_DATA_SIZE(HobStart) \ #define GET_GUID_HOB_DATA_SIZE(HobStart) \
(UINT16)(GET_HOB_LENGTH (HobStart) - sizeof (EFI_HOB_GUID_TYPE)) (UINT16)(GET_HOB_LENGTH(HobStart) - sizeof(EFI_HOB_GUID_TYPE))
/** /**
Returns the pointer to the HOB list. Returns the pointer to the HOB list.

View File

@ -56,7 +56,7 @@ GetUsableLowMemTop (
* Collect memory ranges * Collect memory ranges
*/ */
MemLen = 0x100000; MemLen = 0x100000;
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) { if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
/* /*
@ -68,7 +68,7 @@ GetUsableLowMemTop (
} }
} }
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return MemLen; return MemLen;
@ -98,7 +98,7 @@ GetUsableHighMemTop (
* Collect memory ranges * Collect memory ranges
*/ */
MemTop = 0x100000000; MemTop = 0x100000000;
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) { if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
/* /*
@ -109,7 +109,7 @@ GetUsableHighMemTop (
} }
} }
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return MemTop; return MemTop;
@ -143,7 +143,7 @@ GetFspReservedMemoryFromGuid (
/* /*
* Collect memory ranges * Collect memory ranges
*/ */
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) { if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) { if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) {
if (CompareGuid(&Hob.ResourceDescriptor->Owner, OwnerGuid)) { if (CompareGuid(&Hob.ResourceDescriptor->Owner, OwnerGuid)) {
@ -153,7 +153,7 @@ GetFspReservedMemoryFromGuid (
} }
} }
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
} }

View File

@ -142,11 +142,11 @@ GetNextHob (
// //
// Parse the HOB list until end of list or matching type is found. // Parse the HOB list until end of list or matching type is found.
// //
while (!END_OF_HOB_LIST (Hob)) { while (!END_OF_HOB_LIST(Hob.Raw)) {
if (Hob.Header->HobType == Type) { if (Hob.Header->HobType == Type) {
return Hob.Raw; return Hob.Raw;
} }
Hob.Raw = GET_NEXT_HOB (Hob); Hob.Raw = GET_NEXT_HOB(Hob.Raw);
} }
return NULL; return NULL;
} }
@ -183,7 +183,7 @@ GetNextGuidHob (
if (CompareGuid (Guid, &GuidHob.Guid->Name)) { if (CompareGuid (Guid, &GuidHob.Guid->Name)) {
break; break;
} }
GuidHob.Raw = GET_NEXT_HOB (GuidHob); GuidHob.Raw = GET_NEXT_HOB(GuidHob.Raw);
} }
return GuidHob.Raw; return GuidHob.Raw;
} }