From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ma1-aaemail-dr-lapp01.apple.com (ma1-aaemail-dr-lapp01.apple.com [17.171.2.60]) by mx.groups.io with SMTP id smtpd.web10.9728.1583120872780949371 for ; Sun, 01 Mar 2020 19:47:53 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@apple.com header.s=20180706 header.b=ds+j9PuW; spf=pass (domain: apple.com, ip: 17.171.2.60, mailfrom: afish@apple.com) Received: from pps.filterd (ma1-aaemail-dr-lapp01.apple.com [127.0.0.1]) by ma1-aaemail-dr-lapp01.apple.com (8.16.0.27/8.16.0.27) with SMTP id 0223lK7e030354; Sun, 1 Mar 2020 19:47:51 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=sender : from : message-id : content-type : mime-version : subject : date : in-reply-to : cc : to : references; s=20180706; bh=PM3fzQUHqPwL1bWl7ggsjh/S0hqY8OYEBHkCEddYf6o=; b=ds+j9PuWQH0Jolp2bXRzAmKrybfL7BFmzNWdihHg3XD2NPyny7m978f0ssXSV9aNZa8m 7XZYpEoffNB8xXpiLuj1gsHqj9xE/Hs7y/Wv8uEeRd2MjJ1qbczmnNblhmrhdwPo7mRs 9YAUv6OttE/pRTZwzrtyF4a285NIFKGZrD8F3y9GZeayPiq7JIutaeRu3OU/W51J01/7 dsCcypXDjiTyCgKAafo3jtwgCLLb5JRXdnYnKKYNDtpdUdqXqMtEM69ajhBcdmL3feIA vZsWJgTDxozAynKIm3E/uyiRVaAFEjZCbZsNuSpmeL0tq1YD6dKhDLhANTGOSiZy0K7J QQ== Received: from rn-mailsvcp-mta-lapp04.rno.apple.com (rn-mailsvcp-mta-lapp04.rno.apple.com [10.225.203.152]) by ma1-aaemail-dr-lapp01.apple.com with ESMTP id 2yfqg50a0s-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Sun, 01 Mar 2020 19:47:51 -0800 Received: from rn-mailsvcp-mmp-lapp02.rno.apple.com (rn-mailsvcp-mmp-lapp02.rno.apple.com [17.179.253.15]) by rn-mailsvcp-mta-lapp04.rno.apple.com (Oracle Communications Messaging Server 8.1.0.1.20190704 64bit (built Jul 4 2019)) with ESMTPS id <0Q6J003CZRVR1Z10@rn-mailsvcp-mta-lapp04.rno.apple.com>; Sun, 01 Mar 2020 19:47:51 -0800 (PST) Received: from process_milters-daemon.rn-mailsvcp-mmp-lapp02.rno.apple.com by rn-mailsvcp-mmp-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.1.20190704 64bit (built Jul 4 2019)) id <0Q6J01100RMXE300@rn-mailsvcp-mmp-lapp02.rno.apple.com>; Sun, 01 Mar 2020 19:47:51 -0800 (PST) X-Va-A: X-Va-T-CD: e48e8dc3f6c377b8dc939b4126ad19f3 X-Va-E-CD: 4419952549f2d824860fb848b4955a59 X-Va-R-CD: 1809f0aec25bbd5206a319010f13edc6 X-Va-CD: 0 X-Va-ID: 88581274-6330-4f20-bfda-7bdde7e12c6e X-V-A: X-V-T-CD: e48e8dc3f6c377b8dc939b4126ad19f3 X-V-E-CD: 4419952549f2d824860fb848b4955a59 X-V-R-CD: 1809f0aec25bbd5206a319010f13edc6 X-V-CD: 0 X-V-ID: 755d14ea-917f-440c-b47e-092a40df92e6 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-03-01_09:2020-02-28,2020-03-01 signatures=0 Received: from [17.235.62.14] by rn-mailsvcp-mmp-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.1.20190704 64bit (built Jul 4 2019)) with ESMTPSA id <0Q6J00C3ERVOEA30@rn-mailsvcp-mmp-lapp02.rno.apple.com>; Sun, 01 Mar 2020 19:47:50 -0800 (PST) Sender: afish@apple.com From: "Andrew Fish" Message-id: <7E325DE5-04A9-4C4F-97A8-519D0A5CF905@apple.com> MIME-version: 1.0 (Mac OS X Mail 13.0 \(3594.4.17\)) Subject: Re: [edk2-devel] [Patch] IntelSiliconPkg/ShadowMicrocodePei: Fix GCC build error. Date: Sun, 01 Mar 2020 19:47:48 -0800 In-reply-to: Cc: "Gao, Liming" , "Fu, Siyuan" , "Ni, Ray" , "Chaganty, Rangasai V" To: devel@edk2.groups.io, Mike Kinney References: <63C810E5-7643-4524-B4A5-14D78D912FD9@apple.com> X-Mailer: Apple Mail (2.3594.4.17) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-03-01_09:2020-02-28,2020-03-01 signatures=0 Content-type: multipart/alternative; boundary="Apple-Mail=_7093CCA7-7010-4748-B0FF-26FABB672A07" --Apple-Mail=_7093CCA7-7010-4748-B0FF-26FABB672A07 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Mar 1, 2020, at 3:41 PM, Michael D Kinney wrote: >=20 > Andrew, >=20 > Thanks. I did not realize this was a struct with=20 > a single flexible array member. I agree that does > not make sense. >=20 > The top level struct here is a HOB that must be in > contiguous memory. The HOB can vary in size based on > MicrocodeCount and StorageType. We are trying to make > it easy to write the C code that produces and consumes > this HOB. Using flexible array members helps improve > the readability when structures have this attribute. >=20 > For the storage type defined, the StorageContext is a=20 > single UINT64 value. Other storage type GUIDs may have > more complex StorageContext structures. This array > of structures is guaranteed to start on an 8-byte > boundary, so the use case is to cast the start of > the StorageContext to the defined type and access > the array if structures and their fields. >=20 > Do you have any suggestions on how to make this > better? Mike, The flexible array member can not be in a struct by its self or a member o= f a union (I looked into that, but clang warns on that too). It has to be a= the end of a structure with size.=20 If we can't build a compound structure with the preamble data as that data= varies too much the best I can think of is this: Add the known size element to enforce alignment, and make the flexible siz= e member legal C. Add a macro that converts the pointer to raw data to the = FLEXIBLE_ARRAY. Basically you need to subtract the fixed size element to ge= t the pointer to the flexible array aligned and indexable.=20 typedef struct { UINT64 ForceAlign; UINT8 Array[]; } FLEXIBLE_ARRAY; FLEXIBLE_ARRAY *gFlex =3D FLEXIBLE_ARRAY_ALIGN (RawData); Now FLEXIBLE_ARRAY.Array[] is an index into the RawData, and the definitio= n of the FLEXIBLE_ARRAY_ALIGN can explain the trick and why it is required = or standard C.=20 Then from the C code it looks more like code that requires aligning a buff= er?=20 Sorry that is the best I've got. But at the end of the day a pointer is a= lso a flexible array in C so that is the other option.=20 Thanks, =20 Andrew Fish >=20 > Mike >=20 >> -----Original Message----- >> From: afish@apple.com > >> Sent: Thursday, February 27, 2020 7:43 AM >> To: devel@edk2.groups.io ; Kinney, Michael= D >> > >> Cc: Gao, Liming >; F= u, Siyuan >> >; Ni, Ray >; >> Chaganty, Rangasai V > >> Subject: Re: [edk2-devel] [Patch] >> IntelSiliconPkg/ShadowMicrocodePei: Fix GCC build >> error. >>=20 >> Mike, >>=20 >> Flexible array members must be the last element of a >> struct but they can not be the only element. >>=20 >> This is non standard behavior from the compilers that >> are not throwing the error. >>=20 >> Why not just use a pointer? >>=20 >> Sent from my iPhone >>=20 >>> On Feb 26, 2020, at 10:03 PM, Michael D Kinney >> wrote: >>>=20 >>> =EF=BB=BFLiming, >>>=20 >>> This does not make sense. Those compilers >>> should support C99 flexible array members. >>>=20 >>> Structured PCDs also require use of flexible >>> array members. >>>=20 >>> We need to make sure the compiler flags for >>> those tool chain are correct to support flexible >>> array members. >>>=20 >>> Mike >>>=20 >>>> -----Original Message----- >>>> From: Gao, Liming >>>> Sent: Wednesday, February 26, 2020 9:58 PM >>>> To: devel@edk2.groups.io; Kinney, Michael D >>>> ; Fu, Siyuan >>>> >>>> Cc: Ni, Ray ; Chaganty, Rangasai V >>>> >>>> Subject: RE: [edk2-devel] [Patch] >>>> IntelSiliconPkg/ShadowMicrocodePei: Fix GCC build >>>> error. >>>>=20 >>>> Mike: >>>> I find this issue on GCC5 tool chain tag with GCC >> 5.5 >>>> and CLANGPDB tool chain tag with CLANG 9.0.0 >>>>=20 >>>> Thanks >>>> Liming >>>>> -----Original Message----- >>>>> From: devel@edk2.groups.io >> On >>>> Behalf Of Michael D Kinney >>>>> Sent: Thursday, February 27, 2020 1:54 PM >>>>> To: Gao, Liming ; >>>> devel@edk2.groups.io; Fu, Siyuan >> ; >>>> Kinney, Michael D >>>>> >>>>> Cc: Ni, Ray ; Chaganty, Rangasai >> V >>>> >>>>> Subject: Re: [edk2-devel] [Patch] >>>> IntelSiliconPkg/ShadowMicrocodePei: Fix GCC build >>>> error. >>>>>=20 >>>>> Which GCC and CLANG tool chain tags? >>>>>=20 >>>>> Flexible array member is a standard C feature >>>>> documented in C99. >>>>>=20 >>>>> Mike >>>>>=20 >>>>>> -----Original Message----- >>>>>> From: Gao, Liming >>>>>> Sent: Wednesday, February 26, 2020 9:38 PM >>>>>> To: Kinney, Michael D >> ; >>>>>> devel@edk2.groups.io; Fu, Siyuan >>>> >>>>>> Cc: Ni, Ray ; Chaganty, Rangasai >>>> V >>>>>> >>>>>> Subject: RE: [edk2-devel] [Patch] >>>>>> IntelSiliconPkg/ShadowMicrocodePei: Fix GCC build >>>>>> error. >>>>>>=20 >>>>>> Mike: >>>>>> I find GCC and CLANG will report the error for >>>> the >>>>>> empty struct. >>>>>>=20 >>>>>> d:\allpkg\edk2- >>>>>>=20 >>>>=20 >> platforms\Silicon\Intel\IntelSiliconPkg\Include\Guid/Mi >>>>>> crocodeShadowInfoHob.h:61:11: error: flexible >> array >>>>>> member 'MicrocodeAddressInFlash' not allowed in >>>>>> otherwise empty struct >>>>>> UINT64 MicrocodeAddressInFlash[]; >>>>>> ^ >>>>>> 1 error generated. >>>>>>=20 >>>>>> Thanks >>>>>> Liming >>>>>>> -----Original Message----- >>>>>>> From: Kinney, Michael D >>>> >>>>>>> Sent: Thursday, February 27, 2020 1:25 PM >>>>>>> To: devel@edk2.groups.io; Fu, Siyuan >>>>>> ; Kinney, Michael D >>>>>> >>>>>>> Cc: Ni, Ray ; Chaganty, >>>> Rangasai V >>>>>> ; Gao, Liming >>>>>> >>>>>>> Subject: RE: [edk2-devel] [Patch] >>>>>> IntelSiliconPkg/ShadowMicrocodePei: Fix GCC build >>>>>> error. >>>>>>>=20 >>>>>>> What compiler does not like the flexible array >>>>>>> member syntax []. >>>>>>>=20 >>>>>>> Mike >>>>>>>=20 >>>>>>>> -----Original Message----- >>>>>>>> From: devel@edk2.groups.io >>>> >>>>>> On >>>>>>>> Behalf Of Siyuan, Fu >>>>>>>> Sent: Wednesday, February 26, 2020 5:58 PM >>>>>>>> To: devel@edk2.groups.io >>>>>>>> Cc: Ni, Ray ; Chaganty, >>>> Rangasai >>>>>> V >>>>>>>> ; Gao, Liming >>>>>>>> >>>>>>>> Subject: [edk2-devel] [Patch] >>>>>>>> IntelSiliconPkg/ShadowMicrocodePei: Fix GCC >>>> build >>>>>>>> error. >>>>>>>>=20 >>>>>>>> This patch fixes compiler error introduced by >>>>>> commit >>>>>>>> b0099a39bd. >>>>>>>>=20 >>>>>>>> BZ: >>>>>>>>=20 >>>>>>=20 >>>>=20 >> https://tianocore.acgmultimedia.com/show_bug.cgi?id=3D244 >>>>>>>> 9 >>>>>>>> Cc: Ray Ni >>>>>>>> Cc: Rangasai V Chaganty >>>>>> >>>>>>>> Cc: Liming Gao >>>>>>>> Signed-off-by: Siyuan Fu >>>>>>>> --- >>>>>>>>=20 >>>> .../Feature/ShadowMicrocode/ShadowMicrocodePei.c >>>>>>>> | 2 +- >>>>>>>>=20 >>>>>>>>=20 >>>>>>=20 >>>>=20 >> .../Intel/IntelSiliconPkg/Include/Guid/MicrocodeShadowI >>>>>>>> nfoHob.h | 2 +- >>>>>>>> 2 files changed, 2 insertions(+), 2 >>>> deletions(-) >>>>>>>>=20 >>>>>>>> diff --git >>>>>>>>=20 >>>>>>=20 >>>>=20 >> a/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode >>>>>>>> /ShadowMicrocodePei.c >>>>>>>>=20 >>>>>>=20 >>>>=20 >> b/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode >>>>>>>> /ShadowMicrocodePei.c >>>>>>>> index 7e4084247e..8d6574f667 100644 >>>>>>>> --- >>>>>>>>=20 >>>>>>=20 >>>>=20 >> a/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode >>>>>>>> /ShadowMicrocodePei.c >>>>>>>> +++ >>>>>>>>=20 >>>>>>=20 >>>>=20 >> b/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode >>>>>>>> /ShadowMicrocodePei.c >>>>>>>> @@ -247,7 +247,7 @@ ShadowMicrocodePatchWorker >>>> ( >>>>>>>> (VOID *) Patches[Index].Address, >>>>>>>> Patches[Index].Size >>>>>>>> ); >>>>>>>> - MicrocodeAddressInMemory[Index] =3D (UINT64) >>>>>> Walker; >>>>>>>> + MicrocodeAddressInMemory[Index] =3D (UINT64) >>>>>> (UINTN) >>>>>>>> Walker; >>>>>>>> Flashcontext- >>>>> MicrocodeAddressInFlash[Index] >>>>>> =3D >>>>>>>> (UINT64) Patches[Index].Address; >>>>>>>> Walker +=3D Patches[Index].Size; >>>>>>>> } >>>>>>>> diff --git >>>>>>>>=20 >>>>>>=20 >>>>=20 >> a/Silicon/Intel/IntelSiliconPkg/Include/Guid/MicrocodeS >>>>>>>> hadowInfoHob.h >>>>>>>>=20 >>>>>>=20 >>>>=20 >> b/Silicon/Intel/IntelSiliconPkg/Include/Guid/MicrocodeS >>>>>>>> hadowInfoHob.h >>>>>>>> index d887b39123..1daae1234a 100644 >>>>>>>> --- >>>>>>>>=20 >>>>>>=20 >>>>=20 >> a/Silicon/Intel/IntelSiliconPkg/Include/Guid/MicrocodeS >>>>>>>> hadowInfoHob.h >>>>>>>> +++ >>>>>>>>=20 >>>>>>=20 >>>>=20 >> b/Silicon/Intel/IntelSiliconPkg/Include/Guid/MicrocodeS >>>>>>>> hadowInfoHob.h >>>>>>>> @@ -58,7 +58,7 @@ typedef struct { >>>>>>>> // microcode patch address on flash. The >>>> address >>>>>> is >>>>>>>> placed in same >>>>>>>> // order as the microcode patches in >>>>>>>> MicrocodeAddrInMemory. >>>>>>>> // >>>>>>>> - UINT64 MicrocodeAddressInFlash[]; >>>>>>>> + UINT64 MicrocodeAddressInFlash[0]; >>>>>>>> } EFI_MICROCODE_STORAGE_TYPE_FLASH_CONTEXT; >>>>>>>>=20 >>>>>>>> #endif >>>>>>>> -- >>>>>>>> 2.19.1.windows.1 >>>>>>>>=20 >>>>>>>>=20 >>>>>>>>=20 >>>>>=20 >>>>>=20 >>>>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >=20 >=20 --Apple-Mail=_7093CCA7-7010-4748-B0FF-26FABB672A07 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Mar 1, 2020, at 3:41 PM,= Michael D Kinney <michael.d.kinney@intel.com> wrote:

