878ddf1f |
1 | /*++\r |
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 | Module Name:\r |
13 | \r |
14 | PciPowerManagement.c\r |
15 | \r |
16 | Abstract:\r |
17 | \r |
18 | PCI Bus Driver\r |
19 | \r |
20 | Revision History\r |
21 | \r |
22 | --*/\r |
23 | \r |
f0ec738d |
24 | #include "pcibus.h"\r |
878ddf1f |
25 | \r |
26 | EFI_STATUS\r |
27 | ResetPowerManagementFeature (\r |
28 | IN PCI_IO_DEVICE *PciIoDevice\r |
29 | )\r |
30 | /*++\r |
31 | \r |
32 | Routine Description:\r |
33 | \r |
34 | This function is intended to turn off PWE assertion and\r |
35 | put the device to D0 state if the device supports\r |
36 | PCI Power Management.\r |
37 | \r |
38 | Arguments:\r |
39 | \r |
40 | Returns:\r |
41 | \r |
42 | None\r |
43 | \r |
44 | --*/\r |
45 | // TODO: PciIoDevice - add argument and description to function comment\r |
46 | // TODO: EFI_UNSUPPORTED - add return value to function comment\r |
47 | // TODO: EFI_SUCCESS - add return value to function comment\r |
48 | {\r |
49 | EFI_STATUS Status;\r |
50 | UINT8 PowerManagementRegBlock;\r |
51 | UINT16 PMCSR;\r |
52 | \r |
53 | PowerManagementRegBlock = 0;\r |
54 | \r |
55 | Status = LocateCapabilityRegBlock (\r |
56 | PciIoDevice,\r |
57 | EFI_PCI_CAPABILITY_ID_PMI,\r |
58 | &PowerManagementRegBlock,\r |
59 | NULL\r |
60 | );\r |
61 | \r |
62 | if (EFI_ERROR (Status)) {\r |
63 | return EFI_UNSUPPORTED;\r |
64 | }\r |
65 | \r |
66 | //\r |
67 | // Turn off the PWE assertion and put the device into D0 State\r |
68 | //\r |
69 | PMCSR = 0x8000;\r |
70 | \r |
71 | //\r |
72 | // Write PMCSR\r |
73 | //\r |
74 | PciIoDevice->PciIo.Pci.Write (\r |
75 | &PciIoDevice->PciIo,\r |
76 | EfiPciIoWidthUint16,\r |
77 | PowerManagementRegBlock + 4,\r |
78 | 1,\r |
79 | &PMCSR\r |
80 | );\r |
81 | \r |
82 | return EFI_SUCCESS;\r |
83 | }\r |