Re: [edk2-devel] [PATCH v2] IntelFsp2Pkg: PatchFv parseInfFile function modification

2021-07-05 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

> -Original Message-
> From: S, Ashraf Ali 
> Sent: Monday, July 5, 2021 4:11 PM
> To: devel@edk2.groups.io
> Cc: S, Ashraf Ali ; Ni, Ray ; Chiu,
> Chasel ; Desimone, Nathaniel L
> ; Zeng, Star 
> Subject: [PATCH v2] IntelFsp2Pkg: PatchFv parseInfFile function modification
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3476
> 
> parseInfFile currently reading the EFI_BASE_ADDRESS from INF, once the
> address found still it's continues to read the complete inf file which is not
> required. once the EFI_BASE_ADDRESS read from the INF no need to read the
> INF further.
> MSFT compiler can generate the map file address 8 or 16 based on which
> architecture the INF is compiler. currently it's support for IA32, modified 
> the
> patchfv to support for all.
> modification of few typo errors in parseModMapFile, getCurr function required
> 
> Signed-off-by: Ashraf Ali S 
> Cc: Ray Ni 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Star Zeng 
> ---
>  IntelFsp2Pkg/Tools/PatchFv.py | 18 +-
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
> index 112de4077a..64b4e927a0 100644
> --- a/IntelFsp2Pkg/Tools/PatchFv.py
> +++ b/IntelFsp2Pkg/Tools/PatchFv.py
> @@ -1,6 +1,6 @@
>  ## @ PatchFv.py
>  #
> -# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
> +# Copyright (c) 2014 - 2021, Intel Corporation. All rights
> +reserved.
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  #  ## @@ -304,10 +304,11 @@
> class Symbols:
>  match = re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", 
> rptLine)
>  if match is not None:
>  self.fdBase = int(match.group(1), 16) - fvOffset
> +break
>  rptLine  = fdIn.readline()
>  fdIn.close()
>  if self.fdBase == 0x:
> -raise Exception("Could not find EFI_BASE_ADDRESS in INF file!" % 
> fvFile)
> +raise Exception("Could not find EFI_BASE_ADDRESS in INF
> + file!" % infFile)
>  return 0
> 
>  #
> @@ -402,6 +403,7 @@ class Symbols:
>  #
>  #  retval  0   Parsed MOD MAP file successfully
>  #  retval  1   There is no moduleEntryPoint in modSymbols
> +#  retval  2   There is no offset for moduleEntryPoint in 
> modSymbols
>  #
>  def parseModMapFile(self, moduleName, mapFile):
>  #
> @@ -426,7 +428,7 @@ class Symbols:
>  else:
>  #MSFT
>  #0003:0190   _gComBase  7a50 
> SerialPo
> -patchMapFileMatchString =  "^\s[0-9a-fA-F]{4}:[0-9a-fA-
> F]{8}\s+(\w+)\s+([0-9a-fA-F]{8}\s+)"
> +patchMapFileMatchString =  "^\s[0-9a-fA-F]{4}:[0-9a-fA-
> F]{8}\s+(\w+)\s+([0-9a-fA-F]{8,16}\s+)"
>  matchKeyGroupIndex = 1
>  matchSymbolGroupIndex  = 2
>  prefix = ''
> @@ -455,7 +457,13 @@ class Symbols:
>  continue
> 
>  if not moduleEntryPoint in modSymbols:
> -return 1
> +if matchSymbolGroupIndex == 1:
> +if not '_ModuleEntryPoint' in modSymbols:
> +return 1
> +else:
> +moduleEntryPoint = "_ModuleEntryPoint"
> +else:
> +return 1
> 
>  modEntry = '%s:%s' % (moduleName,moduleEntryPoint)
>  if not modEntry in self.dictSymbolAddress:
> @@ -498,7 +506,7 @@ class Symbols:
>  #
>  #  Get current character
>  #
> -#  retval  elf.string[self.index]
> +#  retval  self.string[self.index]
>  #  retval  ''   Exception
>  #
>  def getCurr(self):
> --
> 2.30.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77498): https://edk2.groups.io/g/devel/message/77498
Mute This Topic: https://groups.io/mt/83993064/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] 回复: [PATCH v2 2/2] MdeModulePkg: Update YAML file to fix CI error

2021-07-05 Thread gaoliming
Reviewed-by: Liming Gao 

> -邮件原件-
> 发件人: Nickle Wang 
> 发送时间: 2021年7月5日 10:41
> 收件人: devel@edk2.groups.io
> 抄送: gaolim...@byosoft.com.cn; jian.j.w...@intel.com;
> hao.a...@intel.com; Nickle Wang 
> 主题: [PATCH v2 2/2] MdeModulePkg: Update YAML file to fix CI error
> 
> Add OnigurumaUefiPort.h and OnigurumaUefiPort.c into ECC exception in
> MdeModulePkg.ci.yaml in order to fix CI error.
> 
> Signed-off-by: Nickle Wang 
> ---
>  MdeModulePkg/MdeModulePkg.ci.yaml | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/MdeModulePkg.ci.yaml
> b/MdeModulePkg/MdeModulePkg.ci.yaml
> index 4c71468bd3..8e01caf94c 100644
> --- a/MdeModulePkg/MdeModulePkg.ci.yaml
> +++ b/MdeModulePkg/MdeModulePkg.ci.yaml
> @@ -3,6 +3,7 @@
>  #
> 
>  # Copyright (c) Microsoft Corporation
> 
>  # Copyright (c) 2020, Intel Corporation. All rights reserved.
> 
> +# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> 
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  ##
> 
>  {
> 
> @@ -24,7 +25,9 @@
>  "Library/BrotliCustomDecompressLib/brotli",
> 
>  "Universal/RegularExpressionDxe/oniguruma",
> 
>  "Library/LzmaCustomDecompressLib/Sdk/DOC",
> 
> -"Library/LzmaCustomDecompressLib/Sdk/C"
> 
> +"Library/LzmaCustomDecompressLib/Sdk/C",
> 
> +"Universal/RegularExpressionDxe/OnigurumaUefiPort.h",
> 
> +"Universal/RegularExpressionDxe/OnigurumaUefiPort.c"
> 
>  ]
> 
>  },
> 
>  ## options defined ci/Plugin/CompilerPlugin
> 
> --
> 2.31.1.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77497): https://edk2.groups.io/g/devel/message/77497
Mute This Topic: https://groups.io/mt/84013589/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] Cancelled Event: TianoCore Bug Triage - APAC / NAMO - Tuesday, July 6, 2021 #cal-cancelled

2021-07-05 Thread devel@edk2.groups.io Calendar
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Groups.io Inc//Groups.io Calendar//EN
METHOD:CANCELLED
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:America/Los_Angeles
LAST-MODIFIED:20201011T015911Z
TZURL:http://tzurl.org/zoneinfo-outlook/America/Los_Angeles
X-LIC-LOCATION:America/Los_Angeles
BEGIN:DAYLIGHT
TZNAME:PDT
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
DTSTART:19700308T02
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZNAME:PST
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
DTSTART:19701101T02
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
X-GIOIDS:Event:1057085 
UID:mlda.1580078539586725120.r...@groups.io
DTSTAMP:20210706T033548Z
ORGANIZER;CN=Liming Gao:mailto:gaolim...@byosoft.com.cn
DTSTART:20210707T013000Z
DTEND:20210707T023000Z
SUMMARY:TianoCore Bug Triage - APAC / NAMO
DESCRIPTION:TianoCore Bug Triage - APAC / NAMO\n\nHosted by Liming Gao\n\
 n
 \n\nMicrosoft Teams meeting\n\n*Join on your computer or mobile a
 pp*\n\nClick here to join the meeting ( https://teams.microsoft.com/l/mee
 tup-join/19%3ameeting_OTUyZTg2NjgtNDhlNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh%40
 thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255
 d%22%2c%22Oid%22%3a%22b286b53a-1218-4db3-bfc9-3d4c5aa7669e%22%7d )\n\n*Jo
 in with a video conferencing device*\n\nte...@conf.intel.com\n\nVideo Con
 ference ID: 116 062 094 0\n\nAlternate VTC dialing instructions ( https:/
 /conf.intel.com/teams/?conf=1160620940=teams=conf.intel.com=te
 st_call )\n\n*Or call in (audio only)*\n\n+1 916-245-6934\,\,77463821# ( 
 tel:+19162456934\,\,77463821# ) United States\, Sacramento\n\nPhone Confe
 rence ID: 774 638 21#\n\nFind a local number ( https://dialin.teams.micro
 soft.com/d195d438-2daa-420e-b9ea-da26f9d1d6d5?id=77463821 ) | Reset PIN (
  https://mysettings.lync.com/pstnconferencing )\n\nLearn More ( https://a
 ka.ms/JoinTeamsMeeting ) | Meeting options ( https://teams.microsoft.com/
 meetingOptions/?organizerId=b286b53a-1218-4db3-bfc9-3d4c5aa7669e
 =46c98d88-e344-4ed4-8496-4ed7712e255d=19_meeting_OTUyZTg2NjgtNDh
 lNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh@thread.v2=0=en-US )
LOCATION:https://teams.microsoft.com/l/meetup-join/19%3ameeting_OTUyZTg2N
 jgtNDhlNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh%40thread.v2/0?context=%7b%22Tid%2
 2%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%22b286b53a-
 1218-4db3-bfc9-3d4c5aa7669e%22%7d
SEQUENCE:999
STATUS:CANCELLED
END:VEVENT
END:VCALENDAR


invite.ics
Description: application/ics


回复: [edk2-devel] Event: TianoCore Bug Triage - APAC / NAMO - 07/06/2021 #cal-reminder