Andrew,

Thanks. &= nbsp;I did not realize this was a struct with 
a= single flexible array member.  I agree that does
not make sense.

The top lev= el struct here is a HOB that must be in
contiguous memory.  The HOB can vary in size based on=
MicrocodeCount and Sto= rageType.  We are trying to make
it easy to write the C code that produces and consumes
this HOB.  Using flexib= le array members helps improve
the readability when structures have this attribute.

For the storage type defined, the StorageContext is a 

single UINT64 value.  Other storage type GUIDs may have
more complex StorageContext = structures.  This array
<= span style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size:= 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; = letter-spacing: normal; text-align: start; text-indent: 0px; text-transform= : none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: = 0px; text-decoration: none; float: none; display: inline !important;" class= = =3D"">of structures is guaranteed to start on an 8-byte

boundary, so the use case is to cast the = start of
the StorageCon= text to the defined type and access
the array if structures and their fields.

Do = you have any suggestions on how to make this
better?


Mike,

The flexible array member can not be in a struct by its se= lf or a member of a union (I looked into that, but clang warns on that too)= . It has to be a the end of a structure with size. 

If we can't build a compound struct= ure with the preamble data as that data varies too much the best I can thin= k of is this:

Add= the known size element to enforce alignment, and make the flexible size me= mber legal C. Add a macro that converts the pointer to raw data to the FLEX= IBLE_ARRAY. Basically you need to subtract the fixed size element to get th= e pointer to the flexible array aligned and indexable. 

