2009-01-08 09:48:15 +01:00
|
|
|
/** @file
|
2007-07-23 09:06:23 +02:00
|
|
|
|
|
|
|
Copyright (c) 2006, 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-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.
|
|
|
|
|
2008-04-16 11:24:58 +02:00
|
|
|
@param PciIoDevice Pci device instance
|
2007-06-28 16:02:17 +02:00
|
|
|
|
2008-04-16 11:24:58 +02:00
|
|
|
@retval EFI_UNSUPPORTED Device do not support power management
|
|
|
|
@retval EFI_SUCCESS Success
|
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
|
|
|
|
//
|
|
|
|
PciIoWrite (
|
|
|
|
&PciIoDevice->PciIo,
|
|
|
|
EfiPciIoWidthUint16,
|
|
|
|
PowerManagementRegBlock + 4,
|
|
|
|
1,
|
2009-01-13 08:28:52 +01:00
|
|
|
&PowerManagementCSR
|
2007-06-28 16:02:17 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
2008-04-16 11:24:58 +02:00
|
|
|
|