+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- PciPowerManagement.c\r
- \r
-Abstract:\r
-\r
- PCI Bus Driver\r
-\r
-Revision History\r
-\r
---*/\r
-\r
-#include "PciBus.h"\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-ResetPowerManagementFeature (\r
- IN PCI_IO_DEVICE *PciIoDevice\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- This function is intended to turn off PWE assertion and\r
- put the device to D0 state if the device supports\r
- PCI Power Management.\r
-\r
-Arguments:\r
-\r
-Returns:\r
- \r
- None\r
-\r
---*/\r
-{\r
- EFI_STATUS Status;\r
- UINT8 PowerManagementRegBlock;\r
- UINT16 PowerManagementCSR;\r
-\r
- PowerManagementRegBlock = 0;\r
-\r
- Status = LocateCapabilityRegBlock (\r
- PciIoDevice,\r
- EFI_PCI_CAPABILITY_ID_PMI,\r
- &PowerManagementRegBlock,\r
- NULL\r
- );\r
-\r
- if (EFI_ERROR (Status)) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- //\r
- // Turn off the PWE assertion and put the device into D0 State\r
- //\r
-\r
- //\r
- // Read PMCSR\r
- //\r
- Status = PciIoDevice->PciIo.Pci.Read (\r
- &PciIoDevice->PciIo,\r
- EfiPciIoWidthUint16,\r
- PowerManagementRegBlock + 4,\r
- 1,\r
- &PowerManagementCSR\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // Clear PME_Status bit\r
- //\r
- PowerManagementCSR |= BIT15;\r
- //\r
- // Clear PME_En bit. PowerState = D0.\r
- //\r
- PowerManagementCSR &= ~(BIT8 | BIT1 | BIT0);\r
-\r
- //\r
- // Write PMCSR\r
- //\r
- Status = PciIoDevice->PciIo.Pci.Write (\r
- &PciIoDevice->PciIo,\r
- EfiPciIoWidthUint16,\r
- PowerManagementRegBlock + 4,\r
- 1,\r
- &PowerManagementCSR\r
- );\r
- }\r
- return Status;\r
-}\r