typedef struct {
  UINT64  ForceAlign;
  UINT8 &n= bsp; Array[];
}  FLEXIBLE_ARRAY;


FLEXIBLE_ARRAY *gFlex =3D FLEXIBLE_ARRAY_ALIGN (RawData);<= /div>

Now FLEXIBLE_ARRAY.Array[] is an = index into the RawData, and the definition of the FLEXIBLE_ARRAY_ALIGN can = explain the trick and why it is required or standard C. 
Then from the C code it looks more like code that re= quires aligning a buffer? 

Sorry t= hat is the best I've got.  But at the end of the day a pointer is also= a flexible array in C so that is the other option. 

Thanks,
 
Andrew Fish


Mike

= -----Original Message-----
From: afish@a= pple.com <afish@apple.com>
Sent: Thursday, February 27, 2020 7:43 AM
To: devel@edk2.groups.io; Kinney, Michael D
= <michael.d.kinn= ey@intel.com>
Cc: Gao, Liming <liming.gao@intel.com>; Fu, Siyuan
<siyuan.fu@= intel.com>; Ni, Ray <ray.ni@intel.com>;
Chaganty, Rangasai V <rangasai.v.chaganty@i= ntel.com>
Subject: Re: [edk2-devel] [Patch]
IntelSiliconPkg/ShadowMicrocodePei: Fix GCC build
erro= r.

