public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kuo, Ted" <ted.kuo@intel.com>
To: devel@edk2.groups.io
Cc: Ray Ni <ray.ni@intel.com>, Debkumar De <debkumar.de@intel.com>,
	Harry Han <harry.han@intel.com>,
	Catharine West <catharine.west@intel.com>,
	Min Xu <min.m.xu@intel.com>
Subject: [edk2-devel][PATCH] UefiCpuPkg: Update BFV searching algorithm in VTF0
Date: Thu, 17 Mar 2022 16:38:32 +0800	[thread overview]
Message-ID: <65c13f6c870c05511506205f0ac02dd61a3afedf.1647497354.git.ted.kuo@intel.com> (raw)

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3870
The new algorithm searches FFS3 GUID first and then FFS2 GUID at
every 4KB address in the top 16MB just below 4GB.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Debkumar De <debkumar.de@intel.com>
Cc: Harry Han <harry.han@intel.com>
Cc: Catharine West <catharine.west@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
---
 .../Vtf0/Bin/IA32/ResetVector.ia32.port80.raw       | Bin 548 -> 532 bytes
 .../ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw  | Bin 516 -> 500 bytes
 .../Vtf0/Bin/IA32/ResetVector.ia32.serial.raw       | Bin 932 -> 900 bytes
 .../Bin/X64/PageTable1G/ResetVector.x64.port80.raw  | Bin 12292 -> 12292 bytes
 .../Vtf0/Bin/X64/PageTable1G/ResetVector.x64.raw    | Bin 12292 -> 12292 bytes
 .../Bin/X64/PageTable1G/ResetVector.x64.serial.raw  | Bin 12292 -> 12292 bytes
 .../Bin/X64/PageTable2M/ResetVector.x64.port80.raw  | Bin 28676 -> 28676 bytes
 .../Vtf0/Bin/X64/PageTable2M/ResetVector.x64.raw    | Bin 28676 -> 28676 bytes
 .../Bin/X64/PageTable2M/ResetVector.x64.serial.raw  | Bin 28676 -> 28676 bytes
 .../ResetVector/Vtf0/Ia32/SearchForBfvBase.asm      |  19 +++++--------------
 10 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.port80.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.port80.raw
