]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/PciBusDxe/PciPowerManagement.c
1. Correct File header to ## @file
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / PciBusDxe / PciPowerManagement.c
CommitLineData
9060e3ec 1/** @file\r
2 Power management support fucntions implementation for PCI Bus module.\r
3\r
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
12\r
13**/\r
14\r
15#include "PciBus.h"\r
16\r
17/**\r
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
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
26\r
27**/\r
28EFI_STATUS\r
29ResetPowerManagementFeature (\r
30 IN PCI_IO_DEVICE *PciIoDevice\r
31 )\r
32{\r
33 EFI_STATUS Status;\r
34 UINT8 PowerManagementRegBlock;\r
35 UINT16 PowerManagementCSR;\r
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
53 PowerManagementCSR = 0x8000;\r
54\r
55 //\r
56 // Write PMCSR\r
57 //\r
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
65\r
66 return EFI_SUCCESS;\r
67}\r
68\r