Mike,

Flexible= array members must be the last element of a
struct  but= they can not be the only element.

This is non= standard behavior from the compilers that
are not throwing t= he error.

Why not just use a pointer?



On Feb 26, 2020, at 10:03 PM, Michael D Kinney
=
<m= ichael.d.kinney@intel.com> wrote:

=EF=BB=BFLiming,

This does not make sense.  Those compilers
should sup= port C99 flexible array members.

Structured PC= Ds also require use of flexible
array members.
=
We need to make sure the compiler flags for
th= ose tool chain are correct to support flexible
array members.=

Mike

-----Original Message-----
From: Ga= o, Liming <liming.gao= @intel.com>
Sent: Wednesday, February 26, 2020 9:58 PM=
To: devel= @edk2.groups.io; Kinney, Michael D
<michael.d.kinney@intel.com>; = Fu, Siyuan
<siyuan.fu@intel.com>
Cc: Ni, Ray <ray.ni@intel.com>; Chaganty, Ra= ngasai V
<rangasai.v.chaganty@intel.com>
Subject: RE= : [edk2-devel] [Patch]
IntelSiliconPkg/ShadowMicrocodePei: Fi= x GCC build
error.

Mike:
I find this issue on GCC5 tool chain tag with GCC
5.5
and CLANGPDB tool chain tag with CLA= NG 9.0.0

