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