index 23254e83bf1a17dee9f38c235fcc9948624a7536..a3601274c25dde665872ff375f1deadf1c838476 100644
GIT binary patch
delta 190
zcmZ3&GKHmn0uUG;&}9%{V6bIiVEA7Y*;pY^b)Yz;RJO4~<h1Q6-%^pr3W>e>a??t=
z8!KcwpPS4oWqPdwR8{e`r>FENP?c?$jDP7KpsJasor$HJfvQ>$>s~Hh)m)*%P`ae^
zFmr@L>D<@68#X*^*s&i7I*-2o*Lifq#%B#L8KWjnif8;k@l&;M&40Z#en#=M9m)(0
p4*W_7(q6?+ZeUbk^qjnqQF!tuMib78|1Z`5{r~@R;pF#>rU2NrRB!+Q

delta 211
zcmbQjvV^660uUG;*vZVmz@W<@z`$S&Wc)9RYyQbxs@7N`P<5a<r1V*1g~(~!Q@*8l
z8!IIC=F3ehz0z1A)A`(FR_W>2DnL~gPkVYw4**r!cFFjcZU?HGY1)}sx(=wS^|0>c
z(xuH6Dh#FbI}bBQD3s24Eoykcv-u}uY2Sto!p|CZ><5C*qp$yU9^J6<S;NbSi4F0L
ze<wbu7OwlRm&VU1p0-1ofx&@a=|I}6#L0P#3LNee<QXRX|NnpT3`RT7s{b#=|NZ~}
Ka`EK*jHUp(F<`s^

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.raw
index 18562d8f1f58601f66fcb0cbf2f994046ce48fde..6124f3f9a40e4e58cc672b54cbf5cc33360b3858 100644
GIT binary patch
delta 192
zcmZo+`NCX30SF8a=rRZ}FxWCMF#IoyY^)HdI#3)^D%)5ga@zKkZ>dOQg~Z-`xoM@`
zjTJJT&rN2PGQCy-s;YR}(^GmBsLHlW#=mqAP}NM+&cxEqKvk`WbuX8$YOYXWC|%Nd
zm^nhBbna`;9s7Zx^XTh;okw3fGBPk2-tN3Nabf`DyNQp=g<JmXrSUV0r|nQ?U~u49
rI*|4%dvXq=441<Md4>u9|NoybVe$k<Gmg%e9{>LTf4OV&IYu)8Aly`5

delta 202
zcmeyu+`>{n0SF8a>||zOV9;d{U|_HXGX59EHUDHTRcoves5(#_Qu?g1LgcjVDc{n&
zjTI7m^W~<MUTLh5>3nW7tMv416`-n$r#(HT2Y{+<yJY-Jw*ytpH0?|*T?bUvdRX^z
z>C)y36^7FJorjqt6iR2j7BoEI+5D5Sv~S0L?*04scOHHHuk+|j`-v6djBh4hC>L(~
zub0NpD4w=MnSsH9U+F;FtK7*^j4~W{6XY2t{Qv)das#6oNB2vMfB*l#+%tI}qZt4b
C>RJ*2

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.serial.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/IA32/ResetVector.ia32.serial.raw
index e4aa4fc30a32bc3d4d8d0e1726c43fdafef4a374..48b46e3473e77a1179bf818a1f1deafb7e46cf3e 100644
GIT binary patch
delta 206
zcmZ3&-oidXwqBLl@PICZ00V<90|UeVqR7SyfvN+=A*Hg76(Xl?Px+RLG*(FL&6k^2
z%H3EY)A`(FRw>hK6`-n$r#(HTM}ewryJY-J_W)JRH0?|*-3(OKdRX^z>8j=m6^7C!
zorjqt6iVm5_DtLLm-)>Kg_7@SyM8clNO}k1Ph3~VXf;`t@fKssB&PMkUH|pc_!-61
zb|^D2IPfbSNPA^C`4CeKhus8uh6(@w|DSBatS4~b&ugaF-(Cv;e|i4T|Nk!!PA+0L
F0svn-S`YvL

delta 228
zcmZo+U&1~?w%(Q5@W4)H1_lOQ1_1^JTOi|qQC#y+=2ErB3W2Hv#UZ878Y@Ij+n(|*
zz1vtJu{U3CTIrR>3YpI5CbLRUzg7XNs(9MdQ+fcX%C<|!zjQlL)lAdQ#L{&@Rjr40
zFPAQDu25kpo!@zwIYOay#_K@C1D?%48B6=pcKv0ZcvWh02cy!&V?K-?lZ6>?F&0gJ
z$GBd&=D%JVKcjfs4rK-g2Y#gkX|I$gZ(xcM^O+#eFya6I{}WKaWD#aPfdzkFGrj)y
TlJ)<~^?&~Vf4O;b5VH{gPc~z_

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.port80.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.port80.raw
index 51ad3ecde0e4e02e91ed299ec207e9f7460524b3..def0ec856d0d14b4ea11b0a33db1512077eae00f 100644
GIT binary patch
delta 296
zcmZokXi3<>rckfTAi%(2%fP_!zbLY?LZIqEaY(6bV};0R+f%-!B8?Rid-LU{m2x*$
z$aFq8nN`a4S_P=8;%QG$=~196+b$XZ(mg;`Gfg`aOE&{mwI0^JT)L{cLWQApN#|ka
z2!+zQuX#6Yc-F9EKM-^tef_WV=!T8Y8eUFfWMDA7J$br96r=g%PYP4a%Rc`9FTt=O
z1t>QM=$;)67ykd}SGw`~=mxQ84Zn6XeCWHq`@~1RG=4_$v>nO}3=aHC2hv`xnY>p~
zfzw5u;Q~<mgb9<MC|at&to{G;{onupUuOOT5{Cc(|K9<`|2-6sc_<$BP(0$%`QZPv
i2@^I7Zs1jTDfMXr2mozl2n%szm@wfbGeiU|JOKccERnVV

delta 270
zcmZokXi3<>rcl3=nSp^pmqCDm!4}B)UliB;letu_u|lBgKygUvv&IUM)3&F4OYb&T
zNbJp*n^t<Iu|lTvxyh{3)2~&4sw$rL^pqX|s<Q2p@h{yDR5jDIGqH3XP*v+;-OHs*
zn=4cpO6PYTW{yxOo$*@K@PKFYPsY-|4I7>{?AX75Kkxp|qp$yU9^J6<S;Ncz$qfqe
zj3$#GC`{q$`1t?71jB|DpzzGe4T=)Nw?68n@iU62?NDZ5aNt)ukoIcd<kgA_?2hUT
z4}fYXUs1H=d)@Hz!QcP?U*`M+5+;*nlq47@Y!qC;tMF3m(*zIzdXXV4#EoIXgqOk)
I5wP$C0A)jcr~m)}

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.raw
index eec88b1c9cbd2f87951762b6db2be79c8dd73656..cd6559018826fa74d39def72a3d578628d2891f7 100644
GIT binary patch
delta 290
zcmZokXi3<>rckfTAi%(2%fP_!zbLY?LZIqEaY(6bV};0R+f%-!B8?Rid-LU{m2x*$
z$aFq8nN`a4S_P=8;%QG$=~196+b$XZ(mg;`Gfg`aOE&{mwI0^JT)L{cLWQApN#|ka
z2!+zQuQ_+@2ZGL{um5!(ec8pxz+ia0^IqqRwC-4g$<r0Q7|ka?QkW8w_VNFJ35J&o
zfNt5raN+-dex)0)PyX7?@S*Sa?lm9v()bz0({?B`FgWll9Y}jM1*lqpVTS`70|UR(
zgR~tS41G8H4)i_fd(n5{b$~j<0igVZ36oDKy75*1fBFCK|Nk!w{{acZ%`!?Scqb|d
cD7@tQGyw#F_A!KoxG_wa@bdFVun2?z0M4|C{r~^~

delta 291
zcmZokXi3<>rcl3=nSp^pmqCDm!4}B)UliB;letu_u|lBgKygUvv&IUM)3&F4OYb&T
zNbJp*n^t<Iu|lTvxyh{3)2~&4sw$rL^pqX|s<Q2p@h{yDR5jDIGqH3XP*v+;-OHs*
zn=4cpO6PYTW{yxOo$*@G@PKFYPsY-|9s7Zx^XO~Vf1O8Pc1*5N2xl~%d_iGKP{qgp
z|0Nh+&I3AT2g8N`|M`_}ygvDBH^Ya%+q?ID)Jx-M6i?fs%)sEluXG^o)iR)J0frq8
zYzz$iN)OU@a4_`U=sVE&pzlTBh1Y)S3>Sd%lXob(@m2qS`Tp<!|1XRG0SV*HJW3~c
c6<$hxng9Yos~EyU+!!WIc*zVA0Siw606emaaR2}S

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.serial.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable1G/ResetVector.x64.serial.raw
index de97b858ddd03171114aa0efb1929796b1aa5435..c1cf994c46df4138ef92193eb1dbca86137e7d69 100644
GIT binary patch
delta 263
zcmZokXi3;0t5Cm|+3<iag8&1AEdv9?|Dwpo3W2Hv#UZ7#jTIuNZBO}@iZoV8?9G>(
zR?6L2A=CNXWL7EDYZaiXil;q2rAL9PY`bLqOZNa(%{1*yEZq!L)p}U>a_Oq(3KfRZ
zC7p+vBNR&KzV=Mp^_Th03WbvIX}f+fZ%BFv;ZI(tP{w#@vZ~@O#y69crZBclo~q==
zC_4F$l8<oHXT3CjM)9;A$_xw+{7MJXUTICXR*vEHRcDy+`Tze36DH47wh^`X^P1`P
zx0fvcU%LPK|No`sUm#Jl`MvU2?uiNl3NLSco&W+s&oP9BxG_wa@bWN31S~uO06Ri=
A3jhEB