Thanks
Liming
-----Original Message-----
From: devel@ed= k2.groups.io <dev= el@edk2.groups.io>
On
Behalf Of Michael D Kinney
Sent: Thursday, February 27, 2020 1:54 PM
To: Gao, Liming <liming.gao@intel.com>;
devel@edk2.groups.io; Fu, Siyuan
<siyuan.fu@intel.com>;
Kinney, Michael = D
<michael.d.kinney@intel.com>Cc: Ni, Ray <ray.ni@intel.com>; Chaganty, Rangasai
V
<rangasai.v.chaganty@intel.com>
Subject: Re: [edk2-devel] [Patc= h]
IntelSiliconPkg/ShadowMicrocodePei: Fix GCC b= uild
error.

Which GCC and CLANG tool chain tags?

Flexible array member is a standard C feature
documen= ted in C99.

Mike

=
-----Original Message-----
From: Gao, Liming <liming.gao@intel.com>
Sent: Wednesday, February 26, 2= 020 9:38 PM
To: Kinney, Michael D
=
<michael.d.kinney@intel.com>;
=
<= blockquote type=3D"cite" class=3D"">
devel@edk2.groups.io; = Fu, Siyuan
<siyuan.fu@intel.com>
Cc: = Ni, Ray <ray.ni@intel.com= >; Chaganty, Rangasai
V
<ra= ngasai.v.chaganty@intel.com>
Subject: RE: [edk2-devel]= [Patch]
IntelSiliconPkg/ShadowMicrocodePei: Fix GCC builderror.