2021-07-05 Thread gaoliming
Few new issues are submitted this week. Let’s cancel the meeting. 

 


  3465

EDK2

Tools

unassig...@tianocore.org

UNCO

Build tools cannot parse #if FixedPcdGetBool , used in header file of Structure 
PCD  

Mon 08:23

madhusudhan.nimb...@gmail.com


  3473

EDK2

Code

ray...@intel.com  

UNCO

UefiCpuPkg VTF0 X64: Build page tables using Linear-Address Translation to a 
1-GByte Page  

Sun 07:28

ashraf.al...@intel.com


  2424

Tianocor

Code

yonghong@intel.com  

UNCO

TLSv1.3 support  

2021-06-29

prarthan...@amiindia.co.in


  3466

Tianocor

Code

unassig...@tianocore.org

UNCO

CryptoPkg: consume OpenSSL 3.0 
 

2021-06-29

ler...@redhat.com


  3446

Tianocor

Code

unassig...@tianocore.org

UNCO

TianoCore missing support for Specification 2.8 Items 
 

2021-06-23

kevin.da...@insyde.com

 

Thanks

Liming

 

发件人: devel@edk2.groups.io  代表 devel@edk2.groups.io 
Calendar
发送时间: 2021年7月6日 9:30
收件人: devel@edk2.groups.io
主题: [edk2-devel] Event: TianoCore Bug Triage - APAC / NAMO - 07/06/2021 
#cal-reminder

 

Reminder: TianoCore Bug Triage - APAC / NAMO 

When:
07/06/2021
6:30pm to 7:30pm
(UTC-07:00) America/Los Angeles 

Where:
https://teams.microsoft.com/l/meetup-join/19%3ameeting_OTUyZTg2NjgtNDhlNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%22b286b53a-1218-4db3-bfc9-3d4c5aa7669e%22%7d
 

Organizer: Liming Gao gaolim...@byosoft.com.cn 


View Event  

Description:

TianoCore Bug Triage - APAC / NAMO

Hosted by Liming Gao

 


 

Microsoft Teams meeting 

Join on your computer or mobile app 

 

 Click here to join the meeting 

Join with a video conferencing device 

te...@conf.intel.com 

Video Conference ID: 116 062 094 0 

 

 Alternate VTC dialing instructions 

Or call in (audio only) 

  +1 916-245-6934,,77463821#   United States, 
Sacramento 

Phone Conference ID: 774 638 21# 

 

 Find a local number |   Reset 
PIN 

  Learn More |  

 Meeting options 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77495): https://edk2.groups.io/g/devel/message/77495
Mute This Topic: https://groups.io/mt/84013441/21656
Mute #cal-reminder:https://edk2.groups.io/g/devel/mutehashtag/cal-reminder
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] UefiCpuPkg/ExceptionLib: Conditionally clear shadow stack token busy bit

2021-07-05 Thread Sheng Wei
Hi Eric,
Thank you for the review and give review by.
Could you help to submit the patch to the edk2 branch?
I just attached the patch file.
BR
Sheng Wei


> -Original Message-
> From: Dong, Eric 
> Sent: 2021年7月6日 10:53
> To: Sheng, W ; devel@edk2.groups.io
> Cc: Ni, Ray ; Laszlo Ersek ; Kumar,
> Rahul1 ; Yao, Jiewen ;
> Zhuang, Qihua ; Dong, Daquan
> ; Tong, Justin ; Xu, Tom
> 
> Subject: RE: [PATCH] UefiCpuPkg/ExceptionLib: Conditionally clear shadow
> stack token busy bit
> 
> Reviewed-by: Eric Dong 
> 
> -Original Message-
> From: Sheng, W 
> Sent: Friday, July 2, 2021 1:29 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric ; Ni, Ray ; Laszlo
> Ersek ; Kumar, Rahul1 ; Yao,
> Jiewen ; Zhuang, Qihua ;
> Dong, Daquan ; Tong, Justin
> ; Xu, Tom 
> Subject: [PATCH] UefiCpuPkg/ExceptionLib: Conditionally clear shadow stack
> token busy bit
> 
> When enter SMM exception, there will be a stack switch only if the IST field
> of the interrupt gate is set. When CET shadow stack feature is enabled, if
> there is a stack switch between SMM exception and SMM, the shadow stack
> token busy bit needs to be cleared when return from SMM exception to
> SMM. In UEFI BIOS, only page fault exception does the stack swith when
> SMM shack guard feature is enabled. The condition of clear shadow stack
> token busy bit should be SMM stack guard enabled, CET shadows stack
> feature enabled and page fault exception.
> The shadow stack token should be initialized by UINT64.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3462
> 
> Signed-off-by: Sheng Wei 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Cc: Rahul Kumar 
> Cc: Jiewen Yao 
> Cc: Qihua Zhuang 
> Cc: Daquan Dong 
> Cc: Justin Tong 
> Cc: Tom Xu 
> ---
>  .../X64/Xcode5ExceptionHandlerAsm.nasm | 83 +++--
> -
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c   |  2 +-
>  2 files changed, 43 insertions(+), 42 deletions(-)
> 
> diff --git
> a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandle
> rAsm.nasm
> b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandle
> rAsm.nasm
> index ebe0eec874..4881a02848 100644
> ---
> a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandle
> rAsm.nasm
> +++
> b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandl
> +++ erAsm.nasm
> @@ -20,6 +20,7 @@
>  ;
> 
>  %define VC_EXCEPTION 29
> +%define PF_EXCEPTION 14
> 
>  extern ASM_PFX(mErrorCodeFlag); Error code flags for exceptions
>  extern ASM_PFX(mDoFarReturnFlag)  ; Do far return flag @@ -279,6 +280,46
> @@ DrFinish:
>  callASM_PFX(CommonExceptionHandler)
>  add rsp, 4 * 8 + 8
> 
> +; The follow algorithm is used for clear shadow stack token busy bit.
> +; The comment is based on the sample shadow stack.
> +; The sample shadow stack layout :
> +; Address | Context
> +; +-+
> +;  0xFD0  |   FREE  | it is 0xFD8|0x02|(LMA & CS.L), 
> after
> SAVEPREVSSP.
> +; +-+
> +;  0xFD8  |  Prev SSP   |
> +; +-+
> +;  0xFE0  |   RIP   |
> +; +-+
> +;  0xFE8  |   CS|
> +; +-+
> +;  0xFF0  |  0xFF0 | BUSY   | BUSY flag cleared after CLRSSBSY
> +; +-+
> +;  0xFF8  | 0xFD8|0x02|(LMA & CS.L) |
> +; +-+
> +; Instructions for Intel Control Flow Enforcement Technology (CET) are
> supported since NASM version 2.15.01.
> +cmp qword [ASM_PFX(mDoFarReturnFlag)], 0
> +jz  CetDone
> +cmp qword [rbp + 8], PF_EXCEPTION   ; check if it is a Page Fault
> +jnz CetDone
> +cmp byte [dword ASM_PFX(FeaturePcdGet (PcdCpuSmmStackGuard))],
> 0
> +jz  CetDone
> +mov rax, cr4
> +and rax, 0x80   ; check if CET is enabled
> +jz  CetDone
> +; SSP should be 0xFD8 at this point
> +mov rax, 0x04   ; advance past cs:lip:prevssp;supervisor 
> shadow
> stack token
> +INCSSP_RAX  ; After this SSP should be 0xFF8
> +SAVEPREVSSP ; now the shadow stack restore token will be
> created at 0xFD0
> +READSSP_RAX ; Read new SSP, SSP should be 0x1000
> +sub rax, 0x10
> +CLRSSBSY_RAX; Clear token at 0xFF0, SSP should be 0 
> after this
> +sub rax, 0x20
> +RSTORSSP_RAX; Restore to token at 0xFD0, new SSP will be 
> 0xFD0
> +mov rax, 0x01   ; Pop off the new save token created
> +INCSSP_RAX  ; SSP should be 0xFD8 now
> +CetDone:
> +
>  cli
>  ;; UINT64  ExceptionData;
>  add rsp, 8
> @@ -373,47 +414,7 @@ DoReturn:
>  pushqword [rax + 0x18]   ; save EFLAGS in 

Re: [edk2-devel] [PATCH] UefiCpuPkg/ExceptionLib: Conditionally clear shadow stack token busy bit

2021-07-05 Thread Dong, Eric
Reviewed-by: Eric Dong 

-Original Message-
From: Sheng, W  
Sent: Friday, July 2, 2021 1:29 PM
To: devel@edk2.groups.io
Cc: Dong, Eric ; Ni, Ray ; Laszlo Ersek 
; Kumar, Rahul1 ; Yao, Jiewen 
; Zhuang, Qihua ; Dong, Daquan 
; Tong, Justin ; Xu, Tom 

Subject: [PATCH] UefiCpuPkg/ExceptionLib: Conditionally clear shadow stack 
token busy bit

When enter SMM exception, there will be a stack switch only if the IST field of 
the interrupt gate is set. When CET shadow stack feature is enabled, if there 
is a stack switch between SMM exception and SMM, the shadow stack token busy 
bit needs to be cleared when return from SMM exception to SMM. In UEFI BIOS, 
only page fault exception does the stack swith when SMM shack guard feature is 
enabled. The condition of clear shadow stack token busy bit should be SMM stack 
guard enabled, CET shadows stack feature enabled and page fault exception.
The shadow stack token should be initialized by UINT64.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3462

