2009-01-08 09:48:15 +01:00
|
|
|
/** @file
|
2009-06-25 15:47:45 +02:00
|
|
|
Power management support fucntions implementation for PCI Bus module.
|
2007-07-23 09:06:23 +02:00
|
|
|
|
2009-06-25 15:47:45 +02:00
|
|
|
Copyright (c) 2006 - 2009, Intel Corporation
|
|
|
|
All rights reserved. This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
2007-07-23 09:06:23 +02:00
|
|
|
|
|
|
|
**/
|
2007-06-28 16:02:17 +02:00
|
|
|
|
2008-07-16 04:54:54 +02:00
|
|
|
#include "PciBus.h"
|
2007-06-28 16:02:17 +02:00
|
|
|
|
2008-04-14 05:12:57 +02:00
|
|
|
/**
|
2007-06-28 16:02:17 +02:00
|
|
|
This function is intended to turn off PWE assertion and
|
|
|
|
put the device to D0 state if the device supports
|
|
|
|
PCI Power Management.
|
|
|
|
|
2009-06-25 15:47:45 +02:00
|
|
|
@param PciIoDevice PCI device instance.
|
|
|
|
|
|
|
|
@retval EFI_UNSUPPORTED PCI Device does not support power management.
|
|
|
|
@retval EFI_SUCCESS Turned off PWE successfully.
|
2007-06-28 16:02:17 +02:00
|
|
|
|
2008-04-14 05:12:57 +02:00
|
|
|
**/
|
2008-04-16 11:24:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
ResetPowerManagementFeature (
|
|
|
|
IN PCI_IO_DEVICE *PciIoDevice
|
|
|
|
)
|
2007-06-28 16:02:17 +02:00
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
UINT8 PowerManagementRegBlock;
|
2009-01-13 08:28:52 +01:00
|
|
|
UINT16 PowerManagementCSR;
|
2007-06-28 16:02:17 +02:00
|
|
|
|
|
|
|
PowerManagementRegBlock = 0;
|
|
|
|
|
|
|
|
Status = LocateCapabilityRegBlock (
|
|
|
|
PciIoDevice,
|
|
|
|
EFI_PCI_CAPABILITY_ID_PMI,
|
|
|
|
&PowerManagementRegBlock,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return EFI_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Turn off the PWE assertion and put the device into D0 State
|
|
|
|
//
|
2009-01-13 08:28:52 +01:00
|
|
|
PowerManagementCSR = 0x8000;
|
2007-06-28 16:02:17 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Write PMCSR
|
|
|
|
//
|
2009-07-07 06:00:44 +02:00
|
|
|
PciIoDevice->PciIo.Pci.Write (
|
|
|
|
&PciIoDevice->PciIo,
|
|
|
|
EfiPciIoWidthUint16,
|
|
|
|
PowerManagementRegBlock + 4,
|
|
|
|
1,
|
|
|
|
&PowerManagementCSR
|
|
|
|
);
|
2007-06-28 16:02:17 +02:00
|
|
|
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
2008-04-16 11:24:58 +02:00
|
|
|
|