Mike:
I find = GCC and CLANG will report the error for
the
empty struct.

d:\allpkg\= edk2-


platforms\Silicon\Intel\IntelSiliconPkg\Include\= Guid/Mi
crocodeShadowInfoHob.h:61:11: error: flexible
array
member 'MicrocodeAddressInFlash' not allowed in
otherw= ise empty struct
UINT64  MicrocodeAddressInFlash[];
        ^
1= error generated.

Thanks
Liming<= br class=3D"">
-----Original Message---= --
From: Kinney, Michael D
<michael.d.kinney@intel.com>
Sent: Thursday, February 27, 2020 1:25 PM
To= : devel@edk2.groups.io; Fu, Siyuan
<siyuan.fu@intel.com>; Kinney, Michael D
<michael= .d.kinney@intel.com>
Cc: Ni, Ray <ray.n= i@intel.com>; Chaganty,
Rangasai V
<rangasai.v.chaganty@intel.com>; Gao, Liming<liming.g= ao@intel.com>
Sub= ject: RE: [edk2-devel] [Patch]
IntelSiliconPkg/S= hadowMicrocodePei: Fix GCC build
error.

What compiler does not like th= e flexible array
member syntax [].

Mike

-= ----Original Message-----
From: devel@edk2.groups.io
<= /blockquote>
<devel@edk2.groups.io>
On
Behalf Of Siyuan, Fu
Sent: Wednesday, February 26, 2020 5:58= PM
To: de= vel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>; Chaganty,
=
Rangasai
=
V=
<rangasai.v.chaganty@intel.com>; Gao, Liming
<liming.gao@intel.com>= ;
Subject: [edk2-devel] [Patch]
IntelSiliconPkg= /ShadowMicrocodePei: Fix GCC
build
error.