Signed-off-by: Sheng Wei 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Cc: Rahul Kumar 
Cc: Jiewen Yao 
Cc: Qihua Zhuang 
Cc: Daquan Dong 
Cc: Justin Tong 
Cc: Tom Xu 
---
 .../X64/Xcode5ExceptionHandlerAsm.nasm | 83 +++---
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c   |  2 +-
 2 files changed, 43 insertions(+), 42 deletions(-)

diff --git 
a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandlerAsm.nasm 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandlerAsm.nasm
index ebe0eec874..4881a02848 100644
--- 
a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandlerAsm.nasm
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandl
+++ erAsm.nasm
@@ -20,6 +20,7 @@
 ;
 
 %define VC_EXCEPTION 29
+%define PF_EXCEPTION 14
 
 extern ASM_PFX(mErrorCodeFlag); Error code flags for exceptions
 extern ASM_PFX(mDoFarReturnFlag)  ; Do far return flag @@ -279,6 +280,46 @@ 
DrFinish:
 callASM_PFX(CommonExceptionHandler)
 add rsp, 4 * 8 + 8
 
+; The follow algorithm is used for clear shadow stack token busy bit.
+; The comment is based on the sample shadow stack.
+; The sample shadow stack layout :
+; Address | Context
+; +-+
+;  0xFD0  |   FREE  | it is 0xFD8|0x02|(LMA & CS.L), after 
SAVEPREVSSP.
+; +-+
+;  0xFD8  |  Prev SSP   |
+; +-+
+;  0xFE0  |   RIP   |
+; +-+
+;  0xFE8  |   CS|
+; +-+
+;  0xFF0  |  0xFF0 | BUSY   | BUSY flag cleared after CLRSSBSY
+; +-+
+;  0xFF8  | 0xFD8|0x02|(LMA & CS.L) |
+; +-+
+; Instructions for Intel Control Flow Enforcement Technology (CET) are 
supported since NASM version 2.15.01.
+cmp qword [ASM_PFX(mDoFarReturnFlag)], 0
+jz  CetDone
+cmp qword [rbp + 8], PF_EXCEPTION   ; check if it is a Page Fault
+jnz CetDone
+cmp byte [dword ASM_PFX(FeaturePcdGet (PcdCpuSmmStackGuard))], 0
+jz  CetDone
+mov rax, cr4
+and rax, 0x80   ; check if CET is enabled
+jz  CetDone
+; SSP should be 0xFD8 at this point
+mov rax, 0x04   ; advance past cs:lip:prevssp;supervisor 
shadow stack token
+INCSSP_RAX  ; After this SSP should be 0xFF8
+SAVEPREVSSP ; now the shadow stack restore token will be 
created at 0xFD0
+READSSP_RAX ; Read new SSP, SSP should be 0x1000
+sub rax, 0x10
+CLRSSBSY_RAX; Clear token at 0xFF0, SSP should be 0 after 
this
+sub rax, 0x20
+RSTORSSP_RAX; Restore to token at 0xFD0, new SSP will be 
0xFD0
+mov rax, 0x01   ; Pop off the new save token created
+INCSSP_RAX  ; SSP should be 0xFD8 now
+CetDone:
+
 cli
 ;; UINT64  ExceptionData;
 add rsp, 8
@@ -373,47 +414,7 @@ DoReturn:
 pushqword [rax + 0x18]   ; save EFLAGS in new location
 mov rax, [rax]; restore rax
 popfq ; restore EFLAGS
-
-; The follow algorithm is used for clear shadow stack token busy bit.
-; The comment is based on the sample shadow stack.
-; The sample shadow stack layout :
-; Address | Context
-; +-+
-;  0xFD0  |   FREE  | it is 0xFD8|0x02|(LMA & CS.L), after 
SAVEPREVSSP.
-; +-+
-;  0xFD8  |  Prev SSP   |
-; +-+
-;  0xFE0  |   RIP   |
-; +-+
-;  0xFE8  |   CS|
-; 

Re: [edk2-devel] [PATCH] MdeModulePkg/PartitionDxe: Ignore PMBR BootIndicator per UEFI spec

2021-07-05 Thread Wu, Hao A
> -Original Message-
> From: Neal Gompa 
> Sent: Monday, July 5, 2021 5:36 PM
> To: devel@edk2.groups.io
> Cc: Neal Gompa ; Chris Murphy
> ; David Duncan ;
> Lazlo Ersek ; Wu, Hao A ; Ni,
> Ray ; Gao, Zhichao 
> Subject: [PATCH] MdeModulePkg/PartitionDxe: Ignore PMBR BootIndicator
> per UEFI spec
> 
> Per UEFI Spec 2.8 (UEFI_Spec_2_8_final.pdf, page 114)
> 5.2.3 Protective MBR
> Table 20. Protective MBR Partition Record protecting the entire disk
> 
> The description for BootIndicator states the following:
> 
> > Set to 0x00 to indicate a non-bootable partition. If set to any
> > value other than 0x00 the behavior of this flag on non-UEFI
> > systems is undefined. Must be ignored by UEFI implementations.
> 
> Unfortunately, we have been incorrectly assuming that the
> BootIndicator value must be 0x00, which leads to problems
> when the 'pmbr_boot' flag is set on a disk containing a GPT
> (such as with GNU parted). When the flag is set, the value
> changes to 0x01, causing this check to fail and the system
> is rendered unbootable despite it being valid from the
> perspective of the UEFI spec.
> 
> To resolve this, we drop the check for the BootIndicator
> so that we stop caring about the value set there, which
> restores the capability to boot such disks.
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3474
> 
> Cc: Chris Murphy 
> Cc: David Duncan 
> Cc: Lazlo Ersek 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Cc: Zhichao Gao 
> 
> Signed-off-by: Neal Gompa 
> ---
>  MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
> b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
> index aefb2d6ecb3f..efaff5e0808f 100644
> --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
> +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
> @@ -264,8 +264,7 @@ PartitionInstallGptChildHandles (
>// Verify that the Protective MBR is valid
> 
>//
> 
>for (Index = 0; Index < MAX_MBR_PARTITIONS; Index++) {
> 
> -if (ProtectiveMbr->Partition[Index].BootIndicator == 0x00 &&
> 
> -ProtectiveMbr->Partition[Index].OSIndicator == PMBR_GPT_PARTITION
> &&
> 
> +if (ProtectiveMbr->Partition[Index].OSIndicator ==
> PMBR_GPT_PARTITION &&
> 


Thanks a lot for the fix.
Reviewed-by: Hao A Wu 

Best Regards,
Hao Wu


>  UNPACK_UINT32 (ProtectiveMbr->Partition[Index].StartingLBA) == 1
> 
>  ) {
> 
>break;
> 
> --
> 2.31.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77492): https://edk2.groups.io/g/devel/message/77492
Mute This Topic: https://groups.io/mt/83993973/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] Event: TianoCore Bug Triage - APAC / NAMO - 07/06/2021 #cal-reminder

2021-07-05 Thread devel@edk2.groups.io Calendar
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Groups.io Inc//Groups.io Calendar//EN
METHOD:PUBLISH
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:America/Los_Angeles
LAST-MODIFIED:20201011T015911Z
TZURL:http://tzurl.org/zoneinfo-outlook/America/Los_Angeles
X-LIC-LOCATION:America/Los_Angeles
BEGIN:DAYLIGHT
TZNAME:PDT
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
DTSTART:19700308T02
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZNAME:PST
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
DTSTART:19701101T02
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
X-GIOIDS:Event:1057085 
UID:mlda.1580078539586725120.r...@groups.io
DTSTAMP:20210706T013001Z
ORGANIZER;CN=Liming Gao:mailto:gaolim...@byosoft.com.cn
DTSTART:20210707T013000Z
DTEND:20210707T023000Z
SUMMARY:TianoCore Bug Triage - APAC / NAMO
DESCRIPTION:TianoCore Bug Triage - APAC / NAMO\n\nHosted by Liming Gao\n\
 n
 \n\nMicrosoft Teams meeting\n\n*Join on your computer or mobile a
 pp*\n\nClick here to join the meeting ( https://teams.microsoft.com/l/mee
 tup-join/19%3ameeting_OTUyZTg2NjgtNDhlNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh%40
 thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255
 d%22%2c%22Oid%22%3a%22b286b53a-1218-4db3-bfc9-3d4c5aa7669e%22%7d )\n\n*Jo
 in with a video conferencing device*\n\nte...@conf.intel.com\n\nVideo Con
 ference ID: 116 062 094 0\n\nAlternate VTC dialing instructions ( https:/
 /conf.intel.com/teams/?conf=1160620940=teams=conf.intel.com=te
 st_call )\n\n*Or call in (audio only)*\n\n+1 916-245-6934\,\,77463821# ( 
 tel:+19162456934\,\,77463821# ) United States\, Sacramento\n\nPhone Confe
 rence ID: 774 638 21#\n\nFind a local number ( https://dialin.teams.micro
 soft.com/d195d438-2daa-420e-b9ea-da26f9d1d6d5?id=77463821 ) | Reset PIN (
  https://mysettings.lync.com/pstnconferencing )\n\nLearn More ( https://a
 ka.ms/JoinTeamsMeeting ) | Meeting options ( https://teams.microsoft.com/
 meetingOptions/?organizerId=b286b53a-1218-4db3-bfc9-3d4c5aa7669e
 =46c98d88-e344-4ed4-8496-4ed7712e255d=19_meeting_OTUyZTg2NjgtNDh
 lNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh@thread.v2=0=en-US )
LOCATION:https://teams.microsoft.com/l/meetup-join/19%3ameeting_OTUyZTg2N
 jgtNDhlNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh%40thread.v2/0?context=%7b%22Tid%2
 2%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%22b286b53a-
 1218-4db3-bfc9-3d4c5aa7669e%22%7d
SEQUENCE:0
END:VEVENT
END:VCALENDAR


invite.ics
Description: application/ics


Re: [edk2-devel] [edk2-platforms][PATCH v2 0/5] Platform/Sgi: Miscellaneous updates

2021-07-05 Thread Sami Mujawar
Pushed as 086a3a3ce6c4..936e8dd57524

Thanks.

Regards,

Sami Mujawar


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77490): https://edk2.groups.io/g/devel/message/77490
Mute This Topic: https://groups.io/mt/83465453/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-platforms][PATCH v2 0/5] Platform/Sgi: Miscellaneous updates

2021-07-05 Thread Sami Mujawar
Hi Pranav,

This patch series looks good to me.

Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77489): https://edk2.groups.io/g/devel/message/77489
Mute This Topic: https://groups.io/mt/83465453/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V2] Dump hob information from boot loader.

2021-07-05 Thread Zhiguang Liu
From: Thiyagu Kesavan Balakrishnan 

V1:
Universal Payload will consume Hobs from boot loader.
Dump all hobs in the Universal Payload entry.
V2:
Add function comments

Cc: Maurice Ma 
Cc: Guo Dong 
Cc: Ray Ni 
Cc: Benjamin You 

Signed-off-by: Thiyagu Kesavan Balakrishnan 

Signed-off-by: Zhiguang Liu 
---
 UefiPayloadPkg/UefiPayloadEntry/PrintHob.c| 641 
+
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.c   |  17 
+
 UefiPayloadPkg/UefiPayloadEntry/UniversalPayloadEntry.inf |   6 ++
 3 files changed, 664 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c 
b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
new file mode 100644
index 00..ef8cc40e5c
--- /dev/null
+++ b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c
@@ -0,0 +1,641 @@
+/** @file
+  Copyright (c) 2021, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include "UefiPayloadEntry.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define ROW_LIMITER 16
+
+typedef
+EFI_STATUS
+(*HOB_PRINT_HANDLER) (
+  IN  VOID*Hob,
+  IN  UINT16  Hobsize
+);
+
+typedef struct{
+  UINT16   Type;
+  CHAR8*Name;
+  HOB_PRINT_HANDLERPrintHandler;
+} HOB_PRINT_HANDLER_TABLE;
+
+CHAR8 * mMemoryTypeStr[] = {
+  "EfiReservedMemoryType",
+  "EfiLoaderCode",
+  "EfiLoaderData",
+  "EfiBootServicesCode",
+  "EfiBootServicesData",
+  "EfiRuntimeServicesCode",
+  "EfiRuntimeServicesData",
+  "EfiConventionalMemory",
+  "EfiUnusableMemory",
+  "EfiACPIReclaimMemory",
+  "EfiACPIMemoryNVS",
+  "EfiMemoryMappedIO",
+  "EfiMemoryMappedIOPortSpace",
+  "EfiPalCode",
+  "EfiPersistentMemory",
+  "EfiMaxMemoryType"
+};
+
+CHAR8 * mResource_Type_List[] = {
+  "EFI_RESOURCE_SYSTEM_MEMORY  ", //0x
+  "EFI_RESOURCE_MEMORY_MAPPED_IO   ", //0x0001
+  "EFI_RESOURCE_IO ", //0x0002
+  "EFI_RESOURCE_FIRMWARE_DEVICE", //0x0003
+  "EFI_RESOURCE_MEMORY_MAPPED_IO_PORT  ", //0x0004
+  "EFI_RESOURCE_MEMORY_RESERVED", //0x0005
+  "EFI_RESOURCE_IO_RESERVED", //0x0006
+  "EFI_RESOURCE_MAX_MEMORY_TYPE"  //0x0007
+};
+
+typedef
+EFI_STATUS
+(*GUID_HOB_PRINT) (
+  IN  UINT8  *HobRaw,
+  IN  UINT16 Hobsize
+);
+
+typedef struct {
+  EFI_GUID  *Guid;
+  GUID_HOB_PRINTPrintHandler;
+  CHAR8 *GuidName;
+} GUID_HOB_PRINT_HANDLE;
+
+typedef struct{
+ EFI_GUID   *Guid;
+ CHAR8  *Type;
+} PRINT_MEMORY_ALLOCCATION_HOB;
+
+
+/**
+  Print the Hex value of a given range.
+  @param[in]  DataStart  A pointer to the start of data to be printed.
+  @param[in]  DataSize   The length of the data to be printed.
+  @retval EFI_SUCCESSIf it completed successfully.
+**/
+EFI_STATUS
+PrintHex (
+  IN  UINT8 *DataStart,
+  IN  UINT16 DataSize
+  )
+{
+  UINTN  Index1;
+  UINTN  Index2;
+  UINT8  *StartAddr;
+
+  StartAddr = DataStart;
+  for (Index1 = 0; Index1 * ROW_LIMITER < DataSize; Index1++) {
+DEBUG ((DEBUG_VERBOSE, "   0x%04p:", (DataStart - StartAddr)));
+for (Index2 = 0; (Index2 < ROW_LIMITER) && (Index1 * ROW_LIMITER + Index2 
< DataSize); Index2++){
+  DEBUG ((DEBUG_VERBOSE, " %02x", *DataStart));
+  DataStart++;
+}
+DEBUG ((DEBUG_VERBOSE, "\n"));
+  }
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Print the information in HandOffHob.
+
+  @param[in]  HobStart   A pointer to the HOB of type EFI_HOB_TYPE_HANDOFF.
+  @param[in]  HobsizeThe length in bytes of HOB of type 
EFI_HOB_TYPE_HANDOFF.
+  @retval EFI_SUCCESSIf it completed successfully.
+**/
+EFI_STATUS
+PrintHandOffHob(
+  IN  VOID  *HobStart,
+  IN  UINT16 Hobsize
+  )
+{
+  EFI_PEI_HOB_POINTERS  Hob;
+  Hob.Raw = (UINT8 *) HobStart;
+  ASSERT (Hobsize >= sizeof (*Hob.HandoffInformationTable));
+  DEBUG ((DEBUG_INFO, "   BootMode= 0x%x\n",  
Hob.HandoffInformationTable->BootMode));
+  DEBUG ((DEBUG_INFO, "   EfiMemoryTop= 0x%lx\n", 
Hob.HandoffInformationTable->EfiMemoryTop));
+  DEBUG ((DEBUG_INFO, "   EfiMemoryBottom = 0x%lx\n", 
Hob.HandoffInformationTable->EfiMemoryBottom));
+  DEBUG ((DEBUG_INFO, "   EfiFreeMemoryTop= 0x%lx\n", 

[edk2-devel] Neon instruction in ARM fails

2021-07-05 Thread Gabriel Carvalho de Faria via groups.io
Greetings!

We are trying to implement an .efi application that validates some ARM 
architecture instructions.

For this application, an assembly code was created, with the help of 
AsmMacroIoLibV8, present in edk2. The implementation can be seen below.

> 
> #include 
> 
> .data
> 
> OneHundredSeventy: .word 0b10101010
> 
> Filter32bit: .word 4294967295
> 
> .bss
> 
> EmptyVar: .space 64
> 
> .text
> 
> ASM_FUNC(SQXTNInstruction)
> 
> ldr       x1,=OneHundredSeventy
> ldr       x2,=EmptyVar
> mov    x3,#2147483647
> mov    x5,Filter32bit       // The error happens here
> 
> LD1        {V0.16B},[x1]
> SQXTN   V1.2S, V0.2D
> MOV      x2,V1.D[0]
> 
> and     x4,x2,x5
> 
> cmp    x3,x4
> b.ne    Error
> b         End
> 
> Error:
> mov x0,x4
> ret
> End:
> mov x0,#0
> ret
> 

When using the value defined for Filter32bit, as it is in the code, the return 
of this instruction is 1 (error). However, when directly loading the hardcoded 
value into register x5, the return is 0 (success).

This behavior happened on a machine with a Snapdragon(TM) 8cx @ 2.84 GHz - 
QUALCOMM processor.

We would like to know if there is any bug in the implementation or if there is 
an explanation for this behavior.

Best regards!
Gabriel.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77487): https://edk2.groups.io/g/devel/message/77487
Mute This Topic: https://groups.io/mt/83995859/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v4 1/2] OvmfPkg/Bhyve: add USB support

2021-07-05 Thread Laszlo Ersek
On 07/05/21 13:08, Corvin Köhne wrote:
> An USB driver is required to use a keyboard or mouse while installing
> an OS or while in a bootloader menu like grub when using GPU + USB
> Passthrough.
> 
> Reviewed-by: Peter Grehan 
> Acked-by: Rebecca Cran 
> Signed-off-by: Corvin Köhne 
> ---
>  OvmfPkg/Bhyve/BhyveX64.dsc | 9 +
>  OvmfPkg/Bhyve/BhyveX64.fdf | 8 
>  2 files changed, 17 insertions(+)
> 
> diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
> index 39cd354932..a0a2071b86 100644
> --- a/OvmfPkg/Bhyve/BhyveX64.dsc
> +++ b/OvmfPkg/Bhyve/BhyveX64.dsc
> @@ -163,6 +163,7 @@
>FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
>UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
>
> SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
> +  UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
>
> SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
>QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf
>QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
> @@ -778,6 +779,14 @@
>  !endif
>OvmfPkg/VirtioNetDxe/VirtioNet.inf
>  
> +  #
> +  # Usb Support
> +  #
> +  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> +  MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
> +  MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
> +  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
> +
>  !ifdef $(CSM_ENABLE)
>IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf {
>  
> diff --git a/OvmfPkg/Bhyve/BhyveX64.fdf b/OvmfPkg/Bhyve/BhyveX64.fdf
> index f4050c4934..f9e9a4cc3e 100644
> --- a/OvmfPkg/Bhyve/BhyveX64.fdf
> +++ b/OvmfPkg/Bhyve/BhyveX64.fdf
> @@ -292,6 +292,14 @@ INF MdeModulePkg/Logo/LogoDxe.inf
>  !include NetworkPkg/Network.fdf.inc
>INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
>  
> +#
> +# Usb Support
> +#
> +INF  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> +INF  MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
> +INF  MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
> +INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
> +
>  !ifdef $(CSM_ENABLE)
>  INF  IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf
>  !endif
> 

Merged as commit range fea7901dba72..44ced03798d3, via
.

Thanks
Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77486): https://edk2.groups.io/g/devel/message/77486
Mute This Topic: https://groups.io/mt/83994828/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v4 2/2] OvmfPkg/Bhyve: use static PCI32Base address

2021-07-05 Thread Corvin Köhne
It's neccessary to allocate a Graphics Stolen Memory area to enable
GPU-Passthrough for integrated Intel GPUs. Therefore, use a new
memory layout with a static Pci32Baseaddress.

Old layout:
[..., lowmemlimit] RAM
[lowmemlimit, 0xE000 ] PCI Space
New layout:
[..., lowmemlimit] RAM
[lowmemlimit, gsmbase] Memory hole (may be absent)
[gsmbase, 0xC000 ] GSM (may be absent)
[0xC000 , 0xE000 ] PCI Space

Reviewed-by: Peter Grehan 
Acked-by: Rebecca Cran 
Signed-off-by: Corvin Köhne 
---
 OvmfPkg/Bhyve/BhyveX64.dsc   | 4 ++--
 OvmfPkg/Bhyve/PlatformPei/Platform.c | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index a0a2071b86..c435dadc0a 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -537,8 +537,8 @@
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0
-  gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base|0x0
-  gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size|0x0
+  gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base|0xC000
+  gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size|0x2000
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x8
 
diff --git a/OvmfPkg/Bhyve/PlatformPei/Platform.c 
b/OvmfPkg/Bhyve/PlatformPei/Platform.c
index 3a414ffcb7..d980e3fcb0 100644
--- a/OvmfPkg/Bhyve/PlatformPei/Platform.c
+++ b/OvmfPkg/Bhyve/PlatformPei/Platform.c
@@ -191,7 +191,9 @@ MemMapInitialization (
   ASSERT (PciExBarBase <= MAX_UINT32 - SIZE_256MB);
   PciBase = (UINT32)(PciExBarBase + SIZE_256MB);
 } else {
-  PciBase = (TopOfLowRam < BASE_2GB) ? BASE_2GB : TopOfLowRam;
+  PciBase = PcdGet64 (PcdPciMmio32Base);
+  if (PciBase == 0)
+PciBase = (TopOfLowRam < BASE_2GB) ? BASE_2GB : TopOfLowRam;
 }
 
 //
-- 
2.11.0

Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany | Register court: Guetersloh HRA 7075





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77484): https://edk2.groups.io/g/devel/message/77484
Mute This Topic: https://groups.io/mt/83994827/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v4 1/2] OvmfPkg/Bhyve: add USB support

2021-07-05 Thread Corvin Köhne
An USB driver is required to use a keyboard or mouse while installing
an OS or while in a bootloader menu like grub when using GPU + USB
Passthrough.

Reviewed-by: Peter Grehan 
Acked-by: Rebecca Cran 
Signed-off-by: Corvin Köhne 
---
 OvmfPkg/Bhyve/BhyveX64.dsc | 9 +
 OvmfPkg/Bhyve/BhyveX64.fdf | 8 
 2 files changed, 17 insertions(+)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 39cd354932..a0a2071b86 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -163,6 +163,7 @@
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
   UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
+  UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   
SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
   QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf
   QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
@@ -778,6 +779,14 @@
 !endif
   OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
+  #
+  # Usb Support
+  #
+  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
+  MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
+  MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
+  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
+
 !ifdef $(CSM_ENABLE)
   IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf {
 
diff --git a/OvmfPkg/Bhyve/BhyveX64.fdf b/OvmfPkg/Bhyve/BhyveX64.fdf
index f4050c4934..f9e9a4cc3e 100644
--- a/OvmfPkg/Bhyve/BhyveX64.fdf
+++ b/OvmfPkg/Bhyve/BhyveX64.fdf
@@ -292,6 +292,14 @@ INF MdeModulePkg/Logo/LogoDxe.inf
 !include NetworkPkg/Network.fdf.inc
   INF  OvmfPkg/VirtioNetDxe/VirtioNet.inf
 
+#
+# Usb Support
+#
+INF  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
+INF  MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
+INF  MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
+INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
+
 !ifdef $(CSM_ENABLE)
 INF  IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf
 !endif
-- 
2.11.0

Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany | Register court: Guetersloh HRA 7075





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77485): https://edk2.groups.io/g/devel/message/77485
Mute This Topic: https://groups.io/mt/83994828/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-platforms PATCH v5 2/4] ARM Silicon and Platforms: add SecureBootVariableLib class resolution

2021-07-05 Thread Sami Mujawar
Hi Grzegorz,

Thank you for this patch.

For: Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc

Reviewed by: Sami Mujawar 

Regards,

Sami Mujawar


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77483): https://edk2.groups.io/g/devel/message/77483
Mute This Topic: https://groups.io/mt/83912226/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v4 3/3] ArmVirtCloudHv: support Cloud Hypervisor in edk2

2021-07-05 Thread Jianyong Wu
Cloud Hypervisor is KVM based VMM and is implemented in rust. Just like
other VMMs it need UEFI support to let ACPI work. That's why
Cloud Hypervisor is introduced here.

Cc: Laszlo Ersek 
Cc: Sami Mujawar 

Signed-off-by: Jianyong Wu 
---
 ArmVirtPkg/ArmVirtCloudHv.dsc | 364 ++
 ArmVirtPkg/ArmVirtCloudHv.fdf | 258 
 2 files changed, 622 insertions(+)
 create mode 100644 ArmVirtPkg/ArmVirtCloudHv.dsc
 create mode 100644 ArmVirtPkg/ArmVirtCloudHv.fdf

diff --git a/ArmVirtPkg/ArmVirtCloudHv.dsc b/ArmVirtPkg/ArmVirtCloudHv.dsc
new file mode 100644
index ..f292ba6079b2
--- /dev/null
+++ b/ArmVirtPkg/ArmVirtCloudHv.dsc
@@ -0,0 +1,364 @@
+#
+#  Copyright (c) 2021, ARM Limited. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+
+
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+
+[Defines]
+  PLATFORM_NAME  = ArmVirtCloudHv
+  PLATFORM_GUID  = DFFED32B-DFFE-D32B-DFFE-D32BDFFED32B
+  PLATFORM_VERSION   = 0.1
+  DSC_SPECIFICATION  = 0x00010005
+  OUTPUT_DIRECTORY   = Build/ArmVirtCloudHv-$(ARCH)
+  SUPPORTED_ARCHITECTURES= AARCH64|ARM
+  BUILD_TARGETS  = DEBUG|RELEASE|NOOPT
+  SKUID_IDENTIFIER   = DEFAULT
+  FLASH_DEFINITION   = ArmVirtPkg/ArmVirtCloudHv.fdf
+
+  #
+  # Defines for default states.  These can be changed on the command line.
+  # -D FLAG=VALUE
+  #
+  DEFINE TTY_TERMINAL= FALSE
+  DEFINE SECURE_BOOT_ENABLE  = FALSE
+
+!include ArmVirtPkg/ArmVirt.dsc.inc
+
+[LibraryClasses.common]
+  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+
+  # Virtio Support
+  VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
+  
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
+
+  
ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
+
+  TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
+  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+  
PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+  
PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf
+  
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
+  
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
+  QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
+  FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+  
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
+  PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
+  
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
+  
PciHostBridgeUtilityLib|ArmVirtPkg/Library/ArmVirtPciHostBridgeUtilityLib/ArmVirtPciHostBridgeUtilityLib.inf
+
+  
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
+
+!include MdePkg/MdeLibs.dsc.inc
+
+[LibraryClasses.common.PEIM]
+  
ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf
+
+[LibraryClasses.common.DXE_DRIVER]
+  
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
+
+[LibraryClasses.common.UEFI_DRIVER]
+  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
+
+[BuildOptions]
+!include NetworkPkg/NetworkBuildOptions.dsc.inc
+
+
+#
+# Pcd Section - list of all EDK II PCD Entries defined by this Platform
+#
+
+
+[PcdsFeatureFlag.common]
+  ## If TRUE, Graphics Output Protocol will be installed on virtual handle 
created by ConsplitterDxe.
+  #  It could be set FALSE to save size.
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
+
+[PcdsFixedAtBuild.common]
+!if $(ARCH) == AARCH64
+  gArmTokenSpaceGuid.PcdVFPEnabled|1
+!endif
+
+  gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4007c000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
+  gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
+
+  # Rsdp base address in Cloud Hypervisor
+  gArmVirtTokenSpaceGuid.PcdCloudHvAcpiRsdpBaseAddress|0x4020
+
+  

[edk2-devel] [PATCH v4 2/3] Acpi: Install Acpi tables for Cloud hypervisor

2021-07-05 Thread Jianyong Wu
There is no device like Fw-cfg in Qemu in Cloud Hypervisor, so a specific
Acpi handler is introduced here.

The handler implemented here is in a very simple way:
1. acquire the RSDP from the PCD variable in the top ".dsc";
2. get the XSDT address from RSDP structure;
3. get the ACPI tables following the XSDT structure and install them
one by one;
4. get DSDT address from FADT and install DSDT table.

Cc: Laszlo Ersek 
Cc: Sami Mujawar 

Signed-off-by: Jianyong Wu 
---
 ArmVirtPkg/ArmVirtPkg.dec |   6 +
 .../CloudHvAcpiPlatformDxe.inf|  47 ++
 .../CloudHvAcpiPlatformDxe/CloudHvAcpi.c  | 155 ++
 3 files changed, 208 insertions(+)
 create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
 create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c

diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
index bf82f7f1f3f2..4e4d758015bc 100644
--- a/ArmVirtPkg/ArmVirtPkg.dec
+++ b/ArmVirtPkg/ArmVirtPkg.dec
@@ -66,6 +66,12 @@ [PcdsFixedAtBuild, PcdsPatchableInModule]
   #
   gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x65, 0x60, 0xA6, 0xDF, 
0x19, 0xB4, 0xD3, 0x11, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 
0x4D}|VOID*|0x0007
 