delta 267
zcmZokXi3;0t5Cm}+3>(lW(EcZT?PRL23sKGe^FfXPv%m!#tMO|1H~bw&l)R4PTQXH
zExp@VA+a}KZd&P;#tNCv=O(jCPrp_Hs;YR}(^Gl?sLHlW#=mqsP}NM+&cxDnKvk`W
zbuX7LZLUyZD4pMVm^nhBbjIsI!vmhpKN(B=(suo2o_tk7YI297(&S?bK8yz@3oG7Y
zd^P!<;uOYdlbe;?7=<UFQt}a=@>ws9pHVz*hcW|$1HaONv{yEhHI-x7z10~OeE$D`
za-Xt|sK%eyOs~JaWc&Zp{LlaYFRlLqiMq}AmA`T;ynOX}0tf*8#t;_b#xP;R%gYcE
Hu<!%`g?M+R

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.port80.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.port80.raw
index 23c58501b5a48448ffcd2757310442ef33f45fa0..0e981675cc80f2b08e144c16db44d7b48980c608 100644
GIT binary patch
delta 298
zcmZp9z}WJDaRXaIy)J_Q1A{FC1H=EK$i@nRssqI#rLv6`BByOn`Id?_R!Hp4mz!3~
z-B=;h`P^hyDbs5epsI?eJw2sIfvRk~Wc*9_09DO2?My7)3{=&6Sod=2s^$t6hSDXS
zhnXW3O6R`j-LT<V!;bwx(0TOrzs{o@Ha=^3If;>h!SMFv=?PJc=951qOffI}`2W8I
z!-f=~+#H~Lb}&r%|DRv!#_OXS#GW<$+RgBx@AmE!ANA7s8O76fC^IlP@GBiid$nfr
z-b4jX7j=dUK<yJIOn#DRss6I||I7D(|NnoP`431K{{R1f2N3`FP(0?Lc+^Ajh)3sx
k|Ia2&*eJMxSK+19rwJecw2>h!#EoIXgqO?^5wP$C0AK}^xBvhE

delta 272
zcmZp9z}WJDaRXaI{Z3{E1_oUQ0R{$JAme{gT=P%nQnkhkfvN+=A*Ih6D@0D)p7Jfd
z+gKs7H(zdA>6OL`na<}Xvr13DRspK2c-qrbdH|@(woAspbURShOw-Q9(se*pt%r3l
zmo9CtP+=&Y-+7ohLZNiVYf-}kp3OfQOZzr#c-F9E|Ni~F`#X=m{?~bQ!^UR~FZ(Aq
zB*ZhCOn#6sg{R}=|NjyU8&ZJ6GbcABN(kTjsF%jiD4w=MnSsH9U+F;Ft9_GKCn~Tz
zsxv$Qs-1i#(UR|V!^;PM|NnoP^AAXvOqNNKV4Sc~Z~?EvORY~6Kmh1PhOiJfh6xj1
K3PVJ|!V>^C=zwYf

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.raw
index 3438dabefee950826a0541e9549f48311f194d43..b9f09dd46f2a8bfec0f0392235ae63ae50847388 100644
GIT binary patch
delta 292
zcmZp9z}WJDaRXaIy)J_Q1A{FC1H=EK$i@nRssqI#rLv6`BByOn`Id?_R!Hp4mz!3~
z-B=;h`P^hyDbs5epsI?eJw2sIfvRk~Wc*9_09DO2?My7)3{=&6Sod=2s^$t6hSDXS
zhnXW3O6R`j+_4`BI*-2o*Ln117b63M;qA_QoiEb5V+|%xPw-+ipZq9cN=Vwr|NkWz
zUM>K-We3BA|Nr@wZoEGEYd6D(zT3OkeAG+hXB1D{q0GSGz^`;5?bQ^ZY5|5F4r~kz
z{7Mhfc5pEC-RL{e_n_}Z--Xu!>I?^f@)IUZK9T6gSNZ?t|G)qLzbyO*Bn&spB%R=$
es34&5lIzn15CGc85EkObFk!;W&mX}e5CQ;x!HWO@

delta 293
zcmZp9z}WJDaRXaI{Z3{E1_oUQ0R{$JAme{gT=P%nQnkhkfvN+=A*Ih6D@0D)p7Jfd
z+gKs7H(zdA>6OL`na<}Xvr13DRspK2c-qrbdH|@(woAspbURShOw-Q9(se*pt%r3l
zmo9CtP+=&Y-+7ohLZNiVYeB;Up3OfQOZ#^02ZGL{uUY?f9(~y{xgsH)(RA{KgegH4
zAOHWCV0bwX=$IW06aN3_SGw`~<geWfANp?Z-uF>2jh|6GZHF=gg9E?PfwWi4fT{%;
zb~vyxFz_oqNZY}|(08NnK;MJD7kw9A`>8Wr0Lo9^k?6)({r~0rzyJTgEdB>1j5qTn
eo#0h?DfMXr2mq~O2n%szm@wfbGeiU|JOKdfGK_No

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.serial.raw b/UefiCpuPkg/ResetVector/Vtf0/Bin/X64/PageTable2M/ResetVector.x64.serial.raw
index 5ee3012482de343cfae8af590a49170c5b7f1d65..a76f8ad124eea6069c797b4450acbc8fba20e23e 100644
GIT binary patch
delta 265
zcmZp9z}WJDaf56^{aR+j1G)?X3=Fmm3=IE^A{#3Nsty!~l*%?%h@7@P<y$J!SRt`D
zUv63{cVmT2=W~-;rA)6?fT}8<_Vkn<1*)>`lJPIy15`EBv@@}EGf-9QVcpB6tC}lR
z7)qCP9%hbED4qM-Gi}#j<~J)8O1`J<`oX**=^cbWd0j#o<Dto_iMJTvOiG%<*fM!)
zk{hGw<U2_|!cCv`()bz0({?B`FgWll9Y}knHQ72jhSOJ_VZ!JC|0hhCJTKWs)Z));
zrq|zIviyJP{^$SymzIBlM9t>+$zQoADhMdNy!Ckk2mn3D5EkObFk!;W!w?a$@B{!u
C*?LU?

delta 269
zcmZp9z}WJDaf56^{a$9n13Q@+7#MUJ1Q-}>fsFq}am_!OOVt`H1gZ`chm<~RtPnYE
zd&;-;ZexYS-h8=frB@m&WICUl%ql(oS_P=8;%QG$=>ecB+b$XZ((OQ1Gfg`aOV<Ha
zwI0^JT)MQmLWQApe&=E42!+xauLBJacsBoJEbU9%^_O|_)dZ=@9f?Ylk0tmp9+)hg
zc#HAX<adcv7^h8cPI6-uo_s3FM|jF-y)=GC@w6Sv3=9tZN(a(j*-X|<j$!v!XISw0
z|NqH-$u^=Ie_k`a{`QjX|4Z{f|Np<V{tG1PHs4SF%B}G7)#nKy0Q4I}Scn_Lgb6P%
JLqx#B69CGWduIRu

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia32/SearchForBfvBase.asm b/UefiCpuPkg/ResetVector/Vtf0/Ia32/SearchForBfvBase.asm
index 786239325d..64a830521e 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/Ia32/SearchForBfvBase.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/Ia32/SearchForBfvBase.asm
@@ -32,7 +32,6 @@ BITS    32
 Flat32SearchForBfvBase:
 
     xor     eax, eax
-    mov     ecx, 3    ; 3: FFS3 GUID, 2: FFS2 GUID, 1: Not Found
 searchingForBfvHeaderLoop:
     ;
     ; We check for a firmware volume at every 4KB address in the top 16MB
@@ -40,21 +39,19 @@ searchingForBfvHeaderLoop:
     ;
     sub     eax, 0x1000
     cmp     eax, 0xff000000
-    jb      searchingForBfvWithOtherFfsGuid
-    cmp     ecx, 3
-    jne     searchingForFfs2Guid
+    jb      searchedForBfvHeaderButNotFound
 
     ;
     ; Check FFS3 GUID
     ;
     cmp     dword [eax + 0x10], FFS3_GUID_DWORD0
-    jne     searchingForBfvHeaderLoop
+    jne     searchingForFfs2Guid
     cmp     dword [eax + 0x14], FFS3_GUID_DWORD1
-    jne     searchingForBfvHeaderLoop
+    jne     searchingForFfs2Guid
     cmp     dword [eax + 0x18], FFS3_GUID_DWORD2
-    jne     searchingForBfvHeaderLoop
+    jne     searchingForFfs2Guid
     cmp     dword [eax + 0x1c], FFS3_GUID_DWORD3
-    jne     searchingForBfvHeaderLoop
+    jne     searchingForFfs2Guid
     jmp     checkingFvLength
 
 searchingForFfs2Guid:
@@ -82,12 +79,6 @@ checkingFvLength:
 
     jmp     searchedForBfvHeaderAndItWasFound
 
-searchingForBfvWithOtherFfsGuid:
-    xor     eax, eax
-    dec     ecx
-    cmp     ecx, 1
-    jne     searchingForBfvHeaderLoop
-
 searchedForBfvHeaderButNotFound:
     ;
     ; Hang if the SEC entry point was not found
-- 
2.16.2.windows.1


             reply	other threads:[~2022-03-17  8:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17  8:38 Kuo, Ted [this message]
2022-03-17  9:11 ` [edk2-devel][PATCH] UefiCpuPkg: Update BFV searching algorithm in VTF0 Min Xu
2022-03-24  6:43 ` Ni, Ray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=65c13f6c870c05511506205f0ac02dd61a3afedf.1647497354.git.ted.kuo@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox