Shengfeng: 
  Please update the patch title as PackageName ModuleName: Description. 
  And, please run BaseTools\Scripts\PatchCheck.py to check the patch format.

  
  For this patch, I don't review the code change. Please remove my
reviewed-by. 

Thanks
Liming
> -----邮件原件-----
> 发件人: xueshengfeng <xueshengf...@byosoft.com.cn>
> 发送时间: 2021年9月22日 18:10
> 收件人: devel@edk2.groups.io; gaolim...@byosoft.com.cn;
> hao.a...@intel.com; ray...@intel.com
> 抄送: shengfengx....@intel.com; panlingx.li...@intel.com
> 主题: [PATCH V2] On branch PCIBus dulePkg/PciBusDxe:
> PciTestSupportedAttribute logic should be changed.
> 
>  REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3635
> 
>  Currently, PciTestSupportedAttribute() set the bits
>  (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 whethers these attributes are set
>    successfully in the device.
>    The flow is below:
>    1), read the original register value
>    2), set to the input register value
>    3), read back the register value, return this value as output 4),
>      restore the original value.
> 
>    This flow 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.
>    Below are the new suggested flow:
>    1), read the original register value.
>    2), set to input register value OR(|) the original register value.
>    3), read back the register value, return the value AND(&) the input
>      command value as output.
>    4), restore the original value
> 
>      This flow can keep the enabled bits unchanged, and keep the
>      original function feature.
> 
>      Signed-off-by: shengfengx....@intel.com
>      Reviewed-by: gaolim...@byosoft.com.cn
> ---
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> index db1b35f8ef..542e84424b 100644
> --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
> @@ -933,6 +933,7 @@ PciTestSupportedAttribute (
>    )
>  {
>    EFI_TPL OldTpl;
> +  UINT16  CommandTemp;
> 
>    //
>    // Preserve the original value
> @@ -944,9 +945,10 @@ PciTestSupportedAttribute (
>    //
>    OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
> 
> -  PCI_SET_COMMAND_REGISTER (PciIoDevice, *Command);
> -  PCI_READ_COMMAND_REGISTER (PciIoDevice, Command);
> +  PCI_SET_COMMAND_REGISTER (PciIoDevice, (*Command |
> *OldCommand));
> +  PCI_READ_COMMAND_REGISTER (PciIoDevice, &CommandTemp);
> 
> +  *Command = (*Command) & CommandTemp;
>    //
>    // Write back the original value
>    //
> --
> 2.31.1.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81005): https://edk2.groups.io/g/devel/message/81005
Mute This Topic: https://groups.io/mt/85806306/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to