+  ##
+  # This is the physical address of Rsdp which is the core struct of Acpi.
+  # Cloud Hypervisor has no other way to pass Rsdp address to the guest except 
use a PCD.
+  #
+  gArmVirtTokenSpaceGuid.PcdCloudHvAcpiRsdpBaseAddress|0x0|UINT64|0x0005
+
 [PcdsDynamic]
   #
   # Whether to force disable ACPI, regardless of the fw_cfg settings
diff --git a/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf 
b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
new file mode 100644
index ..01de76486686
--- /dev/null
+++ b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
@@ -0,0 +1,47 @@
+## @file
+#  ACPI Platform Driver for Cloud Hypervisor
+#
+#  Copyright (c) 2021, ARM Limited. All rights reserved.
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = CloudHvgAcpiPlatform
+  FILE_GUID  = 6c76e407-73f2-dc1c-938f-5d6c4691ea93
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= CloudHvAcpiPlatformEntryPoint
+
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+  VALID_ARCHITECTURES   = AARCH64
+#
+
+[Sources]
+  CloudHvAcpi.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  OvmfPkg/OvmfPkg.dec
+  ArmVirtPkg/ArmVirtPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  MemoryAllocationLib
+  OrderedCollectionLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+
+[Protocols]
+  gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+
+[Pcd]
+  gArmVirtTokenSpaceGuid.PcdCloudHvAcpiRsdpBaseAddress
+
+[Depex]
+  gEfiAcpiTableProtocolGuid
diff --git a/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c 
b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
new file mode 100644
index ..f5a47aa7f3cd
--- /dev/null
+++ b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
@@ -0,0 +1,155 @@
+/** @file
+  Install Acpi tables for Cloud Hypervisor
+
+  Copyright (c) 2021, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+   Find Acpi table Protocol and return it
+
+   @return AcpiTable  Protocol, which is used to handle Acpi Table, on SUCCESS 
or NULL on FAILURE.
+
+**/
+STATIC
+EFI_ACPI_TABLE_PROTOCOL *
+FindAcpiTableProtocol (
+  VOID
+  )
+{
+  EFI_STATUS  Status;
+  EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+
+  Status = gBS->LocateProtocol (
+  ,
+  NULL,
+  (VOID**)
+  );
+  ASSERT_EFI_ERROR (Status);
+  return AcpiTable;
+}
+
+/** Install Acpi tables for Cloud Hypervisor
+
+  @param [in]  AcpiProtocol  Acpi Protocol which is used to install Acpi 
talbles
+
+  @return EFI_SUCCESSThe table was successfully inserted.
+  @return EFI_INVALID_PARAMETER  Either AcpiProtocol, AcpiTablePtr or DsdtPtr 
is NULL
+ and the size field embedded in the ACPI table 
pointed
+ by AcpiTablePtr or DsdtPtr are not in sync.
+  @return EFI_OUT_OF_RESOURCES   Insufficient resources exist to complete the 
request.
+  @return EFI_NOT_FOUND  DSDT table not found.
+**/
+EFI_STATUS
+EFIAPI
+InstallCloudHvAcpiTables (
+ IN EFI_ACPI_TABLE_PROTOCOL   *AcpiProtocol
+ )
+{
+  UINTN  InstalledKey;
+  UINTN  TableSize;
+  UINTN  AcpiTableLength;
+  UINT64 RsdpPtr;
+  UINT64 XsdtPtr;
+  UINT64 TableOffset;
+  UINT64 AcpiTablePtr;
+  UINT64 *DsdtPtr = 

[edk2-devel] [PATCH v4 1/3] Acpi: reimplement PlatformHasAcpi for Cloud Hypervisor

2021-07-05 Thread Jianyong Wu
The current implementation of PlatformHasAcpiDt is not a common
library and is on behalf of qemu. So give a specific version for
Cloud Hypervisor here.

Cc: Laszlo Ersek 
Cc: Sami Mujawar 

Signed-off-by: Jianyong Wu 
Reviewed-by: Sami Mujawar 
---
 .../CloudHvHasAcpiDtDxe.inf   | 43 
 .../CloudHvHasAcpiDtDxe.c | 69 +++
 2 files changed, 112 insertions(+)
 create mode 100644 
ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
 create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c

diff --git a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf 
b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
new file mode 100644
index ..eb63a4136545
--- /dev/null
+++ b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
@@ -0,0 +1,43 @@
+## @file
+# Decide whether the firmware should expose an ACPI- and/or a Device Tree-based
+# hardware description to the operating system.
+#
+# Copyright (c) 2021, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION= 1.25
+  BASE_NAME  = CloudHvPlatformHasAcpiDtDxe
+  FILE_GUID  = 71fe72f9-6dc1-199d-5054-13b4200ee88d
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= PlatformHasAcpiDt
+
+[Sources]
+  CloudHvHasAcpiDtDxe.c
+
+[Packages]
+  ArmVirtPkg/ArmVirtPkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  PcdLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+
+[Guids]
+  gEdkiiPlatformHasAcpiGuid   ## SOMETIMES_PRODUCES ## PROTOCOL
+  gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL
+
+[Pcd]
+  gArmVirtTokenSpaceGuid.PcdForceNoAcpi
+
+[Depex]
+  gEfiVariableArchProtocolGuid
diff --git a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c 
b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
new file mode 100644
index ..48a446c68a45
--- /dev/null
+++ b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
@@ -0,0 +1,69 @@
+/** @file
+  Decide whether the firmware should expose an ACPI- and/or a Device Tree-based
+  hardware description to the operating system.
+
+  Copyright (c) 2021, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+EFI_STATUS
+EFIAPI
+PlatformHasAcpiDt (
+  IN EFI_HANDLE   ImageHandle,
+  IN EFI_SYSTEM_TABLE *SystemTable
+  )
+{
+  EFI_STATUS   Status;
+
+  //
+  // If we fail to install any of the necessary protocols below, the OS will be
+  // unbootable anyway (due to lacking hardware description), so tolerate no
+  // errors here.
+  //
+  if (MAX_UINTN == MAX_UINT64 &&
+  !PcdGetBool (PcdForceNoAcpi))
+  {
+Status = gBS->InstallProtocolInterface (
+,
+,
+EFI_NATIVE_INTERFACE,
+NULL
+);
+if (EFI_ERROR (Status)) {
+  goto Failed;
+}
+
+return Status;
+  }
+
+  //
+  // Expose the Device Tree otherwise.
+  //
+  Status = gBS->InstallProtocolInterface (
+  ,
+  ,
+  EFI_NATIVE_INTERFACE,
+  NULL
+  );
+  if (EFI_ERROR (Status)) {
+goto Failed;
+  }
+
+  return Status;
+
+Failed:
+  ASSERT_EFI_ERROR (Status);
+  CpuDeadLoop ();
+  //
+  // Keep compilers happy.
+  //
+  return Status;
+}
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77480): https://edk2.groups.io/g/devel/message/77480
Mute This Topic: https://groups.io/mt/83994102/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v4 0/3] Enable Cloud Hypervisor support in edk2

2021-07-05 Thread Jianyong Wu
Cloud Hypervisor is an open source Virtual Machine Monitor (VMM) that
runs on top of KVM. Cloud Hypervisor is implemented in Rust and is based
on the rust-vmm crates. See [1] to find more.

To support UEFI, Cloud Hypervisor is introduced here.
There are 2 parts to be considered to do this enablement, that is:
  1. specific ACPI service implementation compared with qemu, there is no
 device like Fw-cfg, so we have no elegant way to get the RSDP address.
 A specific ACPI implementation is introduced here.

  2. build configuration file for Cloud Hypervisor

Change log:

v3 to v4:
 (1) remove Tpm support in dsc file
 (2) refine Acpi table install code base on Sami's comments in v3

v2 to v3:
 (1) reuse qemu's memory initialization lib as they are in nearly the same
memory laout.
 (2) split Acpi implemetation into PlatformHasAcpi and
InstallAcpiTable.
 (3) remove lots of dependencies from qemu like "*Fwcfg*" lib.
 (4) lots of code cleanup work to let it more approach to edk2 code
style.

[1] https://github.com/cloud-hypervisor/cloud-hypervisor

Jianyong Wu (3):
  Acpi: reimplement PlatformHasAcpi for Cloud Hypervisor
  Acpi: Install Acpi tables for Cloud hypervisor
  ArmVirtCloudHv: support Cloud Hypervisor in edk2

 ArmVirtPkg/ArmVirtPkg.dec |   6 +
 ArmVirtPkg/ArmVirtCloudHv.dsc | 364 ++
 ArmVirtPkg/ArmVirtCloudHv.fdf | 258 +
 .../CloudHvAcpiPlatformDxe.inf|  47 +++
 .../CloudHvHasAcpiDtDxe.inf   |  43 +++
 .../CloudHvAcpiPlatformDxe/CloudHvAcpi.c  | 155 
 .../CloudHvHasAcpiDtDxe.c |  69 
 7 files changed, 942 insertions(+)
 create mode 100644 ArmVirtPkg/ArmVirtCloudHv.dsc
 create mode 100644 ArmVirtPkg/ArmVirtCloudHv.fdf
 create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
 create mode 100644 
ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
 create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
 create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c

-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77479): https://edk2.groups.io/g/devel/message/77479
Mute This Topic: https://groups.io/mt/83994101/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] MdeModulePkg/PartitionDxe: Ignore PMBR BootIndicator per UEFI spec

2021-07-05 Thread Laszlo Ersek
On 07/05/21 11:36, Neal Gompa wrote:
> Per UEFI Spec 2.8 (UEFI_Spec_2_8_final.pdf, page 114)
> 5.2.3 Protective MBR
> Table 20. Protective MBR Partition Record protecting the entire disk
> 
> The description for BootIndicator states the following:
> 
>> Set to 0x00 to indicate a non-bootable partition. If set to any
>> value other than 0x00 the behavior of this flag on non-UEFI
>> systems is undefined. Must be ignored by UEFI implementations.
> 
> Unfortunately, we have been incorrectly assuming that the
> BootIndicator value must be 0x00, which leads to problems
> when the 'pmbr_boot' flag is set on a disk containing a GPT
> (such as with GNU parted). When the flag is set, the value
> changes to 0x01, causing this check to fail and the system
> is rendered unbootable despite it being valid from the
> perspective of the UEFI spec.
> 
> To resolve this, we drop the check for the BootIndicator
> so that we stop caring about the value set there, which
> restores the capability to boot such disks.
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3474
> 
> Cc: Chris Murphy 
> Cc: David Duncan 
> Cc: Lazlo Ersek 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Cc: Zhichao Gao 
> 
> Signed-off-by: Neal Gompa 
> ---
>  MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c 
> b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
> index aefb2d6ecb3f..efaff5e0808f 100644
> --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
> +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
> @@ -264,8 +264,7 @@ PartitionInstallGptChildHandles (
>// Verify that the Protective MBR is valid
>//
>for (Index = 0; Index < MAX_MBR_PARTITIONS; Index++) {
> -if (ProtectiveMbr->Partition[Index].BootIndicator == 0x00 &&
> -ProtectiveMbr->Partition[Index].OSIndicator == PMBR_GPT_PARTITION &&
> +if (ProtectiveMbr->Partition[Index].OSIndicator == PMBR_GPT_PARTITION &&
>  UNPACK_UINT32 (ProtectiveMbr->Partition[Index].StartingLBA) == 1
>  ) {
>break;
> 

Reviewed-by: Laszlo Ersek 

Thanks
Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77478): https://edk2.groups.io/g/devel/message/77478
Mute This Topic: https://groups.io/mt/83993973/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] How to add graphics driver to TianoCore payload

2021-07-05 Thread Дмитрий Понаморев
Hi!

I am trying to compile COREBOOT with TianoCore payload (Tianocore Payload
(UEFIPayload)). When the device boots, I do not see the boot manager
(graphics problems). I have a uefi driver for a video adapter aspeed
ast2510 (uefi_2500_800.efi) which is located on my motherboard. Can I embed
this binary into the TianoCore payload? Unfortunately, the manufacturer
does not provide the source code files for uefi_2500_800.efi.

Inside the binary there are links to the edk2 package:
*edk2\OptionRomPkg\ASPEEDGraphicsDxe\ASPEEDGraphics.c*

*Best regards,*
*Dmitry Ponamorev*


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77476): https://edk2.groups.io/g/devel/message/77476
Mute This Topic: https://groups.io/mt/83993972/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] MdeModulePkg/PartitionDxe: Ignore PMBR BootIndicator per UEFI spec

2021-07-05 Thread Neal Gompa
Per UEFI Spec 2.8 (UEFI_Spec_2_8_final.pdf, page 114)
5.2.3 Protective MBR
Table 20. Protective MBR Partition Record protecting the entire disk

The description for BootIndicator states the following:

> Set to 0x00 to indicate a non-bootable partition. If set to any
> value other than 0x00 the behavior of this flag on non-UEFI
> systems is undefined. Must be ignored by UEFI implementations.

Unfortunately, we have been incorrectly assuming that the
BootIndicator value must be 0x00, which leads to problems
when the 'pmbr_boot' flag is set on a disk containing a GPT
(such as with GNU parted). When the flag is set, the value
changes to 0x01, causing this check to fail and the system
is rendered unbootable despite it being valid from the
perspective of the UEFI spec.

To resolve this, we drop the check for the BootIndicator
so that we stop caring about the value set there, which
restores the capability to boot such disks.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3474

Cc: Chris Murphy 
Cc: David Duncan 
Cc: Lazlo Ersek 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Zhichao Gao 

Signed-off-by: Neal Gompa 
---
 MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c 
b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
index aefb2d6ecb3f..efaff5e0808f 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
@@ -264,8 +264,7 @@ PartitionInstallGptChildHandles (
   // Verify that the Protective MBR is valid
   //
   for (Index = 0; Index < MAX_MBR_PARTITIONS; Index++) {
-if (ProtectiveMbr->Partition[Index].BootIndicator == 0x00 &&
-ProtectiveMbr->Partition[Index].OSIndicator == PMBR_GPT_PARTITION &&
+if (ProtectiveMbr->Partition[Index].OSIndicator == PMBR_GPT_PARTITION &&
 UNPACK_UINT32 (ProtectiveMbr->Partition[Index].StartingLBA) == 1
 ) {
   break;
-- 
2.31.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77477): https://edk2.groups.io/g/devel/message/77477
Mute This Topic: https://groups.io/mt/83993973/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2] IntelFsp2Pkg: PatchFv parseInfFile function modification

2021-07-05 Thread Ashraf Ali S
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3476

parseInfFile currently reading the EFI_BASE_ADDRESS from INF, once the
address found still it's continues to read the complete inf file which
is not required. once the EFI_BASE_ADDRESS read from the INF no need to
read the INF further.
MSFT compiler can generate the map file address 8 or 16 based on which
architecture the INF is compiler. currently it's support for IA32,
modified the patchfv to support for all.
modification of few typo errors in parseModMapFile, getCurr function
required

Signed-off-by: Ashraf Ali S 
Cc: Ray Ni 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
---
 IntelFsp2Pkg/Tools/PatchFv.py | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
index 112de4077a..64b4e927a0 100644
--- a/IntelFsp2Pkg/Tools/PatchFv.py
+++ b/IntelFsp2Pkg/Tools/PatchFv.py
@@ -1,6 +1,6 @@
 ## @ PatchFv.py
 #
-# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -304,10 +304,11 @@ class Symbols:
 match = re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", 
rptLine)
 if match is not None:
 self.fdBase = int(match.group(1), 16) - fvOffset
+break
 rptLine  = fdIn.readline()
 fdIn.close()
 if self.fdBase == 0x:
-raise Exception("Could not find EFI_BASE_ADDRESS in INF file!" % 
fvFile)
+raise Exception("Could not find EFI_BASE_ADDRESS in INF file!" % 
infFile)
 return 0
 
 #
@@ -402,6 +403,7 @@ class Symbols:
 #
 #  retval  0   Parsed MOD MAP file successfully
 #  retval  1   There is no moduleEntryPoint in modSymbols
+#  retval  2   There is no offset for moduleEntryPoint in 
modSymbols
 #
 def parseModMapFile(self, moduleName, mapFile):
 #
@@ -426,7 +428,7 @@ class Symbols:
 else:
 #MSFT
 #0003:0190   _gComBase  7a50 
SerialPo
-patchMapFileMatchString =  
"^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8}\s+)"
+patchMapFileMatchString =  
"^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8,16}\s+)"
 matchKeyGroupIndex = 1
 matchSymbolGroupIndex  = 2
 prefix = ''
@@ -455,7 +457,13 @@ class Symbols:
 continue
 
 if not moduleEntryPoint in modSymbols:
-return 1
+if matchSymbolGroupIndex == 1:
+if not '_ModuleEntryPoint' in modSymbols:
+return 1
+else:
+moduleEntryPoint = "_ModuleEntryPoint"
+else:
+return 1
 
 modEntry = '%s:%s' % (moduleName,moduleEntryPoint)
 if not modEntry in self.dictSymbolAddress:
@@ -498,7 +506,7 @@ class Symbols:
 #
 #  Get current character
 #
-#  retval  elf.string[self.index]
+#  retval  self.string[self.index]
 #  retval  ''   Exception
 #
 def getCurr(self):
-- 
2.30.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77475): https://edk2.groups.io/g/devel/message/77475
Mute This Topic: https://groups.io/mt/83993064/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] IntelFsp2Pkg: PatchFv parseInfFile function modification

2021-07-05 Thread Ashraf Ali S
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3476

parseInfFile currently reading the EFI_BASE_ADDRESS from INF, once the
address found still it's continues to read the complete inf file which
is not required. once the EFI_BASE_ADDRESS read from the INF no need to
read the INF further.
MSFT compiler can generate the map file address 8 or 16 based on which
architecture the INF is compiler. currently it's support for IA32,
modified the patchfv to support for all.
modification of few typo errors in parseModMapFile, getCurr function
required

Signed-off-by: Ashraf Ali S 
Cc: Ray Ni 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
---
 IntelFsp2Pkg/Tools/PatchFv.py | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
index 112de4077a..64b4e927a0 100644
--- a/IntelFsp2Pkg/Tools/PatchFv.py
+++ b/IntelFsp2Pkg/Tools/PatchFv.py
@@ -1,6 +1,6 @@
 ## @ PatchFv.py
 #
-# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -304,10 +304,11 @@ class Symbols:
 match = re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", 
rptLine)
 if match is not None:
 self.fdBase = int(match.group(1), 16) - fvOffset
+break
 rptLine  = fdIn.readline()
 fdIn.close()
 if self.fdBase == 0x:
-raise Exception("Could not find EFI_BASE_ADDRESS in INF file!" % 
fvFile)
+raise Exception("Could not find EFI_BASE_ADDRESS in INF file!" % 
infFile)
 return 0
 
 #
@@ -402,6 +403,7 @@ class Symbols:
 #
 #  retval  0   Parsed MOD MAP file successfully
 #  retval  1   There is no moduleEntryPoint in modSymbols
+#  retval  2   There is no offset for moduleEntryPoint in 
modSymbols
 #
 def parseModMapFile(self, moduleName, mapFile):
 #
@@ -426,7 +428,7 @@ class Symbols:
 else:
 #MSFT
 #0003:0190   _gComBase  7a50 
SerialPo
-patchMapFileMatchString =  
"^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8}\s+)"
+patchMapFileMatchString =  
"^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8,16}\s+)"
 matchKeyGroupIndex = 1
 matchSymbolGroupIndex  = 2
 prefix = ''
@@ -455,7 +457,13 @@ class Symbols:
 continue
 
 if not moduleEntryPoint in modSymbols:
-return 1
+if matchSymbolGroupIndex == 1:
+if not '_ModuleEntryPoint' in modSymbols:
+return 1
+else:
+moduleEntryPoint = "_ModuleEntryPoint"
+else:
+return 1
 
 modEntry = '%s:%s' % (moduleName,moduleEntryPoint)
 if not modEntry in self.dictSymbolAddress:
@@ -498,7 +506,7 @@ class Symbols:
 #
 #  Get current character
 #
-#  retval  elf.string[self.index]
+#  retval  self.string[self.index]
 #  retval  ''   Exception
 #
 def getCurr(self):
-- 
2.30.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77474): https://edk2.groups.io/g/devel/message/77474
Mute This Topic: https://groups.io/mt/83975952/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] IntelFsp2Pkg: PatchFv parseInfFile function modification

2021-07-05 Thread Ashraf Ali S
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3476

parseInfFile currently reading the EFI_BASE_ADDRESS from INF, once the
address found still it's continues to read the complete inf file which
is not required. once the EFI_BASE_ADDRESS read from the INF no need to
read the INF further.
MSFT compiler can generate the map file address 8 or 16 based on which
architecture the INF is compiler. currently it's support for IA32,
modified the patchfv to support for all.
modification of few typo errors in parseModMapFile, getCurr function
required

Signed-off-by: Ashraf Ali S 
Cc: Ray Ni 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
---
 IntelFsp2Pkg/Tools/PatchFv.py | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
index 112de4077a..623eeb55b8 100644
--- a/IntelFsp2Pkg/Tools/PatchFv.py
+++ b/IntelFsp2Pkg/Tools/PatchFv.py
@@ -1,6 +1,6 @@
 ## @ PatchFv.py
 #
-# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -297,17 +297,18 @@ class Symbols:
 #
 fvOffset= self.getFvOffsetInFd(infFile[0:-4] + ".Fv")
 fdIn= open(infFile, "r")
-rptLine = fdIn.readline()
+rptLine = fdIn.readlines()
 self.fdBase = 0x
 while (rptLine != "" ):
 #EFI_BASE_ADDRESS = 0xFFFDF400
 match = re.match("^EFI_BASE_ADDRESS\s*=\s*(0x[a-fA-F0-9]+)", 
rptLine)
 if match is not None:
 self.fdBase = int(match.group(1), 16) - fvOffset
+break
 rptLine  = fdIn.readline()
 fdIn.close()
 if self.fdBase == 0x:
-raise Exception("Could not find EFI_BASE_ADDRESS in INF file!" % 
fvFile)
+raise Exception("Could not find EFI_BASE_ADDRESS in INF file!" % 
infFile)
 return 0
 
 #
@@ -402,6 +403,7 @@ class Symbols:
 #
 #  retval  0   Parsed MOD MAP file successfully
 #  retval  1   There is no moduleEntryPoint in modSymbols
+#  retval  2   There is no offset for moduleEntryPoint in 
modSymbols
 #
 def parseModMapFile(self, moduleName, mapFile):
 #
@@ -426,7 +428,7 @@ class Symbols:
 else:
 #MSFT
 #0003:0190   _gComBase  7a50 
SerialPo
-patchMapFileMatchString =  
"^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8}\s+)"
+patchMapFileMatchString =  
"^\s[0-9a-fA-F]{4}:[0-9a-fA-F]{8}\s+(\w+)\s+([0-9a-fA-F]{8,16}\s+)"
 matchKeyGroupIndex = 1
 matchSymbolGroupIndex  = 2
 prefix = ''
@@ -455,7 +457,13 @@ class Symbols:
 continue
 
 if not moduleEntryPoint in modSymbols:
-return 1
+if matchSymbolGroupIndex == 1:
+if not '_ModuleEntryPoint' in modSymbols:
+return 1
+else:
+moduleEntryPoint = "_ModuleEntryPoint"
+else:
+return 1
 
 modEntry = '%s:%s' % (moduleName,moduleEntryPoint)
 if not modEntry in self.dictSymbolAddress:
@@ -498,7 +506,7 @@ class Symbols:
 #
 #  Get current character
 #
-#  retval  elf.string[self.index]
+#  retval  self.string[self.index]
 #  retval  ''   Exception
 #
 def getCurr(self):
-- 
2.30.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77473): https://edk2.groups.io/g/devel/message/77473
Mute This Topic: https://groups.io/mt/83975952/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V2 2/2] UefiPayloadPkg: Assign the length of UniversalPayload ExtraData

2021-07-05 Thread duntan
V1: Assign the length and revision of UniversalPayload ExtraData
V2: Force int to UINT16

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 

Signed-off-by: DunTan 
---
 UefiPayloadPkg/PayloadLoaderPeim/PayloadLoaderPeim.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/UefiPayloadPkg/PayloadLoaderPeim/PayloadLoaderPeim.c 
b/UefiPayloadPkg/PayloadLoaderPeim/PayloadLoaderPeim.c
index c619470dbb..0e25bef516 100644
--- a/UefiPayloadPkg/PayloadLoaderPeim/PayloadLoaderPeim.c
+++ b/UefiPayloadPkg/PayloadLoaderPeim/PayloadLoaderPeim.c
@@ -110,6 +110,8 @@ PeiLoadFileLoadPayload (
sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA) + ExtraDataCount * sizeof 
(UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY)
);
   ExtraData->Count = ExtraDataCount;
+  ExtraData->Header.Revision = UNIVERSAL_PAYLOAD_EXTRA_DATA_REVISION;
+  ExtraData->Header.Length = (UINT16) (sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA) + 
ExtraDataCount * sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY));
   if (ExtraDataCount != 0) {
 for (ExtraDataIndex = 0, Index = 0; Index < Context.ShNum; Index++) {
   Status = GetElfSectionName (, Index, );
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77472): https://edk2.groups.io/g/devel/message/77472
Mute This Topic: https://groups.io/mt/83992081/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V2 0/2] Fix the length and PldHeader for UniversalPayload ExtraData

2021-07-05 Thread duntan
Change PldHeader to Header in ExtraData.h
Assign the length and revision of UniversalPayload ExtraData

duntan (2):
  MdeModulePkg: Change the PldHeader to Header in ExtraData.h
  UefiPayloadPkg: Assign the length of UniversalPayload ExtraData

 MdeModulePkg/Include/UniversalPayload/ExtraData.h| 4 +++-
 UefiPayloadPkg/PayloadLoaderPeim/PayloadLoaderPeim.c | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77470): https://edk2.groups.io/g/devel/message/77470
Mute This Topic: https://groups.io/mt/83992079/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [Patch V2 1/2] MdeModulePkg: Change the PldHeader to Header in ExtraData.h

2021-07-05 Thread duntan
Change the PldHeader to Header in UNIVERSAL_PAYLOAD_EXTRA_DATA
The meaning of Pld is too general

Cc: Zhiguang Liu 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Hao A Wu 
Reviewed-by: Zhiguang Liu 
Acked-by: Hao A Wu 

Signed-off-by: DunTan 
---
 MdeModulePkg/Include/UniversalPayload/ExtraData.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Include/UniversalPayload/ExtraData.h 
b/MdeModulePkg/Include/UniversalPayload/ExtraData.h
index 146ec845f6..1128f5f47b 100644
--- a/MdeModulePkg/Include/UniversalPayload/ExtraData.h
+++ b/MdeModulePkg/Include/UniversalPayload/ExtraData.h
@@ -18,11 +18,13 @@ typedef struct {
 } UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY;
 
 typedef struct {
-  UNIVERSAL_PAYLOAD_GENERIC_HEADER   PldHeader;
+  UNIVERSAL_PAYLOAD_GENERIC_HEADER   Header;
   UINT32 Count;
   UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY Entry[0];
 } UNIVERSAL_PAYLOAD_EXTRA_DATA;
 
 #pragma pack()
 
+#define UNIVERSAL_PAYLOAD_EXTRA_DATA_REVISION 1
+
 #endif
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77471): https://edk2.groups.io/g/devel/message/77471
Mute This Topic: https://groups.io/mt/83992080/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-