[edk2-devel] [PATCH V4] MdeModulePkg/PciBusDxe: Improve the flow of testing support attributes

Ni, Ray ray.ni at intel.com
Fri Sep 24 06:14:04 UTC 2021


You can only carry "Reviewed-by" when the person replied "Reviewed-by: ...".
Reviewing the patch and providing comments don't mean you get the "Reviewed-by".

Reviewed-by: Ray Ni <ray.ni at intel.com>

> -----Original Message-----
> From: xueshengfeng <xueshengfeng at byosoft.com.cn>
> Sent: Friday, September 24, 2021 2:03 PM
> To: devel at edk2.groups.io; Ni, Ray <ray.ni at intel.com>; Wu, Hao A <hao.a.wu at intel.com>
> Cc: Liang, PanlingX <panlingx.liang at intel.com>; Xue, ShengfengX <shengfengx.xue at intel.com>
> Subject: [PATCH V4] MdeModulePkg/PciBusDxe: Improve the flow of testing support attributes
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=3635
> 
> Currently, in order to test the supported attributes,
> the PciTestSupportedAttribute() will set the command register
> to 0x27 (EFI_PCI_COMMAND_IO_SPACE, EFI_PCI_COMMAND_MEMORY_SPACE,
> EFI_PCI_COMMAND_BUS_MASTER, EFI_PCI_COMMAND_VGA_PALETTE_SNOOP) firstly,
> and then read back to check whether these attributes are
> set successfully in the device.
> This will cause the other enabled bits
>  (other than EFI_PCI_COMMAND_IO_SPACE,EFI_PCI_COMMAND_MEMORY_SPACE,
>  EFI_PCI_COMMAND_BUS_MASTER,EFI_PCI_COMMAND_VGA_PALETTE_SNOOP)
>  be cleared for a short of time
>  This patch fixes this issue by keeping the origina
>  enabled bits when setting 0x27.
> 
> Signed-off-by: xueshengfeng <xueshengfeng at byosoft.com.cn>
> Reviewed-by: Ray <ray.ni at intel.com>
> ---
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> index db1b35f8ef..3a238d4e46 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> @@ -933,6 +933,7 @@ PciTestSupportedAttribute (
>    )
>  {
>    EFI_TPL OldTpl;
> +  UINT16  CommandValue;
> 
>    //
>    // Preserve the original value
> @@ -943,10 +944,12 @@ PciTestSupportedAttribute (
>    // Raise TPL to high level to disable timer interrupt while the BAR is probed
>    //
>    OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
> +  CommandValue = *Command | *OldCommand;
> 
> -  PCI_SET_COMMAND_REGISTER (PciIoDevice, *Command);
> -  PCI_READ_COMMAND_REGISTER (PciIoDevice, Command);
> +  PCI_SET_COMMAND_REGISTER (PciIoDevice, CommandValue);
> +  PCI_READ_COMMAND_REGISTER (PciIoDevice, &CommandValue);
> 
> +  *Command = *Command & CommandValue;
>    //
>    // Write back the original value
>    //
> --
> 2.31.1.windows.1
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81065): https://edk2.groups.io/g/devel/message/81065
Mute This Topic: https://groups.io/mt/85833310/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list