Re: [PATCH V8 00/47] Enable Intel TDX in OvmfPkg (Config-A)
Min Xu
On March 15, 2022 11:55 AM, Gao Liming wrote:
Min:Thanks for the comments. In the patch EFI_RESOURCE_MEMORY_UNACCEPTED was defined in MdePkg/Include/Pi/PiHob.h. I check the MdeModulePkg/Include but don't find some proper header files for this definition. Or can we define EFI_RESOURCE_MEMORY_UNACCEPTED in OvmfPkg/Library/PlatformInitLib/IntelTdx.c? In current stage all the unaccepted memory passed from host VMM are all accepted in OvmfPkg/Library/PlatformInitLib/IntelTdx.c. After that these unaccepted memory hob are transferred to private memory hob. So currently EFI_RESOURCE_MEMORY_UNACCEPTED is only seen in above IntelTdx.c. [TDVF] Sec 7.3.1 defines the unaccepted memory resource HOB for DXE phase. But this is for the lazy-accept feature which will be implemented in the future. What's your suggestion? [TDVF] https://www.intel.com/content/dam/develop/external/us/en/documents/tdx-virtual-firmware-design-guide-rev-1.01.pdf Thanks Min |
|
Re: [PATCH v2] MdePkg/AcpiXX.h: Update Error Severity type for Generic Error Status Block
Wu, Hao A
Hello,
toggle quoted message
Show quoted text
Any feedback for the patch? Thanks in advance. Best Regards, Hao Wu -----Original Message----- |
|
Re: [PATCH V8 35/47] MdeModulePkg: Skip setting IA32_ERER.NXE if it has already been set
Wang, Jian J
Reviewed-by: Jian J Wang <jian.j.wang@...>
toggle quoted message
Show quoted text
Regards, Jian -----Original Message----- |
|
Re: [PATCH V8 36/47] MdeModulePkg: Add PcdTdxSharedBitMask
Wang, Jian J
Reviewed-by: Jian J Wang <jian.j.wang@...>
toggle quoted message
Show quoted text
Regards, Jian -----Original Message----- |
|
[edk2-platforms PATCH v1 1/1] BoardModulePkg: Copy device path before processing
Abdul Lateef Attar
GCC compiler puts the DevicePath PCDs to the read-only
section. During boot if try to process the device path after PtrGetPtr it throws a page fault exception. Hence making a local copy using DuplicateDevicePath() to avoid the page fault exception. Cc: Eric Dong <eric.dong@...> Cc: Liming Gao <gaoliming@...> Signed-off-by: Abdul Lateef Attar <abdattar@...> --- Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c index 0bcee7c9a4ba..8700118d255a 100644 --- a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c +++ b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c @@ -3,6 +3,7 @@ implementation instance of the BDS hook library Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> + Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -131,7 +132,7 @@ IsTrustedConsole ( switch (ConsoleType) { case ConIn: - TrustedConsoleDevicepath = PcdGetPtr (PcdTrustedConsoleInputDevicePath); + TrustedConsoleDevicepath = DuplicateDevicePath (PcdGetPtr (PcdTrustedConsoleInputDevicePath)); break; case ConOut: // @@ -147,7 +148,7 @@ IsTrustedConsole ( TempDevicePath = NextDevicePathNode (TempDevicePath); } - TrustedConsoleDevicepath = PcdGetPtr (PcdTrustedConsoleOutputDevicePath); + TrustedConsoleDevicepath = DuplicateDevicePath (PcdGetPtr (PcdTrustedConsoleOutputDevicePath)); break; default: ASSERT (FALSE); @@ -171,7 +172,9 @@ IsTrustedConsole ( } while (TempDevicePath != NULL); FreePool (ConsoleDevice); - + if (TrustedConsoleDevicepath != NULL) { + FreePool (TrustedConsoleDevicepath); + } return FALSE; } @@ -624,7 +627,7 @@ ConnectTrustedStorage ( EFI_STATUS Status; EFI_HANDLE DeviceHandle; - TrustedStorageDevicepath = PcdGetPtr (PcdTrustedStorageDevicePath); + TrustedStorageDevicepath = DuplicateDevicePath (PcdGetPtr (PcdTrustedStorageDevicePath)); DumpDevicePath (L"TrustedStorage", TrustedStorageDevicepath); TempDevicePath = TrustedStorageDevicepath; @@ -649,6 +652,9 @@ ConnectTrustedStorage ( FreePool (Instance); } while (TempDevicePath != NULL); + if (TrustedStorageDevicepath != NULL) { + FreePool (TrustedStorageDevicepath); + } } @@ -1031,7 +1037,7 @@ AddConsoleVariable ( EFI_HANDLE GraphicsControllerHandle; EFI_DEVICE_PATH *GopDevicePath; - TempDevicePath = ConsoleDevicePath; + TempDevicePath = DuplicateDevicePath (ConsoleDevicePath); do { Instance = GetNextDevicePathInstance (&TempDevicePath, &Size); if (Instance == NULL) { @@ -1074,6 +1080,9 @@ AddConsoleVariable ( FreePool (Instance); } while (TempDevicePath != NULL); + if (TempDevicePath != NULL) { + FreePool (TempDevicePath); + } } -- 2.25.1 |
|
[edk2-platforms PATCH v1 0/1] BoardModulePkg: Copy device path
Abdul Lateef Attar
(Resending patch with [edk2-platforms] prefix with correct emailid).
GCC compiler puts the DevicePath PCDs to the read-only section. During boot if try to process the device path after PtrGetPtr it throws a page fault exception. Hence making a local copy using DuplicateDevicePath() to avoid the page fault exception. REF : https://github.com/abdattar/edk2-platforms/tree/BoardModulePkg Cc: Eric Dong <eric.dong@...> Cc: Liming Gao <gaoliming@...> Abdul Lateef Attar (1): BoardModulePkg: Copy device path before processing Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) -- 2.25.1 |
|
回复: [edk2-devel] [PATCH V8 00/47] Enable Intel TDX in OvmfPkg (Config-A)
gaoliming
Min:
toggle quoted message
Show quoted text
As Jiewen mentions, EFI_RESOURCE_MEMORY_UNACCEPTED will be in next public spec. So, it can't be added now. I suggest to add edk2 definition for this type in MdeModulePkg first, such as EDKII_RESOURCE_MEMORY_UNACCEPTED. It can be removed after new spec is published. Thanks Liming -----邮件原件----- |
|
Re: [PATCH v2] IntelFsp2Pkg: BaseFspSwitchStackLib Support for X64
Chiu, Chasel
Thanks Ted for updating patch! Looks good to me.
toggle quoted message
Show quoted text
Reviewed-by: Chasel Chiu <chasel.chiu@...> -----Original Message----- |
|
Re: [PATCH v2] IntelFsp2Pkg: BaseFspDebugLibSerialPort Support for X64
Chiu, Chasel
Thanks Ted for updating patch!
toggle quoted message
Show quoted text
Reviewed-by: Chasel Chiu <chasel.chiu@...> -----Original Message----- |
|
Re: [PATCH edk2-platforms 0/3] JunoPkg: Fix AcpiSsdtRootPci.asl to use spaces and reserve ECAM area
Rebecca Cran
Could someone review this please?
toggle quoted message
Show quoted text
Thanks. Rebecca Cran On 3/4/22 21:19, Rebecca Cran wrote:
I noticed Linux reports a firmware bug with the current Juno ACPI |
|
Re: [PATCH] EmulatorPkg/RedfishPlatformCredentialLib: Check EFI_SECURE_BOOT_MODE_NAME
Nickle Wang
Reviewed-by: Nickle Wang <nickle.wang@...>
toggle quoted message
Show quoted text
Thanks, Nickle -----Original Message-----
From: Chang, Abner (HPS SW/FW Technologist) <abner.chang@...> Sent: Thursday, March 10, 2022 1:42 PM To: devel@edk2.groups.io Cc: Wang, Nickle (Server BIOS) <nickle.wang@...>; Andrew Fish <afish@...>; Ray Ni <ray.ni@...> Subject: [PATCH] EmulatorPkg/RedfishPlatformCredentialLib: Check EFI_SECURE_BOOT_MODE_NAME Check EFI_SECURE_BOOT_MODE_NAME before setting the flags to prohibit acquiring Redfish service credential and using Redfish service. Signed-off-by: Abner Chang <abner.chang@...> Cc: Nickle Wang <nickle.wang@...> Cc: Andrew Fish <afish@...> Cc: Ray Ni <ray.ni@...> --- .../RedfishPlatformCredentialLib.c | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c index eaf9c56450..a0233a984d 100644 --- a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c +++ b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c @@ -165,6 +165,9 @@ LibStopRedfishService ( IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE ServiceStopType ) { + EFI_STATUS Status; + UINT8 *SecureBootVar; + if (ServiceStopType >= ServiceStopTypeMax) { return EFI_INVALID_PARAMETER; } @@ -177,8 +180,18 @@ LibStopRedfishService ( if (!PcdGetBool (PcdRedfishServieStopIfSecureBootDisabled)) { return EFI_UNSUPPORTED; } else { - mStopRedfishService = TRUE; - DEBUG ((DEBUG_INFO, "EFI Redfish service is stopped due to SecureBoot is disabled!!\n")); + // + // Check Secure Boot status and lock Redfish service if Secure Boot is disabled. + // + Status = GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid, (VOID **)&SecureBootVar, NULL); + if (EFI_ERROR (Status) || (*SecureBootVar != SECURE_BOOT_MODE_ENABLE)) { + // + // Secure Boot is disabled + // + mSecureBootDisabled = TRUE; + mStopRedfishService = TRUE; + DEBUG ((DEBUG_INFO, "EFI Redfish service is stopped due to SecureBoot is disabled!!\n")); + } } } else if (ServiceStopType == ServiceStopTypeExitBootService) { // @@ -224,18 +237,5 @@ LibCredentialEndOfDxeNotify ( IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This ) { - EFI_STATUS Status; - UINT8 *SecureBootVar; - - // - // Check Secure Boot status and lock Redfish service if Secure Boot is disabled. - // - Status = GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableGuid, (VOID **)&SecureBootVar, NULL); - if (EFI_ERROR (Status) || (*SecureBootVar != SECURE_BOOT_MODE_ENABLE)) { - // - // Secure Boot is disabled - // - mSecureBootDisabled = TRUE; - LibStopRedfishService (This, ServiceStopTypeSecureBootDisabled); - } + LibStopRedfishService (This, ServiceStopTypeSecureBootDisabled); } -- 2.17.1 |
|
Event: TianoCore Bug Triage - APAC / NAMO - 03/15/2022
#cal-reminder
devel@edk2.groups.io Calendar <noreply@...>
Reminder: TianoCore Bug Triage - APAC / NAMO When: Where: Organizer: Liming Gao gaoliming@... 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 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# |
|
Re: [PATCH v2] BaseTools/GenFw: Enhance GenFw to support PRM GCC build
Bob Feng
Created a PR: https://github.com/tianocore/edk2/pull/2622
toggle quoted message
Show quoted text
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob Feng Sent: Monday, March 14, 2022 2:45 PM To: Huang, Li-Xia <lisa.huang@...>; devel@edk2.groups.io Cc: Gao, Liming <gaoliming@...>; Chen, Christine <yuwei.chen@...> Subject: Re: [edk2-devel] [PATCH v2] BaseTools/GenFw: Enhance GenFw to support PRM GCC build This patch looks good to me. Reviewed-by: Bob Feng <bob.c.feng@...> -----Original Message----- From: Huang, Li-Xia <lisa.huang@...> Sent: Monday, March 14, 2022 1:27 PM To: devel@edk2.groups.io Cc: Huang, Li-Xia <lisa.huang@...>; Gao, Liming <gaoliming@...>; Feng, Bob C <bob.c.feng@...>; Chen, Christine <yuwei.chen@...> Subject: [edk2-devel] [PATCH v2] BaseTools/GenFw: Enhance GenFw to support PRM GCC build REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3802 Since PRM module needs to support export table in PE-COFF, we'll enhance GenFw tool to support this. Add one export flag in GenFw tool. If export flag is set: Step1: Scan ELF symbol table based on PRM module descriptor to get descriptor offset address; Step2: Find PRM handlers number and name in COFF file based on the address from step1; Step3: Write PRM info such as handler name and export RVA into COFF export table. PRM option currently only supports DXE RUNTIME driver and X64 arch. Cc: Liming Gao <gaoliming@...> Cc: Bob Feng <bob.c.feng@...> Cc: Yuwei Chen <yuwei.chen@...> Signed-off-by: Lixia Huang <lisa.huang@...> --- BaseTools/Source/C/GenFw/Elf64Convert.c | 242 +++++++++++++++++- BaseTools/Source/C/GenFw/ElfConvert.c | 8 + BaseTools/Source/C/GenFw/ElfConvert.h | 43 +++- BaseTools/Source/C/GenFw/GenFw.c | 20 +- .../C/Include/IndustryStandard/PeImage.h | 7 + 5 files changed, 315 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c index 0bb3ead228..2aa9bfcc94 100644 --- a/BaseTools/Source/C/GenFw/Elf64Convert.c +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c @@ -56,6 +56,12 @@ WriteDebug64 ( VOID ); +STATIC+VOID+WriteExport64 (+ VOID+ );+ STATIC VOID SetImageSize64 (@@ -106,7 +112,7 @@ STATIC UINT32 mCoffAlignment = 0x20; // // PE section alignment. //-STATIC const UINT16 mCoffNbrSections = 4;+STATIC UINT16 mCoffNbrSections = 4; // // ELF sections to offset in Coff file.@@ -122,7 +128,7 @@ STATIC UINT32 mDataOffset; STATIC UINT32 mHiiRsrcOffset; STATIC UINT32 mRelocOffset; STATIC UINT32 mDebugOffset;-+STATIC UINT32 mExportOffset; // // Used for RISC-V relocations. //@@ -132,6 +138,14 @@ STATIC Elf64_Half mRiscVPass1SymSecIndex = 0; STATIC INT32 mRiscVPass1Offset; STATIC INT32 mRiscVPass1GotFixup; +//+// Used for Export section.+//+STATIC UINT32 mExportSize;+STATIC UINT32 mExportRVA[PRM_MODULE_EXPORT_SYMBOL_NUM];+STATIC UINT32 mExportSymNum;+STATIC CHAR8 mExportSymName[PRM_MODULE_EXPORT_SYMBOL_NUM][PRM_HANDLER_NAME_MAXIMUM_LENGTH];+ // // Initialization Function //@@ -171,6 +185,13 @@ InitializeElf64 ( return FALSE; } + if (mExportFlag) {+ if (mEhdr->e_machine != EM_X86_64) {+ Error (NULL, 0, 3000, "Unsupported", "--prm option currently only supports X64 arch.");+ return FALSE;+ }+ }+ // // Update section header pointers //@@ -200,6 +221,11 @@ InitializeElf64 ( ElfFunctions->SetImageSize = SetImageSize64; ElfFunctions->CleanUp = CleanUp64; + if (mExportFlag) {+ mCoffNbrSections ++;+ ElfFunctions->WriteExport = WriteExport64;+ }+ return TRUE; } @@ -263,6 +289,17 @@ IsHiiRsrcShdr ( return (BOOLEAN) (strcmp((CHAR8*)mEhdr + Namedr->sh_offset + Shdr->sh_name, ELF_HII_SECTION_NAME) == 0); } +STATIC+BOOLEAN+IsSymbolShdr (+ Elf_Shdr *Shdr+ )+{+ Elf_Shdr *Namehdr = GetShdrByIndex(mEhdr->e_shstrndx);++ return (BOOLEAN) (strcmp((CHAR8*)mEhdr + Namehdr->sh_offset + Shdr->sh_name, ELF_SYMBOL_SECTION_NAME) == 0);+}+ STATIC BOOLEAN IsDataShdr (@@ -335,6 +372,37 @@ GetSymName ( return StrtabContents + Sym->st_name; } +//+// Get Prm Handler number and name+//+STATIC+VOID+FindPrmHandler (+ UINT64 Offset+ )+{+ PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER *PrmExport;+ PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT *PrmHandler;+ UINT32 HandlerNum;++ PrmExport = (PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER*)((UINT8*)mEhdr + Offset);+ PrmHandler = (PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT *)(PrmExport + 1);++ for (HandlerNum = 0; HandlerNum < PrmExport->NumberPrmHandlers; HandlerNum++) {+ strcpy(mExportSymName[mExportSymNum], PrmHandler->PrmHandlerName);+ mExportSymNum ++;+ PrmHandler += 1;++ //+ // Check if PRM handler number is larger than (PRM_MODULE_EXPORT_SYMBOL_NUM - 1)+ //+ if (mExportSymNum >= (PRM_MODULE_EXPORT_SYMBOL_NUM - 1)) {+ Error (NULL, 0, 3000, "Invalid", "FindPrmHandler: Number %u is too high.", mExportSymNum);+ exit(EXIT_FAILURE);+ }+ }+}+ // // Find the ELF section hosting the GOT from an ELF Rva // of a single GOT entry. Normally, GOT is placed in@@ -717,6 +785,7 @@ ScanSections64 ( UINT32 CoffEntry; UINT32 SectionCount; BOOLEAN FoundSection;+ UINT32 Offset; CoffEntry = 0; mCoffOffset = 0;@@ -880,6 +949,82 @@ ScanSections64 ( Warning (NULL, 0, 0, NULL, "Multiple sections in %s are merged into 1 data section. Source level debug might not work correctly.", mInImageName); } + //+ // The Symbol sections.+ //+ if (mExportFlag) {+ UINT32 SymIndex;+ Elf_Sym *Sym;+ UINT64 SymNum;+ const UINT8 *SymName;++ mExportOffset = mCoffOffset;+ mExportSize = sizeof(EFI_IMAGE_EXPORT_DIRECTORY) + strlen(mInImageName) + 1;++ for (i = 0; i < mEhdr->e_shnum; i++) {++ //+ // Determine if this is a symbol section.+ //+ Elf_Shdr *shdr = GetShdrByIndex(i);+ if (!IsSymbolShdr(shdr)) {+ continue;+ }++ UINT8 *Symtab = (UINT8*)mEhdr + shdr->sh_offset;+ SymNum = (shdr->sh_size) / (shdr->sh_entsize);++ //+ // First Get PrmModuleExportDescriptor+ //+ for (SymIndex = 0; SymIndex < SymNum; SymIndex++) {+ Sym = (Elf_Sym *)(Symtab + SymIndex * shdr->sh_entsize);+ SymName = GetSymName(Sym);+ if (SymName == NULL) {+ continue;+ }++ if (strcmp((CHAR8*)SymName, PRM_MODULE_EXPORT_DESCRIPTOR_NAME) == 0) {+ //+ // Find PrmHandler Number and Name+ //+ FindPrmHandler(Sym->st_value);++ strcpy(mExportSymName[mExportSymNum], (CHAR8*)SymName);+ mExportRVA[mExportSymNum] = (UINT32)(Sym->st_value);+ mExportSize += 2 * EFI_IMAGE_EXPORT_ADDR_SIZE + EFI_IMAGE_EXPORT_ORDINAL_SIZE + strlen((CHAR8 *)SymName) + 1;+ mExportSymNum ++;+ break;+ }+ }++ //+ // Second Get PrmHandler+ //+ for (SymIndex = 0; SymIndex < SymNum; SymIndex++) {+ UINT32 ExpIndex;+ Sym = (Elf_Sym *)(Symtab + SymIndex * shdr->sh_entsize);+ SymName = GetSymName(Sym);+ if (SymName == NULL) {+ continue;+ }++ for (ExpIndex = 0; ExpIndex < (mExportSymNum -1); ExpIndex++) {+ if (strcmp((CHAR8*)SymName, mExportSymName[ExpIndex]) != 0) {+ continue;+ }+ mExportRVA[ExpIndex] = (UINT32)(Sym->st_value);+ mExportSize += 2 * EFI_IMAGE_EXPORT_ADDR_SIZE + EFI_IMAGE_EXPORT_ORDINAL_SIZE + strlen((CHAR8 *)SymName) + 1;+ }+ }++ break;+ }++ mCoffOffset += mExportSize;+ mCoffOffset = CoffAlign(mCoffOffset);+ }+ // // The HII resource sections. //@@ -989,8 +1134,17 @@ ScanSections64 ( NtHdr->Pe32Plus.FileHeader.NumberOfSections--; } + //+ // If found symbol, add edata section between data and rsrc section+ //+ if(mExportFlag) {+ Offset = mExportOffset;+ } else {+ Offset = mHiiRsrcOffset;+ }+ if ((mHiiRsrcOffset - mDataOffset) > 0) {- CreateSectionHeader (".data", mDataOffset, mHiiRsrcOffset - mDataOffset,+ CreateSectionHeader (".data", mDataOffset, Offset - mDataOffset, EFI_IMAGE_SCN_CNT_INITIALIZED_DATA | EFI_IMAGE_SCN_MEM_WRITE | EFI_IMAGE_SCN_MEM_READ);@@ -999,6 +1153,20 @@ ScanSections64 ( NtHdr->Pe32Plus.FileHeader.NumberOfSections--; } + if(mExportFlag) {+ if ((mHiiRsrcOffset - mExportOffset) > 0) {+ CreateSectionHeader (".edata", mExportOffset, mHiiRsrcOffset - mExportOffset,+ EFI_IMAGE_SCN_CNT_INITIALIZED_DATA+ | EFI_IMAGE_SCN_MEM_READ);+ NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT].Size = mHiiRsrcOffset - mExportOffset;+ NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress = mExportOffset;++ } else {+ // Don't make a section of size 0.+ NtHdr->Pe32Plus.FileHeader.NumberOfSections--;+ }+ }+ if ((mRelocOffset - mHiiRsrcOffset) > 0) { CreateSectionHeader (".rsrc", mHiiRsrcOffset, mRelocOffset - mHiiRsrcOffset, EFI_IMAGE_SCN_CNT_INITIALIZED_DATA@@ -1757,4 +1925,72 @@ CleanUp64 ( } } +STATIC+VOID+WriteExport64 (+ VOID+ )+{+ EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;+ EFI_IMAGE_EXPORT_DIRECTORY *ExportDir;+ EFI_IMAGE_DATA_DIRECTORY *DataDir;+ UINT32 FileNameOffset;+ UINT32 NameOffset;+ UINT16 Index;+ UINT8 *Tdata = NULL;++ ExportDir = (EFI_IMAGE_EXPORT_DIRECTORY*)(mCoffFile + mExportOffset);+ ExportDir->Characteristics = 0;+ ExportDir->TimeDateStamp = 0;+ ExportDir->MajorVersion = 0;+ ExportDir->MinorVersion =0;+ ExportDir->Name = 0;+ ExportDir->NumberOfFunctions = mExportSymNum;+ ExportDir->NumberOfNames = mExportSymNum;+ ExportDir->Base = EFI_IMAGE_EXPORT_ORDINAL_BASE;+ ExportDir->AddressOfFunctions = mExportOffset + sizeof(EFI_IMAGE_EXPORT_DIRECTORY);+ ExportDir->AddressOfNames = ExportDir->AddressOfFunctions + EFI_IMAGE_EXPORT_ADDR_SIZE * mExportSymNum;+ ExportDir->AddressOfNameOrdinals = ExportDir->AddressOfNames + EFI_IMAGE_EXPORT_ADDR_SIZE * mExportSymNum;++ FileNameOffset = ExportDir->AddressOfNameOrdinals + EFI_IMAGE_EXPORT_ORDINAL_SIZE * mExportSymNum;+ NameOffset = FileNameOffset + strlen(mInImageName) + 1;++ // Write Input image Name RVA+ ExportDir->Name = FileNameOffset;++ // Write Input image Name+ strcpy((char *)(mCoffFile + FileNameOffset), mInImageName);++ for (Index = 0; Index < mExportSymNum; Index++) {+ //+ // Write Export Address Table+ //+ Tdata = mCoffFile + ExportDir->AddressOfFunctions + Index * EFI_IMAGE_EXPORT_ADDR_SIZE;+ *(UINT32 *)Tdata = mExportRVA[Index];++ //+ // Write Export Name Pointer Table+ //+ Tdata = mCoffFile + ExportDir->AddressOfNames + Index * EFI_IMAGE_EXPORT_ADDR_SIZE;+ *(UINT32 *)Tdata = NameOffset;++ //+ // Write Export Ordinal table+ //+ Tdata = mCoffFile + ExportDir->AddressOfNameOrdinals + Index * EFI_IMAGE_EXPORT_ORDINAL_SIZE;+ *(UINT16 *)Tdata = Index;++ //+ // Write Export Name Table+ //+ strcpy((char *)(mCoffFile + NameOffset), mExportSymName[Index]);+ NameOffset += strlen(mExportSymName[Index]) + 1;+ }++ NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset);+ DataDir = &NtHdr->Pe32Plus.OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT];+ DataDir->VirtualAddress = mExportOffset;+ DataDir->Size = mExportSize;++} diff --git a/BaseTools/Source/C/GenFw/ElfConvert.c b/BaseTools/Source/C/GenFw/ElfConvert.c index 7db8721167..be98544056 100644 --- a/BaseTools/Source/C/GenFw/ElfConvert.c +++ b/BaseTools/Source/C/GenFw/ElfConvert.c @@ -223,6 +223,14 @@ ConvertElf ( VerboseMsg ("Write debug info."); ElfFunctions.WriteDebug (); + //+ // For PRM Driver to Write export info.+ //+ if (mExportFlag) {+ VerboseMsg ("Write export info.");+ ElfFunctions.WriteExport ();+ }+ // // Make sure image size is correct before returning the new image. //diff --git a/BaseTools/Source/C/GenFw/ElfConvert.h b/BaseTools/Source/C/GenFw/ElfConvert.h index 801e8de4a2..6ab4605227 100644 --- a/BaseTools/Source/C/GenFw/ElfConvert.h +++ b/BaseTools/Source/C/GenFw/ElfConvert.h @@ -24,6 +24,7 @@ extern UINT8 *mCoffFile; extern UINT32 mTableOffset; extern UINT32 mOutImageType; extern UINT32 mFileBufferSize;+extern BOOLEAN mExportFlag; // // Common EFI specific data.@@ -31,6 +32,44 @@ extern UINT32 mFileBufferSize; #define ELF_HII_SECTION_NAME ".hii" #define ELF_STRTAB_SECTION_NAME ".strtab" #define MAX_COFF_ALIGNMENT 0x10000+#define ELF_SYMBOL_SECTION_NAME ".symtab"++//+// Platform Runtime Mechanism (PRM) specific data.+//+#define PRM_MODULE_EXPORT_SYMBOL_NUM 256++// <to-do> to include PRM header directly once PrmPkg is in main repo+#define PRM_HANDLER_NAME_MAXIMUM_LENGTH 128++#define PRM_MODULE_EXPORT_DESCRIPTOR_NAME "PrmModuleExportDescriptor"+#define PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE SIGNATURE_64 ('P', 'R', 'M', '_', 'M', 'E', 'D', 'T')+#define PRM_MODULE_EXPORT_REVISION 0x0++//+// Platform Runtime Mechanism (PRM) Export Descriptor Structures+//+#pragma pack(push, 1)++typedef struct {+ EFI_GUID PrmHandlerGuid;+ CHAR8 PrmHandlerName[PRM_HANDLER_NAME_MAXIMUM_LENGTH];+} PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT;++typedef struct {+ UINT64 Signature;+ UINT16 Revision;+ UINT16 NumberPrmHandlers;+ EFI_GUID PlatformGuid;+ EFI_GUID ModuleGuid;+} PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER;++typedef struct {+ PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER Header;+ PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT PrmHandlerExportDescriptors[1];+} PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT;++#pragma pack(pop) // // Filter Types@@ -38,7 +77,8 @@ extern UINT32 mFileBufferSize; typedef enum { SECTION_TEXT, SECTION_HII,- SECTION_DATA+ SECTION_DATA,+ SECTION_SYMBOL } SECTION_FILTER_TYPES; @@ -50,6 +90,7 @@ typedef struct { BOOLEAN (*WriteSections) (SECTION_FILTER_TYPES FilterType); VOID (*WriteRelocations) (); VOID (*WriteDebug) ();+ VOID (*WriteExport) (); VOID (*SetImageSize) (); VOID (*CleanUp) (); diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c index 8cab70ba4d..6f61f16788 100644 --- a/BaseTools/Source/C/GenFw/GenFw.c +++ b/BaseTools/Source/C/GenFw/GenFw.c @@ -87,7 +87,7 @@ UINT32 mImageTimeStamp = 0; UINT32 mImageSize = 0; UINT32 mOutImageType = FW_DUMMY_IMAGE; BOOLEAN mIsConvertXip = FALSE;-+BOOLEAN mExportFlag = FALSE; STATIC EFI_STATUS@@ -279,6 +279,10 @@ Returns: except for -o or -r option. It is a action option.\n\ If it is combined with other action options, the later\n\ input action option will override the previous one.\n");+ fprintf (stdout, " --prm Scan symbol section from ELF image and \n\+ write export table into PE-COFF.\n\+ This option can be used together with -e.\n\+ It doesn't work for other options.\n"); fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n"); fprintf (stdout, " -q, --quiet Disable all messages except key message and fatal error\n"); fprintf (stdout, " -d, --debug level Enable debug messages, at input debug level.\n");@@ -1436,6 +1440,20 @@ Returns: continue; } + if (stricmp (argv[0], "--prm") == 0) {+ if (stricmp (ModuleType, "DXE_RUNTIME_DRIVER") != 0 ){+ Error (NULL, 0, 1001, "Invalid", "--prm option only supports DXE RUNTIME driver.");+ goto Finish;+ }++ if (!mExportFlag) {+ mExportFlag = TRUE;+ }+ argc --;+ argv ++;+ continue;+ }+ if (argv[0][0] == '-') { Error (NULL, 0, 1000, "Unknown option", argv[0]); goto Finish;diff --git a/BaseTools/Source/C/Include/IndustryStandard/PeImage.h b/BaseTools/Source/C/Include/IndustryStandard/PeImage.h index f17b8ee19b..21c968e650 100644 --- a/BaseTools/Source/C/Include/IndustryStandard/PeImage.h +++ b/BaseTools/Source/C/Include/IndustryStandard/PeImage.h @@ -571,6 +571,13 @@ typedef struct { UINT32 AddressOfNameOrdinals; } EFI_IMAGE_EXPORT_DIRECTORY; +//+// Based export types.+//+#define EFI_IMAGE_EXPORT_ORDINAL_BASE 1+#define EFI_IMAGE_EXPORT_ADDR_SIZE 4+#define EFI_IMAGE_EXPORT_ORDINAL_SIZE 2+ /// /// DLL support. /// Import Format-- 2.26.2.windows.1 |
|
Now: Tools, CI, Code base construction meeting series - 03/14/2022
#cal-notice
devel@edk2.groups.io Calendar <noreply@...>
Tools, CI, Code base construction meeting series When: Where: Description: TianoCore community, Microsoft and Intel will be hosting a series of open meetings to discuss build, CI, tools, and other related topics. If you are interested, have ideas/opinions please join us. These meetings will be Monday 4:30pm Pacific Time on Microsoft Teams. MS Teams Link in following discussion: * https://github.com/tianocore/edk2/discussions/2614 Anyone is welcome to join.
MS Teams Browser Clients * https://docs.microsoft.com/en-us/microsoftteams/get-clients?tabs=Windows#browser-client |
|
Re: [edk2-platforms][PATCH V1 1/1] WhitleyOpenBoardPkg/JunctionCity: Build ACPI content
Isaac/Nate :
Extracted the patch (refer the attached patch) from this email. When trying to apply the patch on latest edk2-platform (7cd51aa3c1ee601e0bf56d34dcf0533334c38997), we are seeing patch apply failure. It says conflict at line number 39 or 26 based on the patch command used.
Please let us know EDKII-Platform commit you used for creating the patch ? Also, let us know which EDKII tag used by you to build the source ?
Thank you
-Manic
-----Original Message-----
From: Isaac Oram <isaac.w.oram@...> Sent: Friday, March 11, 2022 6:31 PM To: devel@edk2.groups.io Cc: Nate DeSimone <nathaniel.l.desimone@...>; Chasel Chiu <chasel.chiu@...>; Manickavasakam Karpagavinayagam <manickavasakamk@...> Subject: [EXTERNAL] [edk2-devel][edk2-platforms][PATCH V1 1/1] WhitleyOpenBoardPkg/JunctionCity: Build ACPI content
**CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**
Use source versions of AcpiTables, AcpiPlatform, and StaticSkuDataDxe.
Cc: Nate DeSimone <nathaniel.l.desimone@...> Cc: Chasel Chiu <chasel.chiu@...> Cc: Manickavasakam Karpagavinayagam <manickavasakamk@...> Signed-off-by: Isaac Oram <isaac.w.oram@...> --- Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/PlatformPkg.fdf | 3 + Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_board.py | 63 ++++++++++++++++++++ Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_config.cfg | 15 +++++ 3 files changed, 81 insertions(+)
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/PlatformPkg.fdf b/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/PlatformPkg.fdf index 0b919b5ea9..b72aa2b688 100644 --- a/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/PlatformPkg.fdf +++ b/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/PlatformPkg.fdf @@ -601,6 +601,7 @@ SET gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize = 0x01000000 # UBA DXE common and board specific components # !include WhitleyOpenBoardPkg/Uba/UbaDxeCommon.fdf + INF $(RP_PKG)/Uba/UbaMain/StaticSkuDataDxe/StaticSkuDataDxe.inf INF $(RP_PKG)/$(BOARD_NAME)/Uba/TypeJunctionCity/Dxe/UsbOcUpdateDxe/UsbOcUpdateDxe.inf INF $(RP_PKG)/$(BOARD_NAME)/Uba/TypeJunctionCity/Dxe/IioCfgUpdateDxe/IioCfgUpdateDxe.inf INF $(RP_PKG)/$(BOARD_NAME)/Uba/TypeJunctionCity/Dxe/SlotDataUpdateDxe/SlotDataUpdateDxe.inf @@ -682,6 +683,8 @@ SET gMinPlatformPkgTokenSpaceGuid.PcdFlashAreaSize = 0x01000000 INF BoardModulePkg/LegacySioDxe/LegacySioDxe.inf INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+ INF RuleOverride = ACPITABLE + WhitleyOpenBoardPkg/Features/Acpi/AcpiTables/AcpiTables10nm.inf + INF WhitleyOpenBoardPkg/Features/Acpi/AcpiPlatform/AcpiPlatform.inf INF WhitleyOpenBoardPkg/Features/AcpiVtd/AcpiVtd.inf INF MinPlatformPkg/Acpi/AcpiSmm/AcpiSmm.inf
diff --git a/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_board.py b/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_board.py index 33698f9809..72d0c5089a 100644 --- a/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_board.py +++ b/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_board.py @@ -25,6 +25,7 @@ def pre_build_ex(config, functions): :returns: nothing """ print("pre_build_ex") + config["BUILD_DIR_PATH"] = os.path.join(config["WORKSPACE"], 'Build', config["PLATFORM_BOARD_PACKAGE"], @@ -55,6 +56,68 @@ def pre_build_ex(config, functions):
if config.get("API_MODE_FSP_WRAPPER_BUILD", "FALSE") == "TRUE": raise ValueError("FSP API Mode is currently unsupported on Ice Lake Xeon Scalable") + + # Build the ACPI AML offset table *.offset.h + print("Info: re-generating PlatformOffset header files") + + execute_script = functions.get("execute_script") + + command = ["build", "-D", "MAX_SOCKET=" + config["MAX_SOCKET"]] + + if config["EXT_BUILD_FLAGS"] and config["EXT_BUILD_FLAGS"] != "": + ext_build_flags = config["EXT_BUILD_FLAGS"].split(" ") + ext_build_flags = [x.strip() for x in ext_build_flags] + ext_build_flags = [x for x in ext_build_flags if x != ""] + command.extend(ext_build_flags) + + aml_offsets_split = os.path.split(os.path.normpath(config["AML_OFFSETS_PATH"])) + command.append("-p") + command.append(os.path.normpath(config["AML_OFFSETS_PATH"]) + '.dsc') + command.append("-m") + command.append(os.path.join(aml_offsets_split[0], aml_offsets_split[1], aml_offsets_split[1] + '.inf')) + command.append("-y") + command.append(os.path.join(config["WORKSPACE"], "PreBuildReport.txt")) + command.append("--log=" + os.path.join(config["WORKSPACE"], + "PreBuild.log")) + + _, _, _, code = execute_script(command, config) + if code != 0: + print(" ".join(command)) + print("Error re-generating PlatformOffset header files") + sys.exit(1) + + # Build AmlGenOffset command to consume the *.offset.h and produce AmlOffsetTable.c for StaticSkuDataDxe use. + + # Get destination path and filename from config + relative_file_path = os.path.normpath(config["STRIPPED_AML_OFFSETS_FILE_PATH"]) # get path relative to Platform/Intel + out_file_path = os.path.join(config["WORKSPACE_PLATFORM"], relative_file_path) # full path to output file + out_file_dir = os.path.dirname(out_file_path) # remove filename + + out_file_root_ext = os.path.splitext(os.path.basename(out_file_path)) # root and extension of output file + + # Get relative path for the generated offset.h file + relative_dsdt_file_path = os.path.normpath(config["DSDT_TABLE_FILE_PATH"]) # path relative to Platform/Intel + dsdt_file_root_ext = os.path.splitext(os.path.basename(relative_dsdt_file_path)) # root and extension of generated offset.h file + + # Generate output directory if it doesn't exist + if not os.path.exists(out_file_dir): + os.mkdir(out_file_dir) + + command = ["python", + os.path.join(config["MIN_PACKAGE_TOOLS"], "AmlGenOffset", "AmlGenOffset.py"), + "-d", "--aml_filter", config["AML_FILTER"], + "-o", out_file_path, + os.path.join(config["BUILD_X64"], aml_offsets_split[0], + aml_offsets_split[1], aml_offsets_split[1], "OUTPUT", + os.path.dirname(relative_dsdt_file_path), dsdt_file_root_ext[0] + + ".offset.h")] + + # execute the command + _, _, _, code = execute_script(command, config) + if code != 0: + print(" ".join(command)) + print("Error re-generating PlatformOffset header files") + sys.exit(1) + + print("GenOffset done") + + return None
def _merge_files(files, ofile): diff --git a/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_config.cfg b/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_config.cfg index 8744e9072c..3b66995128 100644 --- a/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_config.cfg +++ b/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_config.cfg @@ -35,3 +35,18 @@ FSP_BINARY_BUILD = FALSE FSP_TEST_RELEASE = FALSE SECURE_BOOT_ENABLE = FALSE BIOS_INFO_GUID = 4A4CA1C6-871C-45BB-8801-6910A7AA5807 + +# +# AML offset table generation configuration options # All paths should +use / and be relative to edk2-platforms/Platform/Intel # +# AML_FILTER - AML filter is used to strip out unused AML offset data +# AML_OFFSETS_PATH - Path to INF file that builds AML offsets C source file +# The directory name, DSC file name, INF file name, and BASE_NAME must match identically +# DSDT_TABLE_FILE_PATH - Path to DSDT ASL file for the board +# STRIPPED_AML_OFFSETS_FILE_PATH - Target AML offset data file +consumed by UBA driver # AML_FILTER = \"PSYS\" .\.DRVT\" +.\.FIX[0-9,A-Z] BBI[0] BBU[0] CRCM BAR0 .\.CCT[0-9A-Z]\" +.\.CFH[0-9A-Z]\" .\.FXCD\" .\.FXST\" .\.FXIN\" .\.FXOU\" .\.FXBS\" +.\.FXFH\" .\.CENA\" .\.DRVT\" .\.CFIS\" {NULL }; AML_OFFSETS_PATH = +WhitleyOpenBoardPkg/WilsonCityRvp/AmlOffsets +DSDT_TABLE_FILE_PATH = +WhitleyOpenBoardPkg/Features/Acpi/AcpiTables/Dsdt/EPRPPlatform10nm.asl +STRIPPED_AML_OFFSETS_FILE_PATH = +WhitleyOpenBoardPkg/Uba/UbaMain/StaticSkuDataDxe/AmlOffsetTable.c -- 2.27.0.windows.1 -The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. |
|
Re: [edk2-platforms PATCH] Marvell/SolidRun: Rework Readme.md files
Sunny Wang
Looks good. Thanks much, Marcin.
toggle quoted message
Show quoted text
This will be helpful as http://wiki.macchiatobin.net/tiki-index.php has been not accessible for quite a while. Reviewed-by: Sunny Wang <sunny.wang@...> Best Regards, Sunny -----Original Message-----
From: Marcin Wojtas <mw@...> Sent: 14 March 2022 12:06 To: devel@edk2.groups.io Cc: quic_llindhol@...; ardb+tianocore@...; jaz@...; gjb@...; Sunny Wang <Sunny.Wang@...>; Marcin Wojtas <mw@...> Subject: [edk2-platforms PATCH] Marvell/SolidRun: Rework Readme.md files From: Grzegorz Bernacki <gjb@...> This patch reworks Readme.md files of Marvell and SolidRun platforms as follows: * Add supported features list. * Leave minmal EDK2 build command. * Add 'NOTE' box about INCLUDE_TFTP_COMMAND build flag. * Move full firmware image build/burn howtos to external wiki pages. * Add links and update paragraphs. Signed-off-by: Marcin Wojtas <mw@...> --- In order to ease review/merge the patch is available in a public repository: https://github.com/Semihalf/edk2-platforms/commits/marvell-howtos-upstream-r20220314 Platform/Marvell/Cn913xDb/Readme.md | 104 +++++++----------- Platform/SolidRun/Armada80x0McBin/Readme.md | 113 ++++++++------------ Platform/SolidRun/Cn913xCEx7Eval/Readme.md | 109 ++++++++----------- 3 files changed, 124 insertions(+), 202 deletions(-) diff --git a/Platform/Marvell/Cn913xDb/Readme.md b/Platform/Marvell/Cn913xDb/Readme.md index ecdb78302b..0b2ab676f8 100644 --- a/Platform/Marvell/Cn913xDb/Readme.md +++ b/Platform/Marvell/Cn913xDb/Readme.md @@ -5,93 +5,65 @@ This is a port of 64-bit TianoCore EDK II firmware for the Marvell CN913x Development Board. -# Building the firmware - -## Prepare toolchain (for cross-compilation only): - -1. Download the toolchain: - - ``` - wget https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz - ``` +# Supported features -1. After extracting, setup the path and compiler prefix to GCC5\_AARCH64\_PREFIX variable: +Features supported in EDK2: - ``` - export GCC5_AARCH64_PREFIX=<toolchain_path>/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- - ``` +* 1x PCIE root complex +* Networking: + * 3x 10 GbE via SFP+ + * 2x 1 GbE RGMII via RJ45 +* 5x USB 2.0/3.0 +* 3x SATA +* 2x uSD +* 1x eMMC +* RTC +* SPI flash & memory-mapped variable storage access +* I2C +* GPIO -## Prepare prerequisites +Hardware description: -1. Create a new folder (directory) on your local development machine - for use as your workspace. This example uses `/work/git/tianocore`, modify as - appropriate for your needs. +* ACPI (default) +* Device Tree - ``` - $ export WORKSPACE=/work/git/tianocore - $ mkdir -p $WORKSPACE - $ cd $WORKSPACE - ``` +Others: -1. Clone the Trusted Firmware repository: +* Signed capsule update +* X64 option ROM emulator - ``` - $ cd ${WORKSPACE} - $ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git - ``` -1. Clone repository for auxiliary firmware on the SoC co-processors and checkout to binaries-marvell-armada-SDK10.0.1.0: - - ``` - $ cd ${WORKSPACE} - $ git clone https://github.com/MarvellEmbeddedProcessors/binaries-marvell.git - $ cd binaries-marvell/ - $ git checkout -b binaries-marvell-armada-SDK10.0.1.0 origin/binaries-marvell-armada-SDK10.0.1.0 - ``` -1. Clone the DDR training code from: +# Building the firmware - ``` - $ cd ${WORKSPACE} - $ git clone https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git - ``` ## Prepare EDKII environment: -Please follow instructions from "Obtaining source code" and "Manual building" from the top level edk2-platforms [Readme.md](https://github.com/tianocore/edk2-platforms#readme). +Please follow instructions from [Obtaining source code](https://github.com/tianocore/edk2-platforms#obtaining-source-code) +and [Manual building](https://github.com/tianocore/edk2-platforms#manual-building) from the +top level edk2-platforms [Readme.md](https://github.com/tianocore/edk2-platforms#readme). ## Build EDKII: -1. Use below build command: +Use below build command: - ``` - $ cd ${WORKSPACE} - $ build -a AARCH64 -t GCC5 -b RELEASE -D CN9132 -D INCLUDE_TFTP_COMMAND -D CAPSULE_ENABLE -p Platform/Marvell/Cn913xDb/Cn913xDbA.dsc - ``` + ``` + $ build -a AARCH64 -t GCC5 -b RELEASE -D CN9132 -D CAPSULE_ENABLE -D X64EMU_ENABLE -p Platform/Marvell/Cn913xDb/Cn913xDbA.dsc + ``` -## Build the final firmware image: +--- +**NOTE** -1. Set BL33 variable to path to EDK II output binary: +'-D INCLUDE_TFTP_COMMAND' is optional and can be added in order to enable `tftp` command in UEFI Shell. - ``` - $ export BL33=${WORKSPACE}/Build/Cn9132DbA-AARCH64/RELEASE_GCC5/FV/ARMADA_EFI.fd - ``` -1. Export SCP_BL2 variable: +--- - ``` - $ export SCP_BL2=${WORKSKPACE}/binaries-marvell/mrvl_scp_bl2.img - ``` -1. Export compiler variables (for cross-compilation only): +## Build the final firmware image: - ``` - $ export ARCH=arm64 - $ export CROSS_COMPILE=<toolchain_path>/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- - ``` -1. Build the image: +In addition to EDKII binary, the complete firmware image comprises the TF-A and other components. +A complete build instruction can be found at [wiki page](https://github.com/Semihalf/edk2-platforms/wiki/Build_firmware). - ``` - $ cd ${WORKSPACE}/trusted-firmware-a/ - $ make LOG_LEVEL=20 MV_DDR_PATH=${WORKSPACE}/mv-ddr-marvell CP_NUM=3 PLAT=t9130 all fip mrvl_flash +## Burning the firmware - ``` -The firmware image `flash-image.bin` can be found in `build/t9130/release/` directory. +Please follow instruction at [wiki page](https://github.com/Semihalf/edk2-platforms/wiki/Burning_firmware) +to burn image to desired boot device. # ARM System Ready certification. diff --git a/Platform/SolidRun/Armada80x0McBin/Readme.md b/Platform/SolidRun/Armada80x0McBin/Readme.md index c63cf41b2d..8c514835c4 100644 --- a/Platform/SolidRun/Armada80x0McBin/Readme.md +++ b/Platform/SolidRun/Armada80x0McBin/Readme.md @@ -3,94 +3,69 @@ # Summary -This is a port of 64-bit TianoCore EDK II firmware for the SolidRun MacchiatoBin platform based on the Marvell ARMADA 8040 SoC. +This is a port of 64-bit TianoCore EDK II firmware for the [SolidRun MacchiatoBin Double Shot](https://solidrun.atlassian.net/wiki/spaces/developer/pages/286655749/MACCHIATObin+Single+Double+Shot+Quick+Start+Guide) +platform based on the Marvell ARMADA 8040 SoC. -# Building the firmware +# Supported features -## Prepare toolchain (for cross-compilation only): +Features supported in EDK2: -1. Download the toolchain: +* 1x PCIE x4 +* Networking: + * 2x 10 GbE via SFP+ / RJ45 + * 1x 2500 Base-X via SFP+ + * 1x 1 GbE SGMII via RJ45 +* 1x USB 3.0 +* 2x USB 2.0 +* 3x SATA +* 1x uSD +* 1x eMMC +* RTC +* SPI flash & memory-mapped variable storage access +* GPIO - ``` - wget https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz - ``` +Hardware description: -1. After extracting, setup the path and compiler prefix to GCC5\_AARCH64\_PREFIX variable: +* ACPI (default) +* Device Tree - ``` - export GCC5_AARCH64_PREFIX=<toolchain_path>/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- - ``` +Others: -## Prepare prerequisites +* Signed capsule update +* X64 option ROM emulator -1. Create a new folder (directory) on your local development machine - for use as your workspace. This example uses `/work/git/tianocore`, modify as - appropriate for your needs. +# Building the firmware - ``` - $ export WORKSPACE=/work/git/tianocore - $ mkdir -p $WORKSPACE - $ cd $WORKSPACE - ``` +## Prepare EDKII environment: -1. Clone the Trusted Firmware repository: +Please follow instructions from [Obtaining source code](https://github.com/tianocore/edk2-platforms#obtaining-source-code) +and [Manual building](https://github.com/tianocore/edk2-platforms#manual-building) from the +top level edk2-platforms [Readme.md](https://github.com/tianocore/edk2-platforms#readme). - ``` - $ cd ${WORKSPACE} - $ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git - ``` -1. Clone repository for auxiliary firmware on the SoC co-processors and checkout to binaries-marvell-armada-SDK10.0.1.0: +## Build EDKII: - ``` - $ cd ${WORKSPACE} - $ git clone https://github.com/MarvellEmbeddedProcessors/binaries-marvell.git - $ cd binaries-marvell/ - $ git checkout -b binaries-marvell-armada-SDK10.0.1.0 origin/binaries-marvell-armada-SDK10.0.1.0 - ``` -1. Clone the DDR training code from: +Use below build command: - ``` - $ cd ${WORKSPACE} - $ git clone https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git - ``` -## Prepare EDKII environment: + ``` + $ build -a AARCH64 -t GCC5 -b RELEASE -D X64EMU_ENABLE -p Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc + ``` -Please follow instructions from "Obtaining source code" and "Manual building" from the top level edk2-platforms [Readme.md](https://github.com/tianocore/edk2-platforms#readme). +--- +**NOTE** -## Build EDKII: - -1. Use below build command: +'-D INCLUDE_TFTP_COMMAND' is optional and can be added in order to enable `tftp` command in UEFI Shell. - ``` - $ cd ${WORKSPACE} - $ build -a AARCH64 -t GCC5 -b RELEASE -D INCLUDE_TFTP_COMMAND -D X64EMU_ENABLE -p Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc - ``` +--- ## Build the final firmware image: -1. Set BL33 variable to path to EDK II output binary: - - ``` - $ export BL33=${WORKSPACE}/Build/Armada80x0McBin-AARCH64/RELEASE_GCC5/FV/ARMADA_EFI.fd - ``` -1. Export SCP_BL2 variable: - - ``` - $ export SCP_BL2=${WORKSKPACE}/binaries-marvell/mrvl_scp_bl2.img - ``` -1. Export compiler variables (for cross-compilation only): - - ``` - $ export ARCH=arm64 - $ export CROSS_COMPILE=<toolchain_path>/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- - ``` -1. Build the image: - - ``` - $ cd ${WORKSPACE}/trusted-firmware-a/ - $ make LOG_LEVEL=20 MV_DDR_PATH=${WORKSPACE}/mv-ddr-marvell PLAT=a80x0_mcbin all fip mrvl_flash - ``` -The firmware image `flash-image.bin` can be found in `build/a80x0_mcbin/release/` directory. +In addition to EDKII binary, the complete firmware image comprises the TF-A and other components. +A complete build instruction can be found at [wiki page](https://github.com/Semihalf/edk2-platforms/wiki/Build_firmware). + +## Burning the firmware + +Please follow instruction at [wiki page](https://github.com/Semihalf/edk2-platforms/wiki/Burning_firmware) +to burn image to desired boot device. # ARM System Ready certification. diff --git a/Platform/SolidRun/Cn913xCEx7Eval/Readme.md b/Platform/SolidRun/Cn913xCEx7Eval/Readme.md index 813e723b65..0db22b5175 100644 --- a/Platform/SolidRun/Cn913xCEx7Eval/Readme.md +++ b/Platform/SolidRun/Cn913xCEx7Eval/Readme.md @@ -3,95 +3,70 @@ # Summary -This is a port of 64-bit TianoCore EDK II firmware for the SolidRun CN913x CEx7 Evaluation Board. +This is a port of 64-bit TianoCore EDK II firmware for the [SolidRun CN913x CEx7 Evaluation Board](https://solidrun.atlassian.net/wiki/spaces/developer/pages/197493948/CN9132+COM+EVK+Quick+Start+Guide). -# Building the firmware - -## Prepare toolchain (for cross-compilation only): - -1. Download the toolchain: - - ``` - wget https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz - ``` +# Supported features -1. After extracting, setup the path and compiler prefix to GCC5\_AARCH64\_PREFIX variable: +Features supported in EDK2: - ``` - export GCC5_AARCH64_PREFIX=<toolchain_path>/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- - ``` +* 1x PCIE x4 + 6x PCIE x1 +* Networking: + * 1x 10 GbE via SFP+ + * 2x 5 GbE via RJ45 + * 1x 2500 Base-X via quad 1 Gbps switch + * 1x 1 GbE RGMII via RJ45 +* 2x USB 3.0 +* 4x USB 2.0 +* 2x SATA +* 1x uSD +* 1x eMMC +* RTC +* SPI flash & memory-mapped variable storage access +* I2C +* GPIO -## Prepare prerequisites +Hardware description: -1. Create a new folder (directory) on your local development machine - for use as your workspace. This example uses `/work/git/tianocore`, modify as - appropriate for your needs. +* ACPI (default) +* Device Tree - ``` - $ export WORKSPACE=/work/git/tianocore - $ mkdir -p $WORKSPACE - $ cd $WORKSPACE - ``` +Others: -1. Clone the Trusted Firmware repository: +* Signed capsule update +* X64 option ROM emulator - ``` - $ cd ${WORKSPACE} - $ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git - ``` -1. Clone repository for auxiliary firmware on the SoC co-processors and checkout to binaries-marvell-armada-SDK10.0.1.0: - - ``` - $ cd ${WORKSPACE} - $ git clone https://github.com/MarvellEmbeddedProcessors/binaries-marvell.git - $ cd binaries-marvell/ - $ git checkout -b binaries-marvell-armada-SDK10.0.1.0 origin/binaries-marvell-armada-SDK10.0.1.0 - ``` -1. Clone the DDR training code from: +# Building the firmware - ``` - $ cd ${WORKSPACE} - $ git clone https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git - ``` ## Prepare EDKII environment: -Please follow instructions from "Obtaining source code" and "Manual building" from the top level edk2-platforms [Readme.md](https://github.com/tianocore/edk2-platforms#readme). +Please follow instructions from [Obtaining source code](https://github.com/tianocore/edk2-platforms#obtaining-source-code) +and [Manual building](https://github.com/tianocore/edk2-platforms#manual-building) from the +top level edk2-platforms [Readme.md](https://github.com/tianocore/edk2-platforms#readme). ## Build EDKII: -1. Use below build command: +Use below build command: - ``` - $ cd ${WORKSPACE} - $ build -a AARCH64 -t GCC5 -b RELEASE -D INCLUDE_TFTP_COMMAND -D CAPSULE_ENABLE -D X64EMU_ENABLE -p Platform/SolidRun/Cn913xCEx7Eval/Cn913xCEx7Eval.dsc - ``` + ``` + build -a AARCH64 -t GCC5 -b RELEASE -D CAPSULE_ENABLE -D X64EMU_ENABLE -p Platform/SolidRun/Cn913xCEx7Eval/Cn913xCEx7Eval.dsc + ``` -## Build the final firmware image: +--- +**NOTE** -1. Set BL33 variable to path to EDK II output binary: +'-D INCLUDE_TFTP_COMMAND' is optional and can be added in order to enable `tftp` command in UEFI Shell. - ``` - $ export BL33=${WORKSPACE}/Build/Cn913xCEx7Eval-AARCH64/RELEASE_GCC5/FV/ARMADA_EFI.fd - ``` -1. Export SCP_BL2 variable: +--- - ``` - $ export SCP_BL2=${WORKSKPACE}/binaries-marvell/mrvl_scp_bl2.img - ``` -1. Export compiler variables (for cross-compilation only): +## Build the final firmware image: - ``` - $ export ARCH=arm64 - $ export CROSS_COMPILE=<toolchain_path>/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- - ``` -1. Build the image: +In addition to EDKII binary, the complete firmware image comprises the TF-A and other components. +A complete build instruction can be found at [wiki page](https://github.com/Semihalf/edk2-platforms/wiki/Build_firmware). - ``` - $ cd ${WORKSPACE}/trusted-firmware-a/ - $ make LOG_LEVEL=20 MV_DDR_PATH=${WORKSPACE}/mv-ddr-marvell CP_NUM=3 PLAT=t9130_cex7_eval all fip mrvl_flash +## Burning the firmware - ``` -The firmware image `flash-image.bin` can be found in `build/t9130_cex7_eval/release/` directory. +Please follow instruction at [wiki page](https://github.com/Semihalf/edk2-platforms/wiki/Burning_firmware) +to burn image to desired boot device. # ARM System Ready certification. -- 2.29.0 IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. |
|
Re: [PATCH] UefiPayloadPkg: Fix build error
Guo Dong
You would understand it when you look at the NetworkPkg/Network.dsc.inc
toggle quoted message
Show quoted text
In that DSC file, network components could be built as X64 or IA32 depending on PLATFORMX64_ENABLE. -----Original Message-----
From: Ni, Ray <ray.ni@...> Sent: Sunday, March 13, 2022 8:13 PM To: devel@edk2.groups.io; Rhodes, Sean <sean@...> Cc: Dong, Guo <guo.dong@...>; Ma, Maurice <maurice.ma@...>; You, Benjamin <benjamin.you@...> Subject: RE: [edk2-devel] [PATCH] UefiPayloadPkg: Fix build error I don't understand the need of "+ DEFINE PLATFORMX64_ENABLE = TRUE". -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sean Rhodes Sent: Friday, March 11, 2022 9:41 PM To: devel@edk2.groups.io Cc: Dong, Guo <guo.dong@...>; Ni, Ray <ray.ni@...>; Ma, Maurice <maurice.ma@...>; You, Benjamin <benjamin.you@...> Subject: [edk2-devel] [PATCH] UefiPayloadPkg: Fix build error From: Guo Dong <guo.dong@...> On windows build, need add -DPLATFORMX64_ENABLE=TRUE in the build command line beside -DNETWORK_DRIVER_ENABLE=TRUE in order build network features. So set PLATFORMX64_ENABLE to TRUE when need build network feature. On Linux build, DSC file should not have PcdAllowHttpConnections when network feature is not built, else would cause build error. Cc: Guo Dong <guo.dong@...> Cc: Ray Ni <ray.ni@...> Cc: Maurice Ma <maurice.ma@...> Cc: Benjamin You <benjamin.you@...> Signed-off-by: Guo Dong <guo.dong@...> --- UefiPayloadPkg/UefiPayloadPkg.dsc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc index 558513baf1..f3806a8ebc 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -407,7 +407,9 @@ [PcdsPatchableInModule.X64] gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER) gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|$(RTC_TARGET_REGISTER) +!if $(NETWORK_DRIVER_ENABLE) == TRUE gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE +!endif [PcdsPatchableInModule.common] gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 } @@ -530,6 +532,8 @@ # UEFI network modules # !if $(NETWORK_DRIVER_ENABLE) == TRUE +[Defines] + DEFINE PLATFORMX64_ENABLE = TRUE !include NetworkPkg/Network.dsc.inc !endif -- 2.32.0 -=-=-=-=-=-= Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87463): https://edk2.groups.io/g/devel/message/87463 Mute This Topic: https://groups.io/mt/89710183/1712937 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@...] -=-=-=-=-=-= |
|
[edk2-platforms PATCH 8/8] Marvell/Drivers: Pp2Dxe: Fix Pp2SnpReceive
Marcin Wojtas
This patch adds missing parameter's and SNP instance
status checks in SnpReceive callback. Additionally, the local variables declarations are cleaned-up. Signed-off-by: Marcin Wojtas <mw@...> --- Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c | 43 ++++++++++++++++---- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c b/Silicon/Marvell/= Drivers/Net/Pp2Dxe/Pp2Dxe.c index 841a1c8f84..5e463ac932 100644 --- a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c +++ b/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c @@ -1214,23 +1214,50 @@ Pp2SnpReceive ( )=0D {=0D INTN ReceivedPackets;=0D - PP2DXE_CONTEXT *Pp2Context =3D INSTANCE_FROM_SNP(This);=0D - PP2DXE_PORT *Port =3D &Pp2Context->Port;=0D - MVPP2_SHARED *Mvpp2Shared =3D Pp2Context->Port.Priv;=0D + PP2DXE_CONTEXT *Pp2Context;=0D + PP2DXE_PORT *Port;=0D UINTN PhysAddr, VirtAddr;=0D - EFI_STATUS Status =3D EFI_SUCCESS;=0D + EFI_STATUS Status;=0D EFI_TPL SavedTpl;=0D UINT32 StatusReg;=0D INTN PoolId;=0D UINTN PktLength;=0D UINT8 *DataPtr;=0D MVPP2_RX_DESC *RxDesc;=0D - MVPP2_RX_QUEUE *Rxq =3D &Port->Rxqs[0];=0D + MVPP2_RX_QUEUE *Rxq;=0D +=0D + /* Check input parameters. */=0D + if (This =3D=3D NULL || Buffer =3D=3D NULL || BufferSize =3D=3D NULL) {= =0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + SavedTpl =3D gBS->RaiseTPL (TPL_CALLBACK);=0D +=0D + Pp2Context =3D INSTANCE_FROM_SNP (This);=0D =0D + /* Check whether the driver was started and initialized. */=0D + if (This->Mode->State !=3D EfiSimpleNetworkInitialized) {=0D + switch (This->Mode->State) {=0D + case EfiSimpleNetworkStopped:=0D + DEBUG ((DEBUG_WARN, "Pp2Dxe%d: not started\n", Pp2Context->Instance)= );=0D + ReturnUnlock (SavedTpl, EFI_NOT_STARTED);=0D + case EfiSimpleNetworkStarted:=0D + DEBUG ((DEBUG_WARN, "Pp2Dxe%d: not initialized\n", Pp2Context->Insta= nce));=0D + ReturnUnlock (SavedTpl, EFI_DEVICE_ERROR);=0D + default:=0D + DEBUG ((DEBUG_WARN,=0D + "Pp2Dxe%d: wrong state: %u\n",=0D + Pp2Context->Instance,=0D + This->Mode->State));=0D + ReturnUnlock (SavedTpl, EFI_DEVICE_ERROR);=0D + }=0D + }=0D +=0D + Port =3D &Pp2Context->Port;=0D ASSERT (Port !=3D NULL);=0D + Rxq =3D &Port->Rxqs[0];=0D ASSERT (Rxq !=3D NULL);=0D =0D - SavedTpl =3D gBS->RaiseTPL (TPL_CALLBACK);=0D ReceivedPackets =3D Mvpp2RxqReceived(Port, Rxq->Id);=0D =0D if (ReceivedPackets =3D=3D 0) {=0D @@ -1285,10 +1312,12 @@ Pp2SnpReceive ( *EtherType =3D NTOHS (*(UINT16 *)(&DataPtr[12]));=0D }=0D =0D + Status =3D EFI_SUCCESS;=0D +=0D drop:=0D /* Refill: pass packet back to BM */=0D PoolId =3D (StatusReg & MVPP2_RXD_BM_POOL_ID_MASK) >> MVPP2_RXD_BM_POOL_= ID_OFFS;=0D - Mvpp2BmPoolPut(Mvpp2Shared, PoolId, PhysAddr, VirtAddr);=0D + Mvpp2BmPoolPut (Pp2Context->Port.Priv, PoolId, PhysAddr, VirtAddr);=0D =0D /* Update counters with 1 packet received and 1 packet refilled */=0D Mvpp2RxqStatusUpdate(Port, Rxq->Id, 1, 1);=0D --=20 2.29.0 |
|
[edk2-platforms PATCH 7/8] Marvell/Drivers: Pp2Dxe: Fix Pp2SnpReset
Marcin Wojtas
This patch adds missing parameter's and SNP instance
status checks. igned-off-by: Marcin Wojtas <mw@...> --- Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c b/Silicon/Marvell/= Drivers/Net/Pp2Dxe/Pp2Dxe.c index deb3f34625..841a1c8f84 100644 --- a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c +++ b/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c @@ -647,6 +647,33 @@ Pp2SnpReset ( IN BOOLEAN ExtendedVerification=0D )=0D {=0D + PP2DXE_CONTEXT *Pp2Context;=0D +=0D + /* Check This Instance. */=0D + if (This =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + Pp2Context =3D INSTANCE_FROM_SNP (This);=0D +=0D + /* Check that driver was started and initialized. */=0D + if (This->Mode->State !=3D EfiSimpleNetworkInitialized) {=0D + switch (This->Mode->State) {=0D + case EfiSimpleNetworkStopped:=0D + DEBUG ((DEBUG_WARN, "Pp2Dxe%d: not started\n", Pp2Context->Instance)= );=0D + return EFI_NOT_STARTED;=0D + case EfiSimpleNetworkStarted:=0D + DEBUG ((DEBUG_WARN, "Pp2Dxe%d: not initialized\n", Pp2Context->Insta= nce));=0D + return EFI_DEVICE_ERROR;=0D + default:=0D + DEBUG ((DEBUG_WARN,=0D + "Pp2Dxe%d: wrong state: %u\n",=0D + Pp2Context->Instance,=0D + This->Mode->State));=0D + return EFI_DEVICE_ERROR;=0D + }=0D + }=0D +=0D return EFI_SUCCESS;=0D }=0D =0D --=20 2.29.0 |
|
[edk2-platforms PATCH 6/8] Marvell/Drivers: Pp2Dxe: Fix Pp2SnpTransmit
Marcin Wojtas
Error checking for invalid input parameters was too
hard. Replace ASSERT with returning error value. Moreover set EtherType only when we are sure it won't be dereferencing NULL pointer. Signed-off-by: Marcin Wojtas <mw@...> --- Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c b/Silicon/Marvell/= Drivers/Net/Pp2Dxe/Pp2Dxe.c index 8a4c4545c8..deb3f34625 100644 --- a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c +++ b/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c @@ -1074,9 +1074,15 @@ Pp2SnpTransmit ( }=0D =0D if (HeaderSize !=3D 0) {=0D - ASSERT (HeaderSize =3D=3D This->Mode->MediaHeaderSize);=0D - ASSERT (EtherTypePtr !=3D NULL);=0D - ASSERT (DestAddr !=3D NULL);=0D + if (HeaderSize !=3D This->Mode->MediaHeaderSize ||=0D + EtherTypePtr =3D=3D NULL ||=0D + DestAddr =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D + }=0D +=0D + if (BufferSize < This->Mode->MediaHeaderSize) {=0D + return EFI_BUFFER_TOO_SMALL;=0D }=0D =0D SavedTpl =3D gBS->RaiseTPL (TPL_CALLBACK);=0D @@ -1100,8 +1106,6 @@ Pp2SnpTransmit ( ReturnUnlock(SavedTpl, EFI_NOT_READY);=0D }=0D =0D - EtherType =3D HTONS (*EtherTypePtr);=0D -=0D /* Fetch next descriptor */=0D TxDesc =3D Mvpp2TxqNextDescGet(AggrTxq);=0D =0D @@ -1118,6 +1122,8 @@ Pp2SnpTransmit ( else=0D CopyMem(DataPtr + NET_ETHER_ADDR_LEN, &This->Mode->CurrentAddress, N= ET_ETHER_ADDR_LEN);=0D =0D + EtherType =3D HTONS (*EtherTypePtr);=0D +=0D CopyMem(DataPtr + NET_ETHER_ADDR_LEN * 2, &EtherType, 2);=0D }=0D =0D --=20 2.29.0 |
|