Re: [edk2] [PATCH v2] ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
On 2016/6/25 11:05, Andrew Fish wrote: >> > On Jun 24, 2016, at 7:50 PM, Shannon Zhaowrote: >> > >> > >> > >> > On 2016/6/23 21:42, Ard Biesheuvel wrote: > + // > + // Get the RSDP structure address from DeviceTree > + // > + Status = gBS->LocateProtocol (, NULL, >>> >> Please add gFdtClientProtocolGuid to the [Depex] section of this module >>> >> >> > Hi Ard, >> > >> > I try to add gFdtClientProtocolGuid to the [Depex] but I got a compiling >> > error. >> > >> > build.py... >> > : error F001: Invalid dependency expression: missing operator before { >> > 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, >> > 0x4C } } >> >Near { 0xFFE06BDD, 0x6107, 0x46A6, { 0x7B, 0xB2, 0x5A, 0x9C, >> > 0x7E, 0xC5, 0x27, 0x5C }} >> > > That is not a common error. Can you attach you INF file? It sounds like a > syntax error in the [Depex]? Ah, right. I missed the AND between two elements of [Depex]. Thanks so much :) -- Shannon ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2] ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
> On Jun 24, 2016, at 7:50 PM, Shannon Zhaowrote: > > > > On 2016/6/23 21:42, Ard Biesheuvel wrote: + // + // Get the RSDP structure address from DeviceTree + // + Status = gBS->LocateProtocol (, NULL, >> Please add gFdtClientProtocolGuid to the [Depex] section of this module >> > Hi Ard, > > I try to add gFdtClientProtocolGuid to the [Depex] but I got a compiling > error. > > build.py... > : error F001: Invalid dependency expression: missing operator before { > 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, > 0x4C } } >Near { 0xFFE06BDD, 0x6107, 0x46A6, { 0x7B, 0xB2, 0x5A, 0x9C, > 0x7E, 0xC5, 0x27, 0x5C }} > That is not a common error. Can you attach you INF file? It sounds like a syntax error in the [Depex]? Thanks, Andrew Fish > How to deal with this problem? > > Thanks, > -- > Shannon > > ___ > 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
Re: [edk2] [PATCH v2] ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
On 2016/6/23 21:42, Ard Biesheuvel wrote: >> > + // >> > + // Get the RSDP structure address from DeviceTree >> > + // >> > + Status = gBS->LocateProtocol (, NULL, > Please add gFdtClientProtocolGuid to the [Depex] section of this module > Hi Ard, I try to add gFdtClientProtocolGuid to the [Depex] but I got a compiling error. build.py... : error F001: Invalid dependency expression: missing operator before { 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, 0x4C } } Near { 0xFFE06BDD, 0x6107, 0x46A6, { 0x7B, 0xB2, 0x5A, 0x9C, 0x7E, 0xC5, 0x27, 0x5C }} How to deal with this problem? Thanks, -- Shannon ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2] ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
On 23 June 2016 at 13:31, Shannon Zhaowrote: > From: Shannon Zhao > > Add ACPI support for Virt Xen ARM and only for aarch64. It gets the > ACPI tables through Xen ARM multiboot protocol. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Shannon Zhao > --- > Changes since v1: > * move the codes into ArmVirtPkg > * use FdtClient > * don't rely on OvmfPkg/AcpiPlatformDxe/EntryPoint.c while implement own > entry point since it's minor > * use compatible string to find the DT node instead of node path > > If you want to test, the corresponding Xen patches can be fetched from: > https://git.linaro.org/people/shannon.zhao/xen.git domu_acpi_v2 > --- > ArmVirtPkg/ArmVirtXen.dsc | 8 + > ArmVirtPkg/ArmVirtXen.fdf | 8 + > ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c | 241 > + > .../XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf | 49 + > 4 files changed, 306 insertions(+) > create mode 100644 ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c > create mode 100644 ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf > > diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc > index 594ca64..a869986 100644 > --- a/ArmVirtPkg/ArmVirtXen.dsc > +++ b/ArmVirtPkg/ArmVirtXen.dsc > @@ -216,3 +216,11 @@ > >OvmfPkg/XenBusDxe/XenBusDxe.inf >OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf > + > + # > + # ACPI support > + # > +!if $(ARCH) == AARCH64 > + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > + ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf > +!endif > diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf > index 13412f9..b1e00e5 100644 > --- a/ArmVirtPkg/ArmVirtXen.fdf > +++ b/ArmVirtPkg/ArmVirtXen.fdf > @@ -179,6 +179,14 @@ READ_LOCK_STATUS = TRUE >INF OvmfPkg/XenBusDxe/XenBusDxe.inf >INF OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf > > + # > + # ACPI support > + # > +!if $(ARCH) == AARCH64 > + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > + INF ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf > +!endif > + > [FV.FVMAIN_COMPACT] > FvAlignment= 16 > ERASE_POLARITY = 1 > diff --git a/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c > b/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c > new file mode 100644 > index 000..9258be8 > --- /dev/null > +++ b/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c > @@ -0,0 +1,241 @@ > +/** @file > + Xen ARM ACPI Platform Driver using Xen ARM multiboot protocol > + > + Copyright (C) 2016, Linaro 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 > +#include > +#include > +#include > + > +#include > +#include > + > +#include > + > +EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *XenAcpiRsdpStructurePtr = > NULL; > + Does this need to be a global? If yes, please add STATIC, and prefix the name with 'm'. Otherwise, move it into InstallXenArmTables (). > +/** > + Get the address of Xen ACPI Root System Description Pointer (RSDP) > + structure. > + > + @param RsdpStructurePtr Return pointer to RSDP structure > + > + @return EFI_SUCCESSFind Xen RSDP structure successfully. > + @return EFI_NOT_FOUND Don't find Xen RSDP structure. > + @return EFI_ABORTEDFind Xen RSDP structure, but it's not > integrated. > + > +**/ > +EFI_STATUS > +EFIAPI > +GetXenArmAcpiRsdp ( ... and here > + OUT EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER **RsdpPtr > + ) > +{ > + EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *RsdpStructurePtr; > + EFI_STATUS Status; > + FDT_CLIENT_PROTOCOL*FdtClient; > + CONST UINT64 *Reg; > + UINT32 RegElemSize, RegSize; > + UINT64 RegBase; > + UINT8 Sum; > + > + RsdpStructurePtr = NULL; Please initialize FdtClient to NULL here. > + // > + // Get the RSDP structure address from DeviceTree > + // > + Status = gBS->LocateProtocol (, NULL, Please add gFdtClientProtocolGuid to the [Depex] section of this module > + (VOID **)); > + ASSERT_EFI_ERROR (Status); > + > + Status = FdtClient->FindCompatibleNodeReg (FdtClient, "xen,guest-acpi", > +(CONST VOID **), , ); > + if (EFI_ERROR (Status)) { > +DEBUG ((EFI_D_WARN, "%a: No
[edk2] [PATCH v2] ArmVirtPkg/ArmVirtXen: Add ACPI support for Virt Xen ARM
From: Shannon ZhaoAdd ACPI support for Virt Xen ARM and only for aarch64. It gets the ACPI tables through Xen ARM multiboot protocol. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Shannon Zhao --- Changes since v1: * move the codes into ArmVirtPkg * use FdtClient * don't rely on OvmfPkg/AcpiPlatformDxe/EntryPoint.c while implement own entry point since it's minor * use compatible string to find the DT node instead of node path If you want to test, the corresponding Xen patches can be fetched from: https://git.linaro.org/people/shannon.zhao/xen.git domu_acpi_v2 --- ArmVirtPkg/ArmVirtXen.dsc | 8 + ArmVirtPkg/ArmVirtXen.fdf | 8 + ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c | 241 + .../XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf | 49 + 4 files changed, 306 insertions(+) create mode 100644 ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c create mode 100644 ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc index 594ca64..a869986 100644 --- a/ArmVirtPkg/ArmVirtXen.dsc +++ b/ArmVirtPkg/ArmVirtXen.dsc @@ -216,3 +216,11 @@ OvmfPkg/XenBusDxe/XenBusDxe.inf OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf + + # + # ACPI support + # +!if $(ARCH) == AARCH64 + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf +!endif diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf index 13412f9..b1e00e5 100644 --- a/ArmVirtPkg/ArmVirtXen.fdf +++ b/ArmVirtPkg/ArmVirtXen.fdf @@ -179,6 +179,14 @@ READ_LOCK_STATUS = TRUE INF OvmfPkg/XenBusDxe/XenBusDxe.inf INF OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf + # + # ACPI support + # +!if $(ARCH) == AARCH64 + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + INF ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf +!endif + [FV.FVMAIN_COMPACT] FvAlignment= 16 ERASE_POLARITY = 1 diff --git a/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c b/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c new file mode 100644 index 000..9258be8 --- /dev/null +++ b/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c @@ -0,0 +1,241 @@ +/** @file + Xen ARM ACPI Platform Driver using Xen ARM multiboot protocol + + Copyright (C) 2016, Linaro 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 +#include +#include +#include + +#include +#include + +#include + +EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *XenAcpiRsdpStructurePtr = NULL; + +/** + Get the address of Xen ACPI Root System Description Pointer (RSDP) + structure. + + @param RsdpStructurePtr Return pointer to RSDP structure + + @return EFI_SUCCESSFind Xen RSDP structure successfully. + @return EFI_NOT_FOUND Don't find Xen RSDP structure. + @return EFI_ABORTEDFind Xen RSDP structure, but it's not integrated. + +**/ +EFI_STATUS +EFIAPI +GetXenArmAcpiRsdp ( + OUT EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER **RsdpPtr + ) +{ + EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *RsdpStructurePtr; + EFI_STATUS Status; + FDT_CLIENT_PROTOCOL*FdtClient; + CONST UINT64 *Reg; + UINT32 RegElemSize, RegSize; + UINT64 RegBase; + UINT8 Sum; + + RsdpStructurePtr = NULL; + // + // Get the RSDP structure address from DeviceTree + // + Status = gBS->LocateProtocol (, NULL, + (VOID **)); + ASSERT_EFI_ERROR (Status); + + Status = FdtClient->FindCompatibleNodeReg (FdtClient, "xen,guest-acpi", +(CONST VOID **), , ); + if (EFI_ERROR (Status)) { +DEBUG ((EFI_D_WARN, "%a: No 'xen,guest-acpi' compatible DT node found\n", + __FUNCTION__)); +return EFI_NOT_FOUND; + } + + ASSERT (RegSize == 2 * sizeof (UINT64)); + + RegBase = SwapBytes64(Reg[0]); + RsdpStructurePtr = (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)RegBase; + + if (RsdpStructurePtr && RsdpStructurePtr->Revision >= 2) { +Sum = CalculateSum8 ((CONST UINT8 *)RsdpStructurePtr, +sizeof (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER)); +if (Sum != 0) { + return EFI_ABORTED; +} + } + + *RsdpPtr = RsdpStructurePtr; + return EFI_SUCCESS; +} + +/** + Get Xen Acpi tables from the RSDP