ArmPlatformPkg/ArmVExpressDxe: Change FDT default file names.

On the FVP base and foundation models, the default file name
used to retrieve the FDT depended on the values assigned to
model parameters (GIC related model parameters).

Now, in addition to the fallback "fdt.dtb" file name (used for legacy
 reason), only one default file name is used :
- "fvp-base.dtb" for the base model.
- "fvp-foundation.dtb" for the foundation model.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <Olivier.Martin@arm.com>
Reviewed-by: Ronald Cron <Ronald.Cron@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17862 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Olivier Martin 2015-07-07 15:45:36 +00:00 committed by oliviermartin
parent 03931908e2
commit b836204e78
7 changed files with 71 additions and 74 deletions

View File

@ -22,14 +22,10 @@
// model or hardware platforms).
//
CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = {
{ ARM_FVP_VEXPRESS_AEMv8x4, FixedPcdGetPtr (PcdFdtFvpVExpressAEMv8x4), L"rtsm_ve-aemv8a.dtb" },
{ ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2, FixedPcdGetPtr (PcdFdtFvpBaseAEMv8x4GicV2), L"fvp-base-gicv2-psci.dtb" },
{ ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY, FixedPcdGetPtr (PcdFdtFvpBaseAEMv8x4GicV2Legacy), L"fvp-base-gicv2legacy-psci.dtb" },
{ ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3, FixedPcdGetPtr (PcdFdtFvpBaseAEMv8x4GicV3), L"fvp-base-gicv3-psci.dtb" },
{ ARM_FVP_FOUNDATION_GICV2, FixedPcdGetPtr (PcdFdtFvpFoundationGicV2), L"fvp-foundation-gicv2-psci.dtb" },
{ ARM_FVP_FOUNDATION_GICV2_LEGACY, FixedPcdGetPtr (PcdFdtFvpFoundationGicV2Legacy), L"fvp-foundation-gicv2legacy-psci.dtb" },
{ ARM_FVP_FOUNDATION_GICV3, FixedPcdGetPtr (PcdFdtFvpFoundationGicV3), L"fvp-foundation-gicv3-psci.dtb" },
{ ARM_FVP_VEXPRESS_UNKNOWN }
{ ARM_FVP_VEXPRESS_AEMv8x4, FixedPcdGetPtr (PcdFdtFvpVExpressAEMv8x4), L"rtsm_ve-aemv8a.dtb" },
{ ARM_FVP_BASE, FixedPcdGetPtr (PcdFdtFvpBaseAEMv8x4), L"fvp-base.dtb" },
{ ARM_FVP_FOUNDATION, FixedPcdGetPtr (PcdFdtFvpFoundation), L"fvp-foundation.dtb" },
{ ARM_FVP_VEXPRESS_UNKNOWN, &gZeroGuid }
};
/**
@ -49,11 +45,9 @@ ArmVExpressGetPlatform (
OUT CONST ARM_VEXPRESS_PLATFORM** Platform
)
{
EFI_STATUS Status;
UINT32 SysId;
UINT32 FvpSysId;
UINT32 VariantSysId;
ARM_GIC_ARCH_REVISION GicRevision;
EFI_STATUS Status;
UINT32 SysId;
UINT32 FvpSysId;
ASSERT (Platform != NULL);
@ -61,46 +55,23 @@ ArmVExpressGetPlatform (
SysId = MmioRead32 (ARM_VE_SYS_ID_REG);
if (SysId != ARM_RTSM_SYS_ID) {
// Remove the GIC variant to identify if we are running on the FVP Base or
// Foundation models
FvpSysId = SysId & (ARM_FVP_SYS_ID_HBI_MASK |
ARM_FVP_SYS_ID_PLAT_MASK );
// Extract the variant from the SysId
VariantSysId = SysId & ARM_FVP_SYS_ID_VARIANT_MASK;
//
// Keep only the HBI board number and the platform type fields of the
// system id register to identify if we are running on the FVP base or
// foundation model.
//
FvpSysId = SysId & (ARM_FVP_SYS_ID_HBI_MASK |
ARM_FVP_SYS_ID_PLAT_MASK );
if (FvpSysId == ARM_FVP_BASE_BOARD_SYS_ID) {
if (VariantSysId == ARM_FVP_GIC_VE_MMAP) {
// FVP Base Model with legacy GIC memory map
Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY, Platform);
} else {
GicRevision = ArmGicGetSupportedArchRevision ();
if (GicRevision == ARM_GIC_ARCH_REVISION_2) {
// FVP Base Model with GICv2 support
Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2, Platform);
} else {
// FVP Base Model with GICv3 support
Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3, Platform);
}
}
Status = ArmVExpressGetPlatformFromId (ARM_FVP_BASE, Platform);
} else if (FvpSysId == ARM_FVP_FOUNDATION_BOARD_SYS_ID) {
if (VariantSysId == ARM_FVP_GIC_VE_MMAP) {
// FVP Foundation Model with legacy GIC memory map
Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV2_LEGACY, Platform);
} else {
GicRevision = ArmGicGetSupportedArchRevision ();
if (GicRevision == ARM_GIC_ARCH_REVISION_2) {
// FVP Foundation Model with GICv2
Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV2, Platform);
} else {
// FVP Foundation Model with GICv3
Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION_GICV3, Platform);
}
}
Status = ArmVExpressGetPlatformFromId (ARM_FVP_FOUNDATION, Platform);
}
} else {
//
// FVP Versatile Express AEMv8
//
Status = ArmVExpressGetPlatformFromId (ARM_FVP_VEXPRESS_AEMv8x4, Platform);
}

View File

@ -24,6 +24,7 @@
#include <Protocol/FirmwareVolume2.h>
#define ARM_FVP_BASE_VIRTIO_BLOCK_BASE 0x1c130000
STATIC CONST CHAR16 *mFdtFallbackName = L"fdt.dtb";
#pragma pack(1)
typedef struct {
@ -155,16 +156,20 @@ ArmFvpInitialise (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
CONST ARM_VEXPRESS_PLATFORM* Platform;
EFI_STATUS Status;
CHAR16 *TextDevicePath;
CONST ARM_VEXPRESS_PLATFORM *Platform;
BOOLEAN NeedFallback;
UINTN TextDevicePathBaseSize;
UINTN TextDevicePathSize;
CHAR16 *TextDevicePath;
VOID *Buffer;
EFI_DEVICE_PATH *FdtDevicePath;
Status = gBS->InstallProtocolInterface (&ImageHandle,
&gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
&mVirtioBlockDevicePath);
Status = gBS->InstallProtocolInterface (
&ImageHandle,
&gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE,
&mVirtioBlockDevicePath
);
if (EFI_ERROR (Status)) {
return Status;
}
@ -180,13 +185,32 @@ ArmFvpInitialise (
}
FreePool (FdtDevicePath);
} else {
TextDevicePathSize = StrSize ((CHAR16*)PcdGetPtr (PcdFvpFdtDevicePathsBase)) - sizeof (CHAR16);
TextDevicePathSize += StrSize (Platform->FdtName);
//
// In the case of the FVP base and foundation platforms, two default
// text device paths for the FDT are defined. The first one, like every
// other platform, ends with a file name that identifies the platform. The
// second one ends with the fallback file name "fdt.dtb" for historical
// backward compatibility reasons.
//
NeedFallback = (Platform->Id == ARM_FVP_BASE) ||
(Platform->Id == ARM_FVP_FOUNDATION);
TextDevicePathBaseSize = StrSize ((CHAR16*)PcdGetPtr (PcdFvpFdtDevicePathsBase)) - sizeof (CHAR16);
TextDevicePathSize = TextDevicePathBaseSize + StrSize (Platform->FdtName);
if (NeedFallback) {
TextDevicePathSize += TextDevicePathBaseSize + StrSize (mFdtFallbackName);
}
TextDevicePath = AllocatePool (TextDevicePathSize);
if (TextDevicePath != NULL) {
StrCpy (TextDevicePath, ((CHAR16*)PcdGetPtr (PcdFvpFdtDevicePathsBase)));
StrCat (TextDevicePath, Platform->FdtName);
if (NeedFallback) {
StrCat (TextDevicePath, L";");
StrCat (TextDevicePath, ((CHAR16*)PcdGetPtr (PcdFvpFdtDevicePathsBase)));
StrCat (TextDevicePath, mFdtFallbackName);
}
}
}
if (TextDevicePath != NULL) {
@ -198,6 +222,11 @@ ArmFvpInitialise (
));
}
FreePool (TextDevicePath);
} else {
DEBUG ((
EFI_D_ERROR,
"ArmFvpDxe: Setting of FDT device path in PcdFdtDevicePaths failed - %r\n", EFI_OUT_OF_RESOURCES
));
}
}

View File

@ -32,6 +32,7 @@
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
ArmPkg/ArmPkg.dec
ArmPlatformPkg/ArmPlatformPkg.dec
ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec
@ -54,6 +55,9 @@
[LibraryClasses.AARCH64]
ArmGicLib
[Guids]
gZeroGuid
[Protocols]
gEfiFirmwareVolume2ProtocolGuid
gEfiDevicePathProtocolGuid
@ -69,12 +73,8 @@
[FixedPcd.AARCH64]
gArmVExpressTokenSpaceGuid.PcdFdtFvpVExpressAEMv8x4
gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV2
gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV2Legacy
gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV3
gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV2
gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV2Legacy
gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV3
gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4
gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundation
[Pcd]
gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths

View File

@ -19,7 +19,6 @@ CONST EFI_GUID ArmHwA9x4Guid = { 0x2fd21cf6, 0xe6e8, 0x4ff2, { 0xa9, 0xca, 0x3b,
CONST EFI_GUID ArmHwA15x2A7x3Guid = { 0xd5e606eb, 0x83df, 0x4e90, { 0x81, 0xe8, 0xc3, 0xdb, 0x2f, 0x77, 0x17, 0x9a } };
CONST EFI_GUID ArmHwA15Guid = { 0x6b8947c2, 0x4287, 0x4d91, { 0x8f, 0xe0, 0xa3, 0x81, 0xea, 0x5b, 0x56, 0x8f } };
CONST EFI_GUID ArmHwA5Guid = { 0xa2cc7663, 0x4d7c, 0x448a, { 0xaa, 0xb5, 0x4c, 0x03, 0x4b, 0x6f, 0xda, 0xb7 } };
CONST EFI_GUID NullGuid = { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } };
//
// Description of the four hardware platforms :
@ -34,7 +33,7 @@ CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = {
{ ARM_HW_A15x2_A7x3, &ArmHwA15x2A7x3Guid, L"ca15a7" },
{ ARM_HW_A15, &ArmHwA15Guid, L"ca15a7" },
{ ARM_HW_A5, &ArmHwA5Guid, L"ca5s" },
{ ARM_FVP_VEXPRESS_UNKNOWN, &NullGuid, NULL }
{ ARM_FVP_VEXPRESS_UNKNOWN, &gZeroGuid, NULL }
};
/**

View File

@ -29,6 +29,7 @@
ArmPlatformPkg/ArmPlatformPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
ArmShellCmdRunAxfLib
@ -36,5 +37,8 @@
MemoryAllocationLib
UefiDriverEntryPoint
[Guids]
gZeroGuid
[Protocols]
gEfiDevicePathProtocolGuid

View File

@ -24,6 +24,8 @@
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Guid/ZeroGuid.h>
#include <VExpressMotherBoard.h>
// This 'enum' is needed as variations based on existing platform exist
@ -36,12 +38,8 @@ typedef enum {
ARM_FVP_VEXPRESS_A15x1_A7x1,
ARM_FVP_VEXPRESS_A15x4_A7x4,
ARM_FVP_VEXPRESS_AEMv8x4,
ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2,
ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY,
ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3,
ARM_FVP_FOUNDATION_GICV2,
ARM_FVP_FOUNDATION_GICV2_LEGACY,
ARM_FVP_FOUNDATION_GICV3,
ARM_FVP_BASE,
ARM_FVP_FOUNDATION,
ARM_HW_A9x4,
ARM_HW_A15x2_A7x3,
ARM_HW_A15,

View File

@ -73,9 +73,5 @@
# AArch64 FVP platforms
gArmVExpressTokenSpaceGuid.PcdFdtFvpVExpressAEMv8x4|{ 0xa8, 0x95, 0x5f, 0xf6, 0x32, 0x7b, 0xf3, 0x16, 0x12, 0x32, 0x45, 0x50, 0xbd, 0x54, 0xca, 0xe5 }|VOID*|0x00000010
gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV2|{ 0x66, 0xcf, 0x57, 0xa4, 0xac, 0x7e, 0x7f, 0x3d, 0x21, 0x88, 0x3a, 0x58, 0x3c, 0x27, 0xd7, 0xe8 }|VOID*|0x00000011
gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV2Legacy|{ 0x8b, 0xcb, 0xe0, 0x14, 0xd1, 0x46, 0x79, 0xae, 0x7f, 0x20, 0xcf, 0x84, 0x22, 0xc7, 0x94, 0x4a }|VOID*|0x00000012
gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4GicV3|{ 0x4d, 0x03, 0xb8, 0x77, 0x63, 0x25, 0x0a, 0x7f, 0xe9, 0x72, 0xfa, 0x68, 0x74, 0xc7, 0x5e, 0xb5 }|VOID*|0x00000013
gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV2|{ 0x36, 0x4f, 0x61, 0x92, 0x86, 0xb1, 0xa2, 0x16, 0x32, 0x65, 0x35, 0x3f, 0x01, 0xf3, 0x3b, 0x64 }|VOID*|0x00000014
gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV2Legacy|{ 0xf6, 0xcb, 0x9d, 0x86, 0x38, 0x74, 0x8a, 0xb0, 0xfe, 0x40, 0x08, 0x0f, 0x3f, 0xb3, 0x50, 0x7c }|VOID*|0x00000015
gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundationGicV3|{ 0x51, 0xd0, 0x75, 0x6b, 0x9d, 0x35, 0x1b, 0x1b, 0xa6, 0xc6, 0xab, 0xa0, 0x90, 0xf9, 0xf0, 0x0a }|VOID*|0x00000016
gArmVExpressTokenSpaceGuid.PcdFdtFvpBaseAEMv8x4|{ 0x66, 0xcf, 0x57, 0xa4, 0xac, 0x7e, 0x7f, 0x3d, 0x21, 0x88, 0x3a, 0x58, 0x3c, 0x27, 0xd7, 0xe8 }|VOID*|0x00000011
gArmVExpressTokenSpaceGuid.PcdFdtFvpFoundation|{ 0x36, 0x4f, 0x61, 0x92, 0x86, 0xb1, 0xa2, 0x16, 0x32, 0x65, 0x35, 0x3f, 0x01, 0xf3, 0x3b, 0x64 }|VOID*|0x00000014