Use the platform ID and config ID values from the platform ID
HOB to choose the right set of ACPI tables to be installed.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
---
Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 33 +++++++++++++++++---
Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf | 2 ++
Platform/ARM/SgiPkg/SgiPlatform.dsc | 1 +
Platform/ARM/SgiPkg/SgiPlatform.fdf | 1 +
4 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index edaae5b..f077a2c 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -14,6 +14,8 @@
#include <Library/AcpiLib.h>
#include <Library/DebugLib.h>
+#include <Library/HobLib.h>
+#include <SgiPlatform.h>
EFI_STATUS
InitVirtioBlockIo (
@@ -28,20 +30,41 @@ ArmSgiPkgEntryPoint (
)
{
EFI_STATUS Status;
+ VOID *PlatformIdHob;
+ SGI_PLATFORM_DESCRIPTOR *HobData;
+ UINT32 ConfigId;
+ UINT32 PartNum;
- Status = LocateAndInstallAcpiFromFv (&gSgi575AcpiTablesiFileGuid);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__));
- return Status;
+ PlatformIdHob = GetFirstGuidHob (&gArmSgiPlatformIdDescriptorGuid);
+ if (PlatformIdHob == NULL) {
+ DEBUG ((DEBUG_ERROR, "Platform ID HOB is NULL\n"));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ HobData = (SGI_PLATFORM_DESCRIPTOR *)(GET_GUID_HOB_DATA (PlatformIdHob));
+
+ PartNum = (HobData->PlatformId & SGI_PART_NUM_MASK);
+ ConfigId = ((HobData->PlatformId >> SGI_CONFIG_SHIFT) & SGI_CONFIG_MASK);
+
+ if ((PartNum == SGI575_PART_NUM) && (ConfigId == SGI575_CONF_NUM)) {
+ Status = LocateAndInstallAcpiFromFv (&gSgi575AcpiTablesiFileGuid);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__));
+ return Status;
+ }
+ } else {
+ DEBUG ((DEBUG_ERROR, "PlatformDxe: Unsupported Platform Id\n"));
+ return EFI_UNSUPPORTED;
}
- Status = EFI_REQUEST_UNLOAD_IMAGE;
if (FeaturePcdGet (PcdVirtioSupported)) {
Status = InitVirtioBlockIo (ImageHandle);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: Failed to install Virtio Block device\n",
__FUNCTION__));
}
+ } else {
+ Status = EFI_REQUEST_UNLOAD_IMAGE;
}
return Status;
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index 51ad22f..b6b8209 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -30,10 +30,12 @@
[LibraryClasses]
AcpiLib
+ HobLib
UefiDriverEntryPoint
VirtioMmioDeviceLib
[Guids]
+ gArmSgiPlatformIdDescriptorGuid
gSgi575AcpiTablesiFileGuid
[FeaturePcd]
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc b/Platform/ARM/SgiPkg/SgiPlatform.dsc
index a56175e..7b8e051 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dsc
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc
@@ -199,6 +199,7 @@
<LibraryClasses>
NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
}
+ Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
#
# DXE
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf b/Platform/ARM/SgiPkg/SgiPlatform.fdf
index 17cdf48..0e5739e 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.fdf
+++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf
@@ -220,6 +220,7 @@ READ_LOCK_STATUS = TRUE
INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
+ INF Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf
FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
--
2.7.4
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
On 15 June 2018 at 14:00, Chandni Cherukuri <chandni.cherukuri@arm.com> wrote: > Use the platform ID and config ID values from the platform ID > HOB to choose the right set of ACPI tables to be installed. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com> > --- > Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 33 +++++++++++++++++--- > Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf | 2 ++ > Platform/ARM/SgiPkg/SgiPlatform.dsc | 1 + > Platform/ARM/SgiPkg/SgiPlatform.fdf | 1 + > 4 files changed, 32 insertions(+), 5 deletions(-) > > diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c > index edaae5b..f077a2c 100644 > --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c > +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c > @@ -14,6 +14,8 @@ > > #include <Library/AcpiLib.h> > #include <Library/DebugLib.h> > +#include <Library/HobLib.h> > +#include <SgiPlatform.h> > > EFI_STATUS > InitVirtioBlockIo ( > @@ -28,20 +30,41 @@ ArmSgiPkgEntryPoint ( > ) > { > EFI_STATUS Status; > + VOID *PlatformIdHob; > + SGI_PLATFORM_DESCRIPTOR *HobData; > + UINT32 ConfigId; > + UINT32 PartNum; > > - Status = LocateAndInstallAcpiFromFv (&gSgi575AcpiTablesiFileGuid); > - if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__)); > - return Status; > + PlatformIdHob = GetFirstGuidHob (&gArmSgiPlatformIdDescriptorGuid); > + if (PlatformIdHob == NULL) { > + DEBUG ((DEBUG_ERROR, "Platform ID HOB is NULL\n")); > + return EFI_INVALID_PARAMETER; > + } > + > + HobData = (SGI_PLATFORM_DESCRIPTOR *)(GET_GUID_HOB_DATA (PlatformIdHob)); > + > + PartNum = (HobData->PlatformId & SGI_PART_NUM_MASK); > + ConfigId = ((HobData->PlatformId >> SGI_CONFIG_SHIFT) & SGI_CONFIG_MASK); > + > + if ((PartNum == SGI575_PART_NUM) && (ConfigId == SGI575_CONF_NUM)) { > + Status = LocateAndInstallAcpiFromFv (&gSgi575AcpiTablesiFileGuid); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__)); > + return Status; > + } > + } else { > + DEBUG ((DEBUG_ERROR, "PlatformDxe: Unsupported Platform Id\n")); > + return EFI_UNSUPPORTED; > } > > - Status = EFI_REQUEST_UNLOAD_IMAGE; > if (FeaturePcdGet (PcdVirtioSupported)) { > Status = InitVirtioBlockIo (ImageHandle); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: Failed to install Virtio Block device\n", > __FUNCTION__)); > } > + } else { > + Status = EFI_REQUEST_UNLOAD_IMAGE; > } > This is an unrelated (and unnecessary) change. > return Status; > diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf > index 51ad22f..b6b8209 100644 > --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf > +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf > @@ -30,10 +30,12 @@ > > [LibraryClasses] > AcpiLib > + HobLib > UefiDriverEntryPoint > VirtioMmioDeviceLib > > [Guids] > + gArmSgiPlatformIdDescriptorGuid > gSgi575AcpiTablesiFileGuid > > [FeaturePcd] > diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc b/Platform/ARM/SgiPkg/SgiPlatform.dsc > index a56175e..7b8e051 100644 > --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc > +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc > @@ -199,6 +199,7 @@ > <LibraryClasses> > NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf > } > + Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf > > # > # DXE > diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf b/Platform/ARM/SgiPkg/SgiPlatform.fdf > index 17cdf48..0e5739e 100644 > --- a/Platform/ARM/SgiPkg/SgiPlatform.fdf > +++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf > @@ -220,6 +220,7 @@ READ_LOCK_STATUS = TRUE > INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf > INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf > INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf > + INF Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf > > FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { > SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { > -- > 2.7.4 > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
On Fri, Jun 15, 2018 at 6:35 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote: > On 15 June 2018 at 14:00, Chandni Cherukuri <chandni.cherukuri@arm.com> wrote: >> Use the platform ID and config ID values from the platform ID >> HOB to choose the right set of ACPI tables to be installed. >> >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com> >> --- >> Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 33 +++++++++++++++++--- >> Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf | 2 ++ >> Platform/ARM/SgiPkg/SgiPlatform.dsc | 1 + >> Platform/ARM/SgiPkg/SgiPlatform.fdf | 1 + >> 4 files changed, 32 insertions(+), 5 deletions(-) >> >> diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c >> index edaae5b..f077a2c 100644 >> --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c >> +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c >> @@ -14,6 +14,8 @@ >> >> #include <Library/AcpiLib.h> >> #include <Library/DebugLib.h> >> +#include <Library/HobLib.h> >> +#include <SgiPlatform.h> >> >> EFI_STATUS >> InitVirtioBlockIo ( >> @@ -28,20 +30,41 @@ ArmSgiPkgEntryPoint ( >> ) >> { >> EFI_STATUS Status; >> + VOID *PlatformIdHob; >> + SGI_PLATFORM_DESCRIPTOR *HobData; >> + UINT32 ConfigId; >> + UINT32 PartNum; >> >> - Status = LocateAndInstallAcpiFromFv (&gSgi575AcpiTablesiFileGuid); >> - if (EFI_ERROR (Status)) { >> - DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__)); >> - return Status; >> + PlatformIdHob = GetFirstGuidHob (&gArmSgiPlatformIdDescriptorGuid); >> + if (PlatformIdHob == NULL) { >> + DEBUG ((DEBUG_ERROR, "Platform ID HOB is NULL\n")); >> + return EFI_INVALID_PARAMETER; >> + } >> + >> + HobData = (SGI_PLATFORM_DESCRIPTOR *)(GET_GUID_HOB_DATA (PlatformIdHob)); >> + >> + PartNum = (HobData->PlatformId & SGI_PART_NUM_MASK); >> + ConfigId = ((HobData->PlatformId >> SGI_CONFIG_SHIFT) & SGI_CONFIG_MASK); >> + >> + if ((PartNum == SGI575_PART_NUM) && (ConfigId == SGI575_CONF_NUM)) { >> + Status = LocateAndInstallAcpiFromFv (&gSgi575AcpiTablesiFileGuid); >> + if (EFI_ERROR (Status)) { >> + DEBUG ((DEBUG_ERROR, "%a: Failed to install ACPI tables\n", __FUNCTION__)); >> + return Status; >> + } >> + } else { >> + DEBUG ((DEBUG_ERROR, "PlatformDxe: Unsupported Platform Id\n")); >> + return EFI_UNSUPPORTED; >> } >> > > >> - Status = EFI_REQUEST_UNLOAD_IMAGE; >> if (FeaturePcdGet (PcdVirtioSupported)) { >> Status = InitVirtioBlockIo (ImageHandle); >> if (EFI_ERROR (Status)) { >> DEBUG ((DEBUG_ERROR, "%a: Failed to install Virtio Block device\n", >> __FUNCTION__)); >> } >> + } else { >> + Status = EFI_REQUEST_UNLOAD_IMAGE; >> } >> > > This is an unrelated (and unnecessary) change. removed this unrelated change in v3 patchset > > >> return Status; >> diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf >> index 51ad22f..b6b8209 100644 >> --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf >> +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf >> @@ -30,10 +30,12 @@ >> >> [LibraryClasses] >> AcpiLib >> + HobLib >> UefiDriverEntryPoint >> VirtioMmioDeviceLib >> >> [Guids] >> + gArmSgiPlatformIdDescriptorGuid >> gSgi575AcpiTablesiFileGuid >> >> [FeaturePcd] >> diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc b/Platform/ARM/SgiPkg/SgiPlatform.dsc >> index a56175e..7b8e051 100644 >> --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc >> +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc >> @@ -199,6 +199,7 @@ >> <LibraryClasses> >> NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf >> } >> + Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf >> >> # >> # DXE >> diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf b/Platform/ARM/SgiPkg/SgiPlatform.fdf >> index 17cdf48..0e5739e 100644 >> --- a/Platform/ARM/SgiPkg/SgiPlatform.fdf >> +++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf >> @@ -220,6 +220,7 @@ READ_LOCK_STATUS = TRUE >> INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf >> INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf >> INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf >> + INF Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPei.inf >> >> FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { >> SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { >> -- >> 2.7.4 >> > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.