Re: [edk2] [Patch V2] BaseTool: Fixed incremental rebuild issue.
Hi Laszlo, pt., 22 lut 2019 o 21:08 Laszlo Ersek napisał(a): > > On 02/22/19 20:21, Ard Biesheuvel wrote: > > On Fri, 22 Feb 2019 at 08:26, Gao, Liming wrote: > >> > >> Reviewed-by: Liming Gao > >> > > > > Incremental builds are still broken for me, even with this patch. Is > > anyone else seeing the same? > > I am not; but I've been using Python3.4 for a while now (it is needed by > another package on my system, and then the build tools find it too). > > The regression is attributed to commit d943b0c339fe ("BaseTools: Handle > the bytes and str difference", 2019-02-01), which I believe is related > to the python2/3 conversion. So I assume python3.4 masks the problem. > In my setup with the latest BaseTools update this problem is gone. I'm using Python 3.5.2. Thanks, Marcin > > >>> -Original Message- > >>> From: Feng, Bob C > >>> Sent: Wednesday, February 20, 2019 11:22 PM > >>> To: edk2-devel@lists.01.org > >>> Cc: Feng, Bob C ; Gao, Liming > >>> Subject: [Patch V2] BaseTool: Fixed incremental rebuild issue. > >>> > >>> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1540 > >>> > >>> This issue in introduced by commit > >>> d943b0c339fe3d35ffdf9f580ccb7a55915c6854 > >>> > >>> To convert bytes to string, we need to use bytes.decode() > >>> instead of using str(bytes). > >>> > >>> If the source file is not a txt file, ignore that file. > >>> > >>> Contributed-under: TianoCore Contribution Agreement 1.1 > >>> Signed-off-by: Bob Feng > >>> Cc: Liming Gao > >>> --- > >>> BaseTools/Source/Python/AutoGen/GenMake.py | 16 > >>> .../Source/Python/Workspace/DscBuildData.py | 17 - > >>> 2 files changed, 16 insertions(+), 17 deletions(-) > >>> > >>> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py > >>> b/BaseTools/Source/Python/AutoGen/GenMake.py > >>> index 53c5b8577d..b441817b52 100644 > >>> --- a/BaseTools/Source/Python/AutoGen/GenMake.py > >>> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py > >>> @@ -1043,18 +1043,18 @@ cleanlib: > >>> Fd.close() > >>> except BaseException as X: > >>> EdkLogger.error("build", FILE_OPEN_FAILURE, > >>> ExtraData=F.Path + > >>> "\n\t" + str(X)) > >>> if len(FileContent) == 0: > >>> continue > >>> - > >>> -if FileContent[0] == 0xff or FileContent[0] == 0xfe: > >>> -FileContent = FileContent.decode('utf-16') > >>> -else: > >>> -try: > >>> -FileContent = str(FileContent) > >>> -except: > >>> -pass > >>> +try: > >>> +if FileContent[0] == 0xff or FileContent[0] == 0xfe: > >>> +FileContent = FileContent.decode('utf-16') > >>> +else: > >>> +FileContent = FileContent.decode() > >>> +except: > >>> +# The file is not txt file. for example .mcb file > >>> +continue > >>> IncludedFileList = gIncludePattern.findall(FileContent) > >>> > >>> for Inc in IncludedFileList: > >>> Inc = Inc.strip() > >>> # if there's macro used to reference header file, > >>> expand it > >>> diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py > >>> b/BaseTools/Source/Python/Workspace/DscBuildData.py > >>> index 1ffefe6e7e..7221946062 100644 > >>> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py > >>> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py > >>> @@ -153,19 +153,18 @@ def GetDependencyList(FileStack, SearchPathList): > >>> Fd.close() > >>> > >>> if len(FileContent) == 0: > >>> continue > >>> > >>> -if FileContent[0] == 0xff or FileContent[0] == 0xfe: > >>> -FileContent = FileContent.decode('utf-16') > >>> -IncludedFileList = gIncludePattern.findall(FileContent) > >>> -else: > >>> -try: > >>> -FileContent = str(FileContent) > >>> -IncludedFileList = > >>> gIncludePattern.findall(FileContent) > >>> -except: > >>> -pass > >>> +try: > >>> +if FileContent[0] == 0xff or FileContent[0] == 0xfe: > >>> +FileContent = FileContent.decode('utf-16') > >>> +else: > >>> +FileContent = FileContent.decode() > >>> +except: > >>> +# The file is not txt file. for example .mcb file > >>> +continue > >>> IncludedFileList = gIncludePattern.findall(FileContent) > >>> > >>> for Inc in IncludedFileList: > >>> Inc = Inc.strip() > >>> Inc = os.path.normpath(Inc) > >>> -- > >>> 2.18.0.windows.1 > >> > >>
Re: [edk2] [platforms: PATCH v3 0/5] Armada7k8k memory handling update
czw., 31 sty 2019 o 11:28 Leif Lindholm napisał(a): > > On Thu, Jan 31, 2019 at 08:01:08AM +0100, Marcin Wojtas wrote: > > Hi Leif, > > > > Thanks a lot. While at it - do you think ArmPkg/Include/Library/ArmLib.h > > / ArmPkg/Library/ArmLib/ArmLib.c would be a proper place for it? > > As good a place as any. While not ARM-architecture specific, I feel > it's probably ARM-platform specific. > > I mean, hopefully we'll some day we'll get a sane reporting mechanism > of Secure-reserved regions by ARM-TF and we can drop this juggling in > Non-secure firmware. > Agree on ARM-TF dependency, but the code is IMO pretty generic itself. In the merged version I also used this routine to cut out a hole in the HoB for the reason not related to NS region - therefore I think even MdePkg/Library would be good to go :) Marcin > > Best regards, > > Marcin > > > > śr., 30 sty 2019 o 17:47 Leif Lindholm > > napisał(a): > > > > > Thanks for the rework. > > > > > > (We should probably move that broken-out function to ArmPkg at some > > > point.) > > > > > > For the series: > > > Reviewed-by: Leif Lindholm > > > > > > Pushed as b0bb325f20..0a7d8e7d93. > > > > > > On Mon, Jan 28, 2019 at 10:45:10AM +0100, Marcin Wojtas wrote: > > > > Hi, > > > > > > > > The third version of the patchset moves the new common > > > > header for Marvell SMC ID's to the IndustryStandard directory. > > > > What is more important, now 3 regions (described by new PCDs) > > > > are reserved separately. For that purpose a preparation > > > > patch was added, which extract existing reservation code > > > > into a new subroutine. More details can be found in > > > > the changelog below and the commit messages. > > > > > > > > Patches are available in the github: > > > > > > > https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/dram-upstream-r20190128 > > > > > > > > I'm looking forward to the comments and remarks. > > > > > > > > Best regards, > > > > Marcin > > > > > > > > Changelog: > > > > v2 -> v3 > > > > * 1/5 > > > > - New patch - extract memory reservation to a separate routine > > > > > > > > * 2/2 > > > > - Add new PCDs and reserve 3 regions (ARM-TF, PEI stack, OP-TEE) > > > > separately > > > > - Update commit message accordingly > > > > > > > > * 3/5 > > > > - Move MvSmc.h to Include/IndustryStandard > > > > > > > > * 4,5/5 > > > > - Add Leif's RB > > > > > > > > v1 -> v2: > > > > * 1/4 > > > > - Improve commit log - mention single area size and new PEI stack base > > > > > > > > * 2/4 (new patch) > > > > - Add common header for Marvell SMC ID's > > > > > > > > * 3/4 > > > > - Add function description comment > > > > - Define and use ARMADA7K8K_AP806_INDEX > > > > - Change function argument to EFI_PHYSICAL_ADDRESS > > > > > > > > * 4/4 > > > > - Move new SMC ID to MvSmc.h > > > > - Include ArmadaSoCDescLib.h directly (instead indirectly via > > > BoardDesc.h) > > > > - Remove ARMADA7K8K_AP806_INDEX macro > > > > > > > > Grzegorz Jaszczyk (2): > > > > Marvell/Library: ArmadaSoCDescLib: Add North Bridge description > > > > Marvell/Armada7k8k: Read DRAM settings from ARM-TF > > > > > > > > Marcin Wojtas (3): > > > > Marvell/Armada7k8k: Refactor reserving memory regions > > > > Marvell/Armada7k8k: Shift PEI stack base and extend memory reservation > > > > Marvell/Library: Introduce common header for the SMC ID's > > > > > > > > Silicon/Marvell/Marvell.dec > > > | 8 +- > > > > Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > > | 16 ++- > > > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf > > > | 3 + > > > > > > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.inf > > > | 8 +- > > > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h > > > | 25 - > > > >
Re: [edk2] [platforms: PATCH v3 0/5] Armada7k8k memory handling update
Hi Leif, Thanks a lot. While at it - do you think ArmPkg/Include/Library/ArmLib.h / ArmPkg/Library/ArmLib/ArmLib.c would be a proper place for it? Best regards, Marcin śr., 30 sty 2019 o 17:47 Leif Lindholm napisał(a): > Thanks for the rework. > > (We should probably move that broken-out function to ArmPkg at some point.) > > For the series: > Reviewed-by: Leif Lindholm > > Pushed as b0bb325f20..0a7d8e7d93. > > On Mon, Jan 28, 2019 at 10:45:10AM +0100, Marcin Wojtas wrote: > > Hi, > > > > The third version of the patchset moves the new common > > header for Marvell SMC ID's to the IndustryStandard directory. > > What is more important, now 3 regions (described by new PCDs) > > are reserved separately. For that purpose a preparation > > patch was added, which extract existing reservation code > > into a new subroutine. More details can be found in > > the changelog below and the commit messages. > > > > Patches are available in the github: > > > https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/dram-upstream-r20190128 > > > > I'm looking forward to the comments and remarks. > > > > Best regards, > > Marcin > > > > Changelog: > > v2 -> v3 > > * 1/5 > > - New patch - extract memory reservation to a separate routine > > > > * 2/2 > > - Add new PCDs and reserve 3 regions (ARM-TF, PEI stack, OP-TEE) > > separately > > - Update commit message accordingly > > > > * 3/5 > > - Move MvSmc.h to Include/IndustryStandard > > > > * 4,5/5 > > - Add Leif's RB > > > > v1 -> v2: > > * 1/4 > > - Improve commit log - mention single area size and new PEI stack base > > > > * 2/4 (new patch) > > - Add common header for Marvell SMC ID's > > > > * 3/4 > > - Add function description comment > > - Define and use ARMADA7K8K_AP806_INDEX > > - Change function argument to EFI_PHYSICAL_ADDRESS > > > > * 4/4 > > - Move new SMC ID to MvSmc.h > > - Include ArmadaSoCDescLib.h directly (instead indirectly via > BoardDesc.h) > > - Remove ARMADA7K8K_AP806_INDEX macro > > > > Grzegorz Jaszczyk (2): > > Marvell/Library: ArmadaSoCDescLib: Add North Bridge description > > Marvell/Armada7k8k: Read DRAM settings from ARM-TF > > > > Marcin Wojtas (3): > > Marvell/Armada7k8k: Refactor reserving memory regions > > Marvell/Armada7k8k: Shift PEI stack base and extend memory reservation > > Marvell/Library: Introduce common header for the SMC ID's > > > > Silicon/Marvell/Marvell.dec > | 8 +- > > Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > | 16 ++- > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf > | 3 + > > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.inf > | 8 +- > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h > | 25 - > > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h > | 6 ++ > > Silicon/Marvell/Include/IndustryStandard/MvSmc.h > | 24 + > > Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h > | 28 + > > Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h > | 8 +- > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c > | 60 --- > > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.c > | 107 +--- > > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c > | 34 +++ > > Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c > | 14 +-- > > 13 files changed, 220 insertions(+), 121 deletions(-) > > create mode 100644 Silicon/Marvell/Include/IndustryStandard/MvSmc.h > > > > -- > > 2.7.4 > > > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v3 5/5] Marvell/Armada7k8k: Read DRAM settings from ARM-TF
From: Grzegorz Jaszczyk The memory controller registers are marked as secure in the latest ARM-TF for Armada SoCs. It is available however get the DRAM information via SiP services in the EL3, so use it instead of accessing the registers directly. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf | 3 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h | 25 Silicon/Marvell/Include/IndustryStandard/MvSmc.h| 1 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c | 60 ++-- 4 files changed, 22 insertions(+), 67 deletions(-) diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf index e888566..0c7f320 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf @@ -41,12 +41,15 @@ [Packages] ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec [LibraryClasses] + ArmadaSoCDescLib ArmLib + ArmSmcLib DebugLib MemoryAllocationLib MppLib diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h index cc30e4a..8101cf3 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h @@ -46,28 +46,3 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (MmioRead32 (CCU_MC_RCR_REG) & REMAP_SIZE_MASK) + SIZE_1MB #define DRAM_REMAP_TARGET \ (MmioRead32 (CCU_MC_RTBR_REG) << TARGET_BASE_OFFS) - -#define DRAM_CH0_MMAP_LOW_REG(cs) (0xf0020200 + (cs) * 0x8) -#define DRAM_CS_VALID_ENABLED_MASK 0x1 -#define DRAM_AREA_LENGTH_OFFS 16 -#define DRAM_AREA_LENGTH_MASK (0x1f << DRAM_AREA_LENGTH_OFFS) -#define DRAM_START_ADDRESS_L_OFFS 23 -#define DRAM_START_ADDRESS_L_MASK (0x1ff << DRAM_START_ADDRESS_L_OFFS) -#define DRAM_CH0_MMAP_HIGH_REG(cs) (0xf0020204 + (cs) * 0x8) -#define DRAM_START_ADDR_HTOL_OFFS 32 - -#define DRAM_MAX_CS_NUM 8 - -#define DRAM_CS_ENABLED(Cs) \ - (MmioRead32 (DRAM_CH0_MMAP_LOW_REG (Cs)) & DRAM_CS_VALID_ENABLED_MASK) -#define GET_DRAM_REGION_BASE(Cs) \ - ((UINT64)MmioRead32 (DRAM_CH0_MMAP_HIGH_REG ((Cs))) << \ - DRAM_START_ADDR_HTOL_OFFS) | \ - (MmioRead32 (DRAM_CH0_MMAP_LOW_REG (Cs)) & DRAM_START_ADDRESS_L_MASK); -#define GET_DRAM_REGION_SIZE_CODE(Cs) \ - (MmioRead32 (DRAM_CH0_MMAP_LOW_REG ((Cs))) & \ - DRAM_AREA_LENGTH_MASK) >> DRAM_AREA_LENGTH_OFFS -#define DRAM_REGION_SIZE_EVEN(C)(((C) >= 7) && ((C) <= 26)) -#define GET_DRAM_REGION_SIZE_EVEN(C)((UINT64)1 << ((C) + 16)) -#define DRAM_REGION_SIZE_ODD(C) ((C) <= 4) -#define GET_DRAM_REGION_SIZE_ODD(C) ((UINT64)0x1800 << (C)) diff --git a/Silicon/Marvell/Include/IndustryStandard/MvSmc.h b/Silicon/Marvell/Include/IndustryStandard/MvSmc.h index 2d1542a..0c90f11 100644 --- a/Silicon/Marvell/Include/IndustryStandard/MvSmc.h +++ b/Silicon/Marvell/Include/IndustryStandard/MvSmc.h @@ -19,5 +19,6 @@ #define MV_SMC_ID_COMPHY_POWER_ON 0x8201 #define MV_SMC_ID_COMPHY_POWER_OFF0x8202 #define MV_SMC_ID_COMPHY_PLL_LOCK 0x8203 +#define MV_SMC_ID_DRAM_SIZE 0x8210 #endif //__MV_SMC_H__ diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c index 2a4f5ad..f7bcf52 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c @@ -32,8 +32,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***/ -#include +#include + +#include +#include + +#include #include +#include #include #include #include @@ -57,49 +63,19 @@ GetDramSize ( IN OUT UINT64 *MemSize ) { - UINT64 BaseAddr; - UINT8 RegionCode; - UINT8 Cs; - - *MemSize = 0; - - for (Cs = 0; Cs < DRAM_MAX_CS_NUM; Cs++) { - -/* Exit loop on first disabled DRAM CS */ -if (!DRAM_CS_ENABLED (Cs)) { - break; -} - -/* - * Sanity check for base address of next DRAM block. - * Only continuous space will be used. - */ -BaseAddr = GET_DRAM_REGION_BASE (Cs); -if (BaseAddr != *MemSize) { - DEBUG ((DEBUG_ERROR, -"%a: DRAM blocks ar
[edk2] [platforms: PATCH v3 4/5] Marvell/Library: ArmadaSoCDescLib: Add North Bridge description
From: Grzegorz Jaszczyk For upcomming patch there is need to get AP806 base, provide required getter function for it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h | 6 Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h | 28 Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 34 3 files changed, 68 insertions(+) diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h index bfc8639..c2d7933 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h @@ -22,9 +22,15 @@ // Common macros // #define MV_SOC_CP_BASE(Cp) (0xF200 + ((Cp) * 0x200)) +#define MV_SOC_AP806_BASE0xF000 #define MV_SOC_AP806_COUNT 1 // +// Armada7k8k default North Bridge index +// +#define ARMADA7K8K_AP806_INDEX 0 + +// // Platform description of AHCI controllers // #define MV_SOC_AHCI_BASE(Cp) (MV_SOC_CP_BASE (Cp) + 0x54) diff --git a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h index 26b075a..fc17c3a 100644 --- a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h +++ b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h @@ -20,6 +20,34 @@ #include // +// North Bridge description +// + +/** + +Routine Description: + + Get base address of the SoC North Bridge. + +Arguments: + + ApBase - Base address of the North Bridge. + ApIndex - Index of the North Bridge. + +Returns: + + EFI_SUCCESS - Proper base address is returned. + EFI_INVALID_PARAMETER - The index is out of range. + +**/ +EFI_STATUS +EFIAPI +ArmadaSoCAp8xxBaseGet ( + IN OUT EFI_PHYSICAL_ADDRESS *ApBase, + IN UINTN ApIndex + ); + +// // ComPhy SoC description // typedef struct { diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c index 5b72c20..584f445 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c @@ -28,6 +28,40 @@ #include "Armada7k8kSoCDescLib.h" +/** + +Routine Description: + + Get base address of the SoC North Bridge. + +Arguments: + + ApBase - Base address of the North Bridge. + ApIndex - Index of the North Bridge. + +Returns: + + EFI_SUCCESS - Proper base address is returned. + EFI_INVALID_PARAMETER - The index is out of range. + +**/ +EFI_STATUS +EFIAPI +ArmadaSoCAp8xxBaseGet ( + IN OUT EFI_PHYSICAL_ADDRESS *ApBase, + IN UINTN ApIndex + ) +{ + if (ApIndex != ARMADA7K8K_AP806_INDEX) { +DEBUG ((DEBUG_ERROR, "%a: Only one AP806 in A7K/A8K SoC\n", __FUNCTION__)); +return EFI_INVALID_PARAMETER; + } + + *ApBase = MV_SOC_AP806_BASE; + + return EFI_SUCCESS; +} + EFI_STATUS EFIAPI ArmadaSoCDescComPhyGet ( -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v3 3/5] Marvell/Library: Introduce common header for the SMC ID's
Marvell firmware allows to use SiP services other than for ComPhy handling. In order to avoid spreading the SMC ID's definitions across many files, introduce common header for that purpose. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Include/IndustryStandard/MvSmc.h | 23 Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h | 8 +++ Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c | 14 ++-- 3 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 Silicon/Marvell/Include/IndustryStandard/MvSmc.h diff --git a/Silicon/Marvell/Include/IndustryStandard/MvSmc.h b/Silicon/Marvell/Include/IndustryStandard/MvSmc.h new file mode 100644 index 000..2d1542a --- /dev/null +++ b/Silicon/Marvell/Include/IndustryStandard/MvSmc.h @@ -0,0 +1,23 @@ +/** +* +* Copyright (C) 2019, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef __MV_SMC_H__ +#define __MV_SMC_H__ + +/* Marvell SiP services SMC ID's */ +#define MV_SMC_ID_COMPHY_POWER_ON 0x8201 +#define MV_SMC_ID_COMPHY_POWER_OFF0x8202 +#define MV_SMC_ID_COMPHY_PLL_LOCK 0x8203 + +#endif //__MV_SMC_H__ diff --git a/Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h b/Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h index d156af6..9fd6602 100644 --- a/Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h +++ b/Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h @@ -35,16 +35,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef __COMPHY_SIP_SVC_H__ #define __COMPHY_SIP_SVC_H__ +#include + /* * All values in this file are defined externally and used * for the SerDes configuration via SiP services. */ -/* Firmware related definitions used for SMC calls */ -#define MV_SIP_COMPHY_POWER_ON 0x8201 -#define MV_SIP_COMPHY_POWER_OFF 0x8202 -#define MV_SIP_COMPHY_PLL_LOCK 0x8203 - +/* Helper macros for passing ComPhy parameters to the EL3 */ #define COMPHY_FW_MODE_FORMAT(mode) (mode << 12) #define COMPHY_FW_FORMAT(mode, idx, speeds) \ ((mode << 12) | (idx << 8) | (speeds << 2)) diff --git a/Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c b/Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c index 2abb006..4f85676 100755 --- a/Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c +++ b/Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c @@ -163,7 +163,7 @@ ComPhySataPowerUp ( ComPhySataMacPowerDown (Desc[ChipId].SoC->AhciBaseAddress); - Status = ComPhySmc (MV_SIP_COMPHY_POWER_ON, + Status = ComPhySmc (MV_SMC_ID_COMPHY_POWER_ON, ComPhyBase, Lane, COMPHY_FW_FORMAT (COMPHY_SATA_MODE, @@ -175,7 +175,7 @@ ComPhySataPowerUp ( ComPhySataPhyPowerUp (Desc[ChipId].SoC->AhciBaseAddress); - Status = ComPhySmc (MV_SIP_COMPHY_PLL_LOCK, + Status = ComPhySmc (MV_SMC_ID_COMPHY_PLL_LOCK, ComPhyBase, Lane, COMPHY_FW_FORMAT (COMPHY_SATA_MODE, @@ -234,7 +234,7 @@ ComPhyCp110Init ( case COMPHY_TYPE_PCIE1: case COMPHY_TYPE_PCIE2: case COMPHY_TYPE_PCIE3: - Status = ComPhySmc (MV_SIP_COMPHY_POWER_ON, + Status = ComPhySmc (MV_SMC_ID_COMPHY_POWER_ON, PtrChipCfg->ComPhyBaseAddr, Lane, COMPHY_FW_PCIE_FORMAT (PcieWidth, @@ -269,7 +269,7 @@ ComPhyCp110Init ( break; case COMPHY_TYPE_USB3_HOST0: case COMPHY_TYPE_USB3_HOST1: - Status = ComPhySmc (MV_SIP_COMPHY_POWER_ON, + Status = ComPhySmc (MV_SMC_ID_COMPHY_POWER_ON, PtrChipCfg->ComPhyBaseAddr, Lane, COMPHY_FW_MODE_FORMAT (COMPHY_USB3H_MODE)); @@ -278,7 +278,7 @@ ComPhyCp110Init ( case COMPHY_TYPE_SGMII1: case COMPHY_TYPE_SGMII2: case COMPHY_TYPE_SGMII3: - Status = ComPhySmc (MV_SIP_COMPHY_POWER_ON, + Status = ComPhySmc (MV_SMC_ID_COMPHY_POWER_ON, PtrChipCfg->ComPhyBaseAddr, Lane, COMPHY_FW_FORMAT (COMPHY_SGMII_MODE, @@ -286,7 +286,7 @@ ComPhyCp110Init ( PtrComPhyMap->Speed)); break; case COMPHY_TYPE_SFI: - Status = ComPhySmc (MV_SIP_COMPHY_POWER_ON, + Status = ComPhySmc (MV_SMC_ID_COMPHY_POWER_ON, PtrChipCfg->ComPhyBaseAddr, Lane, COMPHY_FW_FORMAT (COMPHY_SFI_MODE, @@ -295,7 +295,7 @@ ComPhyCp110Init ( break;
[edk2] [platforms: PATCH v3 2/5] Marvell/Armada7k8k: Shift PEI stack base and extend memory reservation
Recent changes in the ARM-TF configure its runtime serices region as protected, hence the hitherto PEI stack base address (0x41F) violated it. Additional region needs to also be reserved to cover OP-TEE In order to fix this, add more regions which are non-accessible by the OS to cover: * the ARM-TF (0x400 - 0x420) * OP-TEE (0x440 - 0x540) * additional reserved region (0x420 - 0x440) Describe regions with the new PCDs and set the PEI stack base address in the latter (0x43F). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Marvell.dec | 8 ++-- Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 16 Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.inf | 8 ++-- Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.c | 18 +++--- 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/Silicon/Marvell/Marvell.dec b/Silicon/Marvell/Marvell.dec index c34d783..c927078 100644 --- a/Silicon/Marvell/Marvell.dec +++ b/Silicon/Marvell/Marvell.dec @@ -211,8 +211,12 @@ # normal world. These PCDs describe such a region, which will be converted # to 'reserved' memory before DXE is entered. # - gMarvellTokenSpaceGuid.PcdSecureRegionBase|0x0|UINT64|0x5000 - gMarvellTokenSpaceGuid.PcdSecureRegionSize|0x0|UINT32|0x5001 + gMarvellTokenSpaceGuid.PcdArmTFRegionBase|0x0|UINT64|0x5000 + gMarvellTokenSpaceGuid.PcdArmTFRegionSize|0x0|UINT32|0x5001 + gMarvellTokenSpaceGuid.PcdAuxiliaryReservedRegionBase|0x0|UINT64|0x5002 + gMarvellTokenSpaceGuid.PcdAuxiliaryReservedRegionSize|0x0|UINT32|0x5003 + gMarvellTokenSpaceGuid.PcdOpTeeRegionBase|0x0|UINT64|0x5004 + gMarvellTokenSpaceGuid.PcdOpTeeRegionSize|0x0|UINT32|0x5005 [Protocols] gMarvellBoardDescProtocolGuid= { 0xebed8738, 0xd4a6, 0x4001, { 0xa9, 0xc9, 0x52, 0xb0, 0xcb, 0x7d, 0xdb, 0xf9 }} diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc index eafcd6e..1e2d248 100644 --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc @@ -376,12 +376,20 @@ gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|36 - gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x41F + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x43F gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x1 - # Secure region reservation - gMarvellTokenSpaceGuid.PcdSecureRegionBase|0x400 - gMarvellTokenSpaceGuid.PcdSecureRegionSize|0x020 + # ARM-TF region reservation + gMarvellTokenSpaceGuid.PcdArmTFRegionBase|0x400 + gMarvellTokenSpaceGuid.PcdArmTFRegionSize|0x20 + + # Additional region reservation (e.g. for PEI stack base) + gMarvellTokenSpaceGuid.PcdAuxiliaryReservedRegionBase|0x420 + gMarvellTokenSpaceGuid.PcdAuxiliaryReservedRegionSize|0x20 + + # OP-TEE region reservation + gMarvellTokenSpaceGuid.PcdOpTeeRegionBase|0x440 + gMarvellTokenSpaceGuid.PcdOpTeeRegionSize|0x100 # TRNG gMarvellTokenSpaceGuid.PcdEip76TrngBaseAddress|0xF276 diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.inf b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.inf index 096495d..360de90 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.inf +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.inf @@ -42,5 +42,9 @@ gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob [FixedPcd] - gMarvellTokenSpaceGuid.PcdSecureRegionBase - gMarvellTokenSpaceGuid.PcdSecureRegionSize + gMarvellTokenSpaceGuid.PcdArmTFRegionBase + gMarvellTokenSpaceGuid.PcdArmTFRegionSize + gMarvellTokenSpaceGuid.PcdAuxiliaryReservedRegionBase + gMarvellTokenSpaceGuid.PcdAuxiliaryReservedRegionSize + gMarvellTokenSpaceGuid.PcdOpTeeRegionBase + gMarvellTokenSpaceGuid.PcdOpTeeRegionSize diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.c index 3e7902f..571f77e 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.c +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.c @@ -167,10 +167,22 @@ MemoryPeim ( // Get Virtual Memory Map from the Platform Library ArmPlatformGetVirtualMemoryMap (); - // Reserve memory region for secure firmware + // Reserve memory region for ARM-TF ReserveMemoryRegion ( -(EFI_PHYSICAL_ADDRESS)FixedPcdGet64 (PcdSecureRegionBase
[edk2] [platforms: PATCH v3 1/5] Marvell/Armada7k8k: Refactor reserving memory regions
Extract reserving memory region in the Hob list into a separate routine. It is a preparation for adding multiple of such regions in a following patch. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.c | 95 +--- 1 file changed, 61 insertions(+), 34 deletions(-) diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.c index 53119f4..3e7902f 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.c +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.c @@ -49,40 +49,31 @@ InitMmu ( Routine Description: - + Remove the reserved region from a System Memory Hob that covers it. Arguments: FileHandle - Handle of the file being invoked. PeiServices - Describes the list of possible PEI Services. -Returns: - - Status - EFI_SUCCESS if the boot mode could be set - --*/ -EFI_STATUS -EFIAPI -MemoryPeim ( - IN EFI_PHYSICAL_ADDRESS UefiMemoryBase, - IN UINT64 UefiMemorySize +STATIC +VOID +ReserveMemoryRegion ( + IN EFI_PHYSICAL_ADDRESS ReservedRegionBase, + IN UINT32ReservedRegionSize ) { - ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable; EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes; - UINT64 ResourceLength; - EFI_PEI_HOB_POINTERS NextHob; - EFI_PHYSICAL_ADDRESS SecureTop; + EFI_PHYSICAL_ADDRESS ReservedRegionTop; EFI_PHYSICAL_ADDRESS ResourceTop; + EFI_PEI_HOB_POINTERS NextHob; + UINT64 ResourceLength; - // Get Virtual Memory Map from the Platform Library - ArmPlatformGetVirtualMemoryMap (); - - SecureTop = (EFI_PHYSICAL_ADDRESS)FixedPcdGet64 (PcdSecureRegionBase) + - FixedPcdGet32 (PcdSecureRegionSize); + ReservedRegionTop = ReservedRegionBase + ReservedRegionSize; // - // Search for System Memory Hob that covers the secure firmware, + // Search for System Memory Hob that covers the reserved region, // and punch a hole in it // for (NextHob.Raw = GetHobList (); @@ -91,31 +82,32 @@ MemoryPeim ( NextHob.Raw)) { if ((NextHob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) && -(FixedPcdGet64 (PcdSecureRegionBase) >= NextHob.ResourceDescriptor->PhysicalStart) && -(SecureTop <= NextHob.ResourceDescriptor->PhysicalStart + +(ReservedRegionBase >= NextHob.ResourceDescriptor->PhysicalStart) && +(ReservedRegionTop <= NextHob.ResourceDescriptor->PhysicalStart + NextHob.ResourceDescriptor->ResourceLength)) { ResourceAttributes = NextHob.ResourceDescriptor->ResourceAttribute; ResourceLength = NextHob.ResourceDescriptor->ResourceLength; ResourceTop = NextHob.ResourceDescriptor->PhysicalStart + ResourceLength; - if (FixedPcdGet64 (PcdSecureRegionBase) == NextHob.ResourceDescriptor->PhysicalStart) { + if (ReservedRegionBase == NextHob.ResourceDescriptor->PhysicalStart) { // // This region starts right at the start of the reserved region, so we // can simply move its start pointer and reduce its length by the same // value // -NextHob.ResourceDescriptor->PhysicalStart += FixedPcdGet32 (PcdSecureRegionSize); -NextHob.ResourceDescriptor->ResourceLength -= FixedPcdGet32 (PcdSecureRegionSize); +NextHob.ResourceDescriptor->PhysicalStart += ReservedRegionSize; +NextHob.ResourceDescriptor->ResourceLength -= ReservedRegionSize; } else if ((NextHob.ResourceDescriptor->PhysicalStart + - NextHob.ResourceDescriptor->ResourceLength) == SecureTop) { + NextHob.ResourceDescriptor->ResourceLength) == + ReservedRegionTop) { // // This region ends right at the end of the reserved region, so we // can simply reduce its length by the size of the region. // -NextHob.ResourceDescriptor->ResourceLength -= FixedPcdGet32 (PcdSecureRegionSize); +NextHob.ResourceDescriptor->ResourceLength -= ReservedRegionSize; } else { // @@ -123,28 +115,63 @@ MemoryPeim ( // each one touching the reserved region at either end, but not covering // it. // -NextHob.ResourceDescriptor->ResourceLength = FixedPcdGet64 (PcdSecureRegionBase) - - NextHob.ResourceDescriptor->PhysicalStart; +NextHob.ResourceDescript
[edk2] [platforms: PATCH v3 0/5] Armada7k8k memory handling update
Hi, The third version of the patchset moves the new common header for Marvell SMC ID's to the IndustryStandard directory. What is more important, now 3 regions (described by new PCDs) are reserved separately. For that purpose a preparation patch was added, which extract existing reservation code into a new subroutine. More details can be found in the changelog below and the commit messages. Patches are available in the github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/dram-upstream-r20190128 I'm looking forward to the comments and remarks. Best regards, Marcin Changelog: v2 -> v3 * 1/5 - New patch - extract memory reservation to a separate routine * 2/2 - Add new PCDs and reserve 3 regions (ARM-TF, PEI stack, OP-TEE) separately - Update commit message accordingly * 3/5 - Move MvSmc.h to Include/IndustryStandard * 4,5/5 - Add Leif's RB v1 -> v2: * 1/4 - Improve commit log - mention single area size and new PEI stack base * 2/4 (new patch) - Add common header for Marvell SMC ID's * 3/4 - Add function description comment - Define and use ARMADA7K8K_AP806_INDEX - Change function argument to EFI_PHYSICAL_ADDRESS * 4/4 - Move new SMC ID to MvSmc.h - Include ArmadaSoCDescLib.h directly (instead indirectly via BoardDesc.h) - Remove ARMADA7K8K_AP806_INDEX macro Grzegorz Jaszczyk (2): Marvell/Library: ArmadaSoCDescLib: Add North Bridge description Marvell/Armada7k8k: Read DRAM settings from ARM-TF Marcin Wojtas (3): Marvell/Armada7k8k: Refactor reserving memory regions Marvell/Armada7k8k: Shift PEI stack base and extend memory reservation Marvell/Library: Introduce common header for the SMC ID's Silicon/Marvell/Marvell.dec | 8 +- Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 16 ++- Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf | 3 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.inf | 8 +- Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h | 25 - Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h | 6 ++ Silicon/Marvell/Include/IndustryStandard/MvSmc.h | 24 + Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h | 28 + Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h | 8 +- Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c | 60 --- Silicon/Marvell/Armada7k8k/Library/Armada7k8kMemoryInitPeiLib/Armada7k8kMemoryInitPeiLib.c | 107 +--- Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 34 +++ Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c | 14 +-- 13 files changed, 220 insertions(+), 121 deletions(-) create mode 100644 Silicon/Marvell/Include/IndustryStandard/MvSmc.h -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH v2 1/4] Marvell/Armada7k8k: Shift PEI stack base
Hi Leif, śr., 23 sty 2019 o 10:42 Leif Lindholm napisał(a): > > On Wed, Jan 23, 2019 at 09:28:40AM +0100, Marcin Wojtas wrote: > > wt., 22 sty 2019 o 22:10 Leif Lindholm > > napisał(a): > > > > > > On Tue, Jan 22, 2019 at 09:56:14PM +0100, Marcin Wojtas wrote: > > > > > > > I think I gave my suggestion for the resolution of this problem > > > > > > > (with > > > > > > > moving StackBase to 0x0540 as the alternative) in my previous > > > > > > > reply. > > > > > > > > > > > > > > > > > > > Yes, and I answered, presenting the alternative memory map with > > > > > > additional 64kB "cut out" on top of 20MB "hole" of memory, which I'm > > > > > > not fancy, given available space inside the 20MB chunk. > > > > > > > > > > Please go back and reread my first and my second email. > > > > > Then please point out where I have, other than as an alternative > > > > > solution, suggested growing the cutout size. > > > > > > > > > > Then perhaps we can rewind this conversation and try again? > > > > > > > > Ok. So would it be sufficient to replace > > > > gMarvellTokenSpaceGuid.PcdSecureRegionBase with two sets of separate > > > > PCDs for ARM-TF runtime services and OPTEE leaving the PEI stack base > > > > @0x43f? > > > > > > That would be lovely, thank you :) > > > > > > (Although your reference to wanting to keep the PEI stack area out of > > > the hands of the operating system might mean that you want three? I'll > > > leave that to your discretion.) > > > > > > > PEI stack has its own PCDs: > >gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase > >gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize > > > > I want to keep it simple (and btw aligned with U-Boot booting the > > mainline DTB with single 20MB reserved memory area), so what I intend > > to do is to limit reserved region in Armada7k8kMemoryInitPeiLib.c with > > PcdArmTFRegionBase (@0x400) up to PcdOpteeRegionBase + > > PcdOpteeRegionSize (@0x540). > > I am totally online with you wanting to align the reservation of 20MB > of RAM with U-Boot. > > If you want to remove the 2MB gap between ARM-TF and Optee from use by > the OS, you need to reserve that 2MB window. Not pretend that it forms > part of an adjacent region that you also happen to want to keep out of > the hands of the OS. > > The point of the source code is not wiggling the correct signal lines > to create an expected behaviour. Were that the case, we'd be hacking > programs directly into binary. > The point of the source code is to describe what is being done such > that someone else can come in and understand it. > > Saving 15 (or 30, or whatever) lines of boilerplate text by making the > code misleading is not a win. > > You want to solve this by making PcdCPUCorePrimaryStackSize 2MB? > Fine. It's not misleading, and you could always shrink it if you need > the remainder for something else. > > You want to solve this by setting up a third reserved area of > (2MB - PcdCPUCorePrimaryStackSize)? > Fine. > > You want to solve this by making the source code say that a memory > region is simultaneously reserved for Secure world and where our > Non-secure stack resides? > Not fine. That is what I mean by semantic sense. > Thank you for your input. I will explicitly handle each region then. Best regards, Marcin ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH v2 1/4] Marvell/Armada7k8k: Shift PEI stack base
Hi Leif, wt., 22 sty 2019 o 22:10 Leif Lindholm napisał(a): > > On Tue, Jan 22, 2019 at 09:56:14PM +0100, Marcin Wojtas wrote: > > > > > I think I gave my suggestion for the resolution of this problem (with > > > > > moving StackBase to 0x0540 as the alternative) in my previous > > > > > reply. > > > > > > > > > > > > > Yes, and I answered, presenting the alternative memory map with > > > > additional 64kB "cut out" on top of 20MB "hole" of memory, which I'm > > > > not fancy, given available space inside the 20MB chunk. > > > > > > Please go back and reread my first and my second email. > > > Then please point out where I have, other than as an alternative > > > solution, suggested growing the cutout size. > > > > > > Then perhaps we can rewind this conversation and try again? > > > > Ok. So would it be sufficient to replace > > gMarvellTokenSpaceGuid.PcdSecureRegionBase with two sets of separate > > PCDs for ARM-TF runtime services and OPTEE leaving the PEI stack base > > @0x43f? > > That would be lovely, thank you :) > > (Although your reference to wanting to keep the PEI stack area out of > the hands of the operating system might mean that you want three? I'll > leave that to your discretion.) > PEI stack has its own PCDs: gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize I want to keep it simple (and btw aligned with U-Boot booting the mainline DTB with single 20MB reserved memory area), so what I intend to do is to limit reserved region in Armada7k8kMemoryInitPeiLib.c with PcdArmTFRegionBase (@0x400) up to PcdOpteeRegionBase + PcdOpteeRegionSize (@0x540). Best regards, Marcin ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH v2 1/4] Marvell/Armada7k8k: Shift PEI stack base
Hi Leif, wt., 22 sty 2019 o 21:26 Leif Lindholm napisał(a): > > On Tue, Jan 22, 2019 at 08:27:10PM +0100, Marcin Wojtas wrote: > > > > > > In order to fix this, extend the region which is non-accessible > > > > > > by the OS to cover both the ARM-TF (0x400 - 0x420) and OPTEE > > > > > > (0x440 - 0x540) within a single area (0x400 - > > > > > > 0x540). > > > > > > Set the PEI stack base address between both images (0x43F). > > > > > > > > > > OK, that is a much better description. > > > > > But I'm getting slight cognitive dissonance from placing the PEI stack > > > > > inside something we've just claimed belongs to Secure world... > > > > > > > > > > Could you instead break this out into two separate protected regions? > > > > > PcdSecureOpteeBase/Size and PcdSecureTfBase/Size? > > > > > > > > > > Alternatively, nudge the stackbase to 0x540? > > > > > > > > As discussed some time ago with Ard, when the PEI stack base was > > > > introduced, it is recommended that this stack is placed in the > > > > location, which is not accessible by OS. Most preferred is to have it > > > > in the SRAM (cannot do it on Armada7k8k) or in a reserved region - cut > > > > out from the memory map passed to the OS. > > > > > > > > Currently we have a single region (a "hole") that covers: > > > > 2MB for EL3 runtime services > > > > 2MB of nothing > > > > 16MB for OPTEE image > > > > > > > > The 2MB space between images IMO seems perfect for PEI stack to place. > > > > If it was placed e.g. @0x540 and we kept the reserved regions > > > > separate, the outcome would be: > > > > 2MB for EL3 runtime services > > > > 2MB of DRAM normal memory > > > > 16MB + 64kB for Optee and PEI stack base. > > > > > > > > This is the reason, I'd like to keep original setting, proposed in the > > > > patch. Please let know your opinion. > > > > > > I have no issue with the placement of the PEI stack between the ARM-TF > > > region and the Op-TEE region. I _have_ an issue with the PEI stack > > > being placed between PcdSecureRegionBase and (PcdSecureRegionBase + > > > PcdSecureRegionSize). I.e. something that we describe as "the Secure > > > region". > > > > > > I think I gave my suggestion for the resolution of this problem (with > > > moving StackBase to 0x0540 as the alternative) in my previous > > > reply. > > > > > > > Yes, and I answered, presenting the alternative memory map with > > additional 64kB "cut out" on top of 20MB "hole" of memory, which I'm > > not fancy, given available space inside the 20MB chunk. > > Please go back and reread my first and my second email. > Then please point out where I have, other than as an alternative > solution, suggested growing the cutout size. > > Then perhaps we can rewind this conversation and try again? Ok. So would it be sufficient to replace gMarvellTokenSpaceGuid.PcdSecureRegionBase with two sets of separate PCDs for ARM-TF runtime services and OPTEE leaving the PEI stack base @0x43f? Best regards, Marcin > > Best Regards, > > Leif > > > Because in fact this region is not entirely secure (EL3 runtime > > services are exectued in NS context for example), how about I: > > - rename the PCD's to be more generic (e.g. > > gMarvellTokenSpaceGuid.PcdReservedRegionBase) > > - add proper comment in Armada7k8k.dsc.inc for the default reserved > > memory (+ maybe in Armada7k8kLib, where the PCD's are used) > > ? > > > > Best regards, > > Marcin > > > > > > > > > > Best regards, > > > > Marcin > > > > > > > > > > > > > > > > > > / > > > > > Leif > > > > > > > > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > > > > Signed-off-by: Marcin Wojtas > > > > > > --- > > > > > > Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 4 ++-- > > > > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > > > > > > > diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > > > > > b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > >
Re: [edk2] [platforms: PATCH v2 1/4] Marvell/Armada7k8k: Shift PEI stack base
Hi Leif, wt., 22 sty 2019 o 20:06 Leif Lindholm napisał(a): > > On Tue, Jan 22, 2019 at 07:26:58PM +0100, Marcin Wojtas wrote: > > Hi Leif, > > > > wt., 22 sty 2019 o 18:26 Leif Lindholm > > napisał(a): > > > > > > On Tue, Jan 22, 2019 at 02:32:19AM +0100, Marcin Wojtas wrote: > > > > Recent changes in the ARM-TF configure its runtime serices region > > > > as protected, hence the hitherto PEI stack base address (0x41F) > > > > violated it. > > > > > > > > In order to fix this, extend the region which is non-accessible > > > > by the OS to cover both the ARM-TF (0x400 - 0x420) and OPTEE > > > > (0x440 - 0x540) within a single area (0x400 - 0x540). > > > > Set the PEI stack base address between both images (0x43F). > > > > > > OK, that is a much better description. > > > But I'm getting slight cognitive dissonance from placing the PEI stack > > > inside something we've just claimed belongs to Secure world... > > > > > > Could you instead break this out into two separate protected regions? > > > PcdSecureOpteeBase/Size and PcdSecureTfBase/Size? > > > > > > Alternatively, nudge the stackbase to 0x540? > > > > As discussed some time ago with Ard, when the PEI stack base was > > introduced, it is recommended that this stack is placed in the > > location, which is not accessible by OS. Most preferred is to have it > > in the SRAM (cannot do it on Armada7k8k) or in a reserved region - cut > > out from the memory map passed to the OS. > > > > Currently we have a single region (a "hole") that covers: > > 2MB for EL3 runtime services > > 2MB of nothing > > 16MB for OPTEE image > > > > The 2MB space between images IMO seems perfect for PEI stack to place. > > If it was placed e.g. @0x540 and we kept the reserved regions > > separate, the outcome would be: > > 2MB for EL3 runtime services > > 2MB of DRAM normal memory > > 16MB + 64kB for Optee and PEI stack base. > > > > This is the reason, I'd like to keep original setting, proposed in the > > patch. Please let know your opinion. > > I have no issue with the placement of the PEI stack between the ARM-TF > region and the Op-TEE region. I _have_ an issue with the PEI stack > being placed between PcdSecureRegionBase and (PcdSecureRegionBase + > PcdSecureRegionSize). I.e. something that we describe as "the Secure > region". > > I think I gave my suggestion for the resolution of this problem (with > moving StackBase to 0x0540 as the alternative) in my previous > reply. > Yes, and I answered, presenting the alternative memory map with additional 64kB "cut out" on top of 20MB "hole" of memory, which I'm not fancy, given available space inside the 20MB chunk. Because in fact this region is not entirely secure (EL3 runtime services are exectued in NS context for example), how about I: - rename the PCD's to be more generic (e.g. gMarvellTokenSpaceGuid.PcdReservedRegionBase) - add proper comment in Armada7k8k.dsc.inc for the default reserved memory (+ maybe in Armada7k8kLib, where the PCD's are used) ? Best regards, Marcin > > > > Best regards, > > Marcin > > > > > > > > > > / > > > Leif > > > > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > > Signed-off-by: Marcin Wojtas > > > > --- > > > > Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 4 ++-- > > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > > > b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > > > index eafcd6e..c8c597f 100644 > > > > --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > > > +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > > > @@ -376,12 +376,12 @@ > > > > > > > >gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|36 > > > > > > > > - gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x41F > > > > + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x43F > > > >gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x1 > > > > > > > ># Secure region reservation > > > >gMarvellTokenSpaceGuid.PcdSecureRegionBase|0x400 > > > > - gMarvellTokenSpaceGuid.PcdSecureRegionSize|0x020 > > > > + gMarvellTokenSpaceGuid.PcdSecureRegionSize|0x140 > > > > > > > ># TRNG > > > >gMarvellTokenSpaceGuid.PcdEip76TrngBaseAddress|0xF276 > > > > -- > > > > 2.7.4 > > > > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH v2 1/4] Marvell/Armada7k8k: Shift PEI stack base
Hi Leif, wt., 22 sty 2019 o 18:26 Leif Lindholm napisał(a): > > On Tue, Jan 22, 2019 at 02:32:19AM +0100, Marcin Wojtas wrote: > > Recent changes in the ARM-TF configure its runtime serices region > > as protected, hence the hitherto PEI stack base address (0x41F) > > violated it. > > > > In order to fix this, extend the region which is non-accessible > > by the OS to cover both the ARM-TF (0x400 - 0x420) and OPTEE > > (0x440 - 0x540) within a single area (0x400 - 0x540). > > Set the PEI stack base address between both images (0x43F). > > OK, that is a much better description. > But I'm getting slight cognitive dissonance from placing the PEI stack > inside something we've just claimed belongs to Secure world... > > Could you instead break this out into two separate protected regions? > PcdSecureOpteeBase/Size and PcdSecureTfBase/Size? > > Alternatively, nudge the stackbase to 0x540? As discussed some time ago with Ard, when the PEI stack base was introduced, it is recommended that this stack is placed in the location, which is not accessible by OS. Most preferred is to have it in the SRAM (cannot do it on Armada7k8k) or in a reserved region - cut out from the memory map passed to the OS. Currently we have a single region (a "hole") that covers: 2MB for EL3 runtime services 2MB of nothing 16MB for OPTEE image The 2MB space between images IMO seems perfect for PEI stack to place. If it was placed e.g. @0x540 and we kept the reserved regions separate, the outcome would be: 2MB for EL3 runtime services 2MB of DRAM normal memory 16MB + 64kB for Optee and PEI stack base. This is the reason, I'd like to keep original setting, proposed in the patch. Please let know your opinion. Best regards, Marcin > > / > Leif > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > index eafcd6e..c8c597f 100644 > > --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > @@ -376,12 +376,12 @@ > > > >gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|36 > > > > - gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x41F > > + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x43F > >gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x1 > > > ># Secure region reservation > >gMarvellTokenSpaceGuid.PcdSecureRegionBase|0x400 > > - gMarvellTokenSpaceGuid.PcdSecureRegionSize|0x020 > > + gMarvellTokenSpaceGuid.PcdSecureRegionSize|0x140 > > > ># TRNG > >gMarvellTokenSpaceGuid.PcdEip76TrngBaseAddress|0xF276 > > -- > > 2.7.4 > > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH v2 2/4] Marvell/Library: Introduce common header for the SMC ID's
Hi Leif, wt., 22 sty 2019 o 18:36 Leif Lindholm napisał(a): > > On Tue, Jan 22, 2019 at 02:32:20AM +0100, Marcin Wojtas wrote: > > Marvell firmware allows to use SiP services other than > > for ComPhy handling. In order to avoid spreading the SMC > > ID's definitions across many files, introduce common header > > for that purpose. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > Silicon/Marvell/Include/Library/MvSmc.h | 23 > > Final nitpick: This isn't a library. > IndustryStandard is probably a better approximation. (You are > effectively extending ArmPkg/Include/IndustryStandard/ArmStdSmc.h with > vendor-specific bits.) > Ok, I will move MvSmc.h to such location. Thanks, Marcin > With that change: > Reviewed-by: Leif Lindholm > > / > Leif > > > Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h | 8 +++ > > Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c | 14 ++-- > > 3 files changed, 33 insertions(+), 12 deletions(-) > > create mode 100644 Silicon/Marvell/Include/Library/MvSmc.h > > > > diff --git a/Silicon/Marvell/Include/Library/MvSmc.h > > b/Silicon/Marvell/Include/Library/MvSmc.h > > new file mode 100644 > > index 000..2d1542a > > --- /dev/null > > +++ b/Silicon/Marvell/Include/Library/MvSmc.h > > @@ -0,0 +1,23 @@ > > +/** > > +* > > +* Copyright (C) 2019, Marvell International Ltd. and its affiliates. > > +* > > +* This program and the accompanying materials are licensed and made > > available > > +* under the terms and conditions of the BSD License which accompanies this > > +* distribution. The full text of the license may be found at > > +* http://opensource.org/licenses/bsd-license.php > > +* > > +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > > +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > > IMPLIED. > > +* > > +**/ > > + > > +#ifndef __MV_SMC_H__ > > +#define __MV_SMC_H__ > > + > > +/* Marvell SiP services SMC ID's */ > > +#define MV_SMC_ID_COMPHY_POWER_ON 0x8201 > > +#define MV_SMC_ID_COMPHY_POWER_OFF0x8202 > > +#define MV_SMC_ID_COMPHY_PLL_LOCK 0x8203 > > + > > +#endif //__MV_SMC_H__ > > diff --git a/Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h > > b/Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h > > index d156af6..f6ac65b 100644 > > --- a/Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h > > +++ b/Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h > > @@ -35,16 +35,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH > > DAMAGE. > > #ifndef __COMPHY_SIP_SVC_H__ > > #define __COMPHY_SIP_SVC_H__ > > > > +#include > > + > > /* > > * All values in this file are defined externally and used > > * for the SerDes configuration via SiP services. > > */ > > > > -/* Firmware related definitions used for SMC calls */ > > -#define MV_SIP_COMPHY_POWER_ON 0x8201 > > -#define MV_SIP_COMPHY_POWER_OFF 0x8202 > > -#define MV_SIP_COMPHY_PLL_LOCK 0x8203 > > - > > +/* Helper macros for passing ComPhy parameters to the EL3 */ > > #define COMPHY_FW_MODE_FORMAT(mode) (mode << 12) > > #define COMPHY_FW_FORMAT(mode, idx, speeds) \ > > ((mode << 12) | (idx << 8) | (speeds > > << 2)) > > diff --git a/Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c > > b/Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c > > index 2abb006..4f85676 100755 > > --- a/Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c > > +++ b/Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c > > @@ -163,7 +163,7 @@ ComPhySataPowerUp ( > > > >ComPhySataMacPowerDown (Desc[ChipId].SoC->AhciBaseAddress); > > > > - Status = ComPhySmc (MV_SIP_COMPHY_POWER_ON, > > + Status = ComPhySmc (MV_SMC_ID_COMPHY_POWER_ON, > > ComPhyBase, > > Lane, > > COMPHY_FW_FORMAT (COMPHY_SATA_MODE, > > @@ -175,7 +175,7 @@ ComPhySataPowerUp ( > > > >ComPhySataPhyPowerUp (Desc[ChipId].SoC->AhciBaseAddress); > > > > - Status = ComPhySmc (MV_SIP_COMPHY_PLL_LOCK, > > + Status = ComPhySmc (MV_SMC_ID_COMPHY_PLL_LOCK, > > ComPhyBase, > > Lane, > > COMPHY_FW_FORMAT (COMPHY_SATA_MODE, > > @@ -234,7 +234,7 @@ ComPhyCp110Init ( > &g
[edk2] [platforms: PATCH v2 4/4] Marvell/Armada7k8k: Read DRAM settings from ARM-TF
From: Grzegorz Jaszczyk The memory controller registers are marked as secure in the latest ARM-TF for Armada SoCs. It is available however get the DRAM information via SiP services in the EL3, so use it instead of accessing the registers directly. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf | 3 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h | 25 Silicon/Marvell/Include/Library/MvSmc.h | 1 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c | 60 ++-- 4 files changed, 22 insertions(+), 67 deletions(-) diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf index e888566..0c7f320 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf @@ -41,12 +41,15 @@ [Packages] ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec [LibraryClasses] + ArmadaSoCDescLib ArmLib + ArmSmcLib DebugLib MemoryAllocationLib MppLib diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h index cc30e4a..8101cf3 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h @@ -46,28 +46,3 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (MmioRead32 (CCU_MC_RCR_REG) & REMAP_SIZE_MASK) + SIZE_1MB #define DRAM_REMAP_TARGET \ (MmioRead32 (CCU_MC_RTBR_REG) << TARGET_BASE_OFFS) - -#define DRAM_CH0_MMAP_LOW_REG(cs) (0xf0020200 + (cs) * 0x8) -#define DRAM_CS_VALID_ENABLED_MASK 0x1 -#define DRAM_AREA_LENGTH_OFFS 16 -#define DRAM_AREA_LENGTH_MASK (0x1f << DRAM_AREA_LENGTH_OFFS) -#define DRAM_START_ADDRESS_L_OFFS 23 -#define DRAM_START_ADDRESS_L_MASK (0x1ff << DRAM_START_ADDRESS_L_OFFS) -#define DRAM_CH0_MMAP_HIGH_REG(cs) (0xf0020204 + (cs) * 0x8) -#define DRAM_START_ADDR_HTOL_OFFS 32 - -#define DRAM_MAX_CS_NUM 8 - -#define DRAM_CS_ENABLED(Cs) \ - (MmioRead32 (DRAM_CH0_MMAP_LOW_REG (Cs)) & DRAM_CS_VALID_ENABLED_MASK) -#define GET_DRAM_REGION_BASE(Cs) \ - ((UINT64)MmioRead32 (DRAM_CH0_MMAP_HIGH_REG ((Cs))) << \ - DRAM_START_ADDR_HTOL_OFFS) | \ - (MmioRead32 (DRAM_CH0_MMAP_LOW_REG (Cs)) & DRAM_START_ADDRESS_L_MASK); -#define GET_DRAM_REGION_SIZE_CODE(Cs) \ - (MmioRead32 (DRAM_CH0_MMAP_LOW_REG ((Cs))) & \ - DRAM_AREA_LENGTH_MASK) >> DRAM_AREA_LENGTH_OFFS -#define DRAM_REGION_SIZE_EVEN(C)(((C) >= 7) && ((C) <= 26)) -#define GET_DRAM_REGION_SIZE_EVEN(C)((UINT64)1 << ((C) + 16)) -#define DRAM_REGION_SIZE_ODD(C) ((C) <= 4) -#define GET_DRAM_REGION_SIZE_ODD(C) ((UINT64)0x1800 << (C)) diff --git a/Silicon/Marvell/Include/Library/MvSmc.h b/Silicon/Marvell/Include/Library/MvSmc.h index 2d1542a..0c90f11 100644 --- a/Silicon/Marvell/Include/Library/MvSmc.h +++ b/Silicon/Marvell/Include/Library/MvSmc.h @@ -19,5 +19,6 @@ #define MV_SMC_ID_COMPHY_POWER_ON 0x8201 #define MV_SMC_ID_COMPHY_POWER_OFF0x8202 #define MV_SMC_ID_COMPHY_PLL_LOCK 0x8203 +#define MV_SMC_ID_DRAM_SIZE 0x8210 #endif //__MV_SMC_H__ diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c index 2a4f5ad..8517deb 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c @@ -32,12 +32,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***/ -#include +#include + +#include + +#include #include +#include #include #include #include #include +#include #include "Armada7k8kLibMem.h" @@ -57,49 +63,19 @@ GetDramSize ( IN OUT UINT64 *MemSize ) { - UINT64 BaseAddr; - UINT8 RegionCode; - UINT8 Cs; - - *MemSize = 0; - - for (Cs = 0; Cs < DRAM_MAX_CS_NUM; Cs++) { - -/* Exit loop on first disabled DRAM CS */ -if (!DRAM_CS_ENABLED (Cs)) { - break; -} - -/* - * Sanity check for base address of next DRAM block. - * Only continuous space will be used. - */ -BaseAddr = GET_DRAM_REGION_BASE (Cs); -if (BaseAddr != *MemSize) { - DEBUG ((DEBUG_ERROR, -"%a: DRAM blocks are not c
[edk2] [platforms: PATCH v2 3/4] Marvell/Library: ArmadaSoCDescLib: Add North Bridge description
From: Grzegorz Jaszczyk For upcomming patch there is need to get AP806 base, provide required getter function for it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h | 6 Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h | 28 Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 34 3 files changed, 68 insertions(+) diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h index bfc8639..c2d7933 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h @@ -22,9 +22,15 @@ // Common macros // #define MV_SOC_CP_BASE(Cp) (0xF200 + ((Cp) * 0x200)) +#define MV_SOC_AP806_BASE0xF000 #define MV_SOC_AP806_COUNT 1 // +// Armada7k8k default North Bridge index +// +#define ARMADA7K8K_AP806_INDEX 0 + +// // Platform description of AHCI controllers // #define MV_SOC_AHCI_BASE(Cp) (MV_SOC_CP_BASE (Cp) + 0x54) diff --git a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h index 26b075a..fc17c3a 100644 --- a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h +++ b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h @@ -20,6 +20,34 @@ #include // +// North Bridge description +// + +/** + +Routine Description: + + Get base address of the SoC North Bridge. + +Arguments: + + ApBase - Base address of the North Bridge. + ApIndex - Index of the North Bridge. + +Returns: + + EFI_SUCCESS - Proper base address is returned. + EFI_INVALID_PARAMETER - The index is out of range. + +**/ +EFI_STATUS +EFIAPI +ArmadaSoCAp8xxBaseGet ( + IN OUT EFI_PHYSICAL_ADDRESS *ApBase, + IN UINTN ApIndex + ); + +// // ComPhy SoC description // typedef struct { diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c index 5b72c20..584f445 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c @@ -28,6 +28,40 @@ #include "Armada7k8kSoCDescLib.h" +/** + +Routine Description: + + Get base address of the SoC North Bridge. + +Arguments: + + ApBase - Base address of the North Bridge. + ApIndex - Index of the North Bridge. + +Returns: + + EFI_SUCCESS - Proper base address is returned. + EFI_INVALID_PARAMETER - The index is out of range. + +**/ +EFI_STATUS +EFIAPI +ArmadaSoCAp8xxBaseGet ( + IN OUT EFI_PHYSICAL_ADDRESS *ApBase, + IN UINTN ApIndex + ) +{ + if (ApIndex != ARMADA7K8K_AP806_INDEX) { +DEBUG ((DEBUG_ERROR, "%a: Only one AP806 in A7K/A8K SoC\n", __FUNCTION__)); +return EFI_INVALID_PARAMETER; + } + + *ApBase = MV_SOC_AP806_BASE; + + return EFI_SUCCESS; +} + EFI_STATUS EFIAPI ArmadaSoCDescComPhyGet ( -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v2 2/4] Marvell/Library: Introduce common header for the SMC ID's
Marvell firmware allows to use SiP services other than for ComPhy handling. In order to avoid spreading the SMC ID's definitions across many files, introduce common header for that purpose. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Include/Library/MvSmc.h | 23 Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h | 8 +++ Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c | 14 ++-- 3 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 Silicon/Marvell/Include/Library/MvSmc.h diff --git a/Silicon/Marvell/Include/Library/MvSmc.h b/Silicon/Marvell/Include/Library/MvSmc.h new file mode 100644 index 000..2d1542a --- /dev/null +++ b/Silicon/Marvell/Include/Library/MvSmc.h @@ -0,0 +1,23 @@ +/** +* +* Copyright (C) 2019, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef __MV_SMC_H__ +#define __MV_SMC_H__ + +/* Marvell SiP services SMC ID's */ +#define MV_SMC_ID_COMPHY_POWER_ON 0x8201 +#define MV_SMC_ID_COMPHY_POWER_OFF0x8202 +#define MV_SMC_ID_COMPHY_PLL_LOCK 0x8203 + +#endif //__MV_SMC_H__ diff --git a/Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h b/Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h index d156af6..f6ac65b 100644 --- a/Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h +++ b/Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h @@ -35,16 +35,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef __COMPHY_SIP_SVC_H__ #define __COMPHY_SIP_SVC_H__ +#include + /* * All values in this file are defined externally and used * for the SerDes configuration via SiP services. */ -/* Firmware related definitions used for SMC calls */ -#define MV_SIP_COMPHY_POWER_ON 0x8201 -#define MV_SIP_COMPHY_POWER_OFF 0x8202 -#define MV_SIP_COMPHY_PLL_LOCK 0x8203 - +/* Helper macros for passing ComPhy parameters to the EL3 */ #define COMPHY_FW_MODE_FORMAT(mode) (mode << 12) #define COMPHY_FW_FORMAT(mode, idx, speeds) \ ((mode << 12) | (idx << 8) | (speeds << 2)) diff --git a/Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c b/Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c index 2abb006..4f85676 100755 --- a/Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c +++ b/Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c @@ -163,7 +163,7 @@ ComPhySataPowerUp ( ComPhySataMacPowerDown (Desc[ChipId].SoC->AhciBaseAddress); - Status = ComPhySmc (MV_SIP_COMPHY_POWER_ON, + Status = ComPhySmc (MV_SMC_ID_COMPHY_POWER_ON, ComPhyBase, Lane, COMPHY_FW_FORMAT (COMPHY_SATA_MODE, @@ -175,7 +175,7 @@ ComPhySataPowerUp ( ComPhySataPhyPowerUp (Desc[ChipId].SoC->AhciBaseAddress); - Status = ComPhySmc (MV_SIP_COMPHY_PLL_LOCK, + Status = ComPhySmc (MV_SMC_ID_COMPHY_PLL_LOCK, ComPhyBase, Lane, COMPHY_FW_FORMAT (COMPHY_SATA_MODE, @@ -234,7 +234,7 @@ ComPhyCp110Init ( case COMPHY_TYPE_PCIE1: case COMPHY_TYPE_PCIE2: case COMPHY_TYPE_PCIE3: - Status = ComPhySmc (MV_SIP_COMPHY_POWER_ON, + Status = ComPhySmc (MV_SMC_ID_COMPHY_POWER_ON, PtrChipCfg->ComPhyBaseAddr, Lane, COMPHY_FW_PCIE_FORMAT (PcieWidth, @@ -269,7 +269,7 @@ ComPhyCp110Init ( break; case COMPHY_TYPE_USB3_HOST0: case COMPHY_TYPE_USB3_HOST1: - Status = ComPhySmc (MV_SIP_COMPHY_POWER_ON, + Status = ComPhySmc (MV_SMC_ID_COMPHY_POWER_ON, PtrChipCfg->ComPhyBaseAddr, Lane, COMPHY_FW_MODE_FORMAT (COMPHY_USB3H_MODE)); @@ -278,7 +278,7 @@ ComPhyCp110Init ( case COMPHY_TYPE_SGMII1: case COMPHY_TYPE_SGMII2: case COMPHY_TYPE_SGMII3: - Status = ComPhySmc (MV_SIP_COMPHY_POWER_ON, + Status = ComPhySmc (MV_SMC_ID_COMPHY_POWER_ON, PtrChipCfg->ComPhyBaseAddr, Lane, COMPHY_FW_FORMAT (COMPHY_SGMII_MODE, @@ -286,7 +286,7 @@ ComPhyCp110Init ( PtrComPhyMap->Speed)); break; case COMPHY_TYPE_SFI: - Status = ComPhySmc (MV_SIP_COMPHY_POWER_ON, + Status = ComPhySmc (MV_SMC_ID_COMPHY_POWER_ON, PtrChipCfg->ComPhyBaseAddr, Lane, COMPHY_FW_FORMAT (COMPHY_SFI_MODE, @@ -295,7 +295,7 @@ ComPhyCp110Init ( break; case COMPHY_TYPE_RXAUI0:
[edk2] [platforms: PATCH v2 1/4] Marvell/Armada7k8k: Shift PEI stack base
Recent changes in the ARM-TF configure its runtime serices region as protected, hence the hitherto PEI stack base address (0x41F) violated it. In order to fix this, extend the region which is non-accessible by the OS to cover both the ARM-TF (0x400 - 0x420) and OPTEE (0x440 - 0x540) within a single area (0x400 - 0x540). Set the PEI stack base address between both images (0x43F). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc index eafcd6e..c8c597f 100644 --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc @@ -376,12 +376,12 @@ gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|36 - gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x41F + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x43F gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x1 # Secure region reservation gMarvellTokenSpaceGuid.PcdSecureRegionBase|0x400 - gMarvellTokenSpaceGuid.PcdSecureRegionSize|0x020 + gMarvellTokenSpaceGuid.PcdSecureRegionSize|0x140 # TRNG gMarvellTokenSpaceGuid.PcdEip76TrngBaseAddress|0xF276 -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v2 0/4] Armada7k8k memory handling update
Hi, The second version of the patchset introduces the new common header for Marvell SMC ID's, and answers other remarks pointed out in v1 review. The details can be found in the changelog below. Patches are available in the github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/dram-upstream-r20190122 I'm looking forward to the comments and remarks. Best regards, Marcin Changelog: v1 -> v2: * 1/4 - Improve commit log - mention single area size and new PEI stack base * 2/4 (new patch) - Add common header for Marvell SMC ID's * 3/4 - Add function description comment - Define and use ARMADA7K8K_AP806_INDEX - Change function argument to EFI_PHYSICAL_ADDRESS * 4/4 - Move new SMC ID to MvSmc.h - Include ArmadaSoCDescLib.h directly (instead indirectly via BoardDesc.h) - Remove ARMADA7K8K_AP806_INDEX macro Grzegorz Jaszczyk (2): Marvell/Library: ArmadaSoCDescLib: Add North Bridge description Marvell/Armada7k8k: Read DRAM settings from ARM-TF Marcin Wojtas (2): Marvell/Armada7k8k: Shift PEI stack base Marvell/Library: Introduce common header for the SMC ID's Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 4 +- Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf | 3 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h | 25 Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h | 6 ++ Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h | 28 + Silicon/Marvell/Include/Library/MvSmc.h | 24 Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h | 8 +-- Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c | 60 ++-- Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 34 +++ Silicon/Marvell/Library/ComPhyLib/ComPhyCp110.c | 14 ++--- 10 files changed, 125 insertions(+), 81 deletions(-) create mode 100644 Silicon/Marvell/Include/Library/MvSmc.h -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH 3/3] Marvell/Armada7k8k: Read DRAM settings from ARM-TF
Hi Leif, pon., 21 sty 2019 o 12:51 Leif Lindholm napisał(a): > > On Mon, Jan 21, 2019 at 11:52:11AM +0100, Marcin Wojtas wrote: > > From: Grzegorz Jaszczyk > > > > The memory controller registers are marked as secure in the latest > > ARM-TF for Armada SoCs. It is available however get the DRAM > > information via SiP services in the EL3, so use it instead > > of accessing the registers directly. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf | 3 ++ > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h | 27 > > ++ > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c | 55 > > +--- > > 3 files changed, 21 insertions(+), 64 deletions(-) > > > > diff --git > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf > > index e888566..0c7f320 100644 > > --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf > > +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf > > @@ -41,12 +41,15 @@ > > [Packages] > >ArmPkg/ArmPkg.dec > >ArmPlatformPkg/ArmPlatformPkg.dec > > + EmbeddedPkg/EmbeddedPkg.dec > >MdeModulePkg/MdeModulePkg.dec > >MdePkg/MdePkg.dec > >Silicon/Marvell/Marvell.dec > > > > [LibraryClasses] > > + ArmadaSoCDescLib > >ArmLib > > + ArmSmcLib > >DebugLib > >MemoryAllocationLib > >MppLib > > diff --git > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h > > index cc30e4a..8a46df6 100644 > > --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h > > +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h > > @@ -47,27 +47,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH > > DAMAGE. > > #define DRAM_REMAP_TARGET \ > >(MmioRead32 (CCU_MC_RTBR_REG) << TARGET_BASE_OFFS) > > > > -#define DRAM_CH0_MMAP_LOW_REG(cs) (0xf0020200 + (cs) * 0x8) > > -#define DRAM_CS_VALID_ENABLED_MASK 0x1 > > -#define DRAM_AREA_LENGTH_OFFS 16 > > -#define DRAM_AREA_LENGTH_MASK (0x1f << DRAM_AREA_LENGTH_OFFS) > > -#define DRAM_START_ADDRESS_L_OFFS 23 > > -#define DRAM_START_ADDRESS_L_MASK (0x1ff << > > DRAM_START_ADDRESS_L_OFFS) > > -#define DRAM_CH0_MMAP_HIGH_REG(cs) (0xf0020204 + (cs) * 0x8) > > -#define DRAM_START_ADDR_HTOL_OFFS 32 > > +/* Armada7k8k North Bridge index */ > > +#define ARMADA7K8K_AP806_INDEX 0 > > > > -#define DRAM_MAX_CS_NUM 8 > > - > > -#define DRAM_CS_ENABLED(Cs) \ > > - (MmioRead32 (DRAM_CH0_MMAP_LOW_REG (Cs)) & > > DRAM_CS_VALID_ENABLED_MASK) > > -#define GET_DRAM_REGION_BASE(Cs) \ > > - ((UINT64)MmioRead32 (DRAM_CH0_MMAP_HIGH_REG ((Cs))) << \ > > - DRAM_START_ADDR_HTOL_OFFS) | \ > > - (MmioRead32 (DRAM_CH0_MMAP_LOW_REG (Cs)) & > > DRAM_START_ADDRESS_L_MASK); > > -#define GET_DRAM_REGION_SIZE_CODE(Cs) \ > > - (MmioRead32 (DRAM_CH0_MMAP_LOW_REG ((Cs))) & \ > > - DRAM_AREA_LENGTH_MASK) >> DRAM_AREA_LENGTH_OFFS > > -#define DRAM_REGION_SIZE_EVEN(C)(((C) >= 7) && ((C) <= 26)) > > -#define GET_DRAM_REGION_SIZE_EVEN(C)((UINT64)1 << ((C) + 16)) > > -#define DRAM_REGION_SIZE_ODD(C) ((C) <= 4) > > -#define GET_DRAM_REGION_SIZE_ODD(C) ((UINT64)0x1800 << (C)) > > +/* Firmware related definition used for SMC calls */ > > +#define MV_SIP_DRAM_SIZE0x8210 > > Hmm... > This would end us up with having Marvell SMC calls spread across > multiple files. Could you insert an intermediate patch which breaks out > the ones from Silicon/Marvell/Library/ComPhyLib/ComPhySipSvc.h into a > separate (MarvellSmc.h?) include file? How about MvSmc.h ? I try to use 'Mv' prefix consistently, especially when adding new code. > > If you could further add _SMC_ID to the #defines (like in edk2 > ArmPkg/Include/IndustryStandard/ArmStdSmc.h), that would make me very > happy. (I'd be happy for you to drop _SIP, or keep it either side of > the addition, as per your preference - we don't seem to have precedent > here yet.) > How about below: #define MV_SMC_ID_
Re: [edk2] [platforms: PATCH 2/3] Marvell/Library: ArmadaSoCDescLib: Add North Bridge description
Hi Leif, pon., 21 sty 2019 o 12:32 Leif Lindholm napisał(a): > > On Mon, Jan 21, 2019 at 11:52:10AM +0100, Marcin Wojtas wrote: > > From: Grzegorz Jaszczyk > > > > For upcomming patch there is need to get AP806 base, provide required > > getter function for it. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h > > | 1 + > > Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h > > | 10 ++ > > > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c > > | 17 + > > 3 files changed, 28 insertions(+) > > > > diff --git > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h > > > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h > > index bfc8639..6caee6c 100644 > > --- > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h > > +++ > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h > > @@ -22,6 +22,7 @@ > > // Common macros > > // > > #define MV_SOC_CP_BASE(Cp) (0xF200 + ((Cp) * 0x200)) > > +#define MV_SOC_AP806_BASE0xF000 > > #define MV_SOC_AP806_COUNT 1 > > > > // > > diff --git a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h > > b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h > > index 26b075a..7aec9be 100644 > > --- a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h > > +++ b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h > > @@ -20,6 +20,16 @@ > > #include > > > > // > > +// North Bridge description > > +// > > +EFI_STATUS > > +EFIAPI > > +ArmadaSoCAp8xxBaseGet ( > > + IN OUT UINT64 *ApBase, > > + IN UINTNApIndex > > + ); > > + > > +// > > // ComPhy SoC description > > // > > typedef struct { > > diff --git > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c > > > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c > > index 5b72c20..089ac2d 100644 > > --- > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c > > +++ > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c > > @@ -30,6 +30,23 @@ > > > > As I said, I was going to get stricter about adding function > description comments - please add one here. (And clone it to > ArmadaSoCDescLib.h, for the obious place to go look for a template > when implementing a variant for a new platform.) Sure, I will add it. > > > EFI_STATUS > > EFIAPI > > +ArmadaSoCAp8xxBaseGet ( > > + IN OUT UINT64 *ApBase, > > + IN UINTNApIndex > > + ) > > +{ > > + if (ApIndex != 0) { > > This test should be using ARMADA7K8K_AP806_INDEX, and that definition > should be added to this patch. > Ok. Thanks, Marcin > > +DEBUG ((DEBUG_ERROR, "%a: Only one AP806 in A7K/A8K SoC\n", > > __FUNCTION__)); > > +return EFI_INVALID_PARAMETER; > > + } > > + > > + *ApBase = MV_SOC_AP806_BASE; > > + > > + return EFI_SUCCESS; > > +} > > + > > +EFI_STATUS > > +EFIAPI > > ArmadaSoCDescComPhyGet ( > >IN OUT MV_SOC_COMPHY_DESC **ComPhyDesc, > >IN OUT UINTN*DescCount > > -- > > 2.7.4 > > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH 1/3] Marvell: Armada7k8k: Shift PEI stack base
Hi Leif, pon., 21 sty 2019 o 12:26 Leif Lindholm napisał(a): > > On Mon, Jan 21, 2019 at 11:52:09AM +0100, Marcin Wojtas wrote: > > Recent changes in the ARM-TF configure its runtime serices region > > as protected, hence the hitherto PEI stack base address (0x41F) > > violated it. > > > > In order to fix this, extend the region which is non-accessible > > by the OS to cover both the ARM-TF (0x400 - 0x420) and OPTEE > > (0x440 - 0x540) within a single area and set the PEI stack > > What is the single area? The single region is set to: 0x400 - 0x540 PEI stack base is shifted right below the OPTEE region, i.e. to: 0x43F Do you wish to add above to the commit message as well? Best regards, Marcin > > > base address between both images. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > index eafcd6e..c8c597f 100644 > > --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > > @@ -376,12 +376,12 @@ > > > >gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|36 > > > > - gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x41F > > + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x43F > >gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x1 > > > ># Secure region reservation > >gMarvellTokenSpaceGuid.PcdSecureRegionBase|0x400 > > - gMarvellTokenSpaceGuid.PcdSecureRegionSize|0x020 > > + gMarvellTokenSpaceGuid.PcdSecureRegionSize|0x140 > > > ># TRNG > >gMarvellTokenSpaceGuid.PcdEip76TrngBaseAddress|0xF276 > > -- > > 2.7.4 > > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH 3/3] Marvell/Armada7k8k: Read DRAM settings from ARM-TF
From: Grzegorz Jaszczyk The memory controller registers are marked as secure in the latest ARM-TF for Armada SoCs. It is available however get the DRAM information via SiP services in the EL3, so use it instead of accessing the registers directly. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf | 3 ++ Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h | 27 ++ Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c | 55 +--- 3 files changed, 21 insertions(+), 64 deletions(-) diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf index e888566..0c7f320 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf @@ -41,12 +41,15 @@ [Packages] ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec [LibraryClasses] + ArmadaSoCDescLib ArmLib + ArmSmcLib DebugLib MemoryAllocationLib MppLib diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h index cc30e4a..8a46df6 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h @@ -47,27 +47,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define DRAM_REMAP_TARGET \ (MmioRead32 (CCU_MC_RTBR_REG) << TARGET_BASE_OFFS) -#define DRAM_CH0_MMAP_LOW_REG(cs) (0xf0020200 + (cs) * 0x8) -#define DRAM_CS_VALID_ENABLED_MASK 0x1 -#define DRAM_AREA_LENGTH_OFFS 16 -#define DRAM_AREA_LENGTH_MASK (0x1f << DRAM_AREA_LENGTH_OFFS) -#define DRAM_START_ADDRESS_L_OFFS 23 -#define DRAM_START_ADDRESS_L_MASK (0x1ff << DRAM_START_ADDRESS_L_OFFS) -#define DRAM_CH0_MMAP_HIGH_REG(cs) (0xf0020204 + (cs) * 0x8) -#define DRAM_START_ADDR_HTOL_OFFS 32 +/* Armada7k8k North Bridge index */ +#define ARMADA7K8K_AP806_INDEX 0 -#define DRAM_MAX_CS_NUM 8 - -#define DRAM_CS_ENABLED(Cs) \ - (MmioRead32 (DRAM_CH0_MMAP_LOW_REG (Cs)) & DRAM_CS_VALID_ENABLED_MASK) -#define GET_DRAM_REGION_BASE(Cs) \ - ((UINT64)MmioRead32 (DRAM_CH0_MMAP_HIGH_REG ((Cs))) << \ - DRAM_START_ADDR_HTOL_OFFS) | \ - (MmioRead32 (DRAM_CH0_MMAP_LOW_REG (Cs)) & DRAM_START_ADDRESS_L_MASK); -#define GET_DRAM_REGION_SIZE_CODE(Cs) \ - (MmioRead32 (DRAM_CH0_MMAP_LOW_REG ((Cs))) & \ - DRAM_AREA_LENGTH_MASK) >> DRAM_AREA_LENGTH_OFFS -#define DRAM_REGION_SIZE_EVEN(C)(((C) >= 7) && ((C) <= 26)) -#define GET_DRAM_REGION_SIZE_EVEN(C)((UINT64)1 << ((C) + 16)) -#define DRAM_REGION_SIZE_ODD(C) ((C) <= 4) -#define GET_DRAM_REGION_SIZE_ODD(C) ((UINT64)0x1800 << (C)) +/* Firmware related definition used for SMC calls */ +#define MV_SIP_DRAM_SIZE0x8210 diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c index 2a4f5ad..62e8467 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c @@ -33,11 +33,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***/ #include +#include #include +#include #include #include #include #include +#include #include "Armada7k8kLibMem.h" @@ -57,49 +60,19 @@ GetDramSize ( IN OUT UINT64 *MemSize ) { - UINT64 BaseAddr; - UINT8 RegionCode; - UINT8 Cs; - - *MemSize = 0; - - for (Cs = 0; Cs < DRAM_MAX_CS_NUM; Cs++) { - -/* Exit loop on first disabled DRAM CS */ -if (!DRAM_CS_ENABLED (Cs)) { - break; -} - -/* - * Sanity check for base address of next DRAM block. - * Only continuous space will be used. - */ -BaseAddr = GET_DRAM_REGION_BASE (Cs); -if (BaseAddr != *MemSize) { - DEBUG ((DEBUG_ERROR, -"%a: DRAM blocks are not contiguous, limit size to 0x%llx\n", -__FUNCTION__, -*MemSize)); - return EFI_SUCCESS; -} - -/* Decode area length for current CS from register value */ -RegionCode = GET_DRAM_REGION_SIZE_CODE (Cs); - -if (DRAM_REGION_SIZE_EVEN (RegionCode)) { - *MemSize += GET_DRAM_REGION_SIZE_EVEN (RegionCode); -} else if (DRAM_REGION_SIZE_ODD (RegionCode)) { - *MemSize += GET_DRAM_REGION_SIZE_ODD (RegionCode); -}
[edk2] [platforms: PATCH 2/3] Marvell/Library: ArmadaSoCDescLib: Add North Bridge description
From: Grzegorz Jaszczyk For upcomming patch there is need to get AP806 base, provide required getter function for it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h | 1 + Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h | 10 ++ Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 17 + 3 files changed, 28 insertions(+) diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h index bfc8639..6caee6c 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h @@ -22,6 +22,7 @@ // Common macros // #define MV_SOC_CP_BASE(Cp) (0xF200 + ((Cp) * 0x200)) +#define MV_SOC_AP806_BASE0xF000 #define MV_SOC_AP806_COUNT 1 // diff --git a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h index 26b075a..7aec9be 100644 --- a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h +++ b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h @@ -20,6 +20,16 @@ #include // +// North Bridge description +// +EFI_STATUS +EFIAPI +ArmadaSoCAp8xxBaseGet ( + IN OUT UINT64 *ApBase, + IN UINTNApIndex + ); + +// // ComPhy SoC description // typedef struct { diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c index 5b72c20..089ac2d 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c @@ -30,6 +30,23 @@ EFI_STATUS EFIAPI +ArmadaSoCAp8xxBaseGet ( + IN OUT UINT64 *ApBase, + IN UINTNApIndex + ) +{ + if (ApIndex != 0) { +DEBUG ((DEBUG_ERROR, "%a: Only one AP806 in A7K/A8K SoC\n", __FUNCTION__)); +return EFI_INVALID_PARAMETER; + } + + *ApBase = MV_SOC_AP806_BASE; + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI ArmadaSoCDescComPhyGet ( IN OUT MV_SOC_COMPHY_DESC **ComPhyDesc, IN OUT UINTN*DescCount -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH 1/3] Marvell: Armada7k8k: Shift PEI stack base
Recent changes in the ARM-TF configure its runtime serices region as protected, hence the hitherto PEI stack base address (0x41F) violated it. In order to fix this, extend the region which is non-accessible by the OS to cover both the ARM-TF (0x400 - 0x420) and OPTEE (0x440 - 0x540) within a single area and set the PEI stack base address between both images. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc index eafcd6e..c8c597f 100644 --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc @@ -376,12 +376,12 @@ gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|36 - gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x41F + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x43F gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x1 # Secure region reservation gMarvellTokenSpaceGuid.PcdSecureRegionBase|0x400 - gMarvellTokenSpaceGuid.PcdSecureRegionSize|0x020 + gMarvellTokenSpaceGuid.PcdSecureRegionSize|0x140 # TRNG gMarvellTokenSpaceGuid.PcdEip76TrngBaseAddress|0xF276 -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH 0/3] Armada7k8k memory handling update
Hi, This short patchset adjust to the latest Marvell v18.12 ARM-TF sources. They change DRAM configuration registers to be secure, as well as extend the region, which is non-accessible by OS. The patches avoid the issues by shifitng PEI stack base and configuring the memory map, using SiP services. Patches are available in the github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/dram-upstream-r20190121 I'm looking forward to the comments and remarks. Best regards, Marcin Grzegorz Jaszczyk (2): Marvell/Library: ArmadaSoCDescLib: Add North Bridge description Marvell/Armada7k8k: Read DRAM settings from ARM-TF Marcin Wojtas (1): Marvell: Armada7k8k: Shift PEI stack base Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 4 +- Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf | 3 ++ Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.h | 27 ++ Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h | 1 + Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h | 10 Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLibMem.c | 55 +--- Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 17 ++ 7 files changed, 51 insertions(+), 66 deletions(-) -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH v3 03/12] Marvell/Library: Introduce MvGpioLib class
Thanks a lot! Best regards, Marcin czw., 17 sty 2019 o 15:18 Leif Lindholm napisał(a): > > Series pushed as 944fbb62d6..9b725b6ebb > > Thanks! > > On Thu, Jan 17, 2019 at 01:19:52PM +0100, Marcin Wojtas wrote: > > Hi Leif, > > > > Sorry for omitting. I confirm the patch is: > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > > Will you add it (as well as remove class from the subject) or should I > > resubmit? > > > > Thanks, > > Marcin > > > > czw., 17 sty 2019 o 12:33 Leif Lindholm > > napisał(a): > > > > > > (Can drop the "class" from subject line) > > > > > > With that: > > > Reviewed-by: Leif Lindholm > > > > > > On Thu, Jan 17, 2019 at 12:15:06PM +0100, Marcin Wojtas wrote: > > > > Following patches will add two drivers that are capable > > > > of producing the generic EMBEDDED_GPIO protocol. In order > > > > to handle a situation, when the consumer module attempts > > > > to locate and open a proper protocol, add a library > > > > helper function. > > > > > > > > In order to ease description of used GPIO pins and controllers > > > > of the Armada 7k8k platforms, add the common enum types. > > > > > > > > Signed-off-by: Marcin Wojtas > > > > --- > > > > Silicon/Marvell/Marvell.dec | 1 + > > > > Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf | 32 + > > > > Silicon/Marvell/Include/Library/MvGpioLib.h | 68 ++ > > > > Silicon/Marvell/Library/MvGpioLib/MvGpioLib.c | 132 > > > > > > > > 4 files changed, 233 insertions(+) > > > > create mode 100644 Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf > > > > create mode 100644 Silicon/Marvell/Include/Library/MvGpioLib.h > > > > create mode 100644 Silicon/Marvell/Library/MvGpioLib/MvGpioLib.c > > > > > > > > diff --git a/Silicon/Marvell/Marvell.dec b/Silicon/Marvell/Marvell.dec > > > > index 616624e..ac922a0 100644 > > > > --- a/Silicon/Marvell/Marvell.dec > > > > +++ b/Silicon/Marvell/Marvell.dec > > > > @@ -63,6 +63,7 @@ > > > >ArmadaBoardDescLib|Include/Library/ArmadaBoardDescLib.h > > > >ArmadaIcuLib|Include/Library/ArmadaIcuLib.h > > > >ArmadaSoCDescLib|Include/Library/ArmadaSoCDescLib.h > > > > + MvGpioLib|Include/Library/MvGpioLib.h > > > >SampleAtResetLib|Include/Library/SampleAtResetLib.h > > > > > > > > [Protocols] > > > > diff --git a/Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf > > > > b/Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf > > > > new file mode 100644 > > > > index 000..3bc54ce > > > > --- /dev/null > > > > +++ b/Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf > > > > @@ -0,0 +1,32 @@ > > > > +## @file > > > > +# > > > > +# Copyright (C) 2018, Marvell International Ltd. and its > > > > affiliates > > > > +# > > > > +# This program and the accompanying materials are licensed and made > > > > available > > > > +# under the terms and conditions of the BSD License which accompanies > > > > this > > > > +# distribution. The full text of the license may be found at > > > > +# http://opensource.org/licenses/bsd-license.php > > > > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > > > > BASIS, > > > > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > > > > +# IMPLIED. > > > > +# > > > > +## > > > > + > > > > +[Defines] > > > > + INF_VERSION= 0x0001001A > > > > + BASE_NAME = MvGpioLib > > > > + FILE_GUID = f4386b44-6bc2-4fa1-9989-8513bbb22692 > > > > + MODULE_TYPE= BASE > > > > + VERSION_STRING = 1.0 > > > > + LIBRARY_CLASS = MvGpioLib > > > > + > > > > +[Sources] > > > > + MvGpioLib.c > > > > + > > > > +[Packages] > > > > + EmbeddedPkg/EmbeddedPkg.dec > > > > + MdePkg/MdePkg.dec > > > > + Silicon/Marvell/Marvell.dec > > > > + > > > > +[LibraryClasses] > > > &
Re: [edk2] [platforms: PATCH v3 00/12] Armada 7k8k GPIO support
Hi Leif, czw., 17 sty 2019 o 13:04 Leif Lindholm napisał(a): > > So, I was about to say that apart from the "class" to be deleted from > 3/12 subject line, things were fine so I was going to fix that locally > and push. > > However. 3/12 is missing the Contributed-under tag. > Can you please separately confirm that it is intended to be > contributed under TianoCore Contribution Agreement 1.1? > Sure, done. Please let know if I should resubmit. Best regards, Marcin > / > Leif > > On Thu, Jan 17, 2019 at 12:15:03PM +0100, Marcin Wojtas wrote: > > Hi, > > > > I submit v3 of the GPIO patchset for the Marvell SoCs. > > The changes are not significant and they address all the comments > > from the previous version. Please find the details in the changelog > > below. > > > > Patches are available in the github: > > https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/gpio-upstream-r20190117 > > > > I am looking forward to your feedback. > > > > Best regards, > > Marcin > > > > Changelog: > > v2->v3: > > * 1,2,4,12/12 > >- Add Leif's RB > > > > * 3/12 > > - Change MvGpio.h to be library header (Library/MvGpioLib.h) > > - Introduce MvGpioLib library > > - Add PCA_ID enums in this patch (instead from PCA9xxx addition) > > > > * 5,6/12 > > - Use PCA_ID enum from the beginning > > > > * 7/12 > > - Use static global variable and allocate it only only once > > - s/I2C/GPIO/ > > > > * 8/12 > > - Simplify error path after changing approach to not freeing > > already allocated GpioDescription in MvBoardDescDxe > > - Change signature to non-generic > > > > * 10/12 > > - Simplify error path after changing approach to not freeing > > already allocated GpioDescription in MvBoardDescDxe > > - No need to update PCA_ID in this patch > > > > v1->v2: > > * All > > - rebase on top of the master branch and Xenon changes > > > > * 1/12 > > - s/AP/AP806/ in order to avoid confusion > > - drop desc/DESC usage and improve variables naming > > - use GPIO_CONTROLLER from EmbeddedGpio.h instead of custom MV_SOC_GPIO > > - update commit message > > > > * 2,3,4,5/12 > > - drop desc/DESC usage and improve variables naming > > - drop reference to I2c and use GpioExpander > > - improve commit logs > > > > * 6/12 > > - drop desc/DESC usage and improve variables naming > > - drop reference to I2c and use GpioExpander > > - remove global variable - same as for other interfaces the consumer > > is responsible for avoiding memory leak > > > > * 7/12 > > - use MV_GPIO_ prefix > > - switch to EMBEDDED_GPIO > > - remove custom Marvell GPIO Protocol and types > > - add subroutine to MvGpioGetProtocol and more coments to clarify the code > > - add driver types and related enums in other commits > > > > * 8/12 > > - extend error path in the entry point, rename variables > > - use MV_GPIO_ prefix > > - switch to EMBEDDED_GPIO > > - remove custom Marvell GPIO Protocol and types > > - replace '!!' expression for obtaining pin state > > - remove BIT() macro > > - use generic mDevicePathTemplate name > > - put validate function under '#if !defined(MDEPKG_NDEBUG)' and > > call from inside ASSERT_EFI_ERROR, add comment > > - update commit message > > - add common enum for describing controllers > > - change authorship > > > > - 9/12 > > - Add Leif's RB > > > > * 10/12 > > - same modifications as 8/12 > > - use I2C flags directly and remove PCA95XX_OPERATION enum > > - add common enum for describing controllers > > > > * 11/12 > > - Add Leif's RB > > > > * 12/12 > > - Add local headers > > - Make STATIC names more generic > > - s/GetInitializerForType/NonDiscoverableDeviceInitializerGet/ > > - Use global enum for McBin GPIO controller > > > > > > Marcin Wojtas (12): > > Marvell/Library: ArmadaSoCDescLib: Add GPIO information > > Marvell/Library: ArmadaBoardDescLib: Add GPIO information > > Marvell/Library: Introduce MvGpioLib class > > SolidRun/Armada80x0McBin: Extend board description library with GPIO > > Marvell/Armada70x0Db: Extend board description library with GPIO > > Marvell/Armada80x0Db: Exte
Re: [edk2] [platforms: PATCH v3 03/12] Marvell/Library: Introduce MvGpioLib class
Hi Leif, Sorry for omitting. I confirm the patch is: Contributed-under: TianoCore Contribution Agreement 1.1 Will you add it (as well as remove class from the subject) or should I resubmit? Thanks, Marcin czw., 17 sty 2019 o 12:33 Leif Lindholm napisał(a): > > (Can drop the "class" from subject line) > > With that: > Reviewed-by: Leif Lindholm > > On Thu, Jan 17, 2019 at 12:15:06PM +0100, Marcin Wojtas wrote: > > Following patches will add two drivers that are capable > > of producing the generic EMBEDDED_GPIO protocol. In order > > to handle a situation, when the consumer module attempts > > to locate and open a proper protocol, add a library > > helper function. > > > > In order to ease description of used GPIO pins and controllers > > of the Armada 7k8k platforms, add the common enum types. > > > > Signed-off-by: Marcin Wojtas > > --- > > Silicon/Marvell/Marvell.dec | 1 + > > Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf | 32 + > > Silicon/Marvell/Include/Library/MvGpioLib.h | 68 ++ > > Silicon/Marvell/Library/MvGpioLib/MvGpioLib.c | 132 > > 4 files changed, 233 insertions(+) > > create mode 100644 Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf > > create mode 100644 Silicon/Marvell/Include/Library/MvGpioLib.h > > create mode 100644 Silicon/Marvell/Library/MvGpioLib/MvGpioLib.c > > > > diff --git a/Silicon/Marvell/Marvell.dec b/Silicon/Marvell/Marvell.dec > > index 616624e..ac922a0 100644 > > --- a/Silicon/Marvell/Marvell.dec > > +++ b/Silicon/Marvell/Marvell.dec > > @@ -63,6 +63,7 @@ > >ArmadaBoardDescLib|Include/Library/ArmadaBoardDescLib.h > >ArmadaIcuLib|Include/Library/ArmadaIcuLib.h > >ArmadaSoCDescLib|Include/Library/ArmadaSoCDescLib.h > > + MvGpioLib|Include/Library/MvGpioLib.h > >SampleAtResetLib|Include/Library/SampleAtResetLib.h > > > > [Protocols] > > diff --git a/Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf > > b/Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf > > new file mode 100644 > > index 000..3bc54ce > > --- /dev/null > > +++ b/Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf > > @@ -0,0 +1,32 @@ > > +## @file > > +# > > +# Copyright (C) 2018, Marvell International Ltd. and its affiliates > > +# > > +# This program and the accompanying materials are licensed and made > > available > > +# under the terms and conditions of the BSD License which accompanies this > > +# distribution. The full text of the license may be found at > > +# http://opensource.org/licenses/bsd-license.php > > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > > +# IMPLIED. > > +# > > +## > > + > > +[Defines] > > + INF_VERSION= 0x0001001A > > + BASE_NAME = MvGpioLib > > + FILE_GUID = f4386b44-6bc2-4fa1-9989-8513bbb22692 > > + MODULE_TYPE= BASE > > + VERSION_STRING = 1.0 > > + LIBRARY_CLASS = MvGpioLib > > + > > +[Sources] > > + MvGpioLib.c > > + > > +[Packages] > > + EmbeddedPkg/EmbeddedPkg.dec > > + MdePkg/MdePkg.dec > > + Silicon/Marvell/Marvell.dec > > + > > +[LibraryClasses] > > + DebugLib > > diff --git a/Silicon/Marvell/Include/Library/MvGpioLib.h > > b/Silicon/Marvell/Include/Library/MvGpioLib.h > > new file mode 100644 > > index 000..a14acdf > > --- /dev/null > > +++ b/Silicon/Marvell/Include/Library/MvGpioLib.h > > @@ -0,0 +1,68 @@ > > +/** > > +* > > +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. > > +* > > +* This program and the accompanying materials are licensed and made > > available > > +* under the terms and conditions of the BSD License which accompanies this > > +* distribution. The full text of the license may be found at > > +* http://opensource.org/licenses/bsd-license.php > > +* > > +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > > +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > > IMPLIED. > > +* > > +**/ > > +#ifndef __MV_GPIO_LIB_H__ > > +#define __MV_GPIO_LIB_H__ > > + > > +#include > > + > > +typedef enum { > > + MV_GPIO_DRIVER_TYPE_SOC_CONTROLLER, > > + MV_GPIO_DRIVER_TYPE_PCA95XX, > > +} MV_
[edk2] [platforms: PATCH v3 12/12] Marvell/Armada7k8k: Introduce NonDiscoverable device init routines
To abstract the initialization required for non-discoverable devices, which is often platform specific (e.g. enable GPIO-driven power supply), introduce a NonDiscoverableInitLib for use by the NonDiscoverable code, for which each platform can supply its own version. Add XHCI power supply (so called 'VBUS') enabling routines for supported platforms (Armada70x0Db, Armada80x0Db, Armada80x0McBin). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Silicon/Marvell/Marvell.dec | 1 + Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 1 + Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc | 3 + Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc | 3 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc | 3 + Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf | 49 + Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf | 50 + Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.inf | 50 + Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.inf | 1 + Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.h | 23 + Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.h | 28 ++ Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.h | 20 Silicon/Marvell/Include/Library/NonDiscoverableInitLib.h | 28 ++ Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.c | 96 ++ Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.c | 106 Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.c | 71 + Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c | 13 ++- 17 files changed, 543 insertions(+), 3 deletions(-) create mode 100644 Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf create mode 100644 Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf create mode 100644 Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.inf create mode 100644 Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.h create mode 100644 Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.h create mode 100644 Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.h create mode 100644 Silicon/Marvell/Include/Library/NonDiscoverableInitLib.h create mode 100644 Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.c create mode 100644 Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.c create mode 100644 Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.c diff --git a/Silicon/Marvell/Marvell.dec b/Silicon/Marvell/Marvell.dec index ac922a0..c34d783 100644 --- a/Silicon/Marvell/Marvell.dec +++ b/Silicon/Marvell/Marvell.dec @@ -64,6 +64,7 @@ ArmadaIcuLib|Include/Library/ArmadaIcuLib.h ArmadaSoCDescLib|Include/Library/ArmadaSoCDescLib.h MvGpioLib|Include/Library/MvGpioLib.h + NonDiscoverableInitLib|Include/Library/NonDiscoverableInitLib.h SampleAtResetLib|Include/Library/SampleAtResetLib.h [Protocols] diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc index 5b8f4e9..eafcd6e 100644 --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc @@ -37,6 +37,7 @@ ArmPlatformLib|Silicon/Marvell/Armada7k8k/Library/Armada7k8kLib/Armada7k8kLib.inf ComPhyLib|Silicon/Marvell/Library/ComPhyLib/ComPhyLib.inf MppLib|Silicon/Marvell/Library/MppLib/MppLib.inf + MvGpioLib|Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf NorFlashInfoLib|EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf SampleAtResetLib|Silicon/Marvell/Armada7k8k/Library/Armada7k8kSampleAtResetLib/Armada7k8kSampleAtResetLib.inf UtmiPhyLib|Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.inf diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc index 31815e4..e8cd177 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc +++ b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc @@ -48,6 +48,9 @@ !include Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc +[LibraryClasses.common] + NonDiscoverableInitLib|Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf + [Components.common] Silicon/Marvell
[edk2] [platforms: PATCH v3 11/12] Marvell/Armada7k8k: Enable GPIO drivers compilation
Enable building new GPIO drivers before adding VBUS pins handling. Update relevant boards .dsc files with IO expander information. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 2 ++ Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc| 4 ++-- Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf.inc| 2 ++ Platform/Marvell/Armada80x0Db/Armada80x0Db.fdf.inc| 2 ++ Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.fdf.inc | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc index 92ff1da..5b8f4e9 100644 --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc @@ -454,6 +454,8 @@ Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf # Platform drivers + Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf + Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf MdeModulePkg/Bus/I2c/I2cDxe/I2cDxe.inf Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.inf diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc index a935f36..31815e4 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc +++ b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc @@ -89,8 +89,8 @@ gMarvellTokenSpaceGuid.PcdChip1MppSel6|{ 0xE, 0xE, 0xE, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } # I2C - gMarvellTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x50, 0x57, 0x60 } - gMarvellTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0, 0x0 } + gMarvellTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x50, 0x57, 0x60, 0x21 } + gMarvellTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0, 0x0, 0x0 } gMarvellTokenSpaceGuid.PcdI2cControllersEnabled|{ 0x1, 0x1 } gMarvellTokenSpaceGuid.PcdEepromI2cAddresses|{ 0x50, 0x57 } gMarvellTokenSpaceGuid.PcdEepromI2cBuses|{ 0x0, 0x0 } diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf.inc b/Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf.inc index b7e7a65..7129606 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf.inc +++ b/Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf.inc @@ -12,6 +12,8 @@ # Per-board additional content of the DXE phase firmware volume + INF Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf + # DTB INF RuleOverride = DTB Silicon/Marvell/Armada7k8k/DeviceTree/Armada70x0Db.inf diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0Db.fdf.inc b/Platform/Marvell/Armada80x0Db/Armada80x0Db.fdf.inc index 81a81d0..f2fcc55 100644 --- a/Platform/Marvell/Armada80x0Db/Armada80x0Db.fdf.inc +++ b/Platform/Marvell/Armada80x0Db/Armada80x0Db.fdf.inc @@ -12,6 +12,8 @@ # Per-board additional content of the DXE phase firmware volume + INF Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf + # DTB INF RuleOverride = DTB Silicon/Marvell/Armada7k8k/DeviceTree/Armada80x0Db.inf diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.fdf.inc b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.fdf.inc index 326da2e..254fcee 100644 --- a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.fdf.inc +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.fdf.inc @@ -12,6 +12,8 @@ # Per-board additional content of the DXE phase firmware volume + INF Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf + # DTB INF RuleOverride = DTB Silicon/Marvell/Armada7k8k/DeviceTree/Armada80x0McBin.inf -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v3 10/12] Marvell/Drivers: MvPca95xxDxe: Introduce GPIO expander driver
Marvell Armada 7k/8k-based platforms may use Pca95xx to extend amount of the GPIO pins. This patch introduces support for them. The new driver implements a generic EMBEDDED_GPIO protocol. In order to ease description of used PCA9XXX controllers add a common enum type. It can be used e.g. in the board description library to specify the expander model on a board (instead of passing a raw number). Update relevant libraries. Driver is based on initial work done by Allen Yan . Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf | 45 ++ Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.h | 65 ++ Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.c | 645 3 files changed, 755 insertions(+) create mode 100644 Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf create mode 100644 Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.h create mode 100644 Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.c diff --git a/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf b/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf new file mode 100644 index 000..3b1ab4e --- /dev/null +++ b/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf @@ -0,0 +1,45 @@ +## @file +# +# Copyright (c) 2017, Marvell International Ltd. All rights reserved. +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = MvPca95xxDxe + FILE_GUID = f0e405eb-8407-43b9-88e6-2f7d70715c72 + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= MvPca95xxEntryPoint + +[Sources] + MvPca95xxDxe.c + MvPca95xxDxe.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + MemoryAllocationLib + UefiDriverEntryPoint + UefiLib + +[Protocols] + gEfiDriverBindingProtocolGuid + gEfiI2cIoProtocolGuid + gEmbeddedGpioProtocolGuid + gMarvellBoardDescProtocolGuid + +[Depex] + TRUE diff --git a/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.h b/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.h new file mode 100644 index 000..29eb123 --- /dev/null +++ b/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.h @@ -0,0 +1,65 @@ +/** +* +* Copyright (c) 2018, Marvell International Ltd. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ +#ifndef __MV_PCA953X_H__ +#define __MV_PCA953X_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define PCA95XX_GPIO_SIGNATURE SIGNATURE_32 ('I', 'O', 'E', 'X') + +#define PCA95XX_INPUT_REG0x0 +#define PCA95XX_OUTPUT_REG 0x2 +#define PCA95XX_DIRECTION_REG0x6 + +#define PCA95XX_BANK_SIZE8 +#define PCA95XX_OPERATION_COUNT 2 +#define PCA95XX_OPERATION_LENGTH 1 + +typedef enum { + PCA9505_PIN_COUNT = 40, + PCA9534_PIN_COUNT = 8, + PCA9535_PIN_COUNT = 16, + PCA9536_PIN_COUNT = 4, + PCA9537_PIN_COUNT = 4, + PCA9538_PIN_COUNT = 8, + PCA9539_PIN_COUNT = 16, + PCA9554_PIN_COUNT = 8, + PCA9555_PIN_COUNT = 16, + PCA9556_PIN_COUNT = 16, + PCA9557_PIN_COUNT = 16, +} PCA95XX_PIN_COUNT; + +typedef struct { + EMBEDDED_GPIO GpioProtocol; + MV_GPIO_EXPANDER *GpioExpanders; + UINTN GpioExpanderCount; + UINTN Signature; + EFI_HANDLE ControllerHandle; +} PCA95XX; + +#endif diff --git a/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.c b/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.c new file mode 100644 index 000..8e7ea77 --- /dev/null +++ b/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.c @@ -0,0 +1,645 @@ +/** +* +* Copyright (c) 2018, Marvell International Ltd. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* di
[edk2] [platforms: PATCH v3 09/12] Marvell/Drivers: I2c: Use common header for macros
Hitherto I2c solution used same macros, defined in multiple places. Move them to a new common header. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h | 10 --- Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h | 17 ++- Silicon/Marvell/Include/Protocol/MvI2c.h | 31 Silicon/Marvell/Applications/EepromCmd/EepromCmd.c| 5 +--- Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.c | 3 +- Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c | 4 +-- 6 files changed, 37 insertions(+), 33 deletions(-) create mode 100644 Silicon/Marvell/Include/Protocol/MvI2c.h diff --git a/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h b/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h index b1af645..c32ee48 100644 --- a/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h +++ b/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h @@ -41,16 +41,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define MAX_BUFFER_LENGTH 64 -/* - * I2C_FLAG_NORESTART is not part of PI spec, it allows to continue - * transmission without repeated start operation. - * FIXME: This flag is also defined in Drivers/I2c/MvI2cDxe/MvI2cDxe.h - * and it's important to have both version synced. This solution is - * temporary and shared flag should be used by both files. - * Situation is analogous with I2C_GUID, which also should be common, but is - * for now defined same way in two header files. - */ -#define I2C_FLAG_NORESTART 0x0002 #define I2C_GUID \ { \ 0xadc1901b, 0xb83c, 0x4831, { 0x8f, 0x59, 0x70, 0x89, 0x8f, 0x26, 0x57, 0x1e } \ diff --git a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h index 3c9beaf..6850c34 100644 --- a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h +++ b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h @@ -32,8 +32,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***/ -#ifndef __MV_I2C_H__ -#define __MV_I2C_H__ +#ifndef __MV_I2C_DXE_H__ +#define __MV_I2C_DXE_H__ #include @@ -75,17 +75,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define I2C_FAST 0x2 #define I2C_FASTEST0x3 -/* - * I2C_FLAG_NORESTART is not part of PI spec, it allows to continue - * transmission without repeated start operation. - * FIXME: This flag is also defined in - * Platforms/Marvell/Include/Protocol/Eeprom.h and it's important to have both - * version synced. This solution is temporary and shared flag should be used by - * both files. - * Situation is analogous with I2C_GUID, which also should be common, but is - * for now defined same way in two header files. - */ -#define I2C_FLAG_NORESTART 0x0002 #define I2C_GUID \ { \ 0xadc1901b, 0xb83c, 0x4831, { 0x8f, 0x59, 0x70, 0x89, 0x8f, 0x26, 0x57, 0x1e } \ @@ -266,4 +255,4 @@ MvI2cEnableConf ( IN EFI_STATUS *I2cStatus OPTIONAL ); -#endif // __MV_I2C_H__ +#endif // __MV_I2C_DXE_H__ diff --git a/Silicon/Marvell/Include/Protocol/MvI2c.h b/Silicon/Marvell/Include/Protocol/MvI2c.h new file mode 100644 index 000..d8e644e --- /dev/null +++ b/Silicon/Marvell/Include/Protocol/MvI2c.h @@ -0,0 +1,31 @@ +/** +* +* Copyright (c) 2018, Marvell International Ltd. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ +#ifndef __MV_I2C_H__ +#define __MV_I2C_H__ + +/* + * I2C_FLAG_NORESTART is not part of PI spec, it allows to continue + * transmission without repeated start operation. + */ +#define I2C_FLAG_NORESTART 0x0002 + +/* + * Helper macros for maintaining multiple I2C buses + * and devices defined via EFI_I2C_DEVICE. + */ +#define I2C_DEVICE_ADDRESS(Index) ((Index) & MAX_UINT16) +#define I2C_DEVICE_BUS(Index) ((Index) >> 16) +#define I2C_DEVICE_INDEX(Bus, Address) (((Address) & MAX_UINT16) | (Bus) << 16) + +#endif diff --git a/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c b/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c index dc3c95f..712aba9 100644 --- a/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c +++ b/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c @@ -51,10 +51,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include - -#define I2C_DEVICE_INDEX(bus, address) (((address) & 0x) | (bus) << 16) -#
[edk2] [platforms: PATCH v3 08/12] Marvell/Drivers: MvGpioDxe: Introduce platform GPIO driver
Marvell Armada 7k/8k SoCs comprise integrated GPIO controllers, one in AP806 and two in each south bridge hardware blocks. This patch introduces support for them. The new driver implements a generic EMBEDDED_GPIO protocol. In order to ease description of used GPIO pins and controllers of the Armada 7k8k platforms, add a common enum type. Based on original work of Jing Hua . Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf | 44 +++ Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h | 49 +++ Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.c | 353 3 files changed, 446 insertions(+) create mode 100644 Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf create mode 100644 Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h create mode 100644 Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.c diff --git a/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf new file mode 100644 index 000..5ff9130 --- /dev/null +++ b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf @@ -0,0 +1,44 @@ +## @file +# +# Copyright (c) 2017, Marvell International Ltd. All rights reserved. +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = MvGpioDxe + FILE_GUID = 706eb761-b3b5-4f41-8558-5fd9217c0079 + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= MvGpioEntryPoint + +[Sources] + MvGpioDxe.c + MvGpioDxe.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + ArmadaSoCDescLib + DebugLib + MemoryAllocationLib + UefiDriverEntryPoint + UefiLib + +[Protocols] + gEmbeddedGpioProtocolGuid + gMarvellBoardDescProtocolGuid + +[Depex] + TRUE diff --git a/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h new file mode 100644 index 000..6e56ec1 --- /dev/null +++ b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h @@ -0,0 +1,49 @@ +/** +* +* Copyright (c) 2018, Marvell International Ltd. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ +#ifndef __MV_GPIO_H__ +#define __MV_GPIO_H__ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#define MV_GPIO_SIGNATURESIGNATURE_64 ('M', 'V','_','G', 'P', 'I','O',' ') + +// Marvell MV_GPIO Controller Registers +#define MV_GPIO_DATA_OUT_REG (0x0) +#define MV_GPIO_OUT_EN_REG (0x4) +#define MV_GPIO_BLINK_EN_REG (0x8) +#define MV_GPIO_DATA_IN_POL_REG (0xc) +#define MV_GPIO_DATA_IN_REG (0x10) + +typedef struct { + EMBEDDED_GPIO GpioProtocol; + GPIO_CONTROLLER *SoCGpio; + UINTN GpioDeviceCount; + UINTN Signature; + EFI_HANDLEHandle; +} MV_GPIO; + +#endif // __MV_GPIO_H__ diff --git a/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.c b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.c new file mode 100644 index 000..1d37ecc --- /dev/null +++ b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.c @@ -0,0 +1,353 @@ +/** +* +* Copyright (c) 2018, Marvell International Ltd. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include "MvGpioDxe.h" + +STATIC MV_GPIO *mGpioInstance; + +STATIC MV_GPIO_DEVICE_PATH mDevicePathTemplate = { + { +{ + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { +(UINT8) (sizeof (VENDOR_DEVICE_PATH) + + sizeof (MV_GPIO_
[edk2] [platforms: PATCH v3 07/12] Marvell/Drivers: MvBoardDesc: Extend protocol with GPIO support
Introduce new callback that can provide information about GPIO SoC controllers, as well as on-board I2C IO expanders. According ArmadaSoCDescLib ArmadaBoardDescLib routines are used for obtaining required data. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Include/Protocol/BoardDesc.h | 8 Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 50 2 files changed, 58 insertions(+) diff --git a/Silicon/Marvell/Include/Protocol/BoardDesc.h b/Silicon/Marvell/Include/Protocol/BoardDesc.h index 1d57a16..02905ea 100644 --- a/Silicon/Marvell/Include/Protocol/BoardDesc.h +++ b/Silicon/Marvell/Include/Protocol/BoardDesc.h @@ -50,6 +50,13 @@ EFI_STATUS typedef EFI_STATUS +(EFIAPI *MV_BOARD_GPIO_DESCRIPTION_GET) ( + IN MARVELL_BOARD_DESC_PROTOCOL*This, + IN OUT MV_BOARD_GPIO_DESCRIPTION **GpioDescription + ); + +typedef +EFI_STATUS (EFIAPI *MV_BOARD_DESC_I2C_GET) ( IN MARVELL_BOARD_DESC_PROTOCOL *This, IN OUT MV_BOARD_I2C_DESC **I2cDesc @@ -113,6 +120,7 @@ struct _MARVELL_BOARD_DESC_PROTOCOL { MV_BOARD_DESC_UTMI_GET BoardDescUtmiGet; MV_BOARD_DESC_XHCI_GET BoardDescXhciGet; MV_BOARD_DESC_FREE BoardDescFree; + MV_BOARD_GPIO_DESCRIPTION_GET GpioDescriptionGet; }; #endif // __MARVELL_BOARD_DESC_PROTOCOL_H__ diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c index f71bfc4..973c362 100644 --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c @@ -35,6 +35,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MV_BOARD_DESC *mBoardDescInstance; +STATIC MV_BOARD_GPIO_DESCRIPTION *mGpioDescription; + STATIC EFI_STATUS MvBoardDescComPhyGet ( @@ -100,6 +102,53 @@ MvBoardDescComPhyGet ( STATIC EFI_STATUS +MvBoardGpioDescriptionGet ( + IN MARVELL_BOARD_DESC_PROTOCOL*This, + IN OUT MV_BOARD_GPIO_DESCRIPTION **GpioDescription + ) +{ + UINTN SoCGpioCount, GpioExpanderCount; + MV_GPIO_EXPANDER *GpioExpanders; + GPIO_CONTROLLER *SoCGpio; + EFI_STATUS Status; + + /* Use existing structure if already created. */ + if (mGpioDescription != NULL) { +*GpioDescription = mGpioDescription; +return EFI_SUCCESS; + } + + /* Get SoC data about all available GPIO controllers. */ + Status = ArmadaSoCGpioGet (, ); + if (EFI_ERROR (Status)) { +return Status; + } + + /* Get per-board information about all available GPIO expanders. */ + Status = ArmadaBoardGpioExpanderGet (, ); + if (EFI_ERROR (Status)) { +return Status; + } + + /* Allocate and fill board description. */ + mGpioDescription = AllocateZeroPool (sizeof (MV_BOARD_GPIO_DESCRIPTION)); + if (mGpioDescription == NULL) { +DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); +return EFI_OUT_OF_RESOURCES; + } + + mGpioDescription->SoCGpio = SoCGpio; + mGpioDescription->GpioDeviceCount = SoCGpioCount; + mGpioDescription->GpioExpanders = GpioExpanders; + mGpioDescription->GpioExpanderCount = GpioExpanderCount; + + *GpioDescription = mGpioDescription; + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS MvBoardDescI2cGet ( IN MARVELL_BOARD_DESC_PROTOCOL *This, IN OUT MV_BOARD_I2C_DESC **I2cDesc @@ -571,6 +620,7 @@ MvBoardDescInitProtocol ( BoardDescProtocol->BoardDescUtmiGet = MvBoardDescUtmiGet; BoardDescProtocol->BoardDescXhciGet = MvBoardDescXhciGet; BoardDescProtocol->BoardDescFree = MvBoardDescFree; + BoardDescProtocol->GpioDescriptionGet = MvBoardGpioDescriptionGet; return EFI_SUCCESS; } -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v3 05/12] Marvell/Armada70x0Db: Extend board description library with GPIO
This patch implements ArmadaBoarDescLib library for Armada70x0Db comunity board and introduces ArmadaBoardGpioGet routine with per-board GPIO expander description. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c | 24 1 file changed, 24 insertions(+) diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c index 48c68e4..f0133ec 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c +++ b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c @@ -19,9 +19,33 @@ #include #include #include +#include #include // +// GPIO Expander +// +STATIC MV_GPIO_EXPANDER mGpioExpander = { + PCA9555_ID, + 0x21, + 0x0, +}; + + +EFI_STATUS +EFIAPI +ArmadaBoardGpioExpanderGet ( + IN OUT MV_GPIO_EXPANDER **GpioExpanders, + IN OUT UINTN *GpioExpanderCount + ) +{ + *GpioExpanderCount = 1; + *GpioExpanders = + + return EFI_SUCCESS; +} + +// // Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib // STATIC -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v3 06/12] Marvell/Armada80x0Db: Extend board description library with GPIO
This patch implements ArmadaBoarDescLib library for Armada80x0Db board and introduces ArmadaBoardGpioGet routine with per-board GPIO expander description. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c | 30 1 file changed, 30 insertions(+) diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c index feb69ad..61b6202 100644 --- a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c +++ b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c @@ -19,9 +19,39 @@ #include #include #include +#include #include // +// GPIO Expanders +// +STATIC MV_GPIO_EXPANDER mGpioExpanders[] = { + { +PCA9555_ID, +0x21, +0x0, + }, + { +PCA9555_ID, +0x25, +0x0, + }, +}; + +EFI_STATUS +EFIAPI +ArmadaBoardGpioExpanderGet ( + IN OUT MV_GPIO_EXPANDER **GpioExpanders, + IN OUT UINTN *GpioExpanderCount + ) +{ + *GpioExpanderCount = ARRAY_SIZE (mGpioExpanders); + *GpioExpanders = mGpioExpanders; + + return EFI_SUCCESS; +} + +// // Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib // STATIC -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v3 03/12] Marvell/Library: Introduce MvGpioLib class
Following patches will add two drivers that are capable of producing the generic EMBEDDED_GPIO protocol. In order to handle a situation, when the consumer module attempts to locate and open a proper protocol, add a library helper function. In order to ease description of used GPIO pins and controllers of the Armada 7k8k platforms, add the common enum types. Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Marvell.dec | 1 + Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf | 32 + Silicon/Marvell/Include/Library/MvGpioLib.h | 68 ++ Silicon/Marvell/Library/MvGpioLib/MvGpioLib.c | 132 4 files changed, 233 insertions(+) create mode 100644 Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf create mode 100644 Silicon/Marvell/Include/Library/MvGpioLib.h create mode 100644 Silicon/Marvell/Library/MvGpioLib/MvGpioLib.c diff --git a/Silicon/Marvell/Marvell.dec b/Silicon/Marvell/Marvell.dec index 616624e..ac922a0 100644 --- a/Silicon/Marvell/Marvell.dec +++ b/Silicon/Marvell/Marvell.dec @@ -63,6 +63,7 @@ ArmadaBoardDescLib|Include/Library/ArmadaBoardDescLib.h ArmadaIcuLib|Include/Library/ArmadaIcuLib.h ArmadaSoCDescLib|Include/Library/ArmadaSoCDescLib.h + MvGpioLib|Include/Library/MvGpioLib.h SampleAtResetLib|Include/Library/SampleAtResetLib.h [Protocols] diff --git a/Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf b/Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf new file mode 100644 index 000..3bc54ce --- /dev/null +++ b/Silicon/Marvell/Library/MvGpioLib/MvGpioLib.inf @@ -0,0 +1,32 @@ +## @file +# +# Copyright (C) 2018, Marvell International Ltd. and its affiliates +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# +## + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = MvGpioLib + FILE_GUID = f4386b44-6bc2-4fa1-9989-8513bbb22692 + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = MvGpioLib + +[Sources] + MvGpioLib.c + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib diff --git a/Silicon/Marvell/Include/Library/MvGpioLib.h b/Silicon/Marvell/Include/Library/MvGpioLib.h new file mode 100644 index 000..a14acdf --- /dev/null +++ b/Silicon/Marvell/Include/Library/MvGpioLib.h @@ -0,0 +1,68 @@ +/** +* +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ +#ifndef __MV_GPIO_LIB_H__ +#define __MV_GPIO_LIB_H__ + +#include + +typedef enum { + MV_GPIO_DRIVER_TYPE_SOC_CONTROLLER, + MV_GPIO_DRIVER_TYPE_PCA95XX, +} MV_GPIO_DRIVER_TYPE; + +typedef enum { + MV_GPIO_AP806_CONTROLLER0, + MV_GPIO_CP0_CONTROLLER0, + MV_GPIO_CP0_CONTROLLER1, + MV_GPIO_CP1_CONTROLLER0, + MV_GPIO_CP1_CONTROLLER1, + MV_GPIO_CP2_CONTROLLER0, + MV_GPIO_CP2_CONTROLLER1, +} MV_GPIO_SOC_CONTROLLER_TYPE; + +typedef enum { + PCA9505_ID, + PCA9534_ID, + PCA9535_ID, + PCA9536_ID, + PCA9537_ID, + PCA9538_ID, + PCA9539_ID, + PCA9554_ID, + PCA9555_ID, + PCA9556_ID, + PCA9557_ID, + PCA95XX_MAX_ID, +} MV_GPIO_EXPANDER_TYPE_PCA95XX; + +typedef struct { + VENDOR_DEVICE_PATHHeader; + MV_GPIO_DRIVER_TYPE GpioDriverType; + EFI_DEVICE_PATH_PROTOCOL End; +} MV_GPIO_DEVICE_PATH; + +typedef struct { + UINTNControllerId; + UINTNPinNumber; + BOOLEAN ActiveHigh; +} MV_GPIO_PIN; + +EFI_STATUS +EFIAPI +MvGpioGetProtocol ( + IN MV_GPIO_DRIVER_TYPEGpioDriverType, + IN OUT EMBEDDED_GPIO**GpioProtocol + ); + +#endif // __MV_GPIO_LIB_H__ diff --git a/Silicon/Marvell/Library/MvGpioLib/MvGpioLib.c b/Silicon/Marvell/Library/MvGpioLib/MvGpioLib.c new file mode 100644 index 000..a95d5ae --- /dev/null +++ b/Silicon/Marvell/Library/MvGpioLib/MvGpioLib.c @@ -0,0 +1,132 @@ +/** +* +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may
[edk2] [platforms: PATCH v3 04/12] SolidRun/Armada80x0McBin: Extend board description library with GPIO
This patch implements ArmadaBoarDescLib library for Armada80x0McBin comunity board and introduces ArmadaBoardGpioGet routine with per-board GPIO expander description. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf | 1 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c | 17 + 2 files changed, 18 insertions(+) diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf index 63a4f66..43e4b9e 100644 --- a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf @@ -25,6 +25,7 @@ Armada80x0McBinBoardDescLib.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c index d52adfc..32596ad 100644 --- a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c @@ -22,6 +22,23 @@ #include // +// GPIO Expander +// +EFI_STATUS +EFIAPI +ArmadaBoardGpioExpanderGet ( + IN OUT MV_GPIO_EXPANDER **GpioExpanders, + IN OUT UINTN *GpioExpanderCount + ) +{ + /* No GPIO expanders on board */ + *GpioExpanders = NULL; + *GpioExpanderCount = 0; + + return EFI_SUCCESS; +} + +// // Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib // STATIC -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v3 02/12] Marvell/Library: ArmadaBoardDescLib: Add GPIO information
This patch extends library with GPIO devices per-board description. Both embedded SoC controllers and I2C IO expanders are supported. Add a helper routine for obtaining information about the latter. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 23 1 file changed, 23 insertions(+) diff --git a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h index 3fe2988..6ec5ace 100644 --- a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h +++ b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h @@ -25,6 +25,29 @@ typedef struct { } MV_BOARD_COMPHY_DESC; // +// GPIO devices per-board description +// +typedef struct { + UINTN ChipId; + UINTN I2cAddress; + UINTN I2cBus; +} MV_GPIO_EXPANDER; + +typedef struct { + GPIO_CONTROLLER *SoCGpio; + UINTN GpioDeviceCount; + MV_GPIO_EXPANDER *GpioExpanders; + UINTN GpioExpanderCount; +} MV_BOARD_GPIO_DESCRIPTION; + +EFI_STATUS +EFIAPI +ArmadaBoardGpioExpanderGet ( + IN OUT MV_GPIO_EXPANDER **GpioExpanders, + IN OUT UINTN *GpioExpanderCount + ); + +// // I2C devices per-board description // typedef struct { -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v3 01/12] Marvell/Library: ArmadaSoCDescLib: Add GPIO information
This patch introduces new library callback (ArmadaSoCGpioGet ()), which dynamically allocates and fills EmbeddedGpio's GPIO_CONTROLLER structure with the SoC description of GPIO controllers. Because the library header is indirectly used in many modules, update all dependencies after including EmbeddedGpio.h. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf | 1 + Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf | 1 + Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf | 1 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf | 1 + Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf | 1 + Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf | 1 + Silicon/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf | 1 + Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf | 1 + Silicon/Marvell/Library/ComPhyLib/ComPhyLib.inf | 1 + Silicon/Marvell/Library/IcuLib/IcuLib.inf | 1 + Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.inf | 1 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h | 10 + Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h | 12 ++ Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 39 14 files changed, 72 insertions(+) diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf index b26f55b..c995515 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf +++ b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf @@ -25,6 +25,7 @@ Armada70x0DbBoardDescLib.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf index 2d39d96..786b7f0 100644 --- a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf +++ b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf @@ -25,6 +25,7 @@ Armada80x0DbBoardDescLib.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf b/Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf index 5503463..e707fe9 100644 --- a/Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf +++ b/Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf @@ -25,6 +25,7 @@ PlatInitDxe.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf index 2b73b73..48a320c 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf @@ -24,6 +24,7 @@ Armada7k8kSoCDescLib.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf index 0b93948..0b641fe 100644 --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf @@ -42,6 +42,7 @@ MvBoardDescDxe.h [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf index 0eef350..e5bd370 100755 --- a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf +++ b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf @@ -41,6 +41,7 @@ MvI2cDxe.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec ArmPlatformPkg/ArmPlatformPkg.dec diff --git a/Silicon/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf b/Silicon/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf index 739576f..8a877da
[edk2] [platforms: PATCH v3 00/12] Armada 7k8k GPIO support
Hi, I submit v3 of the GPIO patchset for the Marvell SoCs. The changes are not significant and they address all the comments from the previous version. Please find the details in the changelog below. Patches are available in the github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/gpio-upstream-r20190117 I am looking forward to your feedback. Best regards, Marcin Changelog: v2->v3: * 1,2,4,12/12 - Add Leif's RB * 3/12 - Change MvGpio.h to be library header (Library/MvGpioLib.h) - Introduce MvGpioLib library - Add PCA_ID enums in this patch (instead from PCA9xxx addition) * 5,6/12 - Use PCA_ID enum from the beginning * 7/12 - Use static global variable and allocate it only only once - s/I2C/GPIO/ * 8/12 - Simplify error path after changing approach to not freeing already allocated GpioDescription in MvBoardDescDxe - Change signature to non-generic * 10/12 - Simplify error path after changing approach to not freeing already allocated GpioDescription in MvBoardDescDxe - No need to update PCA_ID in this patch v1->v2: * All - rebase on top of the master branch and Xenon changes * 1/12 - s/AP/AP806/ in order to avoid confusion - drop desc/DESC usage and improve variables naming - use GPIO_CONTROLLER from EmbeddedGpio.h instead of custom MV_SOC_GPIO - update commit message * 2,3,4,5/12 - drop desc/DESC usage and improve variables naming - drop reference to I2c and use GpioExpander - improve commit logs * 6/12 - drop desc/DESC usage and improve variables naming - drop reference to I2c and use GpioExpander - remove global variable - same as for other interfaces the consumer is responsible for avoiding memory leak * 7/12 - use MV_GPIO_ prefix - switch to EMBEDDED_GPIO - remove custom Marvell GPIO Protocol and types - add subroutine to MvGpioGetProtocol and more coments to clarify the code - add driver types and related enums in other commits * 8/12 - extend error path in the entry point, rename variables - use MV_GPIO_ prefix - switch to EMBEDDED_GPIO - remove custom Marvell GPIO Protocol and types - replace '!!' expression for obtaining pin state - remove BIT() macro - use generic mDevicePathTemplate name - put validate function under '#if !defined(MDEPKG_NDEBUG)' and call from inside ASSERT_EFI_ERROR, add comment - update commit message - add common enum for describing controllers - change authorship - 9/12 - Add Leif's RB * 10/12 - same modifications as 8/12 - use I2C flags directly and remove PCA95XX_OPERATION enum - add common enum for describing controllers * 11/12 - Add Leif's RB * 12/12 - Add local headers - Make STATIC names more generic - s/GetInitializerForType/NonDiscoverableDeviceInitializerGet/ - Use global enum for McBin GPIO controller Marcin Wojtas (12): Marvell/Library: ArmadaSoCDescLib: Add GPIO information Marvell/Library: ArmadaBoardDescLib: Add GPIO information Marvell/Library: Introduce MvGpioLib class SolidRun/Armada80x0McBin: Extend board description library with GPIO Marvell/Armada70x0Db: Extend board description library with GPIO Marvell/Armada80x0Db: Extend board description library with GPIO Marvell/Drivers: MvBoardDesc: Extend protocol with GPIO support Marvell/Drivers: MvGpioDxe: Introduce platform GPIO driver Marvell/Drivers: I2c: Use common header for macros Marvell/Drivers: MvPca95xxDxe: Introduce GPIO expander driver Marvell/Armada7k8k: Enable GPIO drivers compilation Marvell/Armada7k8k: Introduce NonDiscoverable device init routines Silicon/Marvell/Marvell.dec | 2 + Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 3 + Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc | 7 +- Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc | 3 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc | 3 + Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf | 1 + Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf | 49 ++ Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf | 1 + Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf | 50 ++ Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf | 1 + Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.inf | 50 ++ Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf | 1 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf | 1 + Silicon/Marvell/D
Re: [edk2] [platforms: PATCH v2 06/12] Marvell/Drivers: MvBoardDesc: Extend protocol with GPIO support
wt., 15 sty 2019 o 11:12 Leif Lindholm napisał(a): > > On Tue, Jan 15, 2019 at 11:05:12AM +0100, Marcin Wojtas wrote: > > > > Anyway, I tried to play with the MV_BOARD_GPIO_DESCRIPTION to be the > > > > global variable, but was not convinced by the outcome. My biggest > > > > objection to the global variable and checking whether it's NULL in the > > > > consumer driver is following - until now all users of the > > > > BoardDescProtocol 'know' and call only the relevant protocol routine, > > > > everything what happens underneath (PCDs, variable names, etc) is > > > > transparent. > > > > > > > > The consumers should be responsible for avoiding the memory leaks and > > > > this was an improvement of v2. Both MvGpioDxe and MvPca9xxxDxe have > > > > now fixed error path an properly take care of freeing the memory after > > > > using protocol. > > > > > > But the call sites don't keep track of freeing it when error handling. > > > > > > Which I think serves as a clear demonstrator of how magically > > > allocating buffers makes for difficult code to keep correct. (Which is > > > why the UEFI intefaces all require you to allocate a buffer and then > > > pass that and a size as parameters.) > > > > > > So, since we are dealing with data that isn't changing, I prefer the > > > original design - just not the original implemenation. > > > > > > So how about sticking with that, but moving the STATIC struct global > > > in that source file (but keeping it STATIC)? > > > > > > > Good, keeping the global variable inside MvBoardDescDxe and checking > > it there is a clean and easy solution (consumers won't have to bother > > about the stuff additional to calling the protocol and error handling > > will be simpler). > > > > How about on top of the file I add a section for global varibles (IMO > > it's worth to modify other interfaces to that scheme later) and call > > it: > > > > STATIC MV_BOARD_GPIO_DESCRIPTION gGpioDescription; > > ? > > Static, so 'm', not 'g', but yeah. > Effectively it will be global to other files :) But I will change to 'm' prefix of course. Thanks, Marcin ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH v2 08/12] Marvell/Drivers: MvGpioDxe: Introduce platform GPIO driver
wt., 15 sty 2019 o 11:04 Leif Lindholm napisał(a): > > On Tue, Jan 15, 2019 at 07:19:04AM +0100, Marcin Wojtas wrote: > > > > + if (MmioRead32 (BaseAddress + MV_GPIO_OUT_EN_REG) & (1 << GpioPin)) { > > > > +*Mode = GPIO_MODE_INPUT; > > > > + } else { > > > > +if (MmioRead32 (BaseAddress + MV_GPIO_DATA_IN_REG) & (1 << > > > > GpioPin)) { > > > > + *Mode = GPIO_MODE_OUTPUT_1; > > > > +} else { > > > > + *Mode = GPIO_MODE_OUTPUT_0; > > > > > > Ah, right, it's the change to EMBEDDED_GPIO that means we have two > > > output modes to return instead of just input or output. > > > Could I just ask that you're a bit more explicit about such things in > > > the cover letter? Would have saved me a couple of minutes of head > > > scratching. > > > > Well, in the cover letter I wrote: > > "The biggest change is dropping custom GPIO protocol and start using > > the generic EMBEDDED_GPIO with all its types." > > > > And in the commit log of both drivers: > > "The new driver implements a generic EMBEDDED_GPIO protocol." > > > > Wasn't it explicit enough? :) > > I mean, it's fine - you've technically given all the information > needed to deduce that. But it does sort of imply that the reader knows > all EDK2 interfaces by heart. And I'm not quite there. > Ok, sorry for not being specific enough. Best regards, Marcin ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH v2 06/12] Marvell/Drivers: MvBoardDesc: Extend protocol with GPIO support
wt., 15 sty 2019 o 10:56 Leif Lindholm napisał(a): > > On Tue, Jan 15, 2019 at 07:05:42AM +0100, Marcin Wojtas wrote: > > > > index f71bfc4..e348b85 100644 > > > > --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c > > > > +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c > > > > @@ -100,6 +100,48 @@ MvBoardDescComPhyGet ( > > > > > > > > STATIC > > > > EFI_STATUS > > > > +MvBoardGpioDescriptionGet ( > > > > + IN MARVELL_BOARD_DESC_PROTOCOL*This, > > > > + IN OUT MV_BOARD_GPIO_DESCRIPTION **GpioDescription > > > > + ) > > > > +{ > > > > + MV_BOARD_GPIO_DESCRIPTION *Description; > > > > > > My request on v1 was that this be refactored from a STATIC local > > > variable to a global variable. > > > > > > > + UINTN SoCGpioCount, GpioExpanderCount; > > > > + MV_GPIO_EXPANDER *GpioExpanders; > > > > + GPIO_CONTROLLER *SoCGpio; > > > > + EFI_STATUS Status; > > > > + > > > > + /* Get SoC data about all available GPIO controllers */ > > > > + Status = ArmadaSoCGpioGet (, ); > > > > + if (EFI_ERROR (Status)) { > > > > +return Status; > > > > + } > > > > + > > > > + /* Get per-board information about all available I2C IO expanders */ > > > > > > GPIO > > > > OK. > > > > > > > > > + Status = ArmadaBoardGpioExpanderGet (, > > > > ); > > > > + if (EFI_ERROR (Status)) { > > > > +return Status; > > > > + } > > > > + > > > > + /* Allocate and fill board description */ > > > > + Description = AllocateZeroPool (sizeof (MV_BOARD_GPIO_DESCRIPTION)); > > > > > > Instead, this space is now dynamically allocated. But none of the call > > > sites actually change, leading to potential memory leaks. > > > > > > I don't have a problem if you prefer an alternative solution to the > > > one I propose, but please discuss the change first rather than > > > submitting a new revision containing something I didn't ask for. > > > > Indeed, I could have asked, but didn't want to spoil your Christmas > > time with questions, especially gitven it was 3+ weeks from review:/ > > It's not like I was checking email :) > > > Anyway, I tried to play with the MV_BOARD_GPIO_DESCRIPTION to be the > > global variable, but was not convinced by the outcome. My biggest > > objection to the global variable and checking whether it's NULL in the > > consumer driver is following - until now all users of the > > BoardDescProtocol 'know' and call only the relevant protocol routine, > > everything what happens underneath (PCDs, variable names, etc) is > > transparent. > > > > The consumers should be responsible for avoiding the memory leaks and > > this was an improvement of v2. Both MvGpioDxe and MvPca9xxxDxe have > > now fixed error path an properly take care of freeing the memory after > > using protocol. > > But the call sites don't keep track of freeing it when error handling. > > Which I think serves as a clear demonstrator of how magically > allocating buffers makes for difficult code to keep correct. (Which is > why the UEFI intefaces all require you to allocate a buffer and then > pass that and a size as parameters.) > > So, since we are dealing with data that isn't changing, I prefer the > original design - just not the original implemenation. > > So how about sticking with that, but moving the STATIC struct global > in that source file (but keeping it STATIC)? > Good, keeping the global variable inside MvBoardDescDxe and checking it there is a clean and easy solution (consumers won't have to bother about the stuff additional to calling the protocol and error handling will be simpler). How about on top of the file I add a section for global varibles (IMO it's worth to modify other interfaces to that scheme later) and call it: STATIC MV_BOARD_GPIO_DESCRIPTION gGpioDescription; ? Thanks, Marcin > / > Leif > > > Please let know if above approach is acceptable. > > > > Best regards, > > Marcin > > > > > / > > > Leif > > > > > > > + if (Description == NULL) { > > > > +DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", > > > > __FUNCTION__)); > > > > +return EFI_OUT_OF_RESOURCES; > > > > + } > > > > + > > > > + Description
Re: [edk2] [platforms: PATCH v2 08/12] Marvell/Drivers: MvGpioDxe: Introduce platform GPIO driver
Hi Leif, wt., 15 sty 2019 o 00:32 Leif Lindholm napisał(a): > > On Thu, Jan 10, 2019 at 02:44:35AM +0100, Marcin Wojtas wrote: > > Marvell Armada 7k/8k SoCs comprise integrated GPIO controllers, > > one in AP806 and two in each south bridge hardware blocks. > > > > This patch introduces support for them. The new driver implements > > a generic EMBEDDED_GPIO protocol. > > > > In order to ease description of used GPIO pins and controllers > > of the Armada 7k8k platforms, add a common enum type. > > > > Based on original work of Jing Hua . > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf | 44 +++ > > Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h | 49 +++ > > Silicon/Marvell/Include/Protocol/MvGpio.h| 10 + > > Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.c | 372 > > > > 4 files changed, 475 insertions(+) > > create mode 100644 Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf > > create mode 100644 Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h > > create mode 100644 Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.c > > > > diff --git a/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf > > b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf > > new file mode 100644 > > index 000..5ff9130 > > --- /dev/null > > +++ b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf > > @@ -0,0 +1,44 @@ > > +## @file > > +# > > +# Copyright (c) 2017, Marvell International Ltd. All rights reserved. > > +# > > +# This program and the accompanying materials are licensed and made > > available > > +# under the terms and conditions of the BSD License which accompanies this > > +# distribution. The full text of the license may be found at > > +# http://opensource.org/licenses/bsd-license.php > > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > > +# IMPLIED. > > +# > > + > > +[Defines] > > + INF_VERSION= 0x0001001A > > + BASE_NAME = MvGpioDxe > > + FILE_GUID = 706eb761-b3b5-4f41-8558-5fd9217c0079 > > + MODULE_TYPE= DXE_DRIVER > > + VERSION_STRING = 1.0 > > + ENTRY_POINT= MvGpioEntryPoint > > + > > +[Sources] > > + MvGpioDxe.c > > + MvGpioDxe.h > > + > > +[Packages] > > + EmbeddedPkg/EmbeddedPkg.dec > > + MdeModulePkg/MdeModulePkg.dec > > + MdePkg/MdePkg.dec > > + Silicon/Marvell/Marvell.dec > > + > > +[LibraryClasses] > > + ArmadaSoCDescLib > > + DebugLib > > + MemoryAllocationLib > > + UefiDriverEntryPoint > > + UefiLib > > + > > +[Protocols] > > + gEmbeddedGpioProtocolGuid > > + gMarvellBoardDescProtocolGuid > > + > > +[Depex] > > + TRUE > > diff --git a/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h > > b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h > > new file mode 100644 > > index 000..4e5422b > > --- /dev/null > > +++ b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h > > @@ -0,0 +1,49 @@ > > +/** > > +* > > +* Copyright (c) 2018, Marvell International Ltd. All rights reserved. > > +* > > +* This program and the accompanying materials are licensed and made > > available > > +* under the terms and conditions of the BSD License which accompanies this > > +* distribution. The full text of the license may be found at > > +* http://opensource.org/licenses/bsd-license.php > > +* > > +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > > +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > > IMPLIED. > > +* > > +**/ > > +#ifndef __MV_GPIO_H__ > > +#define __MV_GPIO_H__ > > + > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > + > > +#include > > + > > +#define MV_GPIO_SIGNATURESIGNATURE_32 ('G', 'P', 'I', 'O') > > Unaddressed feedback from last time. But rereading it makes it clear > my feedback was too imprecise, apologies. The point was that "GPIO" is > not a very
Re: [edk2] [platforms: PATCH v2 07/12] Marvell/Protocol: Introduce GPIO helper header
Hi Leif, wt., 15 sty 2019 o 00:12 Leif Lindholm napisał(a): > > On Thu, Jan 10, 2019 at 02:44:34AM +0100, Marcin Wojtas wrote: > > From: jinghua > > > > This patch introduces a helper header that can be used by > > multiple EMBEDDED_GPIO protocol producers (e.g. platform > > driver or GPIO expanders). The drives are differentiated by > > MV_GPIO_DRIVER_TYPE field of driver's MV_GPIO_DEVICE_PATH. > > > > In order to ease selection of the desired GPIO controller > > a helper function was added - MarvellGpioGetProtocol(). > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > Silicon/Marvell/Include/Protocol/MvGpio.h | 156 > > 1 file changed, 156 insertions(+) > > create mode 100644 Silicon/Marvell/Include/Protocol/MvGpio.h > > > > diff --git a/Silicon/Marvell/Include/Protocol/MvGpio.h > > b/Silicon/Marvell/Include/Protocol/MvGpio.h > > new file mode 100644 > > index 000..c9f1007 > > --- /dev/null > > +++ b/Silicon/Marvell/Include/Protocol/MvGpio.h > > @@ -0,0 +1,156 @@ > > +/** > > +* > > +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. > > +* > > +* This program and the accompanying materials are licensed and made > > available > > +* under the terms and conditions of the BSD License which accompanies this > > +* distribution. The full text of the license may be found at > > +* http://opensource.org/licenses/bsd-license.php > > +* > > +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > > +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > > IMPLIED. > > +* > > +**/ > > +#ifndef __MV_GPIO_PROTOCOL_H__ > > +#define __MV_GPIO_PROTOCOL_H__ > > + > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > + > > +typedef enum { > > + MV_GPIO_DRIVER_TYPE_SOC_CONTROLLER, > > +} MV_GPIO_DRIVER_TYPE; > > + > > +typedef struct { > > + VENDOR_DEVICE_PATHHeader; > > + MV_GPIO_DRIVER_TYPE GpioDriverType; > > + EFI_DEVICE_PATH_PROTOCOL End; > > +} MV_GPIO_DEVICE_PATH; > > + > > +typedef struct { > > + UINTNControllerId; > > + UINTNPinNumber; > > + BOOLEAN ActiveHigh; > > +} MV_GPIO_PIN; > > + > > +/* > > + * Check if the driver type matches the requested value. > > + * In case of the success open the GPIO protocol and return. > > + */ > > +STATIC > > +inline > > +EFI_STATUS > > +EFIAPI > > +MvGpioFindMatchingDriver ( > > Eep! > I missed this in v1 (I assumed I'd missed the new file indicator > whilst scrolling) - please move these functions out of this .h file. > https://edk2-docs.gitbooks.io/edk-ii-c-coding-standards-specification/content/v/release/2.20/5_source_files/53_include_files.html#537-include-files-shall-not-generate-code-or-define-data-variables > > This makes me take a closer look at the rest of the patch ... and this > just isn't a protocol - it's a library. Please restrucure it as such > and move the header file to Include/Library rather than > Include/Protocol. > Initially it was a header for MvGpioProtocol + this inline C addition at the end... I will change it to the library. Thanks, Marcin > / > Leif > > > + IN MV_GPIO_DRIVER_TYPEGpioDriverType, > > + IN EFI_HANDLE HandleBuffer, > > + IN EFI_DEVICE_PATH *DevicePath, > > + IN OUT EMBEDDED_GPIO**GpioProtocol > > + ) > > +{ > > + MV_GPIO_DEVICE_PATH *GpioDevicePath; > > + EFI_STATUS Status; > > + > > + while (!IsDevicePathEndType (DevicePath)) { > > +/* Check if GpioDriverType matches one found in the device path */ > > +GpioDevicePath = (MV_GPIO_DEVICE_PATH *)DevicePath; > > +if (GpioDevicePath->GpioDriverType != GpioDriverType) { > > + DevicePath = NextDevicePathNode (DevicePath); > > + continue; > > +} > > + > > +/* > > + * Open GpioProtocol. With EFI_OPEN_PROTOCOL_GET_PROTOCOL attribute > > + * the consumer is not obliged to call CloseProtocol. > > + */ > > +Status = gBS->OpenProtocol (HandleBuffer, > > +, > > +(VOID **)GpioProtocol, > > +gImageHandle, > > +NULL, > > +EFI_OPEN_PROTOCOL_GET_PROTOCOL); > > +return Status; >
Re: [edk2] [platforms: PATCH v2 06/12] Marvell/Drivers: MvBoardDesc: Extend protocol with GPIO support
Hi Leif, pon., 14 sty 2019 o 23:58 Leif Lindholm napisał(a): > > On Thu, Jan 10, 2019 at 02:44:33AM +0100, Marcin Wojtas wrote: > > Introduce new callback that can provide information > > about GPIO SoC controllers, as well as on-board > > I2C IO expanders. According ArmadaSoCDescLib > > ArmadaBoardDescLib routines are used for > > obtaining required data. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > Silicon/Marvell/Include/Protocol/BoardDesc.h | 8 > > Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 43 > > > > 2 files changed, 51 insertions(+) > > > > diff --git a/Silicon/Marvell/Include/Protocol/BoardDesc.h > > b/Silicon/Marvell/Include/Protocol/BoardDesc.h > > index 1d57a16..02905ea 100644 > > --- a/Silicon/Marvell/Include/Protocol/BoardDesc.h > > +++ b/Silicon/Marvell/Include/Protocol/BoardDesc.h > > @@ -50,6 +50,13 @@ EFI_STATUS > > > > typedef > > EFI_STATUS > > +(EFIAPI *MV_BOARD_GPIO_DESCRIPTION_GET) ( > > + IN MARVELL_BOARD_DESC_PROTOCOL*This, > > + IN OUT MV_BOARD_GPIO_DESCRIPTION **GpioDescription > > + ); > > + > > +typedef > > +EFI_STATUS > > (EFIAPI *MV_BOARD_DESC_I2C_GET) ( > >IN MARVELL_BOARD_DESC_PROTOCOL *This, > >IN OUT MV_BOARD_I2C_DESC **I2cDesc > > @@ -113,6 +120,7 @@ struct _MARVELL_BOARD_DESC_PROTOCOL { > >MV_BOARD_DESC_UTMI_GET BoardDescUtmiGet; > >MV_BOARD_DESC_XHCI_GET BoardDescXhciGet; > >MV_BOARD_DESC_FREE BoardDescFree; > > + MV_BOARD_GPIO_DESCRIPTION_GET GpioDescriptionGet; > > }; > > > > #endif // __MARVELL_BOARD_DESC_PROTOCOL_H__ > > diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c > > b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c > > index f71bfc4..e348b85 100644 > > --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c > > +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c > > @@ -100,6 +100,48 @@ MvBoardDescComPhyGet ( > > > > STATIC > > EFI_STATUS > > +MvBoardGpioDescriptionGet ( > > + IN MARVELL_BOARD_DESC_PROTOCOL*This, > > + IN OUT MV_BOARD_GPIO_DESCRIPTION **GpioDescription > > + ) > > +{ > > + MV_BOARD_GPIO_DESCRIPTION *Description; > > My request on v1 was that this be refactored from a STATIC local > variable to a global variable. > > > + UINTN SoCGpioCount, GpioExpanderCount; > > + MV_GPIO_EXPANDER *GpioExpanders; > > + GPIO_CONTROLLER *SoCGpio; > > + EFI_STATUS Status; > > + > > + /* Get SoC data about all available GPIO controllers */ > > + Status = ArmadaSoCGpioGet (, ); > > + if (EFI_ERROR (Status)) { > > +return Status; > > + } > > + > > + /* Get per-board information about all available I2C IO expanders */ > > GPIO OK. > > > + Status = ArmadaBoardGpioExpanderGet (, ); > > + if (EFI_ERROR (Status)) { > > +return Status; > > + } > > + > > + /* Allocate and fill board description */ > > + Description = AllocateZeroPool (sizeof (MV_BOARD_GPIO_DESCRIPTION)); > > Instead, this space is now dynamically allocated. But none of the call > sites actually change, leading to potential memory leaks. > > I don't have a problem if you prefer an alternative solution to the > one I propose, but please discuss the change first rather than > submitting a new revision containing something I didn't ask for. > Indeed, I could have asked, but didn't want to spoil your Christmas time with questions, especially gitven it was 3+ weeks from review:/ Anyway, I tried to play with the MV_BOARD_GPIO_DESCRIPTION to be the global variable, but was not convinced by the outcome. My biggest objection to the global variable and checking whether it's NULL in the consumer driver is following - until now all users of the BoardDescProtocol 'know' and call only the relevant protocol routine, everything what happens underneath (PCDs, variable names, etc) is transparent. The consumers should be responsible for avoiding the memory leaks and this was an improvement of v2. Both MvGpioDxe and MvPca9xxxDxe have now fixed error path an properly take care of freeing the memory after using protocol. Please let know if above approach is acceptable. Best regards, Marcin > / > Leif > > > + if (Description == NULL) { > > +DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); > > +return EFI_OUT_OF_RESOURCES; > > + } > > + > > + Description->SoCGpio = SoCGpio; > > + Descri
Re: [edk2] [platforms: PATCH v2 04/12] Marvell/Armada70x0Db: Extend board description library with GPIO
Hi Leif, pon., 14 sty 2019 o 23:41 Leif Lindholm napisał(a): > > On Thu, Jan 10, 2019 at 02:44:31AM +0100, Marcin Wojtas wrote: > > This patch implements ArmadaBoarDescLib library for > > Armada70x0Db comunity board and introduces ArmadaBoardGpioGet > > routine with per-board GPIO expander description. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > > > Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf > > | 1 + > > > > Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c > >| 25 > > 2 files changed, 26 insertions(+) > > > > diff --git > > a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf > > > > b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf > > index b26f55b..c995515 100644 > > --- > > a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf > > +++ > > b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf > > @@ -25,6 +25,7 @@ > >Armada70x0DbBoardDescLib.c > > > > [Packages] > > + EmbeddedPkg/EmbeddedPkg.dec > >MdeModulePkg/MdeModulePkg.dec > >MdePkg/MdePkg.dec > >Silicon/Marvell/Marvell.dec > > diff --git > > a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c > > > > b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c > > index 48c68e4..f63d8fd 100644 > > --- > > a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c > > +++ > > b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c > > @@ -21,6 +21,31 @@ > > #include > > #include > > > > +#include > > + > > +// > > +// GPIO Expander > > +// > > +STATIC MV_GPIO_EXPANDER mGpioExpander = { > > + 8, /* PCA9555 */ > > Why did you drop the use of the still existing enumeration in favour > of live coding the integer value that it currently produces for the > member PCA9555_ID? > As you noticed, I 'fixed' it in 10/12 - otherwise compilation for this board would be temporarily broken. I will split add MvGpio header with the enum before this one. Best regards, Marcin > / > Leif > > > + 0x21, > > + 0x0, > > +}; > > + > > + > > +EFI_STATUS > > +EFIAPI > > +ArmadaBoardGpioExpanderGet ( > > + IN OUT MV_GPIO_EXPANDER **GpioExpanders, > > + IN OUT UINTN *GpioExpanderCount > > + ) > > +{ > > + *GpioExpanderCount = 1; > > + *GpioExpanders = > > + > > + return EFI_SUCCESS; > > +} > > + > > // > > // Order of devices in SdMmcDescTemplate has to be in par with > > ArmadaSoCDescLib > > // > > -- > > 2.7.4 > > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v2 12/12] Marvell/Armada7k8k: Introduce NonDiscoverable device init routines
To abstract the initialization required for non-discoverable devices, which is often platform specific (e.g. enable GPIO-driven power supply), introduce a NonDiscoverableInitLib for use by the NonDiscoverable code, for which each platform can supply its own version. Add XHCI power supply (so called 'VBUS') enabling routines for supported platforms (Armada70x0Db, Armada80x0Db, Armada80x0McBin). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Marvell.dec | 1 + Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc | 3 + Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc | 3 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc | 3 + Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf | 48 + Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf | 49 + Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.inf | 49 + Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.inf | 1 + Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.h | 23 + Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.h | 28 ++ Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.h | 20 Silicon/Marvell/Include/Library/NonDiscoverableInitLib.h | 28 ++ Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.c | 96 ++ Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.c | 106 Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.c | 71 + Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c | 13 ++- 16 files changed, 539 insertions(+), 3 deletions(-) create mode 100644 Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf create mode 100644 Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf create mode 100644 Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.inf create mode 100644 Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.h create mode 100644 Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.h create mode 100644 Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.h create mode 100644 Silicon/Marvell/Include/Library/NonDiscoverableInitLib.h create mode 100644 Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.c create mode 100644 Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.c create mode 100644 Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.c diff --git a/Silicon/Marvell/Marvell.dec b/Silicon/Marvell/Marvell.dec index 616624e..12bac55 100644 --- a/Silicon/Marvell/Marvell.dec +++ b/Silicon/Marvell/Marvell.dec @@ -63,6 +63,7 @@ ArmadaBoardDescLib|Include/Library/ArmadaBoardDescLib.h ArmadaIcuLib|Include/Library/ArmadaIcuLib.h ArmadaSoCDescLib|Include/Library/ArmadaSoCDescLib.h + NonDiscoverableInitLib|Include/Library/NonDiscoverableInitLib.h SampleAtResetLib|Include/Library/SampleAtResetLib.h [Protocols] diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc index 31815e4..e8cd177 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc +++ b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc @@ -48,6 +48,9 @@ !include Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc +[LibraryClasses.common] + NonDiscoverableInitLib|Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf + [Components.common] Silicon/Marvell/Armada7k8k/DeviceTree/Armada70x0Db.inf diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc b/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc index 42f7bd3..8e8c2ba 100644 --- a/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc +++ b/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc @@ -48,6 +48,9 @@ !include Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc +[LibraryClasses.common] + NonDiscoverableInitLib|Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf + [Components.common] Silicon/Marvell/Armada7k8k/DeviceTree/Armada80x0Db.inf diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc index 077224d..d080136 100644 --- a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc @@ -49,6 +49,9 @@ !include
[edk2] [platforms: PATCH v2 11/12] Marvell/Armada7k8k: Enable GPIO drivers compilation
Enable building new GPIO drivers before adding VBUS pins handling. Update relevant boards .dsc files with IO expander information. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 2 ++ Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc| 4 ++-- Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf.inc| 2 ++ Platform/Marvell/Armada80x0Db/Armada80x0Db.fdf.inc| 2 ++ Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.fdf.inc | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc index b3fd184..a0175de 100644 --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc @@ -455,6 +455,8 @@ Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf # Platform drivers + Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf + Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf MdeModulePkg/Bus/I2c/I2cDxe/I2cDxe.inf Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.inf diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc index a935f36..31815e4 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc +++ b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc @@ -89,8 +89,8 @@ gMarvellTokenSpaceGuid.PcdChip1MppSel6|{ 0xE, 0xE, 0xE, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } # I2C - gMarvellTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x50, 0x57, 0x60 } - gMarvellTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0, 0x0 } + gMarvellTokenSpaceGuid.PcdI2cSlaveAddresses|{ 0x50, 0x57, 0x60, 0x21 } + gMarvellTokenSpaceGuid.PcdI2cSlaveBuses|{ 0x0, 0x0, 0x0, 0x0 } gMarvellTokenSpaceGuid.PcdI2cControllersEnabled|{ 0x1, 0x1 } gMarvellTokenSpaceGuid.PcdEepromI2cAddresses|{ 0x50, 0x57 } gMarvellTokenSpaceGuid.PcdEepromI2cBuses|{ 0x0, 0x0 } diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf.inc b/Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf.inc index b7e7a65..7129606 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf.inc +++ b/Platform/Marvell/Armada70x0Db/Armada70x0Db.fdf.inc @@ -12,6 +12,8 @@ # Per-board additional content of the DXE phase firmware volume + INF Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf + # DTB INF RuleOverride = DTB Silicon/Marvell/Armada7k8k/DeviceTree/Armada70x0Db.inf diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0Db.fdf.inc b/Platform/Marvell/Armada80x0Db/Armada80x0Db.fdf.inc index 81a81d0..f2fcc55 100644 --- a/Platform/Marvell/Armada80x0Db/Armada80x0Db.fdf.inc +++ b/Platform/Marvell/Armada80x0Db/Armada80x0Db.fdf.inc @@ -12,6 +12,8 @@ # Per-board additional content of the DXE phase firmware volume + INF Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf + # DTB INF RuleOverride = DTB Silicon/Marvell/Armada7k8k/DeviceTree/Armada80x0Db.inf diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.fdf.inc b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.fdf.inc index 326da2e..254fcee 100644 --- a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.fdf.inc +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.fdf.inc @@ -12,6 +12,8 @@ # Per-board additional content of the DXE phase firmware volume + INF Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf + # DTB INF RuleOverride = DTB Silicon/Marvell/Armada7k8k/DeviceTree/Armada80x0McBin.inf -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v2 10/12] Marvell/Drivers: MvPca95xxDxe: Introduce GPIO expander driver
Marvell Armada 7k/8k-based platforms may use Pca95xx to extend amount of the GPIO pins. This patch introduces support for them. The new driver implements a generic EMBEDDED_GPIO protocol. In order to ease description of used PCA9XXX controllers add a common enum type. It can be used e.g. in the board description library to specify the expander model on a board (instead of passing a raw number). Update relevant libraries. Driver is based on initial work done by Allen Yan . Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf | 45 ++ Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.h | 65 ++ Silicon/Marvell/Include/Protocol/MvGpio.h | 16 + Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c | 2 +- Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c | 4 +- Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.c | 651 6 files changed, 780 insertions(+), 3 deletions(-) create mode 100644 Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf create mode 100644 Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.h create mode 100644 Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.c diff --git a/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf b/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf new file mode 100644 index 000..3b1ab4e --- /dev/null +++ b/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf @@ -0,0 +1,45 @@ +## @file +# +# Copyright (c) 2017, Marvell International Ltd. All rights reserved. +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = MvPca95xxDxe + FILE_GUID = f0e405eb-8407-43b9-88e6-2f7d70715c72 + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= MvPca95xxEntryPoint + +[Sources] + MvPca95xxDxe.c + MvPca95xxDxe.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + MemoryAllocationLib + UefiDriverEntryPoint + UefiLib + +[Protocols] + gEfiDriverBindingProtocolGuid + gEfiI2cIoProtocolGuid + gEmbeddedGpioProtocolGuid + gMarvellBoardDescProtocolGuid + +[Depex] + TRUE diff --git a/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.h b/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.h new file mode 100644 index 000..1fed739 --- /dev/null +++ b/Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.h @@ -0,0 +1,65 @@ +/** +* +* Copyright (c) 2018, Marvell International Ltd. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ +#ifndef __MV_PCA953X_H__ +#define __MV_PCA953X_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#define PCA95XX_GPIO_SIGNATURE SIGNATURE_32 ('I', 'O', 'E', 'X') + +#define PCA95XX_INPUT_REG0x0 +#define PCA95XX_OUTPUT_REG 0x2 +#define PCA95XX_DIRECTION_REG0x6 + +#define PCA95XX_BANK_SIZE8 +#define PCA95XX_OPERATION_COUNT 2 +#define PCA95XX_OPERATION_LENGTH 1 + +typedef enum { + PCA9505_PIN_COUNT = 40, + PCA9534_PIN_COUNT = 8, + PCA9535_PIN_COUNT = 16, + PCA9536_PIN_COUNT = 4, + PCA9537_PIN_COUNT = 4, + PCA9538_PIN_COUNT = 8, + PCA9539_PIN_COUNT = 16, + PCA9554_PIN_COUNT = 8, + PCA9555_PIN_COUNT = 16, + PCA9556_PIN_COUNT = 16, + PCA9557_PIN_COUNT = 16, +} PCA95XX_PIN_COUNT; + +typedef struct { + EMBEDDED_GPIO GpioProtocol; + MV_GPIO_EXPANDER *GpioExpanders; + UINTN GpioExpanderCount; + UINTN Signature; + EFI_HANDLE ControllerHandle; +} PCA95XX; + +#endif diff --git a/Silicon/Marvell/Include/Protocol/MvGpio.h b/Silicon/Marvell/Include/Protocol/MvGpio.h index 3319b79..5037fc2 100644 --- a/Silicon/Marv
[edk2] [platforms: PATCH v2 09/12] Marvell/Drivers: I2c: Use common header for macros
Hitherto I2c solution used same macros, defined in multiple places. Move them to a new common header. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h | 10 --- Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h | 17 ++- Silicon/Marvell/Include/Protocol/MvI2c.h | 31 Silicon/Marvell/Applications/EepromCmd/EepromCmd.c| 5 +--- Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.c | 3 +- Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c | 4 +-- 6 files changed, 37 insertions(+), 33 deletions(-) create mode 100644 Silicon/Marvell/Include/Protocol/MvI2c.h diff --git a/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h b/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h index b1af645..c32ee48 100644 --- a/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h +++ b/Silicon/Marvell/Drivers/I2c/MvEepromDxe/MvEepromDxe.h @@ -41,16 +41,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define MAX_BUFFER_LENGTH 64 -/* - * I2C_FLAG_NORESTART is not part of PI spec, it allows to continue - * transmission without repeated start operation. - * FIXME: This flag is also defined in Drivers/I2c/MvI2cDxe/MvI2cDxe.h - * and it's important to have both version synced. This solution is - * temporary and shared flag should be used by both files. - * Situation is analogous with I2C_GUID, which also should be common, but is - * for now defined same way in two header files. - */ -#define I2C_FLAG_NORESTART 0x0002 #define I2C_GUID \ { \ 0xadc1901b, 0xb83c, 0x4831, { 0x8f, 0x59, 0x70, 0x89, 0x8f, 0x26, 0x57, 0x1e } \ diff --git a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h index 3c9beaf..6850c34 100644 --- a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h +++ b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h @@ -32,8 +32,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***/ -#ifndef __MV_I2C_H__ -#define __MV_I2C_H__ +#ifndef __MV_I2C_DXE_H__ +#define __MV_I2C_DXE_H__ #include @@ -75,17 +75,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define I2C_FAST 0x2 #define I2C_FASTEST0x3 -/* - * I2C_FLAG_NORESTART is not part of PI spec, it allows to continue - * transmission without repeated start operation. - * FIXME: This flag is also defined in - * Platforms/Marvell/Include/Protocol/Eeprom.h and it's important to have both - * version synced. This solution is temporary and shared flag should be used by - * both files. - * Situation is analogous with I2C_GUID, which also should be common, but is - * for now defined same way in two header files. - */ -#define I2C_FLAG_NORESTART 0x0002 #define I2C_GUID \ { \ 0xadc1901b, 0xb83c, 0x4831, { 0x8f, 0x59, 0x70, 0x89, 0x8f, 0x26, 0x57, 0x1e } \ @@ -266,4 +255,4 @@ MvI2cEnableConf ( IN EFI_STATUS *I2cStatus OPTIONAL ); -#endif // __MV_I2C_H__ +#endif // __MV_I2C_DXE_H__ diff --git a/Silicon/Marvell/Include/Protocol/MvI2c.h b/Silicon/Marvell/Include/Protocol/MvI2c.h new file mode 100644 index 000..d8e644e --- /dev/null +++ b/Silicon/Marvell/Include/Protocol/MvI2c.h @@ -0,0 +1,31 @@ +/** +* +* Copyright (c) 2018, Marvell International Ltd. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ +#ifndef __MV_I2C_H__ +#define __MV_I2C_H__ + +/* + * I2C_FLAG_NORESTART is not part of PI spec, it allows to continue + * transmission without repeated start operation. + */ +#define I2C_FLAG_NORESTART 0x0002 + +/* + * Helper macros for maintaining multiple I2C buses + * and devices defined via EFI_I2C_DEVICE. + */ +#define I2C_DEVICE_ADDRESS(Index) ((Index) & MAX_UINT16) +#define I2C_DEVICE_BUS(Index) ((Index) >> 16) +#define I2C_DEVICE_INDEX(Bus, Address) (((Address) & MAX_UINT16) | (Bus) << 16) + +#endif diff --git a/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c b/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c index dc3c95f..712aba9 100644 --- a/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c +++ b/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c @@ -51,10 +51,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include - -#define I2C_DEVICE_INDEX(bus, address) (((address) & 0x) | (bus) << 16) -#
[edk2] [platforms: PATCH v2 08/12] Marvell/Drivers: MvGpioDxe: Introduce platform GPIO driver
Marvell Armada 7k/8k SoCs comprise integrated GPIO controllers, one in AP806 and two in each south bridge hardware blocks. This patch introduces support for them. The new driver implements a generic EMBEDDED_GPIO protocol. In order to ease description of used GPIO pins and controllers of the Armada 7k8k platforms, add a common enum type. Based on original work of Jing Hua . Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf | 44 +++ Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h | 49 +++ Silicon/Marvell/Include/Protocol/MvGpio.h| 10 + Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.c | 372 4 files changed, 475 insertions(+) create mode 100644 Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf create mode 100644 Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h create mode 100644 Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.c diff --git a/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf new file mode 100644 index 000..5ff9130 --- /dev/null +++ b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf @@ -0,0 +1,44 @@ +## @file +# +# Copyright (c) 2017, Marvell International Ltd. All rights reserved. +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = MvGpioDxe + FILE_GUID = 706eb761-b3b5-4f41-8558-5fd9217c0079 + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= MvGpioEntryPoint + +[Sources] + MvGpioDxe.c + MvGpioDxe.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + ArmadaSoCDescLib + DebugLib + MemoryAllocationLib + UefiDriverEntryPoint + UefiLib + +[Protocols] + gEmbeddedGpioProtocolGuid + gMarvellBoardDescProtocolGuid + +[Depex] + TRUE diff --git a/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h new file mode 100644 index 000..4e5422b --- /dev/null +++ b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.h @@ -0,0 +1,49 @@ +/** +* +* Copyright (c) 2018, Marvell International Ltd. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ +#ifndef __MV_GPIO_H__ +#define __MV_GPIO_H__ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define MV_GPIO_SIGNATURESIGNATURE_32 ('G', 'P', 'I', 'O') + +// Marvell MV_GPIO Controller Registers +#define MV_GPIO_DATA_OUT_REG (0x0) +#define MV_GPIO_OUT_EN_REG (0x4) +#define MV_GPIO_BLINK_EN_REG (0x8) +#define MV_GPIO_DATA_IN_POL_REG (0xc) +#define MV_GPIO_DATA_IN_REG (0x10) + +typedef struct { + EMBEDDED_GPIO GpioProtocol; + GPIO_CONTROLLER *SoCGpio; + UINTN GpioDeviceCount; + UINTN Signature; + EFI_HANDLEHandle; +} MV_GPIO; + +#endif // __MV_GPIO_H__ diff --git a/Silicon/Marvell/Include/Protocol/MvGpio.h b/Silicon/Marvell/Include/Protocol/MvGpio.h index c9f1007..3319b79 100644 --- a/Silicon/Marvell/Include/Protocol/MvGpio.h +++ b/Silicon/Marvell/Include/Protocol/MvGpio.h @@ -27,6 +27,16 @@ typedef enum { MV_GPIO_DRIVER_TYPE_SOC_CONTROLLER, } MV_GPIO_DRIVER_TYPE; +typedef enum { + MV_GPIO_AP806_CONTROLLER0, + MV_GPIO_CP0_CONTROLLER0, + MV_GPIO_CP0_CONTROLLER1, + MV_GPIO_CP1_CONTROLLER0, + MV_GPIO_CP1_CONTROLLER1, + MV_GPIO_CP2_CONTROLLER0, + MV_GPIO_CP2_CONTROLLER1, +} MV_GPIO_SOC_CONTROLLER_TYPE; + typedef struct { VENDOR_DEVICE_PATHHeader; MV_GPIO_DRIVER_TYPE GpioDriverType; diff --git a/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.c b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.c new file mode 100644 index 000..4d5e530 --- /dev/null +++ b/Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.c @@ -0,0 +1,372 @@ +/** +* +* Copyright (c) 2018, Marvell International Ltd. All rights reserved. +* +* This program
[edk2] [platforms: PATCH v2 07/12] Marvell/Protocol: Introduce GPIO helper header
From: jinghua This patch introduces a helper header that can be used by multiple EMBEDDED_GPIO protocol producers (e.g. platform driver or GPIO expanders). The drives are differentiated by MV_GPIO_DRIVER_TYPE field of driver's MV_GPIO_DEVICE_PATH. In order to ease selection of the desired GPIO controller a helper function was added - MarvellGpioGetProtocol(). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Include/Protocol/MvGpio.h | 156 1 file changed, 156 insertions(+) create mode 100644 Silicon/Marvell/Include/Protocol/MvGpio.h diff --git a/Silicon/Marvell/Include/Protocol/MvGpio.h b/Silicon/Marvell/Include/Protocol/MvGpio.h new file mode 100644 index 000..c9f1007 --- /dev/null +++ b/Silicon/Marvell/Include/Protocol/MvGpio.h @@ -0,0 +1,156 @@ +/** +* +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ +#ifndef __MV_GPIO_PROTOCOL_H__ +#define __MV_GPIO_PROTOCOL_H__ + +#include + +#include +#include +#include +#include + +#include + +typedef enum { + MV_GPIO_DRIVER_TYPE_SOC_CONTROLLER, +} MV_GPIO_DRIVER_TYPE; + +typedef struct { + VENDOR_DEVICE_PATHHeader; + MV_GPIO_DRIVER_TYPE GpioDriverType; + EFI_DEVICE_PATH_PROTOCOL End; +} MV_GPIO_DEVICE_PATH; + +typedef struct { + UINTNControllerId; + UINTNPinNumber; + BOOLEAN ActiveHigh; +} MV_GPIO_PIN; + +/* + * Check if the driver type matches the requested value. + * In case of the success open the GPIO protocol and return. + */ +STATIC +inline +EFI_STATUS +EFIAPI +MvGpioFindMatchingDriver ( + IN MV_GPIO_DRIVER_TYPEGpioDriverType, + IN EFI_HANDLE HandleBuffer, + IN EFI_DEVICE_PATH *DevicePath, + IN OUT EMBEDDED_GPIO**GpioProtocol + ) +{ + MV_GPIO_DEVICE_PATH *GpioDevicePath; + EFI_STATUS Status; + + while (!IsDevicePathEndType (DevicePath)) { +/* Check if GpioDriverType matches one found in the device path */ +GpioDevicePath = (MV_GPIO_DEVICE_PATH *)DevicePath; +if (GpioDevicePath->GpioDriverType != GpioDriverType) { + DevicePath = NextDevicePathNode (DevicePath); + continue; +} + +/* + * Open GpioProtocol. With EFI_OPEN_PROTOCOL_GET_PROTOCOL attribute + * the consumer is not obliged to call CloseProtocol. + */ +Status = gBS->OpenProtocol (HandleBuffer, +, +(VOID **)GpioProtocol, +gImageHandle, +NULL, +EFI_OPEN_PROTOCOL_GET_PROTOCOL); +return Status; + } + + return EFI_NOT_FOUND; +} + +/* + * Select desired protocol producer upon MV_GPIO_DRIVER_TYPE + * field of driver's MV_GPIO_DEVICE_PATH. + */ +STATIC +inline +EFI_STATUS +EFIAPI +MvGpioGetProtocol ( + IN MV_GPIO_DRIVER_TYPEGpioDriverType, + IN OUT EMBEDDED_GPIO**GpioProtocol + ) +{ + EFI_DEVICE_PATH *DevicePath; + EFI_HANDLE *HandleBuffer; + EFI_STATUS Status; + UINTNHandleCount; + UINTNIndex; + + /* Locate Handles of all EMBEDDED_GPIO producers */ + Status = gBS->LocateHandleBuffer (ByProtocol, + , + NULL, + , + ); + if (EFI_ERROR (Status)) { +DEBUG ((DEBUG_ERROR, "%a: Unable to locate handles\n", __FUNCTION__)); +return Status; + } + + /* Iterate over all protocol producers */ + for (Index = 0; Index < HandleCount; Index++) { +/* Open device path protocol installed on each handle */ +Status = gBS->OpenProtocol (HandleBuffer[Index], +, +(VOID **), +gImageHandle, +NULL, +EFI_OPEN_PROTOCOL_GET_PROTOCOL); +if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Unable to find DevicePath\n", __FUNCTION__)); + continue; +} + +/* + * Check if the driver type matches the requested value. + * In case of the success open the GPIO protocol and return. + * If there is no match, repeat procedure with the next handle. + */ +Status = MvGpioFindMatchingDriver (GpioDriverType, + HandleBuffer[Index], + DevicePath, + GpioProtocol); +if (Status == EFI_NOT_FOUND) { + continue; +} else if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, +"%a: Unable to open GPIO protocol\n", +__FUNCTION__)); +} +
[edk2] [platforms: PATCH v2 06/12] Marvell/Drivers: MvBoardDesc: Extend protocol with GPIO support
Introduce new callback that can provide information about GPIO SoC controllers, as well as on-board I2C IO expanders. According ArmadaSoCDescLib ArmadaBoardDescLib routines are used for obtaining required data. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Include/Protocol/BoardDesc.h | 8 Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 43 2 files changed, 51 insertions(+) diff --git a/Silicon/Marvell/Include/Protocol/BoardDesc.h b/Silicon/Marvell/Include/Protocol/BoardDesc.h index 1d57a16..02905ea 100644 --- a/Silicon/Marvell/Include/Protocol/BoardDesc.h +++ b/Silicon/Marvell/Include/Protocol/BoardDesc.h @@ -50,6 +50,13 @@ EFI_STATUS typedef EFI_STATUS +(EFIAPI *MV_BOARD_GPIO_DESCRIPTION_GET) ( + IN MARVELL_BOARD_DESC_PROTOCOL*This, + IN OUT MV_BOARD_GPIO_DESCRIPTION **GpioDescription + ); + +typedef +EFI_STATUS (EFIAPI *MV_BOARD_DESC_I2C_GET) ( IN MARVELL_BOARD_DESC_PROTOCOL *This, IN OUT MV_BOARD_I2C_DESC **I2cDesc @@ -113,6 +120,7 @@ struct _MARVELL_BOARD_DESC_PROTOCOL { MV_BOARD_DESC_UTMI_GET BoardDescUtmiGet; MV_BOARD_DESC_XHCI_GET BoardDescXhciGet; MV_BOARD_DESC_FREE BoardDescFree; + MV_BOARD_GPIO_DESCRIPTION_GET GpioDescriptionGet; }; #endif // __MARVELL_BOARD_DESC_PROTOCOL_H__ diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c index f71bfc4..e348b85 100644 --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c @@ -100,6 +100,48 @@ MvBoardDescComPhyGet ( STATIC EFI_STATUS +MvBoardGpioDescriptionGet ( + IN MARVELL_BOARD_DESC_PROTOCOL*This, + IN OUT MV_BOARD_GPIO_DESCRIPTION **GpioDescription + ) +{ + MV_BOARD_GPIO_DESCRIPTION *Description; + UINTN SoCGpioCount, GpioExpanderCount; + MV_GPIO_EXPANDER *GpioExpanders; + GPIO_CONTROLLER *SoCGpio; + EFI_STATUS Status; + + /* Get SoC data about all available GPIO controllers */ + Status = ArmadaSoCGpioGet (, ); + if (EFI_ERROR (Status)) { +return Status; + } + + /* Get per-board information about all available I2C IO expanders */ + Status = ArmadaBoardGpioExpanderGet (, ); + if (EFI_ERROR (Status)) { +return Status; + } + + /* Allocate and fill board description */ + Description = AllocateZeroPool (sizeof (MV_BOARD_GPIO_DESCRIPTION)); + if (Description == NULL) { +DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); +return EFI_OUT_OF_RESOURCES; + } + + Description->SoCGpio = SoCGpio; + Description->GpioDeviceCount = SoCGpioCount; + Description->GpioExpanders = GpioExpanders; + Description->GpioExpanderCount = GpioExpanderCount; + + *GpioDescription = Description; + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS MvBoardDescI2cGet ( IN MARVELL_BOARD_DESC_PROTOCOL *This, IN OUT MV_BOARD_I2C_DESC **I2cDesc @@ -571,6 +613,7 @@ MvBoardDescInitProtocol ( BoardDescProtocol->BoardDescUtmiGet = MvBoardDescUtmiGet; BoardDescProtocol->BoardDescXhciGet = MvBoardDescXhciGet; BoardDescProtocol->BoardDescFree = MvBoardDescFree; + BoardDescProtocol->GpioDescriptionGet = MvBoardGpioDescriptionGet; return EFI_SUCCESS; } -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v2 05/12] Marvell/Armada80x0Db: Extend board description library with GPIO
This patch implements ArmadaBoarDescLib library for Armada80x0Db comunity board and introduces ArmadaBoardGpioGet routine with per-board GPIO expander description. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf | 1 + Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c | 31 2 files changed, 32 insertions(+) diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf index 2d39d96..786b7f0 100644 --- a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf +++ b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf @@ -25,6 +25,7 @@ Armada80x0DbBoardDescLib.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c index feb69ad..f6e3675 100644 --- a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c +++ b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c @@ -21,6 +21,37 @@ #include #include +#include + +// +// GPIO Expanders +// +STATIC MV_GPIO_EXPANDER mGpioExpanders[] = { + { +8, /* PCA9555 */ +0x21, +0x0, + }, + { +8, /* PCA9555 */ +0x25, +0x0, + }, +}; + +EFI_STATUS +EFIAPI +ArmadaBoardGpioExpanderGet ( + IN OUT MV_GPIO_EXPANDER **GpioExpanders, + IN OUT UINTN *GpioExpanderCount + ) +{ + *GpioExpanderCount = ARRAY_SIZE (mGpioExpanders); + *GpioExpanders = mGpioExpanders; + + return EFI_SUCCESS; +} + // // Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib // -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v2 04/12] Marvell/Armada70x0Db: Extend board description library with GPIO
This patch implements ArmadaBoarDescLib library for Armada70x0Db comunity board and introduces ArmadaBoardGpioGet routine with per-board GPIO expander description. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf | 1 + Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c | 25 2 files changed, 26 insertions(+) diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf index b26f55b..c995515 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf +++ b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf @@ -25,6 +25,7 @@ Armada70x0DbBoardDescLib.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c index 48c68e4..f63d8fd 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c +++ b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c @@ -21,6 +21,31 @@ #include #include +#include + +// +// GPIO Expander +// +STATIC MV_GPIO_EXPANDER mGpioExpander = { + 8, /* PCA9555 */ + 0x21, + 0x0, +}; + + +EFI_STATUS +EFIAPI +ArmadaBoardGpioExpanderGet ( + IN OUT MV_GPIO_EXPANDER **GpioExpanders, + IN OUT UINTN *GpioExpanderCount + ) +{ + *GpioExpanderCount = 1; + *GpioExpanders = + + return EFI_SUCCESS; +} + // // Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib // -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v2 03/12] SolidRun/Armada80x0McBin: Extend board description library with GPIO
This patch implements ArmadaBoarDescLib library for Armada80x0McBin comunity board and introduces ArmadaBoardGpioGet routine with per-board GPIO expander description. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf | 1 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c | 17 + 2 files changed, 18 insertions(+) diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf index 63a4f66..43e4b9e 100644 --- a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf @@ -25,6 +25,7 @@ Armada80x0McBinBoardDescLib.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c index d52adfc..32596ad 100644 --- a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c @@ -22,6 +22,23 @@ #include // +// GPIO Expander +// +EFI_STATUS +EFIAPI +ArmadaBoardGpioExpanderGet ( + IN OUT MV_GPIO_EXPANDER **GpioExpanders, + IN OUT UINTN *GpioExpanderCount + ) +{ + /* No GPIO expanders on board */ + *GpioExpanders = NULL; + *GpioExpanderCount = 0; + + return EFI_SUCCESS; +} + +// // Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib // STATIC -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v2 02/12] Marvell/Library: ArmadaBoardDescLib: Add GPIO information
This patch extends library with GPIO devices per-board description. Both embedded SoC controllers and I2C IO expanders are supported. Add a helper routine for obtaining information about the latter. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 23 1 file changed, 23 insertions(+) diff --git a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h index 3fe2988..6ec5ace 100644 --- a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h +++ b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h @@ -25,6 +25,29 @@ typedef struct { } MV_BOARD_COMPHY_DESC; // +// GPIO devices per-board description +// +typedef struct { + UINTN ChipId; + UINTN I2cAddress; + UINTN I2cBus; +} MV_GPIO_EXPANDER; + +typedef struct { + GPIO_CONTROLLER *SoCGpio; + UINTN GpioDeviceCount; + MV_GPIO_EXPANDER *GpioExpanders; + UINTN GpioExpanderCount; +} MV_BOARD_GPIO_DESCRIPTION; + +EFI_STATUS +EFIAPI +ArmadaBoardGpioExpanderGet ( + IN OUT MV_GPIO_EXPANDER **GpioExpanders, + IN OUT UINTN *GpioExpanderCount + ); + +// // I2C devices per-board description // typedef struct { -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v2 01/12] Marvell/Library: ArmadaSoCDescLib: Add GPIO information
This patch introduces new library callback (ArmadaSoCGpioGet ()), which dynamically allocates and fills EmbeddedGpio's GPIO_CONTROLLER structure with the SoC description of GPIO controllers. Because the library header is indirectly used in many modules, update all dependencies after including EmbeddedGpio.h. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf | 1 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf | 1 + Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf | 1 + Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf | 1 + Silicon/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf | 1 + Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf | 1 + Silicon/Marvell/Library/ComPhyLib/ComPhyLib.inf | 1 + Silicon/Marvell/Library/IcuLib/IcuLib.inf | 1 + Silicon/Marvell/Library/UtmiPhyLib/UtmiPhyLib.inf | 1 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h | 10 + Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h | 12 ++ Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c | 39 12 files changed, 70 insertions(+) diff --git a/Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf b/Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf index 5503463..e707fe9 100644 --- a/Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf +++ b/Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf @@ -25,6 +25,7 @@ PlatInitDxe.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf index 2b73b73..48a320c 100644 --- a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf +++ b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf @@ -24,6 +24,7 @@ Armada7k8kSoCDescLib.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf index 0b93948..0b641fe 100644 --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf @@ -42,6 +42,7 @@ MvBoardDescDxe.h [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf index 0eef350..e5bd370 100755 --- a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf +++ b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.inf @@ -41,6 +41,7 @@ MvI2cDxe.c [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec ArmPlatformPkg/ArmPlatformPkg.dec diff --git a/Silicon/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf b/Silicon/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf index 739576f..8a877da 100644 --- a/Silicon/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf +++ b/Silicon/Marvell/Drivers/Net/MvMdioDxe/MvMdioDxe.inf @@ -45,6 +45,7 @@ [Packages] ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf b/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf index 00c738a..09c5842 100644 --- a/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf +++ b/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf @@ -35,6 +35,7 @@ XenonSdMmcOverride.h [Packages] + EmbeddedPkg/EmbeddedPkg.dec MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Library/ComPhyLib/ComPhyLib.inf b/Silicon/Marvell/Library/ComPhyLib/ComPhyLib.inf index 36f498b..c360edd 100644 --- a/Silicon/Marvell/Library/ComPhyLib/ComPhyLib.inf +++ b/Silicon/Marvell/Library/ComPhyLib/ComPhyLib.inf @@ -41,6 +41,7 @@ [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec Silicon/Marvell/Marvell.dec diff --git a/Silicon/Marvell/Library/IcuLib/IcuLib.inf b/Silicon/Marvell/Library/IcuLib/IcuLib.inf index 0010141..ea662be 100644 --- a/Silicon/Marvell/Library/IcuLib/IcuLib.inf +++ b
[edk2] [platforms: PATCH v2 00/12] Armada 7k8k GPIO support
Hi, With a big delay caused by private and professional matters, I finaly submit the second version of the GPIO support for Marvell Armada SoCs. The rework was HUGE. The biggest change is dropping custom GPIO protocol and start using the generic EMBEDDED_GPIO with all its types. I think I answered all of the review remarks, the details can be found in the changelog below. Patches are available in the github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/gpio-upstream-r20190110 I also enclose a diff between v1 and v2, which maybe can ease a bit the effort of review: https://pastebin.com/GvAiYfJD I am looking forward to your feedback. Best regards, Marcin Changelog: v1->v2: * All - rebase on top of the master branch and Xenon changes * 1/12 - s/AP/AP806/ in order to avoid confusion - drop desc/DESC usage and improve variables naming - use GPIO_CONTROLLER from EmbeddedGpio.h instead of custom MV_SOC_GPIO - update commit message * 2,3,4,5/12 - drop desc/DESC usage and improve variables naming - drop reference to I2c and use GpioExpander - improve commit logs * 6/12 - drop desc/DESC usage and improve variables naming - drop reference to I2c and use GpioExpander - remove global variable - same as for other interfaces the consumer is responsible for avoiding memory leak * 7/12 - use MV_GPIO_ prefix - switch to EMBEDDED_GPIO - remove custom Marvell GPIO Protocol and types - add subroutine to MvGpioGetProtocol and more coments to clarify the code - add driver types and related enums in other commits * 8/12 - extend error path in the entry point, rename variables - use MV_GPIO_ prefix - switch to EMBEDDED_GPIO - remove custom Marvell GPIO Protocol and types - replace '!!' expression for obtaining pin state - remove BIT() macro - use generic mDevicePathTemplate name - put validate function under '#if !defined(MDEPKG_NDEBUG)' and call from inside ASSERT_EFI_ERROR, add comment - update commit message - add common enum for describing controllers - change authorship - 9/12 - Add Leif's RB * 10/12 - same modifications as 8/12 - use I2C flags directly and remove PCA95XX_OPERATION enum - add common enum for describing controllers * 11/12 - Add Leif's RB * 12/12 - Add local headers - Make STATIC names more generic - s/GetInitializerForType/NonDiscoverableDeviceInitializerGet/ - Use global enum for McBin GPIO controller Marcin Wojtas (11): Marvell/Library: ArmadaSoCDescLib: Add GPIO information Marvell/Library: ArmadaBoardDescLib: Add GPIO information SolidRun/Armada80x0McBin: Extend board description library with GPIO Marvell/Armada70x0Db: Extend board description library with GPIO Marvell/Armada80x0Db: Extend board description library with GPIO Marvell/Drivers: MvBoardDesc: Extend protocol with GPIO support Marvell/Drivers: MvGpioDxe: Introduce platform GPIO driver Marvell/Drivers: I2c: Use common header for macros Marvell/Drivers: MvPca95xxDxe: Introduce GPIO expander driver Marvell/Armada7k8k: Enable GPIO drivers compilation Marvell/Armada7k8k: Introduce NonDiscoverable device init routines jinghua (1): Marvell/Protocol: Introduce GPIO helper header Silicon/Marvell/Marvell.dec | 1 + Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 2 + Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc | 7 +- Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc | 3 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc | 3 + Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf | 1 + Platform/Marvell/Armada70x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf | 48 ++ Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf | 1 + Platform/Marvell/Armada80x0Db/NonDiscoverableInitLib/NonDiscoverableInitLib.inf | 49 ++ Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf | 1 + Platform/SolidRun/Armada80x0McBin/NonDiscoverableInitLib/NonDiscoverableInitLib.inf | 49 ++ Silicon/Marvell/Armada7k8k/Drivers/PlatInitDxe/PlatInitDxe.inf | 1 + Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.inf | 1 + Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf | 1 + Silicon/Marvell/Drivers/Gpio/MvGpioDxe/MvGpioDxe.inf | 44 ++ Silicon/Marvell/Drivers/Gpio/MvPca95xxDxe/MvPca95xxDxe.inf | 45 ++ Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.
[edk2] [platforms: PATCH 1/1] Marvell/Applications: Drop dependency on ShellBase.h
Recent changes in EDK2 resulted in compilation break of all Marvell platforms, because the applications include deprecated ShellBase.h header. Fix that. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Applications/EepromCmd/EepromCmd.c| 1 - Silicon/Marvell/Applications/FirmwareUpdate/FUpdate.c | 1 - Silicon/Marvell/Applications/SpiTool/SpiFlashCmd.c| 1 - 3 files changed, 3 deletions(-) diff --git a/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c b/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c index f43e411..dc3c95f 100644 --- a/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c +++ b/Silicon/Marvell/Applications/EepromCmd/EepromCmd.c @@ -34,7 +34,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#include #include #include #include diff --git a/Silicon/Marvell/Applications/FirmwareUpdate/FUpdate.c b/Silicon/Marvell/Applications/FirmwareUpdate/FUpdate.c index 9ccb1c7..22a9b8f 100644 --- a/Silicon/Marvell/Applications/FirmwareUpdate/FUpdate.c +++ b/Silicon/Marvell/Applications/FirmwareUpdate/FUpdate.c @@ -31,7 +31,6 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***/ -#include #include #include diff --git a/Silicon/Marvell/Applications/SpiTool/SpiFlashCmd.c b/Silicon/Marvell/Applications/SpiTool/SpiFlashCmd.c index cf91581..a028c54 100644 --- a/Silicon/Marvell/Applications/SpiTool/SpiFlashCmd.c +++ b/Silicon/Marvell/Applications/SpiTool/SpiFlashCmd.c @@ -32,7 +32,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***/ #include -#include #include #include -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] ShellPkg: Remove ShellPkg wrapper header files
Leif, David, Thanks for the heads up. I finally will have a slot for the edk2 today - will fix and submit. Best regards, Marcin wt., 11 gru 2018 o 08:16 David F. napisał(a): > I ran in to it too, it was easy fix, the headers changed to those in > MDEPKG and the header file name changed. IIRC it was the same name minus > the leading Efi, so EfiShellParameters.h became ShellParameters.h. I don't > have a full list but one of the notes on that change points out the new > names. > > On Mon, Dec 10, 2018 at 10:57 AM Leif Lindholm > wrote: > >> Hi Marcin, >> >> This EDK2 patch has been pushed, making all of the Armada platforms >> stop building. Can you have a look please? >> >> Regards, >> >> Leif >> >> On Thu, Nov 15, 2018 at 03:45:28PM +0800, Shenglei Zhang wrote: >> > These wrapper header files are not referenced by all >> > open source, so they are removed. >> > https://bugzilla.tianocore.org/show_bug.cgi?id=158 >> > >> > Cc: Jaben Carsey >> > Cc: Ruiyu Ni >> > Cc: Leif Lindholm >> > Cc: Ard Biesheuvel >> > Contributed-under: TianoCore Contribution Agreement 1.1 >> > Signed-off-by: Shenglei Zhang >> > --- >> > ShellPkg/Include/Protocol/EfiShell.h | 21 --- >> > .../Include/Protocol/EfiShellDynamicCommand.h | 21 --- >> > .../Include/Protocol/EfiShellParameters.h | 20 -- >> > ShellPkg/Include/ShellBase.h | 20 -- >> > 4 files changed, 82 deletions(-) >> > delete mode 100644 ShellPkg/Include/Protocol/EfiShell.h >> > delete mode 100644 ShellPkg/Include/Protocol/EfiShellDynamicCommand.h >> > delete mode 100644 ShellPkg/Include/Protocol/EfiShellParameters.h >> > delete mode 100644 ShellPkg/Include/ShellBase.h >> > >> > diff --git a/ShellPkg/Include/Protocol/EfiShell.h >> b/ShellPkg/Include/Protocol/EfiShell.h >> > deleted file mode 100644 >> > index 8e3c2fe4de..00 >> > --- a/ShellPkg/Include/Protocol/EfiShell.h >> > +++ /dev/null >> > @@ -1,21 +0,0 @@ >> > -/** @file >> > - EFI Shell protocol as defined in the UEFI Shell 2.0 specification >> including errata. >> > - >> > - (C) Copyright 2014 Hewlett-Packard Development Company, L.P. >> > - Copyright (c) 2006 - 2016, Intel Corporation. All rights >> reserved. >> > - This program and the accompanying materials >> > - are licensed and made available under the terms and conditions of >> the BSD License >> > - which accompanies this distribution. The full text of the license >> may be found at >> > - http://opensource.org/licenses/bsd-license.php >> > - >> > - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, >> > - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR >> IMPLIED. >> > - >> > -**/ >> > - >> > -#ifndef __EFI_SHELL_PROTOCOL_H__WRAPPER__ >> > -#define __EFI_SHELL_PROTOCOL_H__WRAPPER__ >> > - >> > -#include >> > - >> > -#endif >> > diff --git a/ShellPkg/Include/Protocol/EfiShellDynamicCommand.h >> b/ShellPkg/Include/Protocol/EfiShellDynamicCommand.h >> > deleted file mode 100644 >> > index 50f9398ec6..00 >> > --- a/ShellPkg/Include/Protocol/EfiShellDynamicCommand.h >> > +++ /dev/null >> > @@ -1,21 +0,0 @@ >> > -/** @file >> > - EFI Shell Dynamic Command registration protocol >> > - >> > - (C) Copyright 2012-2014 Hewlett-Packard Development Company, L.P. >> > - Copyright (c) 2016, Intel Corporation. All rights reserved. >> > - This program and the accompanying materials >> > - are licensed and made available under the terms and conditions of >> the BSD License >> > - which accompanies this distribution. The full text of the license >> may be found at >> > - http://opensource.org/licenses/bsd-license.php >> > - >> > - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, >> > - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR >> IMPLIED. >> > - >> > -**/ >> > - >> > -#ifndef __EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_H__WRAPPER__ >> > -#define __EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_H__WRAPPER__ >> > - >> > -#include >> > - >> > -#endif >> > diff --git a/ShellPkg/Include/Protocol/EfiShellParameters.h >> b/ShellPkg/Include/Protocol/EfiShellParameters.h >> > deleted file mode 100644 >> > index 184b029ffa..00 >> > --- a/ShellPkg/Include/Protocol/EfiShellParameters.h >> > +++ /dev/null >> > @@ -1,20 +0,0 @@ >> > -/** @file >> > - EFI Shell protocol as defined in the UEFI Shell 2.0 specification. >> > - >> > - Copyright (c) 2006 - 2016, Intel Corporation. All rights >> reserved. >> > - This program and the accompanying materials >> > - are licensed and made available under the terms and conditions of >> the BSD License >> > - which accompanies this distribution. The full text of the license >> may be found at >> > - http://opensource.org/licenses/bsd-license.php >> > - >> > - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, >> > - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR >> IMPLIED. >> >
Re: [edk2] [platforms: PATCH 01/12] Marvell/Library: ArmadaSoCDescLib: Add GPIO information
Hi Leif, śr., 14 lis 2018 o 18:33 Leif Lindholm napisał(a): > > On Wed, Nov 14, 2018 at 07:05:01AM +0100, Marcin Wojtas wrote: > > > I think all of my comments on this patch can be summarised as "what is > > > an AP in this context"? > > > > > > The term either needs explicit documenting, or expansion in the macro > > > names such that documentation is not required. > > > > Isn't a glossary on top of this file: > > https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/blob/8ff9b13675a401588d3cc999aef9891838047b18/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h#L13 > > and C file: > > https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/blob/8ff9b13675a401588d3cc999aef9891838047b18/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c#L13 > > sufficient? > > I will confess I missed that. But that also clearly shows the problem. > > The glossary in is sufficient according to the coding style. > But it gets confusing, specifically for the abbreviation "AP", since > this has a specific (and different) meaning in PI. > Xenon is in, so we can focus on the GPIO ;) I will use AP806 in order to avoid confusion. Please don't mind my ignorance - what is the default 'AP' meaning? BoardDesc library patches will be affected when rebasing onto latest merged patches - should I resend v2 or wait for more remarks? Thanks, Marcin ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH v6 0/8] Armada7k8k Xenon driver rework
Thanks! Best regards, Marcin wt., 20 lis 2018 o 10:58 Ard Biesheuvel napisał(a): > > On Mon, 19 Nov 2018 at 07:54, Marcin Wojtas wrote: > > > > Hi, > > > > The sixth version of the patchset applies minor correction in the > > last patch and also simplifies the BoardDesc library callbacks. > > There is no unnecessary allocation now. > > > > Patches are available in the github: > > https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/xenon-upstream-r20181119 > > > > Generic driver patches with fixes and extended SdMmcOverride protocol: > > https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/sdmmc-override-upstream-r20181109 > > > > I'm looking forward to the comments and remarks. > > > > Best regards, > > Marcin > > > > Changelog: > > v5->v6: > > * 3,4,5 > > - pass the pointer to the static table directly instead of > > the copy allocation > > > > * 6/8 > > - remove freeing SdMmc board description structure in > > NonDiscoverableDevicesDxe, as from now on the static > > table will be used > > > > * 8/8 > > - change SdMmcOverride protocol comment to '#PRODUCES' > > - s/Controler/Controller/ > > - remove freeing board description structure > > > > v4->v5: > > * 1,2,6/8 > > - add Ard's RB > > > > * 2,3,4,5 > > - change parameters to OUT > > - assign count only after allocation is successful > > > > * 7/8 & 8/8 > > - split driver rework patches into two steps > > > > v3->v4: > > * 1/7: > > - add Ard's RB > > > > * 2/7: > > - use local enum definition for SlotType in order not to include > > MdeModulePkg > > private header > > > > * 7/7: > > - rework capability handling, without using the structure defined in the > > MdeModulePkg header > > > > v2->v3 > > * 1/7: > > - rename NotifyPhase parameter to PhaseData > > > > * 7/7: > > - rename NotifyPhase parameter to PhaseData > > - update UHS_MODE_SEL only for HS200/HS400 > > in XenonSdMmcHcUhsSignaling > > - use local macros for standard SDHC registers in order not to > > include private MdeModulePkg header > > > > v1 -> v2 > > * 1/7 and 7/7 - adjust to modified SdMmcOverride > > NotifyPhase and Capability routines > > > > > > Marcin Wojtas (2): > > Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride > > Marvell/Drivers: XenonDxe: Remove SdMmcPciHcDxe files > > > > Tomasz Michalec (6): > > Marvell/Library: ArmadaBoardDescLib: Extend SDMMC information > > SolidRun/Armada80x0McBin: Introduce board description library > > Marvell/Armada70x0Db: Introduce board description library > > Marvell/Armada80x0Db: Introduce board description library > > Marvell/Drivers: MvBoardDesc: Extend information for SdMmc > > Marvell/Drivers: XenonDxe: Switch to use generic SdMmcPciHcDxe > > > > For the series > > Reviewed-by: Ard Biesheuvel > > Pushed as ce4f7528ed71..1360ddbc30e2 > > Thanks for > > 32 files changed, 1691 insertions(+), 7384 deletions(-) > > > > > Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc > >|3 +- > > Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc > >|3 + > > Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc > >|3 + > > Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc > >|3 + > > Silicon/Marvell/Armada7k8k/Armada7k8k.fdf > >|3 +- > > > > Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf > >| 34 + > > > > Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf > >| 34 + > > > > Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf > > | 34 + > > Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf > >|1 + > > Silicon/Marvell/Drivers/SdMmc/XenonDxe/{SdMmcPciHcDxe.inf => XenonDxe.inf} > >| 33 +- > > Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.h > >| 791 > > Silicon/Mar
Re: [edk2] [PATCH v4 0/4] SdMmcOverride extension
wt., 20 lis 2018 o 06:59 Wu, Hao A napisał(a): > > > -Original Message- > > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > > Wu, Hao A > > Sent: Tuesday, November 13, 2018 4:29 PM > > To: Marcin Wojtas > > Cc: Tomasz Michalec; Grzegorz Jaszczyk; edk2-devel-01; Gao, Liming; > > nad...@marvell.com; Kinney, Michael D > > Subject: Re: [edk2] [PATCH v4 0/4] SdMmcOverride extension > > > > > -Original Message- > > > From: Marcin Wojtas [mailto:m...@semihalf.com] > > > Sent: Tuesday, November 13, 2018 4:25 PM > > > To: Wu, Hao A > > > Cc: edk2-devel-01; Leif Lindholm; Kinney, Michael D; Gao, Liming; Ard > > > Biesheuvel; nad...@marvell.com; j...@semihalf.com; Tomasz Michalec; > > > Grzegorz Jaszczyk > > > Subject: Re: [PATCH v4 0/4] SdMmcOverride extension > > > > > > Hi Hao, > > > > > > wt., 13 lis 2018 o 08:38 Wu, Hao A napisał(a): > > > > > > > > Hi Marcin, > > > > > > > > The code changes look good to me. > > > > > > > > Could you please grant me some time for some additional tests for these > > > > patches? > > > > > > Sure. > > > > > > > I will inform you with the results sometime next week. Thanks in > > > > advance. > > > > > > > > > > Ard gave his RB to 2/4 and 3/4. Moreover he pointed a typo in 3/4 > > > commit message - should I repost, or could those be included when > > > applying the patches (unless you don't request any code change, of > > > course)? > > > > If no other issues, I will help to address the typo issue in patch 3/4. > > > > A little concern on the commit author information if I modify the commit, > > but > > I will let you know if a repost from you is needed. > > > > Best Regards, > > Hao Wu > > For the series: > Reviewed-by: Hao Wu > > Pushed at 49c9953425..7f3b0bad4b > Thanks a lot! Marcin > > Best Regards, > Hao Wu > > > > > > > > > Best regards, > > > Marcin > > > > > > > Best Regards, > > > > Hao Wu > > > > > > > > > > > > > -Original Message- > > > > > From: Marcin Wojtas [mailto:m...@semihalf.com] > > > > > Sent: Saturday, November 10, 2018 7:01 AM > > > > > To: edk2-devel@lists.01.org > > > > > Cc: leif.lindh...@linaro.org; Wu, Hao A; Kinney, Michael D; Gao, > > > > > Liming; > > > > > ard.biesheu...@linaro.org; nad...@marvell.com; m...@semihalf.com; > > > > > j...@semihalf.com; t...@semihalf.com; j...@semihalf.com > > > > > Subject: [PATCH v4 0/4] SdMmcOverride extension > > > > > > > > > > Hi, > > > > > > > > > > Although I could've waited for Hao's remarks, I think it may > > > > > be better if he takes a look at much cleaner code, which > > > > > addresses v3 review comments. > > > > > The newest version of the patchset cleans-up significantly > > > > > patches 2&3 by removing code duplication and other minor > > > > > improvements. > > > > > > > > > > Patches are available in the github: > > > > > https://github.com/MarvellEmbeddedProcessors/edk2-open- > > > > > platform/commits/sdmmc-override-upstream-r20181109 > > > > > > > > > > Please note that extending SdMmcOverride protocol was impacting > > > > > so far the only user of it (Synquacer controller). In paralel > > > > > edk2-platforms patchset, a patch can be found: > > > > > ("Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride") > > > > > which adjust to the new API. > > > > > https://github.com/MarvellEmbeddedProcessors/edk2-open- > > > > > platform/commits/xenon-upstream-r20181109 > > > > > > > > > > I'm looking forward to the comments and remarks. > > > > > > > > > > Best regards, > > > > > Marcin > > > > > > > > > > Changelog: > > > > > v3->v4 > > > > > * 2/4: > > > > > - avoid duplication by calling SdMmcOverride callback in > > > > > SdMmcHcUhsSignaling > > > > > > > > > > * 3/4: > > > > > - avoid duplication by calling SdMmcOverride callback
[edk2] [platforms: PATCH v6 8/8] Marvell/Drivers: XenonDxe: Switch to use generic SdMmcPciHcDxe
From: Tomasz Michalec XenonDxe was copy of SdMmcPciHcDxe from edk2/MdeModulePkg. Now it implements SdMmcOverride protocol which allows to add quirks to the generic SdMmcPciHcDxe. Platforms that were using XenonDxe/SdMmcPciHcDxe have fixed *.fdf and *.dsc.inc files to use new implementation of XenonDxe. In the new version of the driver apart from using SdMmcOverride protocol, this patch utilizes newly added controllers' description in MvBoardDesc protocol, as well as improved PHY configuration sequence. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 2 + Silicon/Marvell/Armada7k8k/Armada7k8k.fdf | 2 + Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf | 55 +++ Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.h| 151 +++ Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.h | 53 +++ Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdhci.h | 131 +- Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.c| 321 +++ Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.c | 429 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdhci.c | 408 --- 9 files changed, 1399 insertions(+), 153 deletions(-) create mode 100644 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf create mode 100644 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.h create mode 100644 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.h create mode 100644 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.c create mode 100644 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.c diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc index 041fe90..14a1bda 100644 --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc @@ -509,6 +509,8 @@ # SD/MMC MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.inf MdeModulePkg/Bus/Sd/SdDxe/SdDxe.inf + MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.inf + Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf # Console packages MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.fdf b/Silicon/Marvell/Armada7k8k/Armada7k8k.fdf index 6ad7c87..e143517 100644 --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.fdf +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.fdf @@ -171,6 +171,8 @@ FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c # SD/MMC INF MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.inf INF MdeModulePkg/Bus/Sd/SdDxe/SdDxe.inf + INF MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.inf + INF Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf # Multiple Console IO support INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf diff --git a/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf b/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf new file mode 100644 index 000..00c738a --- /dev/null +++ b/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf @@ -0,0 +1,55 @@ +## @file +# SdMmcPciHcDxe driver is used to manage those host controllers which comply with SD +# Host Controller Simplified Specifiction version 3.0. +# +# It will produce EFI_SD_MMC_PASS_THRU_PROTOCOL to allow sending SD/MMC/eMMC cmds +# to specified devices from upper layer. +# +# Copyright (c) 2015, Intel Corporation. All rights reserved. +# Copyright (C) 2018, Marvell International Ltd. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +## + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = XenonDxe + FILE_GUID = 17f56b40-f7c1-435c-ab8d-404872da951e + MODULE_TYPE= UEFI_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= InitializeXenonDxe + +[Sources] + XenonPciHci.c + XenonPciHci.h + XenonSdhci.c + XenonSdhci.h + XenonSdMmcOverride.c + XenonSdMmcOverride.h + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + BaseLib + DebugLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + UefiRuntimeServicesTableLib + +[Protocols] + gEdkiiSdMmcOverrideProtocolGuid ## PRODUCES + gEdkiiNonDiscoverableDeviceProtocolGuid ## TO_START + gEfiPciIoProtocolGuid ## TO_START + gMarvellBoardDescPr
[edk2] [platforms: PATCH v6 6/8] Marvell/Drivers: MvBoardDesc: Extend information for SdMmc
From: Tomasz Michalec Extend MvBoardDescSdMmcGet function to fill MV_BOARD_SDMMC_DESC with Xenon specific info obtained from ArmadaBoardDescLib. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Ard Biesheuvel --- Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf| 1 + Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 24 +--- Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c | 1 - 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf index 41f72d6..0b93948 100644 --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf @@ -47,6 +47,7 @@ Silicon/Marvell/Marvell.dec [LibraryClasses] + ArmadaBoardDescLib ArmadaSoCDescLib DebugLib MemoryAllocationLib diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c index 39dc06c..f71bfc4 100644 --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c @@ -270,6 +270,7 @@ MvBoardDescSdMmcGet ( { UINT8 *SdMmcDeviceEnabled; UINTN SdMmcCount, SdMmcDeviceTableSize, SdMmcIndex, Index; + UINTN SdMmcDevCount; MV_BOARD_SDMMC_DESC *BoardDesc; MV_SOC_SDMMC_DESC *SoCDesc; EFI_STATUS Status; @@ -280,6 +281,13 @@ MvBoardDescSdMmcGet ( return Status; } + /* Get per-board configuration of the controllers */ + Status = ArmadaBoardDescSdMmcGet (, ); + if (EFI_ERROR (Status)) { +DEBUG ((DEBUG_ERROR, "%a: ArmadaBoardDescSdMmcGet filed\n", __FUNCTION__)); +return Status; + } + /* * Obtain table with enabled SDMMC controllers * which is represented as an array of UINT8 values @@ -294,18 +302,12 @@ MvBoardDescSdMmcGet ( SdMmcDeviceTableSize = PcdGetSize (PcdPciESdhci); /* Check if PCD with SDMMC controllers is correctly defined */ - if (SdMmcDeviceTableSize > SdMmcCount) { + if ((SdMmcDeviceTableSize > SdMmcCount) || + (SdMmcDeviceTableSize < SdMmcDevCount)) { DEBUG ((DEBUG_ERROR, "%a: Wrong PcdPciESdhci format\n", __FUNCTION__)); return EFI_INVALID_PARAMETER; } - /* Allocate and fill board description */ - BoardDesc = AllocateZeroPool (SdMmcDeviceTableSize * sizeof (MV_BOARD_SDMMC_DESC)); - if (BoardDesc == NULL) { -DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); -return EFI_OUT_OF_RESOURCES; - } - SdMmcIndex = 0; for (Index = 0; Index < SdMmcDeviceTableSize; Index++) { if (!SdMmcDeviceEnabled[Index]) { @@ -313,6 +315,12 @@ MvBoardDescSdMmcGet ( continue; } +if (SdMmcIndex >= SdMmcDevCount) { + DEBUG ((DEBUG_ERROR, +"%a: More enabled devices than returned by ArmadaBoardDescSdMmcGet\n", +__FUNCTION__)); + return EFI_INVALID_PARAMETER; +} BoardDesc[SdMmcIndex].SoC = [Index]; SdMmcIndex++; } diff --git a/Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c b/Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c index c5cf904..116e9d4 100644 --- a/Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c +++ b/Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c @@ -189,7 +189,6 @@ NonDiscoverableEntryPoint ( if (EFI_ERROR(Status)) { return Status; } - BoardDescProtocol->BoardDescFree (SdMmcBoardDesc); return EFI_SUCCESS; } -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v6 5/8] Marvell/Armada80x0Db: Introduce board description library
From: Tomasz Michalec This patch implements ArmadaBoarDescLib library for Armada8040 Development Board and add to it ArmadaBoardDescSdMmcGet function with description of connected Xenon host controllers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc | 3 + Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf | 34 +++ Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c | 60 3 files changed, 97 insertions(+) create mode 100644 Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf create mode 100644 Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc b/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc index 92e2dc8..42f7bd3 100644 --- a/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc +++ b/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc @@ -54,6 +54,9 @@ [Components.AARCH64] Silicon/Marvell/Armada7k8k/AcpiTables/Armada80x0Db.inf +[LibraryClasses.common] + ArmadaBoardDescLib|Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf + # # Pcd Section - list of all EDK II PCD Entries defined by this Platform diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf new file mode 100644 index 000..2d39d96 --- /dev/null +++ b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf @@ -0,0 +1,34 @@ +## @file +# +# Copyright (C) 2018, Marvell International Ltd. and its affiliates +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# +# +## + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = Armada80x0DbBoardDescLib + FILE_GUID = fee9e874-1481-4b4f-9882-966bd0d1310f + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmadaBoardDescLib + +[Sources] + Armada80x0DbBoardDescLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + IoLib diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c new file mode 100644 index 000..feb69ad --- /dev/null +++ b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c @@ -0,0 +1,60 @@ +/** +* +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include +#include + +// +// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib +// +STATIC +MV_BOARD_SDMMC_DESC mSdMmcDescTemplate[] = { + { /* eMMC 0xF06E */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +TRUE, /* Xenon1v8Enabled */ +TRUE, /* Xenon8BitBusEnabled */ +TRUE, /* XenonSlowModeEnabled */ +0x40, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + }, + { /* SD/MMC 0xF278 */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +FALSE, /* Xenon8BitBusEnabled */ +FALSE, /* XenonSlowModeEnabled */ +0x19, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + } +}; + +EFI_STATUS +EFIAPI +ArmadaBoardDescSdMmcGet ( + OUT UINTN *SdMmcDevCount, + OUT MV_BOARD_SDMMC_DESC **SdMmcDesc + ) +{ + *SdMmcDesc = mSdMmcDescTemplate; + *SdMmcDevCount = ARRAY_SIZE (mSdMmcDescTemplate); + + return EFI_SUCCESS; +} -- 2.7.4 ___ edk
[edk2] [platforms: PATCH v6 4/8] Marvell/Armada70x0Db: Introduce board description library
From: Tomasz Michalec This patch implements ArmadaBoarDescLib library for Armada7040 Development Board and add to it ArmadaBoardDescSdMmcGet function with description of connected Xenon host controllers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc | 3 + Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf | 34 +++ Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c | 60 3 files changed, 97 insertions(+) create mode 100644 Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf create mode 100644 Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc index e0bf447..a935f36 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc +++ b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc @@ -54,6 +54,9 @@ [Components.AARCH64] Silicon/Marvell/Armada7k8k/AcpiTables/Armada70x0Db.inf +[LibraryClasses.common] + ArmadaBoardDescLib|Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf + # # Pcd Section - list of all EDK II PCD Entries defined by this Platform diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf new file mode 100644 index 000..b26f55b --- /dev/null +++ b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf @@ -0,0 +1,34 @@ +## @file +# +# Copyright (C) 2018, Marvell International Ltd. and its affiliates +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# +# +## + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = Armada70x0DbBoardDescLib + FILE_GUID = 3164c8d9-19d4-4ad6-8196-cea094b1ddf1 + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmadaBoardDescLib + +[Sources] + Armada70x0DbBoardDescLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + IoLib diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c new file mode 100644 index 000..48c68e4 --- /dev/null +++ b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c @@ -0,0 +1,60 @@ +/** +* +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include +#include + +// +// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib +// +STATIC +MV_BOARD_SDMMC_DESC mSdMmcDescTemplate[] = { + { /* eMMC 0xF06E */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +FALSE, /* Xenon8BitBusEnabled */ +TRUE, /* XenonSlowModeEnabled */ +0x40, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + }, + { /* SD/MMC 0xF278 */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +FALSE, /* Xenon8BitBusEnabled */ +FALSE, /* XenonSlowModeEnabled */ +0x19, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + } +}; + +EFI_STATUS +EFIAPI +ArmadaBoardDescSdMmcGet ( + OUT UINTN *SdMmcDevCount, + OUT MV_BOARD_SDMMC_DESC **SdMmcDesc + ) +{ + *SdMmcDesc = mSdMmcDescTemplate; + *SdMmcDevCount = ARRAY_SIZE (mSdMmcDescTemplate); + + return EFI_SUCCESS; +} -- 2.7.4 ___ edk
[edk2] [platforms: PATCH v6 3/8] SolidRun/Armada80x0McBin: Introduce board description library
From: Tomasz Michalec This patch implements ArmadaBoarDescLib library for Armada80x0McBin comunity board and add to it ArmadaBoardDescSdMmcGet function with description of connected Xenon host controllers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc | 3 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf | 34 +++ Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c | 60 3 files changed, 97 insertions(+) create mode 100644 Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf create mode 100644 Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc index 52e2b9b..077224d 100644 --- a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc @@ -55,6 +55,9 @@ [Components.AARCH64] Silicon/Marvell/Armada7k8k/AcpiTables/Armada80x0McBin.inf +[LibraryClasses.common] + ArmadaBoardDescLib|Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf + # # Pcd Section - list of all EDK II PCD Entries defined by this Platform diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf new file mode 100644 index 000..63a4f66 --- /dev/null +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf @@ -0,0 +1,34 @@ +## @file +# +# Copyright (C) 2018, Marvell International Ltd. and its affiliates +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# +# +## + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = ArmadaMcBinBoardDescLib + FILE_GUID = 8208558f-5f33-46e2-b5c5-43354384389e + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmadaBoardDescLib + +[Sources] + Armada80x0McBinBoardDescLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + IoLib diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c new file mode 100644 index 000..d52adfc --- /dev/null +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c @@ -0,0 +1,60 @@ +/** +* +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include +#include + +// +// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib +// +STATIC +MV_BOARD_SDMMC_DESC mMcBinSdMmcDescTemplate[] = { + { /* eMMC 0xF06E */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +TRUE, /* Xenon8BitBusEnabled */ +TRUE, /* XenonSlowModeEnabled */ +0x40, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + }, + { /* SD/MMC 0xF278 */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +FALSE, /* Xenon8BitBusEnabled */ +FALSE, /* XenonSlowModeEnabled */ +0x19, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + } +}; + +EFI_STATUS +EFIAPI +ArmadaBoardDescSdMmcGet ( + OUT UINTN *SdMmcDevCount, + OUT MV_BOARD_SDMMC_DESC **SdMmcDesc + ) +{ + *SdMmcDesc = mMc
[edk2] [platforms: PATCH v6 2/8] Marvell/Library: ArmadaBoardDescLib: Extend SDMMC information
From: Tomasz Michalec Added fields specific for Xenon host controller and declaration of ArmadaBoardDescSdMmcGet function. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Ard Biesheuvel --- Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 21 +++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h index ee8e06e..3fe2988 100644 --- a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h +++ b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h @@ -55,11 +55,30 @@ typedef struct { // // SDMMC devices per-board description // +typedef enum { + RemovableSlot, + EmbeddedSlot, + SharedBusSlot, + UnknownSlot +} MV_SDMMC_SLOT_TYPE; + typedef struct { MV_SOC_SDMMC_DESC *SoC; - UINTN SdMmcDevCount; + UINTNSdMmcDevCount; + BOOLEAN Xenon1v8Enabled; + BOOLEAN Xenon8BitBusEnabled; + BOOLEAN XenonSlowModeEnabled; + UINT8XenonTuningStepDivisor; + MV_SDMMC_SLOT_TYPE SlotType; } MV_BOARD_SDMMC_DESC; +EFI_STATUS +EFIAPI +ArmadaBoardDescSdMmcGet ( + OUT UINTN *SdMmcDevCount, + OUT MV_BOARD_SDMMC_DESC **SdMmcDesc + ); + // // XHCI devices per-board description // -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v6 1/8] Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride
The newest changes in the SdMmcOverride protocol added additional arguments to the NotifyPhase and Capability routines. Update according places in the Synquacer Emmc driver. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c index e0987c9..47f5ccc 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c @@ -72,6 +72,8 @@ STATIC VOID *mEventRegistration; @param[in] ControllerHandle The EFI_HANDLE of the controller. @param[in] Slot The 0 based slot index. @param[in,out] SdMmcHcSlotCapability The SDHCI capability structure. + @param[in,out] BaseClkFreq The base clock frequency value that +optionally can be updated. @retval EFI_SUCCESS The override function completed successfully. @retval EFI_NOT_FOUND The specified controller or slot does not exist. @@ -84,7 +86,8 @@ EFIAPI SynQuacerSdMmcCapability ( IN EFI_HANDLE ControllerHandle, IN UINT8 Slot, - IN OUT VOID*SdMmcHcSlotCapability + IN OUT VOID*SdMmcHcSlotCapability, + IN OUT UINT32 *BaseClkFreq ) { UINT64 Capability; @@ -117,6 +120,7 @@ SynQuacerSdMmcCapability ( @param[in] PhaseType The type of operation and whether the hook is invoked right before (pre) or right after (post) + @param[in,out] PhaseData The pointer to a phase-specific data. @retval EFI_SUCCESS The override function completed successfully. @retval EFI_NOT_FOUND The specified controller or slot does not exist. @@ -129,7 +133,8 @@ EFIAPI SynQuacerSdMmcNotifyPhase ( IN EFI_HANDLE ControllerHandle, IN UINT8 Slot, - IN EDKII_SD_MMC_PHASE_TYPE PhaseType + IN EDKII_SD_MMC_PHASE_TYPE PhaseType, + IN OUT VOID *PhaseData ) { if (ControllerHandle != mSdMmcControllerHandle) { -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v6 0/8] Armada7k8k Xenon driver rework
Hi, The sixth version of the patchset applies minor correction in the last patch and also simplifies the BoardDesc library callbacks. There is no unnecessary allocation now. Patches are available in the github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/xenon-upstream-r20181119 Generic driver patches with fixes and extended SdMmcOverride protocol: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/sdmmc-override-upstream-r20181109 I'm looking forward to the comments and remarks. Best regards, Marcin Changelog: v5->v6: * 3,4,5 - pass the pointer to the static table directly instead of the copy allocation * 6/8 - remove freeing SdMmc board description structure in NonDiscoverableDevicesDxe, as from now on the static table will be used * 8/8 - change SdMmcOverride protocol comment to '#PRODUCES' - s/Controler/Controller/ - remove freeing board description structure v4->v5: * 1,2,6/8 - add Ard's RB * 2,3,4,5 - change parameters to OUT - assign count only after allocation is successful * 7/8 & 8/8 - split driver rework patches into two steps v3->v4: * 1/7: - add Ard's RB * 2/7: - use local enum definition for SlotType in order not to include MdeModulePkg private header * 7/7: - rework capability handling, without using the structure defined in the MdeModulePkg header v2->v3 * 1/7: - rename NotifyPhase parameter to PhaseData * 7/7: - rename NotifyPhase parameter to PhaseData - update UHS_MODE_SEL only for HS200/HS400 in XenonSdMmcHcUhsSignaling - use local macros for standard SDHC registers in order not to include private MdeModulePkg header v1 -> v2 * 1/7 and 7/7 - adjust to modified SdMmcOverride NotifyPhase and Capability routines Marcin Wojtas (2): Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride Marvell/Drivers: XenonDxe: Remove SdMmcPciHcDxe files Tomasz Michalec (6): Marvell/Library: ArmadaBoardDescLib: Extend SDMMC information SolidRun/Armada80x0McBin: Introduce board description library Marvell/Armada70x0Db: Introduce board description library Marvell/Armada80x0Db: Introduce board description library Marvell/Drivers: MvBoardDesc: Extend information for SdMmc Marvell/Drivers: XenonDxe: Switch to use generic SdMmcPciHcDxe Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc |3 +- Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc |3 + Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc |3 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc |3 + Silicon/Marvell/Armada7k8k/Armada7k8k.fdf |3 +- Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf | 34 + Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf | 34 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf | 34 + Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf |1 + Silicon/Marvell/Drivers/SdMmc/XenonDxe/{SdMmcPciHcDxe.inf => XenonDxe.inf} | 33 +- Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.h | 791 Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHci.h | 550 -- Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.h | 151 ++ Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.h | 53 + Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdhci.h | 131 +- Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 21 +- Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c | 60 + Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c | 60 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c | 60 + Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 24 +- Silicon/Marvell/Drivers/NonDiscoverableDxe/NonDiscoverableDxe.c |1 - Silicon/Marvell/Drivers/SdMmc/XenonDxe/ComponentName.c | 211 --- Silicon/Marvell/Drivers/SdMmc/XenonDxe/EmmcDevice.c | 1164 Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdDevice.c | 1190 Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.c
Re: [edk2] [platforms: PATCH v5 8/8] Marvell/Drivers: XenonDxe: Switch to use generic SdMmcPciHcDxe
Hi Ard, > > +**/ > > +EFI_STATUS > > +EFIAPI > > +XenonHcRwMmio ( > > + IN EFI_PCI_IO_PROTOCOL *PciIo, > > + IN UINT8 BarIndex, > > + IN UINT32Offset, > > + IN BOOLEAN Read, > > + IN UINT8 Count, > > + IN OUT VOID *Data > > + ) > > +{ > > + EFI_STATUS Status; > > + > > + if ((PciIo == NULL) || (Data == NULL)) { > > +return EFI_INVALID_PARAMETER; > > + } > > + > > + if ((Count != 1) && (Count != 2) && (Count != 4) && (Count != 8)) { > > +return EFI_INVALID_PARAMETER; > > + } > > + > > + if (Read) { > > +Status = PciIo->Mem.Read ( > > + PciIo, > > + EfiPciIoWidthUint8, > > + BarIndex, > > + (UINT64) Offset, > > + Count, > > + Data > > + ); > > + } else { > > +Status = PciIo->Mem.Write ( > > + PciIo, > > + EfiPciIoWidthUint8, > > + BarIndex, > > + (UINT64) Offset, > > + Count, > > + Data > > + ); > > + } > > + > > I guess this is an issue that existed before in the code, but it looks > like you are only doing byte for byte reads and writes here. Is that > intentional? > XenonHcRwMmio is 1:1 to generic MdeModulePkg's SdMmcHcRwMmio, as well as all other SdMmc mmio accessors. I really prefer not to modify any of them and keep the code aligned as-is. Best regards, Marcin > > + return Status; > > +} > > + > > +/** > > + Do OR operation with the value of the specified SD/MMC host controller > > mmio register. > > + > > + @param[in] PciIo The PCI IO protocol instance. > > + @param[in] BarIndex The BAR index of the standard PCI > > Configuration > > + header to use as the base address for the > > memory > > + operation to perform. > > + @param[in] OffsetThe offset within the selected BAR to start > > the > > + memory operation. > > + @param[in] Count The width of the mmio register in bytes. > > + Must be 1, 2 , 4 or 8 bytes. > > + @param[in] OrDataThe pointer to the data used to do OR > > operation. > > + The caller is responsible for having > > ownership of > > + the data buffer and ensuring its size not > > less than > > + Count bytes. > > + > > + @retval EFI_INVALID_PARAMETER The PciIo or OrData is NULL or the Count > > is not valid. > > + @retval EFI_SUCCESS The OR operation succeeds. > > + @retval OthersThe OR operation fails. > > + > > +**/ > > +EFI_STATUS > > +EFIAPI > > +XenonHcOrMmio ( > > + IN EFI_PCI_IO_PROTOCOL *PciIo, > > + IN UINT8BarIndex, > > + IN UINT32 Offset, > > + IN UINT8Count, > > + IN VOID *OrData > > + ) > > +{ > > + EFI_STATUS Status; > > + UINT64 Data; > > + UINT64 Or; > > + > > + Status = XenonHcRwMmio (PciIo, BarIndex, Offset, TRUE, Count, ); > > + if (EFI_ERROR (Status)) { > > +return Status; > > + } > > + > > + if (Count == 1) { > > +Or = *(UINT8*) OrData; > > + } else if (Count == 2) { > > +Or = *(UINT16*) OrData; > > + } else if (Count == 4) { > > +Or = *(UINT32*) OrData; > > + } else if (Count == 8) { > > +Or = *(UINT64*) OrData; > > + } else { > > +return EFI_INVALID_PARAMETER; > > + } > > + > > + Data |= Or; > > + Status = XenonHcRwMmio (PciIo, BarIndex, Offset, FALSE, Count, ); > > + > > + return Status; > > +} > > + > > +/** > > + Do AND operation with the value of the specified SD/MMC host controller > > mmio register. > > + > > + @param[in] PciIo The PCI IO protocol instance. > > + @param[in] BarIndex The BAR index of the standard PCI > > Configuration > > + header to use as the base address for the > > memory > > + operation to perform. > > + @param[in] OffsetThe offset within the selected BAR to start > > the > > + memory operation. > > + @param[in] Count The width of the mmio register in bytes. > > + Must be 1, 2 , 4 or 8 bytes. > > + @param[in] AndData The pointer to the data used to do AND > > operation. > > + The caller is responsible for having > > ownership of > > + the data buffer and ensuring its size not > > less than > > +
Re: [edk2] [platforms: PATCH 02/12] Marvell/Library: ArmadaBoardDescLib: Add GPIO information
Hi Leif, śr., 14 lis 2018 o 02:12 Leif Lindholm napisał(a): > > On Sat, Oct 20, 2018 at 03:57:31AM +0200, Marcin Wojtas wrote: > > This patch extends library with GPIO devices per-board > > description. Both embedded SoC controllers and > > I2C IO expanders are supported. Add a helper routine > > for obtaining information about the latter. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 23 > > > > 1 file changed, 23 insertions(+) > > > > diff --git a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h > > b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h > > index ee8e06e..109164c 100644 > > --- a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h > > +++ b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h > > @@ -25,6 +25,29 @@ typedef struct { > > } MV_BOARD_COMPHY_DESC; > > > > // > > +// GPIO devices per-board description > > +// > > +typedef struct { > > + UINTN ChipId; > > + UINTN I2cAddress; > > + UINTN I2cBus; > > +} MV_I2C_IO_EXPANDER_DESC; > > + > > +typedef struct { > > + MV_SOC_GPIO_DESC*SoC; > > + UINTNGpioDevCount; > > + MV_I2C_IO_EXPANDER_DESC *I2cIoExpanderDesc; > > + UINTNI2cIoExpanderCount; > > +} MV_BOARD_GPIO_DESC; > > + > > +EFI_STATUS > > +EFIAPI > > +ArmadaBoardDescGpioGet ( > > + IN OUT MV_I2C_IO_EXPANDER_DESC **I2cIoExpanderDesc, > > + IN OUT UINTN*I2cIoExpanderCount > > Please expand all DESC/Desc to descriptor/description/whatever as > appropriate. Just to confirm - until now in every case there was an abbreviation used (in SoCDescLib, structures names, etc.). It may look somewhat inconsistently, but of course I can change according to your wish. Please let know your thoughts on that. Thanks, Marcin > With that, Reviewed-by: Leif Lindholm > > > + ); > > + > > +// > > // I2C devices per-board description > > // > > typedef struct { > > -- > > 2.7.4 > > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH 01/12] Marvell/Library: ArmadaSoCDescLib: Add GPIO information
Hi Leif, śr., 14 lis 2018 o 02:10 Leif Lindholm napisał(a): > > On Sat, Oct 20, 2018 at 03:57:30AM +0200, Marcin Wojtas wrote: > > This patch introduces new library callback (ArmadaSoCDescGpioGet ()), > > which dynamically allocates and fills MV_SOC_GPIO_DESC structure with > > the SoC description of GPIO controllers. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Marcin Wojtas > > --- > > > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h > > | 10 + > > Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h > > | 15 > > > > Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c > > | 39 > > 3 files changed, 64 insertions(+) > > > > diff --git > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h > > > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h > > index c14b985..85dd67c 100644 > > --- > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h > > +++ > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h > > @@ -22,6 +22,7 @@ > > // Common macros > > // > > #define MV_SOC_CP_BASE(Cp) (0xF200 + ((Cp) * 0x200)) > > +#define MV_SOC_AP_COUNT 1 > > I think all of my comments on this patch can be summarised as "what is > an AP in this context"? > > The term either needs explicit documenting, or expansion in the macro > names such that documentation is not required. Isn't a glossary on top of this file: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/blob/8ff9b13675a401588d3cc999aef9891838047b18/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.h#L13 and C file: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/blob/8ff9b13675a401588d3cc999aef9891838047b18/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c#L13 sufficient? Thanks, Marcin > > > > > // > > // Platform description of AHCI controllers > > @@ -38,6 +39,15 @@ > > #define MV_SOC_COMPHY_MUX_BITS 4 > > > > // > > +// Platform description of GPIO controllers > > +// > > +#define MV_SOC_AP_GPIO_BASE 0xF06F5040 > > +#define MV_SOC_AP_GPIO_PIN_COUNT 20 > > +#define MV_SOC_GPIO_PER_CP_COUNT 2 > > +#define MV_SOC_CP_GPIO_BASE(Gpio)(0x440100 + ((Gpio) * 0x40)) > > +#define MV_SOC_CP_GPIO_PIN_COUNT(Gpio) ((Gpio) == 0 ? 32 : 31) > > + > > +// > > // Platform description of I2C controllers > > // > > #define MV_SOC_I2C_PER_CP_COUNT 2 > > diff --git a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h > > b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h > > index cdfb51b..f3d4f80 100644 > > --- a/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h > > +++ b/Silicon/Marvell/Include/Library/ArmadaSoCDescLib.h > > @@ -46,6 +46,21 @@ ArmadaSoCDescCpBaseGet ( > >); > > > > // > > +// GPIO devices description template definition > > +// > > +typedef struct { > > + UINTN GpioBaseAddress; > > + UINTN GpioPinCount; > > +} MV_SOC_GPIO_DESC; > > + > > +EFI_STATUS > > +EFIAPI > > +ArmadaSoCDescGpioGet ( > > + IN OUT MV_SOC_GPIO_DESC **GpioDesc, > > + IN OUT UINTN *DescCount > > + ); > > + > > +// > > // I2C > > // > > typedef struct { > > diff --git > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c > > > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c > > index 6902fda..7db4ec7 100644 > > --- > > a/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c > > +++ > > b/Silicon/Marvell/Armada7k8k/Library/Armada7k8kSoCDescLib/Armada7k8kSoCDescLib.c > > @@ -74,6 +74,45 @@ ArmadaSoCDescCpBaseGet ( > > > > EFI_STATUS > > EFIAPI > > +ArmadaSoCDescGpioGet ( > > + IN OUT MV_SOC_GPIO_DESC **GpioDesc, > > + IN OUT UINTN *DescCount > > + ) > > +{ > > + MV_SOC_GPIO_DESC *Desc; > > + UINTN CpCount, CpIndex, Index; > > + > > + CpCount = FixedPcdGet8 (PcdMaxCpCount); > > + > > + *DescCount = CpCount * MV_SOC_GPIO_PER_CP_COUNT + MV_SOC_AP_COUNT; > > + Desc = AllocateZeroPool (*DescCount * sizeof (MV_SOC_GPIO_DESC));
[edk2] [platforms: PATCH v5 8/8] Marvell/Drivers: XenonDxe: Switch to use generic SdMmcPciHcDxe
From: Tomasz Michalec XenonDxe was copy of SdMmcPciHcDxe from edk2/MdeModulePkg. Now it implements SdMmcOverride protocol which allows to add quirks to the generic SdMmcPciHcDxe. Platforms that were using XenonDxe/SdMmcPciHcDxe have fixed *.fdf and *.dsc.inc files to use new implementation of XenonDxe. In the new version of the driver apart from using SdMmcOverride protocol, this patch utilizes newly added controllers' description in MvBoardDesc protocol, as well as improved PHY configuration sequence. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 2 + Silicon/Marvell/Armada7k8k/Armada7k8k.fdf | 2 + Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf | 55 +++ Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.h| 151 +++ Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.h | 53 +++ Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdhci.h | 131 +- Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.c| 321 +++ Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.c | 432 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdhci.c | 408 -- 9 files changed, 1402 insertions(+), 153 deletions(-) create mode 100644 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf create mode 100644 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.h create mode 100644 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.h create mode 100644 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.c create mode 100644 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.c diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc index 041fe90..14a1bda 100644 --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc @@ -509,6 +509,8 @@ # SD/MMC MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.inf MdeModulePkg/Bus/Sd/SdDxe/SdDxe.inf + MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.inf + Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf # Console packages MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.fdf b/Silicon/Marvell/Armada7k8k/Armada7k8k.fdf index 6ad7c87..e143517 100644 --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.fdf +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.fdf @@ -171,6 +171,8 @@ FvNameGuid = 5eda4200-2c5f-43cb-9da3-0baf74b1b30c # SD/MMC INF MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.inf INF MdeModulePkg/Bus/Sd/SdDxe/SdDxe.inf + INF MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.inf + INF Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf # Multiple Console IO support INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf diff --git a/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf b/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf new file mode 100644 index 000..f966e5f --- /dev/null +++ b/Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonDxe.inf @@ -0,0 +1,55 @@ +## @file +# SdMmcPciHcDxe driver is used to manage those host controllers which comply with SD +# Host Controller Simplified Specifiction version 3.0. +# +# It will produce EFI_SD_MMC_PASS_THRU_PROTOCOL to allow sending SD/MMC/eMMC cmds +# to specified devices from upper layer. +# +# Copyright (c) 2015, Intel Corporation. All rights reserved. +# Copyright (C) 2018, Marvell International Ltd. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +## + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = XenonDxe + FILE_GUID = 17f56b40-f7c1-435c-ab8d-404872da951e + MODULE_TYPE= UEFI_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= InitializeXenonDxe + +[Sources] + XenonPciHci.c + XenonPciHci.h + XenonSdhci.c + XenonSdhci.h + XenonSdMmcOverride.c + XenonSdMmcOverride.h + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + BaseLib + DebugLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + UefiRuntimeServicesTableLib + +[Protocols] + gEdkiiSdMmcOverrideProtocolGuid ## BY_START + gEdkiiNonDiscoverableDeviceProtocolGuid ## TO_START + gEfiPciIoProtocolGuid ## TO_START + gMarvellBoardDescPr
[edk2] [platforms: PATCH v5 6/8] Marvell/Drivers: MvBoardDesc: Extend information for SdMmc
From: Tomasz Michalec Extend MvBoardDescSdMmcGet function to fill MV_BOARD_SDMMC_DESC with Xenon specific info obtained from ArmadaBoardDescLib. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Ard Biesheuvel --- Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf | 1 + Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 24 +--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf index 41f72d6..0b93948 100644 --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf @@ -47,6 +47,7 @@ Silicon/Marvell/Marvell.dec [LibraryClasses] + ArmadaBoardDescLib ArmadaSoCDescLib DebugLib MemoryAllocationLib diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c index 39dc06c..f71bfc4 100644 --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c @@ -270,6 +270,7 @@ MvBoardDescSdMmcGet ( { UINT8 *SdMmcDeviceEnabled; UINTN SdMmcCount, SdMmcDeviceTableSize, SdMmcIndex, Index; + UINTN SdMmcDevCount; MV_BOARD_SDMMC_DESC *BoardDesc; MV_SOC_SDMMC_DESC *SoCDesc; EFI_STATUS Status; @@ -280,6 +281,13 @@ MvBoardDescSdMmcGet ( return Status; } + /* Get per-board configuration of the controllers */ + Status = ArmadaBoardDescSdMmcGet (, ); + if (EFI_ERROR (Status)) { +DEBUG ((DEBUG_ERROR, "%a: ArmadaBoardDescSdMmcGet filed\n", __FUNCTION__)); +return Status; + } + /* * Obtain table with enabled SDMMC controllers * which is represented as an array of UINT8 values @@ -294,18 +302,12 @@ MvBoardDescSdMmcGet ( SdMmcDeviceTableSize = PcdGetSize (PcdPciESdhci); /* Check if PCD with SDMMC controllers is correctly defined */ - if (SdMmcDeviceTableSize > SdMmcCount) { + if ((SdMmcDeviceTableSize > SdMmcCount) || + (SdMmcDeviceTableSize < SdMmcDevCount)) { DEBUG ((DEBUG_ERROR, "%a: Wrong PcdPciESdhci format\n", __FUNCTION__)); return EFI_INVALID_PARAMETER; } - /* Allocate and fill board description */ - BoardDesc = AllocateZeroPool (SdMmcDeviceTableSize * sizeof (MV_BOARD_SDMMC_DESC)); - if (BoardDesc == NULL) { -DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); -return EFI_OUT_OF_RESOURCES; - } - SdMmcIndex = 0; for (Index = 0; Index < SdMmcDeviceTableSize; Index++) { if (!SdMmcDeviceEnabled[Index]) { @@ -313,6 +315,12 @@ MvBoardDescSdMmcGet ( continue; } +if (SdMmcIndex >= SdMmcDevCount) { + DEBUG ((DEBUG_ERROR, +"%a: More enabled devices than returned by ArmadaBoardDescSdMmcGet\n", +__FUNCTION__)); + return EFI_INVALID_PARAMETER; +} BoardDesc[SdMmcIndex].SoC = [Index]; SdMmcIndex++; } -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v5 5/8] Marvell/Armada80x0Db: Introduce board description library
From: Tomasz Michalec This patch implements ArmadaBoarDescLib library for Armada8040 Development Board and add to it ArmadaBoardDescSdMmcGet function with description of connected Xenon host controllers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc | 3 + Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf | 34 ++ Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c | 66 3 files changed, 103 insertions(+) create mode 100644 Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf create mode 100644 Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc b/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc index 92e2dc8..42f7bd3 100644 --- a/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc +++ b/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc @@ -54,6 +54,9 @@ [Components.AARCH64] Silicon/Marvell/Armada7k8k/AcpiTables/Armada80x0Db.inf +[LibraryClasses.common] + ArmadaBoardDescLib|Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf + # # Pcd Section - list of all EDK II PCD Entries defined by this Platform diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf new file mode 100644 index 000..2d39d96 --- /dev/null +++ b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf @@ -0,0 +1,34 @@ +## @file +# +# Copyright (C) 2018, Marvell International Ltd. and its affiliates +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# +# +## + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = Armada80x0DbBoardDescLib + FILE_GUID = fee9e874-1481-4b4f-9882-966bd0d1310f + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmadaBoardDescLib + +[Sources] + Armada80x0DbBoardDescLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + IoLib diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c new file mode 100644 index 000..3b69c6b --- /dev/null +++ b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c @@ -0,0 +1,66 @@ +/** +* +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include +#include + +// +// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib +// +STATIC +MV_BOARD_SDMMC_DESC mSdMmcDescTemplate[] = { + { /* eMMC 0xF06E */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +TRUE, /* Xenon1v8Enabled */ +TRUE, /* Xenon8BitBusEnabled */ +TRUE, /* XenonSlowModeEnabled */ +0x40, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + }, + { /* SD/MMC 0xF278 */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +FALSE, /* Xenon8BitBusEnabled */ +FALSE, /* XenonSlowModeEnabled */ +0x19, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + } +}; + +EFI_STATUS +EFIAPI +ArmadaBoardDescSdMmcGet ( + OUT UINTN *SdMmcDevCount, + OUT MV_BOARD_SDMMC_DESC **SdMmcDesc + ) +{ + *SdMmcDesc = AllocateCopyPool (sizeof (mSdMmcDescTemplate), + ); + if (*SdMmcDesc == NULL) { +DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n"
[edk2] [platforms: PATCH v5 4/8] Marvell/Armada70x0Db: Introduce board description library
From: Tomasz Michalec This patch implements ArmadaBoarDescLib library for Armada7040 Development Board and add to it ArmadaBoardDescSdMmcGet function with description of connected Xenon host controllers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc | 3 + Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf | 34 ++ Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c | 66 3 files changed, 103 insertions(+) create mode 100644 Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf create mode 100644 Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc index e0bf447..a935f36 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc +++ b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc @@ -54,6 +54,9 @@ [Components.AARCH64] Silicon/Marvell/Armada7k8k/AcpiTables/Armada70x0Db.inf +[LibraryClasses.common] + ArmadaBoardDescLib|Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf + # # Pcd Section - list of all EDK II PCD Entries defined by this Platform diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf new file mode 100644 index 000..b26f55b --- /dev/null +++ b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf @@ -0,0 +1,34 @@ +## @file +# +# Copyright (C) 2018, Marvell International Ltd. and its affiliates +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# +# +## + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = Armada70x0DbBoardDescLib + FILE_GUID = 3164c8d9-19d4-4ad6-8196-cea094b1ddf1 + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmadaBoardDescLib + +[Sources] + Armada70x0DbBoardDescLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + IoLib diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c new file mode 100644 index 000..66e2f07 --- /dev/null +++ b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c @@ -0,0 +1,66 @@ +/** +* +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include +#include + +// +// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib +// +STATIC +MV_BOARD_SDMMC_DESC mSdMmcDescTemplate[] = { + { /* eMMC 0xF06E */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +FALSE, /* Xenon8BitBusEnabled */ +TRUE, /* XenonSlowModeEnabled */ +0x40, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + }, + { /* SD/MMC 0xF278 */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +FALSE, /* Xenon8BitBusEnabled */ +FALSE, /* XenonSlowModeEnabled */ +0x19, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + } +}; + +EFI_STATUS +EFIAPI +ArmadaBoardDescSdMmcGet ( + OUT UINTN *SdMmcDevCount, + OUT MV_BOARD_SDMMC_DESC **SdMmcDesc + ) +{ + *SdMmcDesc = AllocateCopyPool (sizeof (mSdMmcDescTemplate), + ); + if (*SdMmcDesc == NULL) { +DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n"
[edk2] [platforms: PATCH v5 3/8] SolidRun/Armada80x0McBin: Introduce board description library
From: Tomasz Michalec This patch implements ArmadaBoarDescLib library for Armada80x0McBin comunity board and add to it ArmadaBoardDescSdMmcGet function with description of connected Xenon host controllers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc | 3 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf | 34 ++ Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c | 66 3 files changed, 103 insertions(+) create mode 100644 Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf create mode 100644 Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc index 52e2b9b..077224d 100644 --- a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc @@ -55,6 +55,9 @@ [Components.AARCH64] Silicon/Marvell/Armada7k8k/AcpiTables/Armada80x0McBin.inf +[LibraryClasses.common] + ArmadaBoardDescLib|Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf + # # Pcd Section - list of all EDK II PCD Entries defined by this Platform diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf new file mode 100644 index 000..63a4f66 --- /dev/null +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf @@ -0,0 +1,34 @@ +## @file +# +# Copyright (C) 2018, Marvell International Ltd. and its affiliates +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# +# +## + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = ArmadaMcBinBoardDescLib + FILE_GUID = 8208558f-5f33-46e2-b5c5-43354384389e + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmadaBoardDescLib + +[Sources] + Armada80x0McBinBoardDescLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + IoLib diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c new file mode 100644 index 000..1be4c6d --- /dev/null +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c @@ -0,0 +1,66 @@ +/** +* +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include +#include + +// +// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib +// +STATIC +MV_BOARD_SDMMC_DESC mMcBinSdMmcDescTemplate[] = { + { /* eMMC 0xF06E */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +TRUE, /* Xenon8BitBusEnabled */ +TRUE, /* XenonSlowModeEnabled */ +0x40, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + }, + { /* SD/MMC 0xF278 */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +FALSE, /* Xenon8BitBusEnabled */ +FALSE, /* XenonSlowModeEnabled */ +0x19, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + } +}; + +EFI_STATUS +EFIAPI +ArmadaBoardDescSdMmcGet ( + OUT UINTN *SdMmcDevCount, + OUT MV_BOARD_SDMMC_DESC **SdMmcDesc + ) +{ + *SdMmcDesc = Allo
[edk2] [platforms: PATCH v5 2/8] Marvell/Library: ArmadaBoardDescLib: Extend SDMMC information
From: Tomasz Michalec Added fields specific for Xenon host controller and declaration of ArmadaBoardDescSdMmcGet function. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Ard Biesheuvel --- Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 21 +++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h index ee8e06e..3fe2988 100644 --- a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h +++ b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h @@ -55,11 +55,30 @@ typedef struct { // // SDMMC devices per-board description // +typedef enum { + RemovableSlot, + EmbeddedSlot, + SharedBusSlot, + UnknownSlot +} MV_SDMMC_SLOT_TYPE; + typedef struct { MV_SOC_SDMMC_DESC *SoC; - UINTN SdMmcDevCount; + UINTNSdMmcDevCount; + BOOLEAN Xenon1v8Enabled; + BOOLEAN Xenon8BitBusEnabled; + BOOLEAN XenonSlowModeEnabled; + UINT8XenonTuningStepDivisor; + MV_SDMMC_SLOT_TYPE SlotType; } MV_BOARD_SDMMC_DESC; +EFI_STATUS +EFIAPI +ArmadaBoardDescSdMmcGet ( + OUT UINTN *SdMmcDevCount, + OUT MV_BOARD_SDMMC_DESC **SdMmcDesc + ); + // // XHCI devices per-board description // -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v5 1/8] Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride
The newest changes in the SdMmcOverride protocol added additional arguments to the NotifyPhase and Capability routines. Update according places in the Synquacer Emmc driver. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c index e0987c9..47f5ccc 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c @@ -72,6 +72,8 @@ STATIC VOID *mEventRegistration; @param[in] ControllerHandle The EFI_HANDLE of the controller. @param[in] Slot The 0 based slot index. @param[in,out] SdMmcHcSlotCapability The SDHCI capability structure. + @param[in,out] BaseClkFreq The base clock frequency value that +optionally can be updated. @retval EFI_SUCCESS The override function completed successfully. @retval EFI_NOT_FOUND The specified controller or slot does not exist. @@ -84,7 +86,8 @@ EFIAPI SynQuacerSdMmcCapability ( IN EFI_HANDLE ControllerHandle, IN UINT8 Slot, - IN OUT VOID*SdMmcHcSlotCapability + IN OUT VOID*SdMmcHcSlotCapability, + IN OUT UINT32 *BaseClkFreq ) { UINT64 Capability; @@ -117,6 +120,7 @@ SynQuacerSdMmcCapability ( @param[in] PhaseType The type of operation and whether the hook is invoked right before (pre) or right after (post) + @param[in,out] PhaseData The pointer to a phase-specific data. @retval EFI_SUCCESS The override function completed successfully. @retval EFI_NOT_FOUND The specified controller or slot does not exist. @@ -129,7 +133,8 @@ EFIAPI SynQuacerSdMmcNotifyPhase ( IN EFI_HANDLE ControllerHandle, IN UINT8 Slot, - IN EDKII_SD_MMC_PHASE_TYPE PhaseType + IN EDKII_SD_MMC_PHASE_TYPE PhaseType, + IN OUT VOID *PhaseData ) { if (ControllerHandle != mSdMmcControllerHandle) { -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v5 0/8] Armada7k8k Xenon driver rework
Hi, The fifth version of the patchset splits last commit to two parts (removal of old files and rework). It also applies correction to the BoardDesc library callbacks. Patches are available in the github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/xenon-upstream-r20181113 Generic driver patches with fixes and extended SdMmcOverride protocol: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/sdmmc-override-upstream-r20181109 I'm looking forward to the comments and remarks. Best regards, Marcin Changelog: v4->v5: * 1,2,6/8 - add Ard's RB * 2,3,4,5 - change parameters to OUT - assign count only after allocation is successful * 7/8 & 8/8 - split driver rework patches into two steps v3->v4: * 1/7: - add Ard's RB * 2/7: - use local enum definition for SlotType in order not to include MdeModulePkg private header * 7/7: - rework capability handling, without using the structure defined in the MdeModulePkg header v2->v3 * 1/7: - rename NotifyPhase parameter to PhaseData * 7/7: - rename NotifyPhase parameter to PhaseData - update UHS_MODE_SEL only for HS200/HS400 in XenonSdMmcHcUhsSignaling - use local macros for standard SDHC registers in order not to include private MdeModulePkg header v1 -> v2 * 1/7 and 7/7 - adjust to modified SdMmcOverride NotifyPhase and Capability routines Marcin Wojtas (2): Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride Marvell/Drivers: XenonDxe: Remove SdMmcPciHcDxe files Tomasz Michalec (6): Marvell/Library: ArmadaBoardDescLib: Extend SDMMC information SolidRun/Armada80x0McBin: Introduce board description library Marvell/Armada70x0Db: Introduce board description library Marvell/Armada80x0Db: Introduce board description library Marvell/Drivers: MvBoardDesc: Extend information for SdMmc Marvell/Drivers: XenonDxe: Switch to use generic SdMmcPciHcDxe Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc |3 +- Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc |3 + Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc |3 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc |3 + Silicon/Marvell/Armada7k8k/Armada7k8k.fdf |3 +- Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf | 34 + Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf | 34 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf | 34 + Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf |1 + Silicon/Marvell/Drivers/SdMmc/XenonDxe/{SdMmcPciHcDxe.inf => XenonDxe.inf} | 33 +- Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.h | 791 Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHci.h | 550 -- Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.h | 151 ++ Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.h | 53 + Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdhci.h | 131 +- Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 21 +- Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c | 66 + Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c | 66 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c | 66 + Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 24 +- Silicon/Marvell/Drivers/SdMmc/XenonDxe/ComponentName.c | 211 --- Silicon/Marvell/Drivers/SdMmc/XenonDxe/EmmcDevice.c | 1164 Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdDevice.c | 1190 Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.c | 1320 -- Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHci.c | 1928 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.c | 321 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.c | 432 + Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdhci.c | 408 +++-- Silicon/
Re: [edk2] [PATCH v4 0/4] SdMmcOverride extension
Hi Hao, wt., 13 lis 2018 o 08:38 Wu, Hao A napisał(a): > > Hi Marcin, > > The code changes look good to me. > > Could you please grant me some time for some additional tests for these > patches? Sure. > I will inform you with the results sometime next week. Thanks in advance. > Ard gave his RB to 2/4 and 3/4. Moreover he pointed a typo in 3/4 commit message - should I repost, or could those be included when applying the patches (unless you don't request any code change, of course)? Best regards, Marcin > Best Regards, > Hao Wu > > > > -Original Message- > > From: Marcin Wojtas [mailto:m...@semihalf.com] > > Sent: Saturday, November 10, 2018 7:01 AM > > To: edk2-devel@lists.01.org > > Cc: leif.lindh...@linaro.org; Wu, Hao A; Kinney, Michael D; Gao, Liming; > > ard.biesheu...@linaro.org; nad...@marvell.com; m...@semihalf.com; > > j...@semihalf.com; t...@semihalf.com; j...@semihalf.com > > Subject: [PATCH v4 0/4] SdMmcOverride extension > > > > Hi, > > > > Although I could've waited for Hao's remarks, I think it may > > be better if he takes a look at much cleaner code, which > > addresses v3 review comments. > > The newest version of the patchset cleans-up significantly > > patches 2&3 by removing code duplication and other minor > > improvements. > > > > Patches are available in the github: > > https://github.com/MarvellEmbeddedProcessors/edk2-open- > > platform/commits/sdmmc-override-upstream-r20181109 > > > > Please note that extending SdMmcOverride protocol was impacting > > so far the only user of it (Synquacer controller). In paralel > > edk2-platforms patchset, a patch can be found: > > ("Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride") > > which adjust to the new API. > > https://github.com/MarvellEmbeddedProcessors/edk2-open- > > platform/commits/xenon-upstream-r20181109 > > > > I'm looking forward to the comments and remarks. > > > > Best regards, > > Marcin > > > > Changelog: > > v3->v4 > > * 2/4: > > - avoid duplication by calling SdMmcOverride callback in > > SdMmcHcUhsSignaling > > > > * 3/4: > > - avoid duplication by calling SdMmcOverride callback in > > EmmcSwitchClockFreq > > > > * 4/4: > > - add Ard's RB > > > > v2->v3 > > * 1/4: > > - rename new parameter to PhaseData > > - add Ard's RB > > > > * 2/4: > > - s/Controler/Controller/ > > - remove all references to MMC_SDR_50 mode > > - rename and reorder MMC bus modes > > - rename enum: s/SD_MMC_UHS_TIMING/SD_MMC_BUS_MODE/ > > and move it to protocol header in order to drop including private one > > - fix if condition in EmmcSwitchToHighSpeed > > - call SdMmcHcUhsSignaling unconditionally before SdMmcOverride > > callback, so that protocol producer can optionally modify only quirky > > timing mode values. > > > > *4/4 > > - bump protocol version to 2 > > - remove redundant assert from SdMmcPciHcDriverBindingStart > > (BaseClkFreq is already checked in SdMmcHcInitClockFreq) > > - update comment in SdMmcHcInitClockFreq > > - restore original DumpCapabilityReg and append > > > > v1 -> v2 > > * Rebase onto newest master > > * 1/4 [new patch] - preparation for extending NotifyPhase > > * 2/4 - UhsSignaling as a part of NotifyPhase > > * 3/4 - SwitchClockFreqPost as a part of NotifyPhase > > * 4/4 - Allow updating BaseClkFreq via Capability instead of the > > independent callback. > > > > > > Marcin Wojtas (2): > > MdeModulePkg/SdMmcPciHcDxe: Add an optional parameter in NotifyPhase > > MdeModulePkg/SdMmcPciHcDxe: Allow overriding base clock frequency > > > > Tomasz Michalec (2): > > MdeModulePkg/SdMmcPciHcDxe: Add UhsSignaling to SdMmcOverride > > protocol > > MdeModulePkg/SdMmcPciHcDxe: Add SwitchClockFreqPost to > > SdMmcOverride > > > > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h | 6 + > > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h | 42 ++- > > MdeModulePkg/Include/Protocol/SdMmcOverride.h | 29 - > > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c| 121 ++- > > > > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 35 -- > > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 13 +- > > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 124 > > +--- > > 7 files changed, 280 insertions(+), 90 deletions(-) > > > > -- > > 2.7.4 > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v4 6/7] Marvell/Drivers: MvBoardDesc: Extend information for SdMmc
From: Tomasz Michalec Extend MvBoardDescSdMmcGet function to fill MV_BOARD_SDMMC_DESC with Xenon specific info obtained from ArmadaBoardDescLib. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf | 1 + Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 24 +--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf index 41f72d6..0b93948 100644 --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf @@ -47,6 +47,7 @@ Silicon/Marvell/Marvell.dec [LibraryClasses] + ArmadaBoardDescLib ArmadaSoCDescLib DebugLib MemoryAllocationLib diff --git a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c index 39dc06c..f71bfc4 100644 --- a/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c +++ b/Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c @@ -270,6 +270,7 @@ MvBoardDescSdMmcGet ( { UINT8 *SdMmcDeviceEnabled; UINTN SdMmcCount, SdMmcDeviceTableSize, SdMmcIndex, Index; + UINTN SdMmcDevCount; MV_BOARD_SDMMC_DESC *BoardDesc; MV_SOC_SDMMC_DESC *SoCDesc; EFI_STATUS Status; @@ -280,6 +281,13 @@ MvBoardDescSdMmcGet ( return Status; } + /* Get per-board configuration of the controllers */ + Status = ArmadaBoardDescSdMmcGet (, ); + if (EFI_ERROR (Status)) { +DEBUG ((DEBUG_ERROR, "%a: ArmadaBoardDescSdMmcGet filed\n", __FUNCTION__)); +return Status; + } + /* * Obtain table with enabled SDMMC controllers * which is represented as an array of UINT8 values @@ -294,18 +302,12 @@ MvBoardDescSdMmcGet ( SdMmcDeviceTableSize = PcdGetSize (PcdPciESdhci); /* Check if PCD with SDMMC controllers is correctly defined */ - if (SdMmcDeviceTableSize > SdMmcCount) { + if ((SdMmcDeviceTableSize > SdMmcCount) || + (SdMmcDeviceTableSize < SdMmcDevCount)) { DEBUG ((DEBUG_ERROR, "%a: Wrong PcdPciESdhci format\n", __FUNCTION__)); return EFI_INVALID_PARAMETER; } - /* Allocate and fill board description */ - BoardDesc = AllocateZeroPool (SdMmcDeviceTableSize * sizeof (MV_BOARD_SDMMC_DESC)); - if (BoardDesc == NULL) { -DEBUG ((DEBUG_ERROR, "%a: Cannot allocate memory\n", __FUNCTION__)); -return EFI_OUT_OF_RESOURCES; - } - SdMmcIndex = 0; for (Index = 0; Index < SdMmcDeviceTableSize; Index++) { if (!SdMmcDeviceEnabled[Index]) { @@ -313,6 +315,12 @@ MvBoardDescSdMmcGet ( continue; } +if (SdMmcIndex >= SdMmcDevCount) { + DEBUG ((DEBUG_ERROR, +"%a: More enabled devices than returned by ArmadaBoardDescSdMmcGet\n", +__FUNCTION__)); + return EFI_INVALID_PARAMETER; +} BoardDesc[SdMmcIndex].SoC = [Index]; SdMmcIndex++; } -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v4 5/7] Marvell/Armada80x0Db: Introduce board description library
From: Tomasz Michalec This patch implements ArmadaBoarDescLib library for Armada8040 Development Board and add to it ArmadaBoardDescSdMmcGet function with description of connected Xenon host controllers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc | 3 + Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf | 34 ++ Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c | 66 3 files changed, 103 insertions(+) create mode 100644 Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf create mode 100644 Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc b/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc index 92e2dc8..42f7bd3 100644 --- a/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc +++ b/Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc @@ -54,6 +54,9 @@ [Components.AARCH64] Silicon/Marvell/Armada7k8k/AcpiTables/Armada80x0Db.inf +[LibraryClasses.common] + ArmadaBoardDescLib|Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf + # # Pcd Section - list of all EDK II PCD Entries defined by this Platform diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf new file mode 100644 index 000..2d39d96 --- /dev/null +++ b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf @@ -0,0 +1,34 @@ +## @file +# +# Copyright (C) 2018, Marvell International Ltd. and its affiliates +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# +# +## + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = Armada80x0DbBoardDescLib + FILE_GUID = fee9e874-1481-4b4f-9882-966bd0d1310f + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmadaBoardDescLib + +[Sources] + Armada80x0DbBoardDescLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + IoLib diff --git a/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c new file mode 100644 index 000..00d696d --- /dev/null +++ b/Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c @@ -0,0 +1,66 @@ +/** +* +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include +#include + +// +// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib +// +STATIC +MV_BOARD_SDMMC_DESC mSdMmcDescTemplate[] = { + { /* eMMC 0xF06E */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +TRUE, /* Xenon1v8Enabled */ +TRUE, /* Xenon8BitBusEnabled */ +TRUE, /* XenonSlowModeEnabled */ +0x40, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + }, + { /* SD/MMC 0xF278 */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +FALSE, /* Xenon8BitBusEnabled */ +FALSE, /* XenonSlowModeEnabled */ +0x19, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + } +}; + +EFI_STATUS +EFIAPI +ArmadaBoardDescSdMmcGet ( + IN OUT UINTN *SdMmcDevCount, + IN OUT MV_BOARD_SDMMC_DESC **SdMmcDesc + ) +{ + *SdMmcDevCount = ARRAY_SIZE (mSdMmcDescTemplate); + + *SdMmcDesc = AllocateCopyPool (sizeof (mSdMmcDescTemplate), + ); + if (*SdMmcDesc == NULL) { +
[edk2] [platforms: PATCH v4 4/7] Marvell/Armada70x0Db: Introduce board description library
From: Tomasz Michalec This patch implements ArmadaBoarDescLib library for Armada7040 Development Board and add to it ArmadaBoardDescSdMmcGet function with description of connected Xenon host controllers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc | 3 + Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf | 34 ++ Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c | 66 3 files changed, 103 insertions(+) create mode 100644 Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf create mode 100644 Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc index e0bf447..a935f36 100644 --- a/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc +++ b/Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc @@ -54,6 +54,9 @@ [Components.AARCH64] Silicon/Marvell/Armada7k8k/AcpiTables/Armada70x0Db.inf +[LibraryClasses.common] + ArmadaBoardDescLib|Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf + # # Pcd Section - list of all EDK II PCD Entries defined by this Platform diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf new file mode 100644 index 000..b26f55b --- /dev/null +++ b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf @@ -0,0 +1,34 @@ +## @file +# +# Copyright (C) 2018, Marvell International Ltd. and its affiliates +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# +# +## + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = Armada70x0DbBoardDescLib + FILE_GUID = 3164c8d9-19d4-4ad6-8196-cea094b1ddf1 + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmadaBoardDescLib + +[Sources] + Armada70x0DbBoardDescLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + IoLib diff --git a/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c new file mode 100644 index 000..dd5e3a0 --- /dev/null +++ b/Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c @@ -0,0 +1,66 @@ +/** +* +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include +#include + +// +// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib +// +STATIC +MV_BOARD_SDMMC_DESC mSdMmcDescTemplate[] = { + { /* eMMC 0xF06E */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +FALSE, /* Xenon8BitBusEnabled */ +TRUE, /* XenonSlowModeEnabled */ +0x40, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + }, + { /* SD/MMC 0xF278 */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +FALSE, /* Xenon8BitBusEnabled */ +FALSE, /* XenonSlowModeEnabled */ +0x19, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + } +}; + +EFI_STATUS +EFIAPI +ArmadaBoardDescSdMmcGet ( + IN OUT UINTN *SdMmcDevCount, + IN OUT MV_BOARD_SDMMC_DESC **SdMmcDesc + ) +{ + *SdMmcDevCount = ARRAY_SIZE (mSdMmcDescTemplate); + + *SdMmcDesc = AllocateCopyPool (sizeof (mSdMmcDescTemplate), + ); + if (*SdMmcDesc == NULL) { +
[edk2] [platforms: PATCH v4 3/7] SolidRun/Armada80x0McBin: Introduce board description library
From: Tomasz Michalec This patch implements ArmadaBoarDescLib library for Armada80x0McBin comunity board and add to it ArmadaBoardDescSdMmcGet function with description of connected Xenon host controllers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc | 3 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf | 34 ++ Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c | 66 3 files changed, 103 insertions(+) create mode 100644 Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf create mode 100644 Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc index 52e2b9b..077224d 100644 --- a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc @@ -55,6 +55,9 @@ [Components.AARCH64] Silicon/Marvell/Armada7k8k/AcpiTables/Armada80x0McBin.inf +[LibraryClasses.common] + ArmadaBoardDescLib|Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf + # # Pcd Section - list of all EDK II PCD Entries defined by this Platform diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf new file mode 100644 index 000..63a4f66 --- /dev/null +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf @@ -0,0 +1,34 @@ +## @file +# +# Copyright (C) 2018, Marvell International Ltd. and its affiliates +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# +# +## + +[Defines] + INF_VERSION= 0x0001001A + BASE_NAME = ArmadaMcBinBoardDescLib + FILE_GUID = 8208558f-5f33-46e2-b5c5-43354384389e + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmadaBoardDescLib + +[Sources] + Armada80x0McBinBoardDescLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Marvell/Marvell.dec + +[LibraryClasses] + DebugLib + IoLib diff --git a/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c new file mode 100644 index 000..9e38ce0 --- /dev/null +++ b/Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c @@ -0,0 +1,66 @@ +/** +* +* Copyright (C) 2018, Marvell International Ltd. and its affiliates. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include +#include + +// +// Order of devices in SdMmcDescTemplate has to be in par with ArmadaSoCDescLib +// +STATIC +MV_BOARD_SDMMC_DESC mMcBinSdMmcDescTemplate[] = { + { /* eMMC 0xF06E */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +TRUE, /* Xenon8BitBusEnabled */ +TRUE, /* XenonSlowModeEnabled */ +0x40, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + }, + { /* SD/MMC 0xF278 */ +0, /* SOC will be filled by MvBoardDescDxe */ +0, /* SdMmcDevCount will be filled by MvBoardDescDxe */ +FALSE, /* Xenon1v8Enabled */ +FALSE, /* Xenon8BitBusEnabled */ +FALSE, /* XenonSlowModeEnabled */ +0x19, /* XenonTuningStepDivisor */ +EmbeddedSlot /* SlotType */ + } +}; + +EFI_STATUS +EFIAPI +ArmadaBoardDescSdMmcGet ( + IN OUT UINTN *SdMmcDevCount, + IN OUT MV_BOARD_SDMMC_DESC **SdMmcDesc + ) +{ + *SdMmcD
[edk2] [platforms: PATCH v4 2/7] Marvell/Library: ArmadaBoardDescLib: Extend SDMMC information
From: Tomasz Michalec Added fields specific for Xenon host controller and declaration of ArmadaBoardDescSdMmcGet function. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 22 +++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h index ee8e06e..8e29a68 100644 --- a/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h +++ b/Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h @@ -55,9 +55,21 @@ typedef struct { // // SDMMC devices per-board description // +typedef enum { + RemovableSlot, + EmbeddedSlot, + SharedBusSlot, + UnknownSlot +} MV_SDMMC_SLOT_TYPE; + typedef struct { MV_SOC_SDMMC_DESC *SoC; - UINTN SdMmcDevCount; + UINTNSdMmcDevCount; + BOOLEAN Xenon1v8Enabled; + BOOLEAN Xenon8BitBusEnabled; + BOOLEAN XenonSlowModeEnabled; + UINT8XenonTuningStepDivisor; + MV_SDMMC_SLOT_TYPE SlotType; } MV_BOARD_SDMMC_DESC; // @@ -84,4 +96,12 @@ typedef struct { UINTN UtmiDevCount; UINTN UtmiPortType; } MV_BOARD_UTMI_DESC; + +EFI_STATUS +EFIAPI +ArmadaBoardDescSdMmcGet ( + IN OUT UINTN *SdMmcDevCount, + IN OUT MV_BOARD_SDMMC_DESC **SdMmcDesc + ); + #endif /* __ARMADA_SOC_DESC_LIB_H__ */ -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v4 1/7] Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride
The newest changes in the SdMmcOverride protocol added additional arguments to the NotifyPhase and Capability routines. Update according places in the Synquacer Emmc driver. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c index e0987c9..47f5ccc 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c @@ -72,6 +72,8 @@ STATIC VOID *mEventRegistration; @param[in] ControllerHandle The EFI_HANDLE of the controller. @param[in] Slot The 0 based slot index. @param[in,out] SdMmcHcSlotCapability The SDHCI capability structure. + @param[in,out] BaseClkFreq The base clock frequency value that +optionally can be updated. @retval EFI_SUCCESS The override function completed successfully. @retval EFI_NOT_FOUND The specified controller or slot does not exist. @@ -84,7 +86,8 @@ EFIAPI SynQuacerSdMmcCapability ( IN EFI_HANDLE ControllerHandle, IN UINT8 Slot, - IN OUT VOID*SdMmcHcSlotCapability + IN OUT VOID*SdMmcHcSlotCapability, + IN OUT UINT32 *BaseClkFreq ) { UINT64 Capability; @@ -117,6 +120,7 @@ SynQuacerSdMmcCapability ( @param[in] PhaseType The type of operation and whether the hook is invoked right before (pre) or right after (post) + @param[in,out] PhaseData The pointer to a phase-specific data. @retval EFI_SUCCESS The override function completed successfully. @retval EFI_NOT_FOUND The specified controller or slot does not exist. @@ -129,7 +133,8 @@ EFIAPI SynQuacerSdMmcNotifyPhase ( IN EFI_HANDLE ControllerHandle, IN UINT8 Slot, - IN EDKII_SD_MMC_PHASE_TYPE PhaseType + IN EDKII_SD_MMC_PHASE_TYPE PhaseType, + IN OUT VOID *PhaseData ) { if (ControllerHandle != mSdMmcControllerHandle) { -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [platforms: PATCH v4 0/7] Armada7k8k Xenon driver rework
Hi, The fourth version of the patchset removes dependency on the internal MdeModulePkg header and reworks Capability callback handling. Details can be found in the changelog below. Patches are available in the github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/xenon-upstream-r20181109 Generic driver patches with fixes and extended SdMmcOverride protocol: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/sdmmc-override-upstream-r20181109 I'm looking forward to the comments and remarks. Best regards, Marcin Changelog: v3->v4: * 1/7: - add Ard's RB * 2/7: - use local enum definition for SlotType in order not to include MdeModulePkg private header * 7/7: - rework capability handling, without using the structure defined in the MdeModulePkg header v2->v3 * 1/7: - rename NotifyPhase parameter to PhaseData * 7/7: - rename NotifyPhase parameter to PhaseData - update UHS_MODE_SEL only for HS200/HS400 in XenonSdMmcHcUhsSignaling - use local macros for standard SDHC registers in order not to include private MdeModulePkg header v1 -> v2 * 1/7 and 7/7 - adjust to modified SdMmcOverride NotifyPhase and Capability routines Marcin Wojtas (1): Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride Tomasz Michalec (6): Marvell/Library: ArmadaBoardDescLib: Extend SDMMC information SolidRun/Armada80x0McBin: Introduce board description library Marvell/Armada70x0Db: Introduce board description library Marvell/Armada80x0Db: Introduce board description library Marvell/Drivers: MvBoardDesc: Extend information for SdMmc Marvell/Drivers: XenonDxe: Switch to use generic SdMmcPciHcDxe Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc |3 +- Platform/Marvell/Armada70x0Db/Armada70x0Db.dsc |3 + Platform/Marvell/Armada80x0Db/Armada80x0Db.dsc |3 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc |3 + Silicon/Marvell/Armada7k8k/Armada7k8k.fdf |3 +- Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.inf | 34 + Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.inf | 34 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.inf | 34 + Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.inf |1 + Silicon/Marvell/Drivers/SdMmc/XenonDxe/{SdMmcPciHcDxe.inf => XenonDxe.inf} | 33 +- Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.h | 791 Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHci.h | 550 -- Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.h | 151 ++ Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.h | 53 + Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdhci.h | 131 +- Silicon/Marvell/Include/Library/ArmadaBoardDescLib.h | 22 +- Platform/Marvell/Armada70x0Db/Armada70x0DbBoardDescLib/Armada70x0DbBoardDescLib.c | 66 + Platform/Marvell/Armada80x0Db/Armada80x0DbBoardDescLib/Armada80x0DbBoardDescLib.c | 66 + Platform/SolidRun/Armada80x0McBin/Armada80x0McBinBoardDescLib/Armada80x0McBinBoardDescLib.c | 66 + Silicon/Marvell/Drivers/BoardDesc/MvBoardDescDxe.c | 24 +- Silicon/Marvell/Drivers/SdMmc/XenonDxe/ComponentName.c | 211 --- Silicon/Marvell/Drivers/SdMmc/XenonDxe/EmmcDevice.c | 1164 Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdDevice.c | 1190 Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.c | 1320 -- Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHci.c | 1928 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonPciHci.c | 321 Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdMmcOverride.c | 432 + Silicon/Marvell/Drivers/SdMmc/XenonDxe/XenonSdhci.c | 408 +++-- Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Emmc.c |9 +- Silicon/Marvell/Drivers/SdMmc/XenonDxe/SdMmcPciHcDxe.uni | 23 - Silicon/Marvell/Drivers/Sd
[edk2] [PATCH v4 4/4] MdeModulePkg/SdMmcPciHcDxe: Allow overriding base clock frequency
Some SdMmc host controllers are run by clocks with different frequency than it is reflected in Capabilities Register 1. It is allowed by SDHCI specification ver. 4.2 - if BaseClkFreq field value of the Capability Register 1 is zero, the clock frequency must be obtained via another method. Because the bitfield is only 8 bits wide, a maximum value that could be obtained from hardware is 255MHz. In case the actual frequency exceeds 255MHz, the 8-bit BaseClkFreq member of SD_MMC_HC_SLOT_CAP structure occurs to be not sufficient to be used for setting the clock speed in SdMmcHcClockSupply function. This patch adds new UINT32 array ('BaseClkFreq[]') to SD_MMC_HC_PRIVATE_DATA structure for specifying the input clock speed for each slot of the host controller. All routines that are used for clock configuration are updated accordingly. This patch also adds new IN OUT BaseClockFreq field in the Capability callback of the SdMmcOverride, protocol which allows to update BaseClkFreq value. The patch reuses original commit from edk2-platforms: 20f6f144d3a8 ("Marvell/Drivers: XenonDxe: Allow overriding base clock frequency") Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Ard Biesheuvel --- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h | 6 + MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h | 8 +++ MdeModulePkg/Include/Protocol/SdMmcOverride.h | 7 -- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c| 4 ++-- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 4 ++-- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 13 ++- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 23 ++-- 7 files changed, 43 insertions(+), 22 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h index c683600..8c1a589 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h @@ -118,6 +118,12 @@ typedef struct { UINT64 MaxCurrent[SD_MMC_HC_MAX_SLOT]; UINT32 ControllerVersion; + + // + // Some controllers may require to override base clock frequency + // value stored in Capabilities Register 1. + // + UINT32 BaseClkFreq[SD_MMC_HC_MAX_SLOT]; } SD_MMC_HC_PRIVATE_DATA; #define SD_MMC_HC_TRB_SIG SIGNATURE_32 ('T', 'R', 'B', 'T') diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h index b47b0df..dd45cbd 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h @@ -423,7 +423,7 @@ SdMmcHcStopClock ( @param[in] PciIo The PCI IO protocol instance. @param[in] Slot The slot number of the SD card to send the command to. @param[in] ClockFreq The max clock frequency to be set. The unit is KHz. - @param[in] Capability The capability of the slot. + @param[in] BaseClkFreqThe base clock frequency of host controller in MHz. @retval EFI_SUCCESS The clock is supplied successfully. @retval OthersThe clock isn't supplied successfully. @@ -434,7 +434,7 @@ SdMmcHcClockSupply ( IN EFI_PCI_IO_PROTOCOL*PciIo, IN UINT8 Slot, IN UINT64 ClockFreq, - IN SD_MMC_HC_SLOT_CAP Capability + IN UINT32 BaseClkFreq ); /** @@ -482,7 +482,7 @@ SdMmcHcSetBusWidth ( @param[in] PciIo The PCI IO protocol instance. @param[in] Slot The slot number of the SD card to send the command to. - @param[in] Capability The capability of the slot. + @param[in] BaseClkFreqThe base clock frequency of host controller in MHz. @retval EFI_SUCCESS The clock is supplied successfully. @retval OthersThe clock isn't supplied successfully. @@ -492,7 +492,7 @@ EFI_STATUS SdMmcHcInitClockFreq ( IN EFI_PCI_IO_PROTOCOL*PciIo, IN UINT8 Slot, - IN SD_MMC_HC_SLOT_CAP Capability + IN UINT32 BaseClkFreq ); /** diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h b/MdeModulePkg/Include/Protocol/SdMmcOverride.h index 6160b5b..0aaf258 100644 --- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h @@ -22,7 +22,7 @@ #define EDKII_SD_MMC_OVERRIDE_PROTOCOL_GUID \ { 0xeaf9e3c1, 0xc9cd, 0x46db, { 0xa5, 0xe5, 0x5a, 0x12, 0x4c, 0x83, 0x23, 0x23 } } -#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION0x1 +#define EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION0x2 typedef struct _EDKII_SD_MMC_OVERRIDE EDKII_SD_MMC_OVERRIDE; @@ -58,6 +58,8 @@ typedef enum { @param[in] ControllerHandle The EFI_HANDLE of the controller. @param[in] Slot The 0 based slot index. @pa
[edk2] [PATCH v4 3/4] MdeModulePkg/SdMmcPciHcDxe: Add SwitchClockFreqPost to SdMmcOverride
From: Tomasz Michalec Some SD Host Controlers need to do additional opperations after clock frequency switch. This patch add new callback type to NotifyPhase of the SdMmcOverride protocol. It is called after SdMmcHcClockSupply. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- MdeModulePkg/Include/Protocol/SdMmcOverride.h | 1 + MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c | 31 +--- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 18 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h b/MdeModulePkg/Include/Protocol/SdMmcOverride.h index f948bef..6160b5b 100644 --- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h @@ -48,6 +48,7 @@ typedef enum { EdkiiSdMmcInitHostPre, EdkiiSdMmcInitHostPost, EdkiiSdMmcUhsSignaling, + EdkiiSdMmcSwitchClockFreqPost, } EDKII_SD_MMC_PHASE_TYPE; /** diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c index db4e8a1..b75a9bb 100755 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c @@ -651,6 +651,7 @@ EmmcSwitchBusWidth ( @param[in] Slot The slot number of the SD card to send the command to. @param[in] RcaThe relative device address to be assigned. @param[in] HsTiming The value to be written to HS_TIMING field of EXT_CSD register. + @param[in] Timing The bus mode timing indicator. @param[in] ClockFreq The max clock frequency to be set, the unit is MHz. @retval EFI_SUCCESS The operation is done correctly. @@ -664,6 +665,7 @@ EmmcSwitchClockFreq ( IN UINT8 Slot, IN UINT16 Rca, IN UINT8 HsTiming, + IN SD_MMC_BUS_MODETiming, IN UINT32 ClockFreq ) { @@ -706,6 +708,27 @@ EmmcSwitchClockFreq ( // Convert the clock freq unit from MHz to KHz. // Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, Private->Capability[Slot]); + if (EFI_ERROR (Status)) { +return Status; + } + + if (mOverride != NULL && mOverride->NotifyPhase != NULL) { +Status = mOverride->NotifyPhase ( + Private->ControllerHandle, + Slot, + EdkiiSdMmcSwitchClockFreqPost, + + ); +if (EFI_ERROR (Status)) { + DEBUG (( +DEBUG_ERROR, +"%a: SD/MMC switch clock freq post notifier callback failed - %r\n", +__FUNCTION__, +Status +)); + return Status; +} + } return Status; } @@ -775,7 +798,7 @@ EmmcSwitchToHighSpeed ( } HsTiming = 1; - Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, ClockFreq); + Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, Timing, ClockFreq); return Status; } @@ -863,7 +886,7 @@ EmmcSwitchToHS200 ( Status = SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_CLOCK_CTRL, sizeof (ClockCtrl), ); HsTiming = 2; - Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, ClockFreq); + Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, Timing, ClockFreq); if (EFI_ERROR (Status)) { return Status; } @@ -913,7 +936,7 @@ EmmcSwitchToHS400 ( // Set to Hight Speed timing and set the clock frequency to a value less than 52MHz. // HsTiming = 1; - Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, 52); + Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, SdMmcMmcHsSdr, 52); if (EFI_ERROR (Status)) { return Status; } @@ -933,7 +956,7 @@ EmmcSwitchToHS400 ( } HsTiming = 3; - Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, ClockFreq); + Status = EmmcSwitchClockFreq (PciIo, PassThru, Slot, Rca, HsTiming, Timing, ClockFreq); return Status; } diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c index 55b3564..32fd416 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c @@ -869,6 +869,24 @@ SdCardSetBusMode ( return Status; } + if (mOverride != NULL && mOverride->NotifyPhase != NULL) { +Status = mOverride->NotifyPhase ( + Private->ControllerHandle, + Slot, + EdkiiSdMmcSwitchClockFreqPost, + + ); +if (EFI_ERROR (Status)) { + DEBUG (( +DEBUG_ERROR, +"%a: SD/MMC switch clock freq post notifier callback failed - %r\n", +__FUNCTION__, +Status +)); +
[edk2] [PATCH v4 2/4] MdeModulePkg/SdMmcPciHcDxe: Add UhsSignaling to SdMmcOverride protocol
From: Tomasz Michalec Some SD Host Controllers use different values in Host Control 2 Register to select UHS Mode. This patch adds a new UhsSignaling type routine to the NotifyPhase of the SdMmcOverride protocol. UHS signaling configuration is moved to a common, default routine (SdMmcHcUhsSignaling). After it is executed, the protocol producer can override the values if needed. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas --- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h | 34 MdeModulePkg/Include/Protocol/SdMmcOverride.h| 17 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c | 86 --- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c| 15 ++-- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 89 5 files changed, 181 insertions(+), 60 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h index 7e3f588..b47b0df 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h @@ -63,6 +63,21 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define SD_MMC_HC_CTRL_VER0xFE // +// SD Host Controller bits to HOST_CTRL2 register +// +#define SD_MMC_HC_CTRL_UHS_MASK 0x0007 +#define SD_MMC_HC_CTRL_UHS_SDR12 0x +#define SD_MMC_HC_CTRL_UHS_SDR25 0x0001 +#define SD_MMC_HC_CTRL_UHS_SDR50 0x0002 +#define SD_MMC_HC_CTRL_UHS_SDR104 0x0003 +#define SD_MMC_HC_CTRL_UHS_DDR50 0x0004 +#define SD_MMC_HC_CTRL_MMC_LEGACY 0x +#define SD_MMC_HC_CTRL_MMC_HS_SDR 0x0001 +#define SD_MMC_HC_CTRL_MMC_HS_DDR 0x0004 +#define SD_MMC_HC_CTRL_MMC_HS200 0x0003 +#define SD_MMC_HC_CTRL_MMC_HS400 0x0005 + +// // The transfer modes supported by SD Host Controller // Simplified Spec 3.0 Table 1-2 // @@ -518,4 +533,23 @@ SdMmcHcInitTimeoutCtrl ( IN UINT8 Slot ); +/** + Set SD Host Controller control 2 registry according to selected speed. + + @param[in] ControllerHandle The handle of the controller. + @param[in] PciIoThe PCI IO protocol instance. + @param[in] Slot The slot number of the SD card to send the command to. + @param[in] Timing The timing to select. + + @retval EFI_SUCCESS The timing is set successfully. + @retval Others The timing isn't set successfully. +**/ +EFI_STATUS +SdMmcHcUhsSignaling ( + IN EFI_HANDLE ControllerHandle, + IN EFI_PCI_IO_PROTOCOL*PciIo, + IN UINT8 Slot, + IN SD_MMC_BUS_MODETiming + ); + #endif diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h b/MdeModulePkg/Include/Protocol/SdMmcOverride.h index 8a7669e..f948bef 100644 --- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h @@ -26,11 +26,28 @@ typedef struct _EDKII_SD_MMC_OVERRIDE EDKII_SD_MMC_OVERRIDE; +// +// Bus timing modes +// +typedef enum { + SdMmcUhsSdr12, + SdMmcUhsSdr25, + SdMmcUhsSdr50, + SdMmcUhsSdr104, + SdMmcUhsDdr50, + SdMmcMmcLegacy, + SdMmcMmcHsSdr, + SdMmcMmcHsDdr, + SdMmcMmcHs200, + SdMmcMmcHs400, +} SD_MMC_BUS_MODE; + typedef enum { EdkiiSdMmcResetPre, EdkiiSdMmcResetPost, EdkiiSdMmcInitHostPre, EdkiiSdMmcInitHostPost, + EdkiiSdMmcUhsSignaling, } EDKII_SD_MMC_PHASE_TYPE; /** diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c index c5fd214..db4e8a1 100755 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c @@ -740,10 +740,13 @@ EmmcSwitchToHighSpeed ( IN UINT8 BusWidth ) { - EFI_STATUS Status; - UINT8 HsTiming; - UINT8 HostCtrl1; - UINT8 HostCtrl2; + EFI_STATUS Status; + UINT8 HsTiming; + UINT8 HostCtrl1; + SD_MMC_BUS_MODE Timing; + SD_MMC_HC_PRIVATE_DATA *Private; + + Private = SD_MMC_HC_PRIVATE_FROM_THIS (PassThru); Status = EmmcSwitchBusWidth (PciIo, PassThru, Slot, Rca, IsDdr, BusWidth); if (EFI_ERROR (Status)) { @@ -758,25 +761,15 @@ EmmcSwitchToHighSpeed ( return Status; } - // - // Clean UHS Mode Select field of Host Control 2 reigster before update - // - HostCtrl2 = (UINT8)~0x7; - Status = SdMmcHcAndMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), ); - if (EFI_ERROR (Status)) { -return Status; - } - // - // Set UHS Mode Select field of Host Control 2 reigster to SDR12/25/50 - // if (IsDdr) { -HostCtrl2 = BIT2; +Timing = SdMmcMmcHsDdr; } else if (ClockFreq == 52) { -HostCtrl2 = BIT0; +Timing = SdMmcMmcHsSdr; } else { -HostCtrl2 = 0; +Timing = SdMmcMmcLegacy; } - Status = SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof
[edk2] [PATCH v4 1/4] MdeModulePkg/SdMmcPciHcDxe: Add an optional parameter in NotifyPhase
In order to ensure bigger flexibility in the NotifyPhase routine of the SdMmcOverride protocol, enable using an optional phase-specific data. This will allow to exchange more information between the protocol producer driver and SdMmcPciHcDxe in the newly added callbacks. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marcin Wojtas Reviewed-by: Ard Biesheuvel --- MdeModulePkg/Include/Protocol/SdMmcOverride.h| 4 +++- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 12 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Include/Protocol/SdMmcOverride.h b/MdeModulePkg/Include/Protocol/SdMmcOverride.h index 0766252..8a7669e 100644 --- a/MdeModulePkg/Include/Protocol/SdMmcOverride.h +++ b/MdeModulePkg/Include/Protocol/SdMmcOverride.h @@ -63,6 +63,7 @@ EFI_STATUS @param[in] PhaseType The type of operation and whether the hook is invoked right before (pre) or right after (post) + @param[in,out] PhaseData The pointer to a phase-specific data. @retval EFI_SUCCESS The override function completed successfully. @retval EFI_NOT_FOUND The specified controller or slot does not exist. @@ -74,7 +75,8 @@ EFI_STATUS (EFIAPI * EDKII_SD_MMC_NOTIFY_PHASE) ( IN EFI_HANDLE ControllerHandle, IN UINT8 Slot, - IN EDKII_SD_MMC_PHASE_TYPE PhaseType + IN EDKII_SD_MMC_PHASE_TYPE PhaseType, + IN OUT VOID *PhaseData ); struct _EDKII_SD_MMC_OVERRIDE { diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c index bedc968..923c55b 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c @@ -444,7 +444,8 @@ SdMmcHcReset ( Status = mOverride->NotifyPhase ( Private->ControllerHandle, Slot, - EdkiiSdMmcResetPre); + EdkiiSdMmcResetPre, + NULL); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_WARN, "%a: SD/MMC pre reset notifier callback failed - %r\n", @@ -494,7 +495,8 @@ SdMmcHcReset ( Status = mOverride->NotifyPhase ( Private->ControllerHandle, Slot, - EdkiiSdMmcResetPost); + EdkiiSdMmcResetPost, + NULL); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_WARN, "%a: SD/MMC post reset notifier callback failed - %r\n", @@ -1088,7 +1090,8 @@ SdMmcHcInitHost ( Status = mOverride->NotifyPhase ( Private->ControllerHandle, Slot, - EdkiiSdMmcInitHostPre); + EdkiiSdMmcInitHostPre, + NULL); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_WARN, "%a: SD/MMC pre init notifier callback failed - %r\n", @@ -1123,7 +1126,8 @@ SdMmcHcInitHost ( Status = mOverride->NotifyPhase ( Private->ControllerHandle, Slot, - EdkiiSdMmcInitHostPost); + EdkiiSdMmcInitHostPost, + NULL); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_WARN, "%a: SD/MMC post init notifier callback failed - %r\n", -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v4 0/4] SdMmcOverride extension
Hi, Although I could've waited for Hao's remarks, I think it may be better if he takes a look at much cleaner code, which addresses v3 review comments. The newest version of the patchset cleans-up significantly patches 2&3 by removing code duplication and other minor improvements. Patches are available in the github: https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/sdmmc-override-upstream-r20181109 Please note that extending SdMmcOverride protocol was impacting so far the only user of it (Synquacer controller). In paralel edk2-platforms patchset, a patch can be found: ("Silicon/SynQuacer/PlatformDxe: adjust to updated SdMmcOverride") which adjust to the new API. https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/xenon-upstream-r20181109 I'm looking forward to the comments and remarks. Best regards, Marcin Changelog: v3->v4 * 2/4: - avoid duplication by calling SdMmcOverride callback in SdMmcHcUhsSignaling * 3/4: - avoid duplication by calling SdMmcOverride callback in EmmcSwitchClockFreq * 4/4: - add Ard's RB v2->v3 * 1/4: - rename new parameter to PhaseData - add Ard's RB * 2/4: - s/Controler/Controller/ - remove all references to MMC_SDR_50 mode - rename and reorder MMC bus modes - rename enum: s/SD_MMC_UHS_TIMING/SD_MMC_BUS_MODE/ and move it to protocol header in order to drop including private one - fix if condition in EmmcSwitchToHighSpeed - call SdMmcHcUhsSignaling unconditionally before SdMmcOverride callback, so that protocol producer can optionally modify only quirky timing mode values. *4/4 - bump protocol version to 2 - remove redundant assert from SdMmcPciHcDriverBindingStart (BaseClkFreq is already checked in SdMmcHcInitClockFreq) - update comment in SdMmcHcInitClockFreq - restore original DumpCapabilityReg and append v1 -> v2 * Rebase onto newest master * 1/4 [new patch] - preparation for extending NotifyPhase * 2/4 - UhsSignaling as a part of NotifyPhase * 3/4 - SwitchClockFreqPost as a part of NotifyPhase * 4/4 - Allow updating BaseClkFreq via Capability instead of the independent callback. Marcin Wojtas (2): MdeModulePkg/SdMmcPciHcDxe: Add an optional parameter in NotifyPhase MdeModulePkg/SdMmcPciHcDxe: Allow overriding base clock frequency Tomasz Michalec (2): MdeModulePkg/SdMmcPciHcDxe: Add UhsSignaling to SdMmcOverride protocol MdeModulePkg/SdMmcPciHcDxe: Add SwitchClockFreqPost to SdMmcOverride MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h | 6 + MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h | 42 ++- MdeModulePkg/Include/Protocol/SdMmcOverride.h | 29 - MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c| 121 ++- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c | 35 -- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 13 +- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 124 +--- 7 files changed, 280 insertions(+), 90 deletions(-) -- 2.7.4 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel