From 0b4db1399462dc8febb6d5c798b68c257f9055b1 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Thu, 5 May 2016 20:21:47 -0700 Subject: vendorcode/intel/fsp1_0: Don't break GCC strict aliasing Change-Id: I6b345670db7df652b8b712b721dfe2905373e0d5 Signed-off-by: Stefan Reinauer Reviewed-on: https://review.coreboot.org/14630 Tested-by: build bot (Jenkins) Reviewed-by: Leroy P Leahy Reviewed-by: York Yang --- src/vendorcode/intel/fsp1_0/rangeley/include/fsphob.h | 12 ++++++------ src/vendorcode/intel/fsp1_0/rangeley/srx/fsp_support.c | 12 ++++++------ src/vendorcode/intel/fsp1_0/rangeley/srx/fsphob.c | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/vendorcode/intel/fsp1_0/rangeley') diff --git a/src/vendorcode/intel/fsp1_0/rangeley/include/fsphob.h b/src/vendorcode/intel/fsp1_0/rangeley/include/fsphob.h index 0f743b50d4..a4200c53c1 100644 --- a/src/vendorcode/intel/fsp1_0/rangeley/include/fsphob.h +++ b/src/vendorcode/intel/fsp1_0/rangeley/include/fsphob.h @@ -315,7 +315,7 @@ typedef union { **/ #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. @@ -329,7 +329,7 @@ typedef union { **/ #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. @@ -343,7 +343,7 @@ typedef union { **/ #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. @@ -358,7 +358,7 @@ typedef union { @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. @@ -372,7 +372,7 @@ typedef union { **/ #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. @@ -385,7 +385,7 @@ typedef union { @return The size of the data buffer. **/ #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. diff --git a/src/vendorcode/intel/fsp1_0/rangeley/srx/fsp_support.c b/src/vendorcode/intel/fsp1_0/rangeley/srx/fsp_support.c index 9f15b3e8db..68e6fa0e85 100644 --- a/src/vendorcode/intel/fsp1_0/rangeley/srx/fsp_support.c +++ b/src/vendorcode/intel/fsp1_0/rangeley/srx/fsp_support.c @@ -56,7 +56,7 @@ GetUsableLowMemTop ( * Collect memory ranges */ 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.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; @@ -98,7 +98,7 @@ GetUsableHighMemTop ( * Collect memory ranges */ 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.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; @@ -143,7 +143,7 @@ GetFspReservedMemoryFromGuid ( /* * 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.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) { if (CompareGuid(&Hob.ResourceDescriptor->Owner, OwnerGuid)) { @@ -153,7 +153,7 @@ GetFspReservedMemoryFromGuid ( } } } - Hob.Raw = GET_NEXT_HOB (Hob); + Hob.Raw = GET_NEXT_HOB(Hob.Raw); } } diff --git a/src/vendorcode/intel/fsp1_0/rangeley/srx/fsphob.c b/src/vendorcode/intel/fsp1_0/rangeley/srx/fsphob.c index 4986d52436..ba56543975 100644 --- a/src/vendorcode/intel/fsp1_0/rangeley/srx/fsphob.c +++ b/src/vendorcode/intel/fsp1_0/rangeley/srx/fsphob.c @@ -142,11 +142,11 @@ GetNextHob ( // // 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) { return Hob.Raw; } - Hob.Raw = GET_NEXT_HOB (Hob); + Hob.Raw = GET_NEXT_HOB(Hob.Raw); } return NULL; } @@ -183,7 +183,7 @@ GetNextGuidHob ( if (CompareGuid (Guid, &GuidHob.Guid->Name)) { break; } - GuidHob.Raw = GET_NEXT_HOB (GuidHob); + GuidHob.Raw = GET_NEXT_HOB(GuidHob.Raw); } return GuidHob.Raw; } -- cgit v1.2.3