2 Power management support functions implementation for PCI Bus module.
4 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
12 This function is intended to turn off PWE assertion and
13 put the device to D0 state if the device supports
16 @param PciIoDevice PCI device instance.
18 @retval EFI_UNSUPPORTED PCI Device does not support power management.
19 @retval EFI_SUCCESS Turned off PWE successfully.
23 ResetPowerManagementFeature (
24 IN PCI_IO_DEVICE
*PciIoDevice
28 UINT8 PowerManagementRegBlock
;
29 UINT16 PowerManagementCSR
;
31 PowerManagementRegBlock
= 0;
33 Status
= LocateCapabilityRegBlock (
35 EFI_PCI_CAPABILITY_ID_PMI
,
36 &PowerManagementRegBlock
,
40 if (EFI_ERROR (Status
)) {
41 return EFI_UNSUPPORTED
;
45 // Turn off the PWE assertion and put the device into D0 State
51 Status
= PciIoDevice
->PciIo
.Pci
.Read (
54 PowerManagementRegBlock
+ 4,
59 if (!EFI_ERROR (Status
)) {
61 // Clear PME_Status bit
63 PowerManagementCSR
|= BIT15
;
65 // Clear PME_En bit. PowerState = D0.
67 PowerManagementCSR
&= ~(BIT8
| BIT1
| BIT0
);
72 Status
= PciIoDevice
->PciIo
.Pci
.Write (
75 PowerManagementRegBlock
+ 4,