2 Power management support fucntions implementation for PCI Bus module.
4 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 This function is intended to turn off PWE assertion and
19 put the device to D0 state if the device supports
22 @param PciIoDevice PCI device instance.
24 @retval EFI_UNSUPPORTED PCI Device does not support power management.
25 @retval EFI_SUCCESS Turned off PWE successfully.
29 ResetPowerManagementFeature (
30 IN PCI_IO_DEVICE
*PciIoDevice
34 UINT8 PowerManagementRegBlock
;
35 UINT16 PowerManagementCSR
;
37 PowerManagementRegBlock
= 0;
39 Status
= LocateCapabilityRegBlock (
41 EFI_PCI_CAPABILITY_ID_PMI
,
42 &PowerManagementRegBlock
,
46 if (EFI_ERROR (Status
)) {
47 return EFI_UNSUPPORTED
;
51 // Turn off the PWE assertion and put the device into D0 State
57 Status
= PciIoDevice
->PciIo
.Pci
.Read (
60 PowerManagementRegBlock
+ 4,
65 if (!EFI_ERROR (Status
)) {
67 // Clear PME_Status bit
69 PowerManagementCSR
|= BIT15
;
71 // Clear PME_En bit. PowerState = D0.
73 PowerManagementCSR
&= ~(BIT8
| BIT1
| BIT0
);
78 Status
= PciIoDevice
->PciIo
.Pci
.Write (
81 PowerManagementRegBlock
+ 4,