T= his patch fixes compiler error introduced by
commit
b0099a39bd.

BZ:<= br class=3D"">


https:/= /tianocore.acgmultimedia.com/show_bug.cgi?id=3D244
9
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rangasai V Cha= ganty
<rangasai.v.chaganty@intel= .com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Siyuan Fu <siyuan.fu@intel.com>
-= --

.../Feature/ShadowMicrocode/ShadowMicrocodePei.c
| 2 += -



.../Intel/IntelSiliconPkg/Include/Guid/MicrocodeShadowI
<= blockquote type=3D"cite" class=3D"">
nfoH= ob.h | 2 +-
2 files changed, 2 insertions(+), 2
deletions(-)

diff --git

=


a/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode=
/ShadowMicrocodePei.c



b/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocod= e
/ShadowMicrocodePei.c
index 7e4084247e..8d6574f6= 67 100644
---



a/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode
/ShadowMicrocodePei.c
+++



b/Silicon/Intel/IntelSiliconPkg/Feature/S= hadowMicrocode
/ShadowMicrocodePei.c
@@ -247,7 +24= 7,7 @@ ShadowMicrocodePatchWorker
<= /blockquote>
(
     (VOID = *) Patches[Index].Address,
     Patc= hes[Index].Size
     );
-    MicrocodeAddressInMemory[Index] =3D (UINT64)
Walker;
+    M= icrocodeAddressInMemory[Index] =3D (UINT64)
(UINTN)
Walker;
   Flash= context-
MicrocodeAddr= essInFlash[Index]
=3D
(UINT64) Patches[Index].Address;
   = ;Walker +=3D Patches[Index].Size;
 }
diff = --git



a/Silic= on/Intel/IntelSiliconPkg/Include/Guid/MicrocodeS
hadowInfoHob.h<= br class=3D"">


b/Silicon/Int= el/IntelSiliconPkg/Include/Guid/MicrocodeS
hadowInfoHob.hindex d887b39123..1daae1234a 100644
---



a/Silicon/Intel/Inte= lSiliconPkg/Include/Guid/MicrocodeS
hadowInfoHob.h
+++


=

b/Silico= n/Intel/IntelSiliconPkg/Include/Guid/MicrocodeS
hadowInfoHob.h@@ -58,7 +58,7 @@ typedef struct {
 // micr= ocode patch address on flash. The
<= /blockquote>
address
is
placed in sam= e
 // order as the microcode patches in
Mi= crocodeAddrInMemory.
 //
-  UINT64 &n= bsp;MicrocodeAddressInFlash[];
+  UINT64  Microcode= AddressInFlash[0];
} EFI_MICROCODE_STORAGE_TYPE_FLASH_CONTEXT= ;

#endif
--
2.19.1= .windows.1












--Apple-Mail=_7093CCA7-7010-4748-B0FF-26FABB672A07--