]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciPowerManagement.c
Retired PciIncompatibleDeviceSupportLib from IntelFrameworkModulePkg.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / PciBusDxe / PciPowerManagement.c
CommitLineData
eeefcb9d 1/** @file\r
8e8227d1 2 Power management support fucntions implementation for PCI Bus module.\r
3db51098 3\r
8e8227d1 4Copyright (c) 2006 - 2009, Intel Corporation\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
3db51098 12\r
13**/\r
ead42efc 14\r
03417d8d 15#include "PciBus.h"\r
ead42efc 16\r
bcd70414 17/**\r
ead42efc 18 This function is intended to turn off PWE assertion and\r
19 put the device to D0 state if the device supports\r
20 PCI Power Management.\r
21\r
8e8227d1 22 @param PciIoDevice PCI device instance.\r
23\r
24 @retval EFI_UNSUPPORTED PCI Device does not support power management.\r
25 @retval EFI_SUCCESS Turned off PWE successfully.\r
ead42efc 26\r
bcd70414 27**/\r
57076f45 28EFI_STATUS\r
29ResetPowerManagementFeature (\r
30 IN PCI_IO_DEVICE *PciIoDevice\r
31 )\r
ead42efc 32{\r
33 EFI_STATUS Status;\r
34 UINT8 PowerManagementRegBlock;\r
5326528b 35 UINT16 PowerManagementCSR;\r
ead42efc 36\r
37 PowerManagementRegBlock = 0;\r
38\r
39 Status = LocateCapabilityRegBlock (\r
40 PciIoDevice,\r
41 EFI_PCI_CAPABILITY_ID_PMI,\r
42 &PowerManagementRegBlock,\r
43 NULL\r
44 );\r
45\r
46 if (EFI_ERROR (Status)) {\r
47 return EFI_UNSUPPORTED;\r
48 }\r
49\r
50 //\r
51 // Turn off the PWE assertion and put the device into D0 State\r
52 //\r
5326528b 53 PowerManagementCSR = 0x8000;\r
ead42efc 54\r
55 //\r
56 // Write PMCSR\r
57 //\r
9eb130ff 58 PciIoDevice->PciIo.Pci.Write (\r
59 &PciIoDevice->PciIo,\r
60 EfiPciIoWidthUint16,\r
61 PowerManagementRegBlock + 4,\r
62 1,\r
63 &PowerManagementCSR\r
64 );\r
ead42efc 65\r
66 return EFI_SUCCESS;\r
67}\r
57076f45 68\r