Re: [edk2-devel] [PATCH v3 2/7] OvmfPkg: Add the way of HOBs in QemuFwCfgLibMmio
Hi Ard, Thanks, Chao On 2024/4/26 09:20, Chao Li wrote: Hi Ard, On 2024/4/25 21:02, Ard Biesheuvel wrote: On Thu, 25 Apr 2024 at 14:13, Chao Li wrote: Added the HOB methods to load and store the QEMU firmware configure address, data address and DMA address, which are not enabled during the DXE stage. Build-tested only (with "ArmVirtQemu.dsc and RiscVVirtQemu.dsc"). BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=4755 Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Leif Lindholm Cc: Sami Mujawar Cc: Sunil V L Cc: Andrei Warkentin Signed-off-by: Chao Li --- .../Library/QemuFwCfgLib/QemuFwCfgLibMmio.c | 81 +++-- .../Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf | 1 + .../QemuFwCfgLib/QemuFwCfgLibMmioInternal.h | 74 +++ .../Library/QemuFwCfgLib/QemuFwCfgMmioDxe.c | 91 --- 4 files changed, 226 insertions(+), 21 deletions(-) diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c index dc949c8e26..b5dbc5e4b5 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c @@ -8,11 +8,16 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ +#include #include +#include +#include + #include #include #include +#include #include #include #include @@ -21,6 +26,62 @@ #include "QemuFwCfgLibMmioInternal.h" +EFI_GUID mFwCfgResourceGuid = FW_CONFIG_RESOURCE_HOB_GUID; + +/** + Build firmware configure resource address HOB. + + @param[in] FwCfgResource A pointer to firmware configure resource. + + @retval NULL +**/ +VOID +QemuBuildFwCfgResourceHob ( + IN QEMU_FW_CFG_RESOURCE *FwCfgResource + ) +{ + UINT64 Data64; + + Data64 = (UINT64)(UINTN)FwCfgResource; + + BuildGuidDataHob ( +&mFwCfgResourceGuid, +(VOID *)&Data64, This looks wrong: why are you taking the address of the stack variable rather than the address of the resource descriptor? It only saves the pointer of FwCfgResource, and the memory space has been created in the PEI constructor. Do you mean saving all contents of FwCfgResource in the HOB? The following line is indeed wrong. if only save the pointer, the size should be "sizeof (UINT64)". I will save the real HOB data in the next version. +sizeof (QEMU_FW_CFG_RESOURCE) +); +} + +/** + Get firmware configure resource in HOB. + + @param VOID + + @retval FwCfgResourceThe firmware configure resouce in HOB. resource All right. + NULL The firmware configure resouce not found. +**/ +QEMU_FW_CFG_RESOURCE * +QemuGetFwCfgResourceHob ( + VOID + ) +{ + EFI_HOB_GUID_TYPE *GuidHob; + VOID *DataInHob; + QEMU_FW_CFG_RESOURCE *FwCfgResource; + + GuidHob = NULL; + DataInHob = NULL; + + GuidHob = GetFirstGuidHob (&mFwCfgResourceGuid); Please define this GUID in the package .DEC file and add it to the [Guids] section in the .INF so that you can refer to its name directly. OK. + if (GuidHob == NULL) { +return NULL; + } + + DataInHob = GET_GUID_HOB_DATA (GuidHob); + FwCfgResource = (QEMU_FW_CFG_RESOURCE *)(*(UINTN *)DataInHob); + + return FwCfgResource; +} + /** Returns a boolean indicating if the firmware configuration interface is available or not. @@ -37,7 +98,7 @@ QemuFwCfgIsAvailable ( VOID ) { - return (BOOLEAN)(mFwCfgSelectorAddress != 0 && mFwCfgDataAddress != 0); + return (BOOLEAN)(QemuGetFwCfgSelectorAddress () != 0 && QemuGetFwCfgDataAddress () != 0); } /** @@ -56,7 +117,7 @@ QemuFwCfgSelectItem ( ) { if (QemuFwCfgIsAvailable ()) { -MmioWrite16 (mFwCfgSelectorAddress, SwapBytes16 ((UINT16)QemuFwCfgItem)); +MmioWrite16 (QemuGetFwCfgSelectorAddress (), SwapBytes16 ((UINT16)QemuFwCfgItem)); } } @@ -86,30 +147,30 @@ MmioReadBytes ( #if defined (MDE_CPU_AARCH64) || defined (MDE_CPU_RISCV64) || defined (MDE_CPU_LOONGARCH64) while (Ptr < End) { -*(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress); +*(UINT64 *)Ptr = MmioRead64 (QemuGetFwCfgDataAddress ()); Ptr += 8; } if (Left & 4) { -*(UINT32 *)Ptr = MmioRead32 (mFwCfgDataAddress); +*(UINT32 *)Ptr = MmioRead32 (QemuGetFwCfgDataAddress ()); Ptr += 4; } #else while (Ptr < End) { -*(UINT32 *)Ptr = MmioRead32 (mFwCfgDataAddress); +*(UINT32 *)Ptr = MmioRead32 (QemuGetFwCfgDataAddress ()); Ptr += 4; } #endif if (Left & 2) { -*(UINT16 *)Ptr = MmioRead16 (mFwCfgDataAddress); +*(UINT16 *)Ptr = MmioRead16 (QemuGetFwCfgDataAddress ()); Ptr += 2; } if (Left & 1) { -*Ptr = MmioRead8 (mFwCfgDataAddress); +*Ptr = MmioRead8 (QemuGetFwCfgDataAddress ()); } } @@ -162,9 +223,9 @@ DmaTransferBytes ( // This will fire off the transfer. // #if defined (MDE_CPU_AARCH64) || defined (MDE_CPU_RISCV64) || defined (MDE_CPU_LOONGARCH64) - MmioWrite64
Re: [edk2-devel] [PATCH v3 2/7] OvmfPkg: Add the way of HOBs in QemuFwCfgLibMmio
Hi Ard, Thanks, Chao On 2024/4/25 21:02, Ard Biesheuvel wrote: On Thu, 25 Apr 2024 at 14:13, Chao Li wrote: Added the HOB methods to load and store the QEMU firmware configure address, data address and DMA address, which are not enabled during the DXE stage. Build-tested only (with "ArmVirtQemu.dsc and RiscVVirtQemu.dsc"). BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=4755 Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Leif Lindholm Cc: Sami Mujawar Cc: Sunil V L Cc: Andrei Warkentin Signed-off-by: Chao Li --- .../Library/QemuFwCfgLib/QemuFwCfgLibMmio.c | 81 +++-- .../Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf | 1 + .../QemuFwCfgLib/QemuFwCfgLibMmioInternal.h | 74 +++ .../Library/QemuFwCfgLib/QemuFwCfgMmioDxe.c | 91 --- 4 files changed, 226 insertions(+), 21 deletions(-) diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c index dc949c8e26..b5dbc5e4b5 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c @@ -8,11 +8,16 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ +#include #include +#include +#include + #include #include #include +#include #include #include #include @@ -21,6 +26,62 @@ #include "QemuFwCfgLibMmioInternal.h" +EFI_GUID mFwCfgResourceGuid = FW_CONFIG_RESOURCE_HOB_GUID; + +/** + Build firmware configure resource address HOB. + + @param[in] FwCfgResource A pointer to firmware configure resource. + + @retval NULL +**/ +VOID +QemuBuildFwCfgResourceHob ( + IN QEMU_FW_CFG_RESOURCE *FwCfgResource + ) +{ + UINT64 Data64; + + Data64 = (UINT64)(UINTN)FwCfgResource; + + BuildGuidDataHob ( +&mFwCfgResourceGuid, +(VOID *)&Data64, This looks wrong: why are you taking the address of the stack variable rather than the address of the resource descriptor? It only saves the pointer of FwCfgResource, and the memory space has been created in the PEI constructor. Do you mean saving all contents of FwCfgResource in the HOB? The following line is indeed wrong. if only save the pointer, the size should be "sizeof (UINT64)". +sizeof (QEMU_FW_CFG_RESOURCE) +); +} + +/** + Get firmware configure resource in HOB. + + @param VOID + + @retval FwCfgResourceThe firmware configure resouce in HOB. resource All right. + NULL The firmware configure resouce not found. +**/ +QEMU_FW_CFG_RESOURCE * +QemuGetFwCfgResourceHob ( + VOID + ) +{ + EFI_HOB_GUID_TYPE *GuidHob; + VOID *DataInHob; + QEMU_FW_CFG_RESOURCE *FwCfgResource; + + GuidHob = NULL; + DataInHob = NULL; + + GuidHob = GetFirstGuidHob (&mFwCfgResourceGuid); Please define this GUID in the package .DEC file and add it to the [Guids] section in the .INF so that you can refer to its name directly. OK. + if (GuidHob == NULL) { +return NULL; + } + + DataInHob = GET_GUID_HOB_DATA (GuidHob); + FwCfgResource = (QEMU_FW_CFG_RESOURCE *)(*(UINTN *)DataInHob); + + return FwCfgResource; +} + /** Returns a boolean indicating if the firmware configuration interface is available or not. @@ -37,7 +98,7 @@ QemuFwCfgIsAvailable ( VOID ) { - return (BOOLEAN)(mFwCfgSelectorAddress != 0 && mFwCfgDataAddress != 0); + return (BOOLEAN)(QemuGetFwCfgSelectorAddress () != 0 && QemuGetFwCfgDataAddress () != 0); } /** @@ -56,7 +117,7 @@ QemuFwCfgSelectItem ( ) { if (QemuFwCfgIsAvailable ()) { -MmioWrite16 (mFwCfgSelectorAddress, SwapBytes16 ((UINT16)QemuFwCfgItem)); +MmioWrite16 (QemuGetFwCfgSelectorAddress (), SwapBytes16 ((UINT16)QemuFwCfgItem)); } } @@ -86,30 +147,30 @@ MmioReadBytes ( #if defined (MDE_CPU_AARCH64) || defined (MDE_CPU_RISCV64) || defined (MDE_CPU_LOONGARCH64) while (Ptr < End) { -*(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress); +*(UINT64 *)Ptr = MmioRead64 (QemuGetFwCfgDataAddress ()); Ptr += 8; } if (Left & 4) { -*(UINT32 *)Ptr = MmioRead32 (mFwCfgDataAddress); +*(UINT32 *)Ptr = MmioRead32 (QemuGetFwCfgDataAddress ()); Ptr += 4; } #else while (Ptr < End) { -*(UINT32 *)Ptr = MmioRead32 (mFwCfgDataAddress); +*(UINT32 *)Ptr = MmioRead32 (QemuGetFwCfgDataAddress ()); Ptr += 4; } #endif if (Left & 2) { -*(UINT16 *)Ptr = MmioRead16 (mFwCfgDataAddress); +*(UINT16 *)Ptr = MmioRead16 (QemuGetFwCfgDataAddress ()); Ptr += 2; } if (Left & 1) { -*Ptr = MmioRead8 (mFwCfgDataAddress); +*Ptr = MmioRead8 (QemuGetFwCfgDataAddress ()); } } @@ -162,9 +223,9 @@ DmaTransferBytes ( // This will fire off the transfer. // #if defined (MDE_CPU_AARCH64) || defined (MDE_CPU_RISCV64) || defined (MDE_CPU_LOONGARCH64) - MmioWrite64 (mFwCfgDmaAddress, SwapBytes64 ((UINT64)&Access)); + MmioWrite64 (QemuGetFwCfgDmaAddress (),
Re: [edk2-devel] [PATCH v3 2/7] OvmfPkg: Add the way of HOBs in QemuFwCfgLibMmio
On Thu, 25 Apr 2024 at 14:13, Chao Li wrote: > > Added the HOB methods to load and store the QEMU firmware configure > address, data address and DMA address, which are not enabled during the > DXE stage. > > Build-tested only (with "ArmVirtQemu.dsc and RiscVVirtQemu.dsc"). > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4755 > > Cc: Ard Biesheuvel > Cc: Jiewen Yao > Cc: Gerd Hoffmann > Cc: Leif Lindholm > Cc: Sami Mujawar > Cc: Sunil V L > Cc: Andrei Warkentin > Signed-off-by: Chao Li > --- > .../Library/QemuFwCfgLib/QemuFwCfgLibMmio.c | 81 +++-- > .../Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf | 1 + > .../QemuFwCfgLib/QemuFwCfgLibMmioInternal.h | 74 +++ > .../Library/QemuFwCfgLib/QemuFwCfgMmioDxe.c | 91 --- > 4 files changed, 226 insertions(+), 21 deletions(-) > > diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c > b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c > index dc949c8e26..b5dbc5e4b5 100644 > --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c > +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c > @@ -8,11 +8,16 @@ >SPDX-License-Identifier: BSD-2-Clause-Patent > **/ > > +#include > #include > > +#include > +#include > + > #include > #include > #include > +#include > #include > #include > #include > @@ -21,6 +26,62 @@ > > #include "QemuFwCfgLibMmioInternal.h" > > +EFI_GUID mFwCfgResourceGuid = FW_CONFIG_RESOURCE_HOB_GUID; > + > +/** > + Build firmware configure resource address HOB. > + > + @param[in] FwCfgResource A pointer to firmware configure resource. > + > + @retval NULL > +**/ > +VOID > +QemuBuildFwCfgResourceHob ( > + IN QEMU_FW_CFG_RESOURCE *FwCfgResource > + ) > +{ > + UINT64 Data64; > + > + Data64 = (UINT64)(UINTN)FwCfgResource; > + > + BuildGuidDataHob ( > +&mFwCfgResourceGuid, > +(VOID *)&Data64, This looks wrong: why are you taking the address of the stack variable rather than the address of the resource descriptor? > +sizeof (QEMU_FW_CFG_RESOURCE) > +); > +} > + > +/** > + Get firmware configure resource in HOB. > + > + @param VOID > + > + @retval FwCfgResourceThe firmware configure resouce in HOB. resource > + NULL The firmware configure resouce not found. > +**/ > +QEMU_FW_CFG_RESOURCE * > +QemuGetFwCfgResourceHob ( > + VOID > + ) > +{ > + EFI_HOB_GUID_TYPE *GuidHob; > + VOID *DataInHob; > + QEMU_FW_CFG_RESOURCE *FwCfgResource; > + > + GuidHob = NULL; > + DataInHob = NULL; > + > + GuidHob = GetFirstGuidHob (&mFwCfgResourceGuid); Please define this GUID in the package .DEC file and add it to the [Guids] section in the .INF so that you can refer to its name directly. > + if (GuidHob == NULL) { > +return NULL; > + } > + > + DataInHob = GET_GUID_HOB_DATA (GuidHob); > + FwCfgResource = (QEMU_FW_CFG_RESOURCE *)(*(UINTN *)DataInHob); > + > + return FwCfgResource; > +} > + > /** >Returns a boolean indicating if the firmware configuration interface >is available or not. > @@ -37,7 +98,7 @@ QemuFwCfgIsAvailable ( >VOID >) > { > - return (BOOLEAN)(mFwCfgSelectorAddress != 0 && mFwCfgDataAddress != 0); > + return (BOOLEAN)(QemuGetFwCfgSelectorAddress () != 0 && > QemuGetFwCfgDataAddress () != 0); > } > > /** > @@ -56,7 +117,7 @@ QemuFwCfgSelectItem ( >) > { >if (QemuFwCfgIsAvailable ()) { > -MmioWrite16 (mFwCfgSelectorAddress, SwapBytes16 ((UINT16)QemuFwCfgItem)); > +MmioWrite16 (QemuGetFwCfgSelectorAddress (), SwapBytes16 > ((UINT16)QemuFwCfgItem)); >} > } > > @@ -86,30 +147,30 @@ MmioReadBytes ( > > #if defined (MDE_CPU_AARCH64) || defined (MDE_CPU_RISCV64) || defined > (MDE_CPU_LOONGARCH64) >while (Ptr < End) { > -*(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress); > +*(UINT64 *)Ptr = MmioRead64 (QemuGetFwCfgDataAddress ()); > Ptr += 8; >} > >if (Left & 4) { > -*(UINT32 *)Ptr = MmioRead32 (mFwCfgDataAddress); > +*(UINT32 *)Ptr = MmioRead32 (QemuGetFwCfgDataAddress ()); > Ptr += 4; >} > > #else >while (Ptr < End) { > -*(UINT32 *)Ptr = MmioRead32 (mFwCfgDataAddress); > +*(UINT32 *)Ptr = MmioRead32 (QemuGetFwCfgDataAddress ()); > Ptr += 4; >} > > #endif > >if (Left & 2) { > -*(UINT16 *)Ptr = MmioRead16 (mFwCfgDataAddress); > +*(UINT16 *)Ptr = MmioRead16 (QemuGetFwCfgDataAddress ()); > Ptr += 2; >} > >if (Left & 1) { > -*Ptr = MmioRead8 (mFwCfgDataAddress); > +*Ptr = MmioRead8 (QemuGetFwCfgDataAddress ()); >} > } > > @@ -162,9 +223,9 @@ DmaTransferBytes ( >// This will fire off the transfer. >// > #if defined (MDE_CPU_AARCH64) || defined (MDE_CPU_RISCV64) || defined > (MDE_CPU_LOONGARCH64) > - MmioWrite64 (mFwCfgDmaAddress, SwapBytes64 ((UINT64)&Access)); > + MmioWrite64 (QemuGetFwCfgDmaAddress (), SwapBytes64 ((UINT64)&Access)); > #else > - MmioWrite32 ((UINT32)(mFwCfgDma
[edk2-devel] [PATCH v3 2/7] OvmfPkg: Add the way of HOBs in QemuFwCfgLibMmio
Added the HOB methods to load and store the QEMU firmware configure address, data address and DMA address, which are not enabled during the DXE stage. Build-tested only (with "ArmVirtQemu.dsc and RiscVVirtQemu.dsc"). BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4755 Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Leif Lindholm Cc: Sami Mujawar Cc: Sunil V L Cc: Andrei Warkentin Signed-off-by: Chao Li --- .../Library/QemuFwCfgLib/QemuFwCfgLibMmio.c | 81 +++-- .../Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf | 1 + .../QemuFwCfgLib/QemuFwCfgLibMmioInternal.h | 74 +++ .../Library/QemuFwCfgLib/QemuFwCfgMmioDxe.c | 91 --- 4 files changed, 226 insertions(+), 21 deletions(-) diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c index dc949c8e26..b5dbc5e4b5 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c @@ -8,11 +8,16 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ +#include #include +#include +#include + #include #include #include +#include #include #include #include @@ -21,6 +26,62 @@ #include "QemuFwCfgLibMmioInternal.h" +EFI_GUID mFwCfgResourceGuid = FW_CONFIG_RESOURCE_HOB_GUID; + +/** + Build firmware configure resource address HOB. + + @param[in] FwCfgResource A pointer to firmware configure resource. + + @retval NULL +**/ +VOID +QemuBuildFwCfgResourceHob ( + IN QEMU_FW_CFG_RESOURCE *FwCfgResource + ) +{ + UINT64 Data64; + + Data64 = (UINT64)(UINTN)FwCfgResource; + + BuildGuidDataHob ( +&mFwCfgResourceGuid, +(VOID *)&Data64, +sizeof (QEMU_FW_CFG_RESOURCE) +); +} + +/** + Get firmware configure resource in HOB. + + @param VOID + + @retval FwCfgResourceThe firmware configure resouce in HOB. + NULL The firmware configure resouce not found. +**/ +QEMU_FW_CFG_RESOURCE * +QemuGetFwCfgResourceHob ( + VOID + ) +{ + EFI_HOB_GUID_TYPE *GuidHob; + VOID *DataInHob; + QEMU_FW_CFG_RESOURCE *FwCfgResource; + + GuidHob = NULL; + DataInHob = NULL; + + GuidHob = GetFirstGuidHob (&mFwCfgResourceGuid); + if (GuidHob == NULL) { +return NULL; + } + + DataInHob = GET_GUID_HOB_DATA (GuidHob); + FwCfgResource = (QEMU_FW_CFG_RESOURCE *)(*(UINTN *)DataInHob); + + return FwCfgResource; +} + /** Returns a boolean indicating if the firmware configuration interface is available or not. @@ -37,7 +98,7 @@ QemuFwCfgIsAvailable ( VOID ) { - return (BOOLEAN)(mFwCfgSelectorAddress != 0 && mFwCfgDataAddress != 0); + return (BOOLEAN)(QemuGetFwCfgSelectorAddress () != 0 && QemuGetFwCfgDataAddress () != 0); } /** @@ -56,7 +117,7 @@ QemuFwCfgSelectItem ( ) { if (QemuFwCfgIsAvailable ()) { -MmioWrite16 (mFwCfgSelectorAddress, SwapBytes16 ((UINT16)QemuFwCfgItem)); +MmioWrite16 (QemuGetFwCfgSelectorAddress (), SwapBytes16 ((UINT16)QemuFwCfgItem)); } } @@ -86,30 +147,30 @@ MmioReadBytes ( #if defined (MDE_CPU_AARCH64) || defined (MDE_CPU_RISCV64) || defined (MDE_CPU_LOONGARCH64) while (Ptr < End) { -*(UINT64 *)Ptr = MmioRead64 (mFwCfgDataAddress); +*(UINT64 *)Ptr = MmioRead64 (QemuGetFwCfgDataAddress ()); Ptr += 8; } if (Left & 4) { -*(UINT32 *)Ptr = MmioRead32 (mFwCfgDataAddress); +*(UINT32 *)Ptr = MmioRead32 (QemuGetFwCfgDataAddress ()); Ptr += 4; } #else while (Ptr < End) { -*(UINT32 *)Ptr = MmioRead32 (mFwCfgDataAddress); +*(UINT32 *)Ptr = MmioRead32 (QemuGetFwCfgDataAddress ()); Ptr += 4; } #endif if (Left & 2) { -*(UINT16 *)Ptr = MmioRead16 (mFwCfgDataAddress); +*(UINT16 *)Ptr = MmioRead16 (QemuGetFwCfgDataAddress ()); Ptr += 2; } if (Left & 1) { -*Ptr = MmioRead8 (mFwCfgDataAddress); +*Ptr = MmioRead8 (QemuGetFwCfgDataAddress ()); } } @@ -162,9 +223,9 @@ DmaTransferBytes ( // This will fire off the transfer. // #if defined (MDE_CPU_AARCH64) || defined (MDE_CPU_RISCV64) || defined (MDE_CPU_LOONGARCH64) - MmioWrite64 (mFwCfgDmaAddress, SwapBytes64 ((UINT64)&Access)); + MmioWrite64 (QemuGetFwCfgDmaAddress (), SwapBytes64 ((UINT64)&Access)); #else - MmioWrite32 ((UINT32)(mFwCfgDmaAddress + 4), SwapBytes32 ((UINT32)&Access)); + MmioWrite32 ((UINT32)(QemuGetFwCfgDmaAddress () + 4), SwapBytes32 ((UINT32)&Access)); #endif // @@ -233,7 +294,7 @@ MmioWriteBytes ( UINTN Idx; for (Idx = 0; Idx < Size; ++Idx) { -MmioWrite8 (mFwCfgDataAddress, ((UINT8 *)Buffer)[Idx]); +MmioWrite8 (QemuGetFwCfgDataAddress (), ((UINT8 *)Buffer)[Idx]); } } diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf index f2596f270e..8e191f2d22 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.inf +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMm