]>
Commit | Line | Data |
---|---|---|
eeefcb9d | 1 | /** @file\r |
3db51098 | 2 | \r |
3 | Copyright (c) 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT 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 | 26 | EFI_STATUS\r |
27 | ResetPowerManagementFeature (\r | |
28 | IN PCI_IO_DEVICE *PciIoDevice\r | |
29 | )\r | |
ead42efc | 30 | {\r |
31 | EFI_STATUS Status;\r | |
32 | UINT8 PowerManagementRegBlock;\r | |
33 | UINT16 PMCSR;\r | |
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 | |
51 | PMCSR = 0x8000;\r | |
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 | |
61 | &PMCSR\r | |
62 | );\r | |
63 | \r | |
64 | return EFI_SUCCESS;\r | |
65 | }\r | |
57076f45 | 66 | \r |