2009-05-27 23:10:18 +02:00
|
|
|
/** @file
|
|
|
|
Platform BDS customizations.
|
|
|
|
|
2014-08-13 08:31:08 +02:00
|
|
|
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
2010-04-28 14:43:04 +02:00
|
|
|
This program and the accompanying materials
|
2009-05-27 23:10:18 +02:00
|
|
|
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.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#include "BdsPlatform.h"
|
2016-03-13 18:08:26 +01:00
|
|
|
#include <Guid/RootBridgesConnectedEventGroup.h>
|
2015-01-02 13:07:57 +01:00
|
|
|
#include <Library/QemuBootOrderLib.h>
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
|
2009-06-30 17:57:35 +02:00
|
|
|
//
|
|
|
|
// Global data
|
|
|
|
//
|
|
|
|
|
|
|
|
VOID *mEfiDevPathNotifyReg;
|
|
|
|
EFI_EVENT mEfiDevPathEvent;
|
2009-09-26 09:15:55 +02:00
|
|
|
VOID *mEmuVariableEventReg;
|
|
|
|
EFI_EVENT mEmuVariableEvent;
|
2009-09-16 18:29:00 +02:00
|
|
|
BOOLEAN mDetectVgaOnly;
|
2014-11-17 20:09:12 +01:00
|
|
|
UINT16 mHostBridgeDevId;
|
2009-09-16 18:29:00 +02:00
|
|
|
|
2014-11-17 20:09:12 +01:00
|
|
|
//
|
|
|
|
// Table of host IRQs matching PCI IRQs A-D
|
|
|
|
// (for configuring PCI Interrupt Line register)
|
|
|
|
//
|
|
|
|
CONST UINT8 PciHostIrqs[] = {
|
|
|
|
0x0a, 0x0a, 0x0b, 0x0b
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// Array Size macro
|
|
|
|
//
|
|
|
|
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
|
2009-09-16 18:29:00 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Type definitions
|
|
|
|
//
|
|
|
|
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
|
|
|
(EFIAPI *PROTOCOL_INSTANCE_CALLBACK)(
|
|
|
|
IN EFI_HANDLE Handle,
|
|
|
|
IN VOID *Instance,
|
|
|
|
IN VOID *Context
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
@param[in] Handle - Handle of PCI device instance
|
|
|
|
@param[in] PciIo - PCI IO protocol instance
|
|
|
|
@param[in] Pci - PCI Header register block
|
|
|
|
**/
|
|
|
|
typedef
|
|
|
|
EFI_STATUS
|
|
|
|
(EFIAPI *VISIT_PCI_INSTANCE_CALLBACK)(
|
|
|
|
IN EFI_HANDLE Handle,
|
|
|
|
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
|
|
|
IN PCI_TYPE00 *Pci
|
|
|
|
);
|
2009-06-30 17:57:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Function prototypes
|
|
|
|
//
|
|
|
|
|
2009-09-16 18:29:00 +02:00
|
|
|
EFI_STATUS
|
|
|
|
VisitAllInstancesOfProtocol (
|
|
|
|
IN EFI_GUID *Id,
|
|
|
|
IN PROTOCOL_INSTANCE_CALLBACK CallBackFunction,
|
|
|
|
IN VOID *Context
|
|
|
|
);
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
VisitAllPciInstancesOfProtocol (
|
|
|
|
IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction
|
|
|
|
);
|
|
|
|
|
2009-06-30 17:57:35 +02:00
|
|
|
VOID
|
|
|
|
InstallDevicePathCallback (
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
|
|
|
// BDS Platform Functions
|
|
|
|
//
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
PlatformBdsInit (
|
2009-06-07 06:44:53 +02:00
|
|
|
VOID
|
2009-05-27 23:10:18 +02:00
|
|
|
)
|
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
Platform Bds init. Incude the platform firmware vendor, revision
|
|
|
|
and so crc check.
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
--*/
|
|
|
|
{
|
|
|
|
DEBUG ((EFI_D_INFO, "PlatformBdsInit\n"));
|
2009-06-30 17:57:35 +02:00
|
|
|
InstallDevicePathCallback ();
|
2009-05-27 23:10:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EFI_STATUS
|
2015-07-14 14:01:52 +02:00
|
|
|
EFIAPI
|
2009-05-27 23:10:18 +02:00
|
|
|
ConnectRootBridge (
|
2015-07-14 14:01:52 +02:00
|
|
|
IN EFI_HANDLE RootBridgeHandle,
|
|
|
|
IN VOID *Instance,
|
|
|
|
IN VOID *Context
|
2009-05-27 23:10:18 +02:00
|
|
|
)
|
|
|
|
{
|
2015-07-14 14:01:52 +02:00
|
|
|
EFI_STATUS Status;
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
//
|
2015-07-14 14:01:52 +02:00
|
|
|
// Make the PCI bus driver connect the root bridge, non-recursively. This
|
|
|
|
// will produce a number of child handles with PciIo on them.
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
2015-07-14 14:01:52 +02:00
|
|
|
Status = gBS->ConnectController (
|
|
|
|
RootBridgeHandle, // ControllerHandle
|
|
|
|
NULL, // DriverImageHandle
|
|
|
|
NULL, // RemainingDevicePath -- produce all
|
|
|
|
// children
|
|
|
|
FALSE // Recursive
|
2009-05-27 23:10:18 +02:00
|
|
|
);
|
2015-07-14 14:01:52 +02:00
|
|
|
return Status;
|
2009-05-27 23:10:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
PrepareLpcBridgeDevicePath (
|
|
|
|
IN EFI_HANDLE DeviceHandle
|
|
|
|
)
|
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
Add IsaKeyboard to ConIn,
|
|
|
|
add IsaSerial to ConOut, ConIn, ErrOut.
|
|
|
|
LPC Bridge: 06 01 00
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
DeviceHandle - Handle of PCIIO protocol.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
EFI_SUCCESS - LPC bridge is added to ConOut, ConIn, and ErrOut.
|
|
|
|
EFI_STATUS - No LPC bridge is added.
|
|
|
|
|
|
|
|
--*/
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
|
|
|
|
CHAR16 *DevPathStr;
|
|
|
|
|
|
|
|
DevicePath = NULL;
|
|
|
|
Status = gBS->HandleProtocol (
|
|
|
|
DeviceHandle,
|
|
|
|
&gEfiDevicePathProtocolGuid,
|
|
|
|
(VOID*)&DevicePath
|
|
|
|
);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
TempDevicePath = DevicePath;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Register Keyboard
|
|
|
|
//
|
|
|
|
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gPnpPs2KeyboardDeviceNode);
|
|
|
|
|
|
|
|
BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Register COM1
|
|
|
|
//
|
|
|
|
DevicePath = TempDevicePath;
|
|
|
|
gPnp16550ComPortDeviceNode.UID = 0;
|
|
|
|
|
|
|
|
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gPnp16550ComPortDeviceNode);
|
|
|
|
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);
|
|
|
|
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Print Device Path
|
|
|
|
//
|
|
|
|
DevPathStr = DevicePathToStr(DevicePath);
|
2013-07-26 05:14:08 +02:00
|
|
|
if (DevPathStr != NULL) {
|
|
|
|
DEBUG((
|
|
|
|
EFI_D_INFO,
|
|
|
|
"BdsPlatform.c+%d: COM%d DevPath: %s\n",
|
|
|
|
__LINE__,
|
|
|
|
gPnp16550ComPortDeviceNode.UID + 1,
|
|
|
|
DevPathStr
|
|
|
|
));
|
|
|
|
FreePool(DevPathStr);
|
|
|
|
}
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);
|
|
|
|
BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);
|
|
|
|
BdsLibUpdateConsoleVariable (VarErrorOut, DevicePath, NULL);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Register COM2
|
|
|
|
//
|
|
|
|
DevicePath = TempDevicePath;
|
|
|
|
gPnp16550ComPortDeviceNode.UID = 1;
|
|
|
|
|
|
|
|
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gPnp16550ComPortDeviceNode);
|
|
|
|
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);
|
|
|
|
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Print Device Path
|
|
|
|
//
|
|
|
|
DevPathStr = DevicePathToStr(DevicePath);
|
2013-07-26 05:14:08 +02:00
|
|
|
if (DevPathStr != NULL) {
|
|
|
|
DEBUG((
|
|
|
|
EFI_D_INFO,
|
|
|
|
"BdsPlatform.c+%d: COM%d DevPath: %s\n",
|
|
|
|
__LINE__,
|
|
|
|
gPnp16550ComPortDeviceNode.UID + 1,
|
|
|
|
DevPathStr
|
|
|
|
));
|
|
|
|
FreePool(DevPathStr);
|
|
|
|
}
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);
|
|
|
|
BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);
|
|
|
|
BdsLibUpdateConsoleVariable (VarErrorOut, DevicePath, NULL);
|
|
|
|
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
GetGopDevicePath (
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *PciDevicePath,
|
|
|
|
OUT EFI_DEVICE_PATH_PROTOCOL **GopDevicePath
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UINTN Index;
|
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_HANDLE PciDeviceHandle;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *TempPciDevicePath;
|
|
|
|
UINTN GopHandleCount;
|
|
|
|
EFI_HANDLE *GopHandleBuffer;
|
|
|
|
|
|
|
|
if (PciDevicePath == NULL || GopDevicePath == NULL) {
|
|
|
|
return EFI_INVALID_PARAMETER;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Initialize the GopDevicePath to be PciDevicePath
|
|
|
|
//
|
|
|
|
*GopDevicePath = PciDevicePath;
|
|
|
|
TempPciDevicePath = PciDevicePath;
|
|
|
|
|
|
|
|
Status = gBS->LocateDevicePath (
|
|
|
|
&gEfiDevicePathProtocolGuid,
|
|
|
|
&TempPciDevicePath,
|
|
|
|
&PciDeviceHandle
|
|
|
|
);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Try to connect this handle, so that GOP dirver could start on this
|
|
|
|
// device and create child handles with GraphicsOutput Protocol installed
|
|
|
|
// on them, then we get device paths of these child handles and select
|
|
|
|
// them as possible console device.
|
|
|
|
//
|
|
|
|
gBS->ConnectController (PciDeviceHandle, NULL, NULL, FALSE);
|
|
|
|
|
|
|
|
Status = gBS->LocateHandleBuffer (
|
|
|
|
ByProtocol,
|
|
|
|
&gEfiGraphicsOutputProtocolGuid,
|
|
|
|
NULL,
|
|
|
|
&GopHandleCount,
|
|
|
|
&GopHandleBuffer
|
|
|
|
);
|
|
|
|
if (!EFI_ERROR (Status)) {
|
|
|
|
//
|
|
|
|
// Add all the child handles as possible Console Device
|
|
|
|
//
|
|
|
|
for (Index = 0; Index < GopHandleCount; Index++) {
|
|
|
|
Status = gBS->HandleProtocol (GopHandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID*)&TempDevicePath);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (CompareMem (
|
|
|
|
PciDevicePath,
|
|
|
|
TempDevicePath,
|
|
|
|
GetDevicePathSize (PciDevicePath) - END_DEVICE_PATH_LENGTH
|
|
|
|
) == 0) {
|
|
|
|
//
|
|
|
|
// In current implementation, we only enable one of the child handles
|
|
|
|
// as console device, i.e. sotre one of the child handle's device
|
|
|
|
// path to variable "ConOut"
|
|
|
|
// In futhure, we could select all child handles to be console device
|
|
|
|
//
|
|
|
|
|
|
|
|
*GopDevicePath = TempDevicePath;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Delete the PCI device's path that added by GetPlugInPciVgaDevicePath()
|
|
|
|
// Add the integrity GOP device path.
|
|
|
|
//
|
|
|
|
BdsLibUpdateConsoleVariable (VarConsoleOutDev, NULL, PciDevicePath);
|
|
|
|
BdsLibUpdateConsoleVariable (VarConsoleOutDev, TempDevicePath, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gBS->FreePool (GopHandleBuffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
PreparePciVgaDevicePath (
|
|
|
|
IN EFI_HANDLE DeviceHandle
|
|
|
|
)
|
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
Add PCI VGA to ConOut.
|
|
|
|
PCI VGA: 03 00 00
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
DeviceHandle - Handle of PCIIO protocol.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
EFI_SUCCESS - PCI VGA is added to ConOut.
|
|
|
|
EFI_STATUS - No PCI VGA device is added.
|
|
|
|
|
|
|
|
--*/
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *GopDevicePath;
|
|
|
|
|
2014-08-13 08:31:08 +02:00
|
|
|
DevicePath = NULL;
|
|
|
|
GopDevicePath = NULL;
|
2009-05-27 23:10:18 +02:00
|
|
|
Status = gBS->HandleProtocol (
|
|
|
|
DeviceHandle,
|
|
|
|
&gEfiDevicePathProtocolGuid,
|
|
|
|
(VOID*)&DevicePath
|
|
|
|
);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetGopDevicePath (DevicePath, &GopDevicePath);
|
|
|
|
DevicePath = GopDevicePath;
|
|
|
|
|
|
|
|
BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);
|
|
|
|
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
PreparePciSerialDevicePath (
|
|
|
|
IN EFI_HANDLE DeviceHandle
|
|
|
|
)
|
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
Add PCI Serial to ConOut, ConIn, ErrOut.
|
|
|
|
PCI Serial: 07 00 02
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
DeviceHandle - Handle of PCIIO protocol.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
EFI_SUCCESS - PCI Serial is added to ConOut, ConIn, and ErrOut.
|
|
|
|
EFI_STATUS - No PCI Serial device is added.
|
|
|
|
|
|
|
|
--*/
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
|
|
|
|
|
|
|
DevicePath = NULL;
|
|
|
|
Status = gBS->HandleProtocol (
|
|
|
|
DeviceHandle,
|
|
|
|
&gEfiDevicePathProtocolGuid,
|
|
|
|
(VOID*)&DevicePath
|
|
|
|
);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);
|
|
|
|
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);
|
|
|
|
|
|
|
|
BdsLibUpdateConsoleVariable (VarConsoleOut, DevicePath, NULL);
|
|
|
|
BdsLibUpdateConsoleVariable (VarConsoleInp, DevicePath, NULL);
|
|
|
|
BdsLibUpdateConsoleVariable (VarErrorOut, DevicePath, NULL);
|
|
|
|
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
EFI_STATUS
|
2009-09-16 18:29:00 +02:00
|
|
|
VisitAllInstancesOfProtocol (
|
|
|
|
IN EFI_GUID *Id,
|
|
|
|
IN PROTOCOL_INSTANCE_CALLBACK CallBackFunction,
|
|
|
|
IN VOID *Context
|
2009-05-27 23:10:18 +02:00
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
UINTN HandleCount;
|
|
|
|
EFI_HANDLE *HandleBuffer;
|
|
|
|
UINTN Index;
|
2009-09-16 18:29:00 +02:00
|
|
|
VOID *Instance;
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Start to check all the PciIo to find all possible device
|
|
|
|
//
|
|
|
|
HandleCount = 0;
|
|
|
|
HandleBuffer = NULL;
|
|
|
|
Status = gBS->LocateHandleBuffer (
|
|
|
|
ByProtocol,
|
2009-09-16 18:29:00 +02:00
|
|
|
Id,
|
2009-05-27 23:10:18 +02:00
|
|
|
NULL,
|
|
|
|
&HandleCount,
|
|
|
|
&HandleBuffer
|
|
|
|
);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Index = 0; Index < HandleCount; Index++) {
|
2009-09-16 18:29:00 +02:00
|
|
|
Status = gBS->HandleProtocol (HandleBuffer[Index], Id, &Instance);
|
2009-05-27 23:10:18 +02:00
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-16 18:29:00 +02:00
|
|
|
Status = (*CallBackFunction) (
|
|
|
|
HandleBuffer[Index],
|
|
|
|
Instance,
|
|
|
|
Context
|
|
|
|
);
|
|
|
|
}
|
2009-05-27 23:10:18 +02:00
|
|
|
|
2009-09-16 18:29:00 +02:00
|
|
|
gBS->FreePool (HandleBuffer);
|
2009-09-07 22:18:19 +02:00
|
|
|
|
2009-09-16 18:29:00 +02:00
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
VisitingAPciInstance (
|
|
|
|
IN EFI_HANDLE Handle,
|
|
|
|
IN VOID *Instance,
|
|
|
|
IN VOID *Context
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_PCI_IO_PROTOCOL *PciIo;
|
|
|
|
PCI_TYPE00 Pci;
|
|
|
|
|
|
|
|
PciIo = (EFI_PCI_IO_PROTOCOL*) Instance;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Check for all PCI device
|
|
|
|
//
|
|
|
|
Status = PciIo->Pci.Read (
|
|
|
|
PciIo,
|
|
|
|
EfiPciIoWidthUint32,
|
|
|
|
0,
|
|
|
|
sizeof (Pci) / sizeof (UINT32),
|
|
|
|
&Pci
|
|
|
|
);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2009-09-21 16:20:11 +02:00
|
|
|
return (*(VISIT_PCI_INSTANCE_CALLBACK)(UINTN) Context) (
|
2009-09-16 18:29:00 +02:00
|
|
|
Handle,
|
|
|
|
PciIo,
|
|
|
|
&Pci
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
VisitAllPciInstances (
|
|
|
|
IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return VisitAllInstancesOfProtocol (
|
|
|
|
&gEfiPciIoProtocolGuid,
|
|
|
|
VisitingAPciInstance,
|
2009-09-21 16:20:11 +02:00
|
|
|
(VOID*)(UINTN) CallBackFunction
|
2009-09-16 18:29:00 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Do platform specific PCI Device check and add them to
|
|
|
|
ConOut, ConIn, ErrOut.
|
|
|
|
|
|
|
|
@param[in] Handle - Handle of PCI device instance
|
|
|
|
@param[in] PciIo - PCI IO protocol instance
|
|
|
|
@param[in] Pci - PCI Header register block
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS - PCI Device check and Console variable update successfully.
|
|
|
|
@retval EFI_STATUS - PCI Device check or Console variable update fail.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
2009-12-17 00:28:46 +01:00
|
|
|
EFIAPI
|
2009-09-16 18:29:00 +02:00
|
|
|
DetectAndPreparePlatformPciDevicePath (
|
|
|
|
IN EFI_HANDLE Handle,
|
|
|
|
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
|
|
|
IN PCI_TYPE00 *Pci
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
|
|
|
|
Status = PciIo->Attributes (
|
|
|
|
PciIo,
|
|
|
|
EfiPciIoAttributeOperationEnable,
|
|
|
|
EFI_PCI_DEVICE_ENABLE,
|
|
|
|
NULL
|
|
|
|
);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
|
|
|
if (!mDetectVgaOnly) {
|
|
|
|
//
|
|
|
|
// Here we decide whether it is LPC Bridge
|
|
|
|
//
|
|
|
|
if ((IS_PCI_LPC (Pci)) ||
|
|
|
|
((IS_PCI_ISA_PDECODE (Pci)) &&
|
|
|
|
(Pci->Hdr.VendorId == 0x8086) &&
|
|
|
|
(Pci->Hdr.DeviceId == 0x7000)
|
|
|
|
)
|
|
|
|
) {
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
2009-09-16 18:29:00 +02:00
|
|
|
// Add IsaKeyboard to ConIn,
|
|
|
|
// add IsaSerial to ConOut, ConIn, ErrOut
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
2009-09-16 18:29:00 +02:00
|
|
|
DEBUG ((EFI_D_INFO, "Found LPC Bridge device\n"));
|
|
|
|
PrepareLpcBridgeDevicePath (Handle);
|
|
|
|
return EFI_SUCCESS;
|
2009-05-27 23:10:18 +02:00
|
|
|
}
|
|
|
|
//
|
2009-09-16 18:29:00 +02:00
|
|
|
// Here we decide which Serial device to enable in PCI bus
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
2009-09-16 18:29:00 +02:00
|
|
|
if (IS_PCI_16550SERIAL (Pci)) {
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
2009-09-16 18:29:00 +02:00
|
|
|
// Add them to ConOut, ConIn, ErrOut.
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
2009-09-16 18:29:00 +02:00
|
|
|
DEBUG ((EFI_D_INFO, "Found PCI 16550 SERIAL device\n"));
|
|
|
|
PreparePciSerialDevicePath (Handle);
|
|
|
|
return EFI_SUCCESS;
|
2009-05-27 23:10:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-16 18:29:00 +02:00
|
|
|
//
|
|
|
|
// Here we decide which VGA device to enable in PCI bus
|
|
|
|
//
|
|
|
|
if (IS_PCI_VGA (Pci)) {
|
|
|
|
//
|
|
|
|
// Add them to ConOut.
|
|
|
|
//
|
|
|
|
DEBUG ((EFI_D_INFO, "Found PCI VGA device\n"));
|
|
|
|
PreparePciVgaDevicePath (Handle);
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
2009-05-27 23:10:18 +02:00
|
|
|
|
2009-09-16 18:29:00 +02:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut
|
|
|
|
|
|
|
|
@param[in] DetectVgaOnly - Only detect VGA device if it's TRUE.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS - PCI Device check and Console variable update successfully.
|
|
|
|
@retval EFI_STATUS - PCI Device check or Console variable update fail.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
DetectAndPreparePlatformPciDevicePaths (
|
|
|
|
BOOLEAN DetectVgaOnly
|
|
|
|
)
|
|
|
|
{
|
|
|
|
mDetectVgaOnly = DetectVgaOnly;
|
|
|
|
return VisitAllPciInstances (DetectAndPreparePlatformPciDevicePath);
|
2009-05-27 23:10:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
PlatformBdsConnectConsole (
|
|
|
|
IN BDS_CONSOLE_CONNECT_ENTRY *PlatformConsole
|
|
|
|
)
|
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
Connect the predefined platform default console device. Always try to find
|
|
|
|
and enable the vga device if have.
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
PlatformConsole - Predfined platform default console device array.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
EFI_SUCCESS - Success connect at least one ConIn and ConOut
|
|
|
|
device, there must have one ConOut device is
|
|
|
|
active vga device.
|
|
|
|
|
|
|
|
EFI_STATUS - Return the status of
|
|
|
|
BdsLibConnectAllDefaultConsoles ()
|
|
|
|
|
|
|
|
--*/
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
UINTN Index;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *VarConout;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *VarConin;
|
|
|
|
UINTN DevicePathSize;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Connect RootBridge
|
|
|
|
//
|
|
|
|
VarConout = BdsLibGetVariableAndSize (
|
|
|
|
VarConsoleOut,
|
|
|
|
&gEfiGlobalVariableGuid,
|
|
|
|
&DevicePathSize
|
|
|
|
);
|
|
|
|
VarConin = BdsLibGetVariableAndSize (
|
|
|
|
VarConsoleInp,
|
|
|
|
&gEfiGlobalVariableGuid,
|
|
|
|
&DevicePathSize
|
|
|
|
);
|
|
|
|
|
|
|
|
if (VarConout == NULL || VarConin == NULL) {
|
|
|
|
//
|
|
|
|
// Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut
|
|
|
|
//
|
2009-09-16 18:29:00 +02:00
|
|
|
DetectAndPreparePlatformPciDevicePaths (FALSE);
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Have chance to connect the platform default console,
|
|
|
|
// the platform default console is the minimue device group
|
|
|
|
// the platform should support
|
|
|
|
//
|
|
|
|
for (Index = 0; PlatformConsole[Index].DevicePath != NULL; ++Index) {
|
|
|
|
//
|
|
|
|
// Update the console variable with the connect type
|
|
|
|
//
|
|
|
|
if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {
|
|
|
|
BdsLibUpdateConsoleVariable (VarConsoleInp, PlatformConsole[Index].DevicePath, NULL);
|
|
|
|
}
|
|
|
|
if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {
|
|
|
|
BdsLibUpdateConsoleVariable (VarConsoleOut, PlatformConsole[Index].DevicePath, NULL);
|
|
|
|
}
|
|
|
|
if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {
|
|
|
|
BdsLibUpdateConsoleVariable (VarErrorOut, PlatformConsole[Index].DevicePath, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//
|
|
|
|
// Only detect VGA device and add them to ConOut
|
|
|
|
//
|
2009-09-16 18:29:00 +02:00
|
|
|
DetectAndPreparePlatformPciDevicePaths (TRUE);
|
2009-05-27 23:10:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Connect the all the default console with current cosole variable
|
|
|
|
//
|
|
|
|
Status = BdsLibConnectAllDefaultConsoles ();
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-11-17 20:09:12 +01:00
|
|
|
/**
|
|
|
|
Configure PCI Interrupt Line register for applicable devices
|
|
|
|
Ported from SeaBIOS, src/fw/pciinit.c, *_pci_slot_get_irq()
|
|
|
|
|
|
|
|
@param[in] Handle - Handle of PCI device instance
|
|
|
|
@param[in] PciIo - PCI IO protocol instance
|
|
|
|
@param[in] PciHdr - PCI Header register block
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS - PCI Interrupt Line register configured successfully.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
SetPciIntLine (
|
|
|
|
IN EFI_HANDLE Handle,
|
|
|
|
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
|
|
|
IN PCI_TYPE00 *PciHdr
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
|
OvmfPkg: PlatformBdsLib: debug log interrupt line assignments
These messages are helpful for comparing the assignments made by OVMF
against those made by SeaBIOS. To SeaBIOS a small debug patch like the
following can be applied:
> diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
> index ac39d23..9e61c22 100644
> --- a/src/fw/pciinit.c
> +++ b/src/fw/pciinit.c
> @@ -308,8 +308,12 @@ static void pci_bios_init_device(struct pci_device *pci)
>
> /* map the interrupt */
> int pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN);
> - if (pin != 0)
> - pci_config_writeb(bdf, PCI_INTERRUPT_LINE, pci_slot_get_irq(pci, pin));
> + if (pin != 0) {
> + int irqline = pci_slot_get_irq(pci, pin);
> +
> + pci_config_writeb(bdf, PCI_INTERRUPT_LINE, irqline);
> + dprintf(1, "assigned irq line %d\n", irqline);
> + }
>
> pci_init_device(pci_device_tbl, pci, NULL);
>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gabriel Somlo <somlo@cmu.edu>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17952 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-14 14:01:43 +02:00
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevPath;
|
2014-11-17 20:09:12 +01:00
|
|
|
UINTN RootSlot;
|
|
|
|
UINTN Idx;
|
|
|
|
UINT8 IrqLine;
|
|
|
|
EFI_STATUS Status;
|
2015-07-14 14:01:48 +02:00
|
|
|
UINT32 RootBusNumber;
|
2014-11-17 20:09:12 +01:00
|
|
|
|
|
|
|
Status = EFI_SUCCESS;
|
|
|
|
|
|
|
|
if (PciHdr->Device.InterruptPin != 0) {
|
|
|
|
|
|
|
|
DevPathNode = DevicePathFromHandle (Handle);
|
|
|
|
ASSERT (DevPathNode != NULL);
|
OvmfPkg: PlatformBdsLib: debug log interrupt line assignments
These messages are helpful for comparing the assignments made by OVMF
against those made by SeaBIOS. To SeaBIOS a small debug patch like the
following can be applied:
> diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
> index ac39d23..9e61c22 100644
> --- a/src/fw/pciinit.c
> +++ b/src/fw/pciinit.c
> @@ -308,8 +308,12 @@ static void pci_bios_init_device(struct pci_device *pci)
>
> /* map the interrupt */
> int pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN);
> - if (pin != 0)
> - pci_config_writeb(bdf, PCI_INTERRUPT_LINE, pci_slot_get_irq(pci, pin));
> + if (pin != 0) {
> + int irqline = pci_slot_get_irq(pci, pin);
> +
> + pci_config_writeb(bdf, PCI_INTERRUPT_LINE, irqline);
> + dprintf(1, "assigned irq line %d\n", irqline);
> + }
>
> pci_init_device(pci_device_tbl, pci, NULL);
>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gabriel Somlo <somlo@cmu.edu>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17952 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-14 14:01:43 +02:00
|
|
|
DevPath = DevPathNode;
|
2014-11-17 20:09:12 +01:00
|
|
|
|
2015-07-14 14:01:48 +02:00
|
|
|
RootBusNumber = 0;
|
|
|
|
if (DevicePathType (DevPathNode) == ACPI_DEVICE_PATH &&
|
|
|
|
DevicePathSubType (DevPathNode) == ACPI_DP &&
|
|
|
|
((ACPI_HID_DEVICE_PATH *)DevPathNode)->HID == EISA_PNP_ID(0x0A03)) {
|
|
|
|
RootBusNumber = ((ACPI_HID_DEVICE_PATH *)DevPathNode)->UID;
|
|
|
|
}
|
|
|
|
|
2014-11-17 20:09:12 +01:00
|
|
|
//
|
|
|
|
// Compute index into PciHostIrqs[] table by walking
|
|
|
|
// the device path and adding up all device numbers
|
|
|
|
//
|
|
|
|
Status = EFI_NOT_FOUND;
|
|
|
|
RootSlot = 0;
|
|
|
|
Idx = PciHdr->Device.InterruptPin - 1;
|
|
|
|
while (!IsDevicePathEnd (DevPathNode)) {
|
|
|
|
if (DevicePathType (DevPathNode) == HARDWARE_DEVICE_PATH &&
|
|
|
|
DevicePathSubType (DevPathNode) == HW_PCI_DP) {
|
|
|
|
|
|
|
|
Idx += ((PCI_DEVICE_PATH *)DevPathNode)->Device;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Unlike SeaBIOS, which starts climbing from the leaf device
|
|
|
|
// up toward the root, we traverse the device path starting at
|
|
|
|
// the root moving toward the leaf node.
|
|
|
|
// The slot number of the top-level parent bridge is needed for
|
|
|
|
// Q35 cases with more than 24 slots on the root bus.
|
|
|
|
//
|
|
|
|
if (Status != EFI_SUCCESS) {
|
|
|
|
Status = EFI_SUCCESS;
|
|
|
|
RootSlot = ((PCI_DEVICE_PATH *)DevPathNode)->Device;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DevPathNode = NextDevicePathNode (DevPathNode);
|
|
|
|
}
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
2015-07-14 14:01:48 +02:00
|
|
|
if (RootBusNumber == 0 && RootSlot == 0) {
|
2014-11-17 20:09:12 +01:00
|
|
|
DEBUG((
|
|
|
|
EFI_D_ERROR,
|
|
|
|
"%a: PCI host bridge (00:00.0) should have no interrupts!\n",
|
|
|
|
__FUNCTION__
|
|
|
|
));
|
|
|
|
ASSERT (FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Final PciHostIrqs[] index calculation depends on the platform
|
|
|
|
// and should match SeaBIOS src/fw/pciinit.c *_pci_slot_get_irq()
|
|
|
|
//
|
|
|
|
switch (mHostBridgeDevId) {
|
|
|
|
case INTEL_82441_DEVICE_ID:
|
|
|
|
Idx -= 1;
|
|
|
|
break;
|
|
|
|
case INTEL_Q35_MCH_DEVICE_ID:
|
|
|
|
//
|
|
|
|
// SeaBIOS contains the following comment:
|
|
|
|
// "Slots 0-24 rotate slot:pin mapping similar to piix above, but
|
|
|
|
// with a different starting index - see q35-acpi-dsdt.dsl.
|
|
|
|
//
|
|
|
|
// Slots 25-31 all use LNKA mapping (or LNKE, but A:D = E:H)"
|
|
|
|
//
|
|
|
|
if (RootSlot > 24) {
|
|
|
|
//
|
|
|
|
// in this case, subtract back out RootSlot from Idx
|
|
|
|
// (SeaBIOS never adds it to begin with, but that would make our
|
|
|
|
// device path traversal loop above too awkward)
|
|
|
|
//
|
|
|
|
Idx -= RootSlot;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT (FALSE); // should never get here
|
|
|
|
}
|
|
|
|
Idx %= ARRAY_SIZE (PciHostIrqs);
|
|
|
|
IrqLine = PciHostIrqs[Idx];
|
|
|
|
|
OvmfPkg: PlatformBdsLib: debug log interrupt line assignments
These messages are helpful for comparing the assignments made by OVMF
against those made by SeaBIOS. To SeaBIOS a small debug patch like the
following can be applied:
> diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
> index ac39d23..9e61c22 100644
> --- a/src/fw/pciinit.c
> +++ b/src/fw/pciinit.c
> @@ -308,8 +308,12 @@ static void pci_bios_init_device(struct pci_device *pci)
>
> /* map the interrupt */
> int pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN);
> - if (pin != 0)
> - pci_config_writeb(bdf, PCI_INTERRUPT_LINE, pci_slot_get_irq(pci, pin));
> + if (pin != 0) {
> + int irqline = pci_slot_get_irq(pci, pin);
> +
> + pci_config_writeb(bdf, PCI_INTERRUPT_LINE, irqline);
> + dprintf(1, "assigned irq line %d\n", irqline);
> + }
>
> pci_init_device(pci_device_tbl, pci, NULL);
>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gabriel Somlo <somlo@cmu.edu>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17952 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-14 14:01:43 +02:00
|
|
|
DEBUG_CODE_BEGIN ();
|
|
|
|
{
|
|
|
|
CHAR16 *DevPathString;
|
|
|
|
STATIC CHAR16 Fallback[] = L"<failed to convert>";
|
|
|
|
UINTN Segment, Bus, Device, Function;
|
|
|
|
|
|
|
|
DevPathString = ConvertDevicePathToText (DevPath, FALSE, FALSE);
|
|
|
|
if (DevPathString == NULL) {
|
|
|
|
DevPathString = Fallback;
|
|
|
|
}
|
|
|
|
Status = PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
|
|
|
DEBUG ((EFI_D_VERBOSE, "%a: [%02x:%02x.%x] %s -> 0x%02x\n", __FUNCTION__,
|
|
|
|
(UINT32)Bus, (UINT32)Device, (UINT32)Function, DevPathString,
|
|
|
|
IrqLine));
|
|
|
|
|
|
|
|
if (DevPathString != Fallback) {
|
|
|
|
FreePool (DevPathString);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DEBUG_CODE_END ();
|
|
|
|
|
2014-11-17 20:09:12 +01:00
|
|
|
//
|
|
|
|
// Set PCI Interrupt Line register for this device to PciHostIrqs[Idx]
|
|
|
|
//
|
|
|
|
Status = PciIo->Pci.Write (
|
|
|
|
PciIo,
|
|
|
|
EfiPciIoWidthUint8,
|
|
|
|
PCI_INT_LINE_OFFSET,
|
|
|
|
1,
|
|
|
|
&IrqLine
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-27 23:10:18 +02:00
|
|
|
VOID
|
2014-11-14 01:39:04 +01:00
|
|
|
PciAcpiInitialization (
|
2009-05-27 23:10:18 +02:00
|
|
|
)
|
|
|
|
{
|
2014-11-14 01:39:04 +01:00
|
|
|
UINTN Pmba;
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
//
|
2014-11-14 01:39:04 +01:00
|
|
|
// Query Host Bridge DID to determine platform type
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
2014-11-17 20:09:12 +01:00
|
|
|
mHostBridgeDevId = PcdGet16 (PcdOvmfHostBridgePciDevId);
|
|
|
|
switch (mHostBridgeDevId) {
|
2014-11-14 01:39:04 +01:00
|
|
|
case INTEL_82441_DEVICE_ID:
|
2015-05-13 11:31:49 +02:00
|
|
|
Pmba = POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA);
|
2014-11-14 01:39:04 +01:00
|
|
|
//
|
|
|
|
// 00:01.0 ISA Bridge (PIIX4) LNK routing targets
|
|
|
|
//
|
|
|
|
PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x60), 0x0b); // A
|
|
|
|
PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x61), 0x0b); // B
|
|
|
|
PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x62), 0x0a); // C
|
|
|
|
PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x63), 0x0a); // D
|
|
|
|
break;
|
|
|
|
case INTEL_Q35_MCH_DEVICE_ID:
|
2015-05-13 11:31:44 +02:00
|
|
|
Pmba = POWER_MGMT_REGISTER_Q35 (ICH9_PMBASE);
|
2014-11-14 01:39:04 +01:00
|
|
|
//
|
|
|
|
// 00:1f.0 LPC Bridge (Q35) LNK routing targets
|
|
|
|
//
|
|
|
|
PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x60), 0x0a); // A
|
|
|
|
PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x61), 0x0a); // B
|
|
|
|
PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x62), 0x0b); // C
|
|
|
|
PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x63), 0x0b); // D
|
|
|
|
PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x68), 0x0a); // E
|
|
|
|
PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x69), 0x0a); // F
|
|
|
|
PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x6a), 0x0b); // G
|
|
|
|
PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x6b), 0x0b); // H
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DEBUG ((EFI_D_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n",
|
2014-11-17 20:09:12 +01:00
|
|
|
__FUNCTION__, mHostBridgeDevId));
|
2014-11-14 01:39:04 +01:00
|
|
|
ASSERT (FALSE);
|
|
|
|
return;
|
|
|
|
}
|
2009-05-27 23:10:18 +02:00
|
|
|
|
2012-05-04 17:01:56 +02:00
|
|
|
//
|
2014-11-17 20:09:12 +01:00
|
|
|
// Initialize PCI_INTERRUPT_LINE for applicable present PCI devices
|
2012-05-04 17:01:56 +02:00
|
|
|
//
|
2014-11-17 20:09:12 +01:00
|
|
|
VisitAllPciInstances (SetPciIntLine);
|
2014-11-14 01:39:04 +01:00
|
|
|
|
|
|
|
//
|
2014-11-17 20:09:12 +01:00
|
|
|
// Set ACPI SCI_EN bit in PMCNTRL
|
2014-11-14 01:39:04 +01:00
|
|
|
//
|
2014-11-17 20:09:12 +01:00
|
|
|
IoOr16 ((PciRead32 (Pmba) & ~BIT0) + 4, BIT0);
|
2012-05-04 17:01:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 18:29:03 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ConnectRecursivelyIfPciMassStorage (
|
|
|
|
IN EFI_HANDLE Handle,
|
|
|
|
IN EFI_PCI_IO_PROTOCOL *Instance,
|
|
|
|
IN PCI_TYPE00 *PciHeader
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
|
|
|
CHAR16 *DevPathStr;
|
|
|
|
|
|
|
|
if (IS_CLASS1 (PciHeader, PCI_CLASS_MASS_STORAGE)) {
|
|
|
|
DevicePath = NULL;
|
|
|
|
Status = gBS->HandleProtocol (
|
|
|
|
Handle,
|
|
|
|
&gEfiDevicePathProtocolGuid,
|
|
|
|
(VOID*)&DevicePath
|
|
|
|
);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Print Device Path
|
|
|
|
//
|
|
|
|
DevPathStr = DevicePathToStr (DevicePath);
|
2013-07-26 05:14:08 +02:00
|
|
|
if (DevPathStr != NULL) {
|
|
|
|
DEBUG((
|
|
|
|
EFI_D_INFO,
|
|
|
|
"Found Mass Storage device: %s\n",
|
|
|
|
DevPathStr
|
|
|
|
));
|
|
|
|
FreePool(DevPathStr);
|
|
|
|
}
|
2009-09-16 18:29:03 +02:00
|
|
|
|
|
|
|
Status = gBS->ConnectController (Handle, NULL, NULL, TRUE);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-26 09:15:55 +02:00
|
|
|
/**
|
|
|
|
This notification function is invoked when the
|
|
|
|
EMU Variable FVB has been changed.
|
|
|
|
|
|
|
|
@param Event The event that occured
|
|
|
|
@param Context For EFI compatiblity. Not used.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
EmuVariablesUpdatedCallback (
|
|
|
|
IN EFI_EVENT Event,
|
|
|
|
IN VOID *Context
|
|
|
|
)
|
|
|
|
{
|
|
|
|
DEBUG ((EFI_D_INFO, "EmuVariablesUpdatedCallback\n"));
|
|
|
|
UpdateNvVarsOnFileSystem ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-16 18:29:03 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
VisitingFileSystemInstance (
|
|
|
|
IN EFI_HANDLE Handle,
|
|
|
|
IN VOID *Instance,
|
|
|
|
IN VOID *Context
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
STATIC BOOLEAN ConnectedToFileSystem = FALSE;
|
|
|
|
|
|
|
|
if (ConnectedToFileSystem) {
|
|
|
|
return EFI_ALREADY_STARTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = ConnectNvVarsToFileSystem (Handle);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
ConnectedToFileSystem = TRUE;
|
2009-09-26 09:15:55 +02:00
|
|
|
mEmuVariableEvent =
|
|
|
|
EfiCreateProtocolNotifyEvent (
|
|
|
|
&gEfiDevicePathProtocolGuid,
|
|
|
|
TPL_CALLBACK,
|
|
|
|
EmuVariablesUpdatedCallback,
|
|
|
|
NULL,
|
|
|
|
&mEmuVariableEventReg
|
|
|
|
);
|
|
|
|
PcdSet64 (PcdEmuVariableEvent, (UINT64)(UINTN) mEmuVariableEvent);
|
|
|
|
|
2009-09-16 18:29:03 +02:00
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
|
|
|
PlatformBdsRestoreNvVarsFromHardDisk (
|
|
|
|
)
|
|
|
|
{
|
|
|
|
VisitAllPciInstances (ConnectRecursivelyIfPciMassStorage);
|
|
|
|
VisitAllInstancesOfProtocol (
|
|
|
|
&gEfiSimpleFileSystemProtocolGuid,
|
|
|
|
VisitingFileSystemInstance,
|
|
|
|
NULL
|
|
|
|
);
|
2010-10-13 09:07:16 +02:00
|
|
|
|
2009-09-16 18:29:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-27 23:10:18 +02:00
|
|
|
VOID
|
|
|
|
PlatformBdsConnectSequence (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
Connect with predeined platform connect sequence,
|
|
|
|
the OEM/IBV can customize with their own connect sequence.
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
--*/
|
|
|
|
{
|
|
|
|
UINTN Index;
|
|
|
|
|
|
|
|
DEBUG ((EFI_D_INFO, "PlatformBdsConnectSequence\n"));
|
|
|
|
|
|
|
|
Index = 0;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Here we can get the customized platform connect sequence
|
|
|
|
// Notes: we can connect with new variable which record the
|
|
|
|
// last time boots connect device path sequence
|
|
|
|
//
|
|
|
|
while (gPlatformConnectSequence[Index] != NULL) {
|
|
|
|
//
|
|
|
|
// Build the platform boot option
|
|
|
|
//
|
|
|
|
BdsLibConnectDevicePath (gPlatformConnectSequence[Index]);
|
|
|
|
Index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Just use the simple policy to connect all devices
|
|
|
|
//
|
|
|
|
BdsLibConnectAll ();
|
|
|
|
|
2014-11-14 01:39:04 +01:00
|
|
|
PciAcpiInitialization ();
|
2009-06-30 17:57:35 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Clear the logo after all devices are connected.
|
|
|
|
//
|
|
|
|
gST->ConOut->ClearScreen (gST->ConOut);
|
2009-05-27 23:10:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
PlatformBdsGetDriverOption (
|
|
|
|
IN OUT LIST_ENTRY *BdsDriverLists
|
|
|
|
)
|
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
Load the predefined driver option, OEM/IBV can customize this
|
|
|
|
to load their own drivers
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
BdsDriverLists - The header of the driver option link list.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
--*/
|
|
|
|
{
|
|
|
|
DEBUG ((EFI_D_INFO, "PlatformBdsGetDriverOption\n"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
PlatformBdsDiagnostics (
|
|
|
|
IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel,
|
2009-07-13 14:07:26 +02:00
|
|
|
IN BOOLEAN QuietBoot,
|
|
|
|
IN BASEM_MEMORY_TEST BaseMemoryTest
|
2009-05-27 23:10:18 +02:00
|
|
|
)
|
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
Perform the platform diagnostic, such like test memory. OEM/IBV also
|
|
|
|
can customize this fuction to support specific platform diagnostic.
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
MemoryTestLevel - The memory test intensive level
|
|
|
|
|
|
|
|
QuietBoot - Indicate if need to enable the quiet boot
|
|
|
|
|
2009-07-13 14:07:26 +02:00
|
|
|
BaseMemoryTest - A pointer to BaseMemoryTest()
|
|
|
|
|
2009-05-27 23:10:18 +02:00
|
|
|
Returns:
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
--*/
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
|
|
|
|
DEBUG ((EFI_D_INFO, "PlatformBdsDiagnostics\n"));
|
|
|
|
|
|
|
|
//
|
|
|
|
// Here we can decide if we need to show
|
|
|
|
// the diagnostics screen
|
|
|
|
// Notes: this quiet boot code should be remove
|
|
|
|
// from the graphic lib
|
|
|
|
//
|
|
|
|
if (QuietBoot) {
|
2009-07-09 07:48:35 +02:00
|
|
|
EnableQuietBoot (PcdGetPtr(PcdLogoFile));
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
|
|
|
// Perform system diagnostic
|
|
|
|
//
|
2009-07-13 14:07:26 +02:00
|
|
|
Status = BaseMemoryTest (MemoryTestLevel);
|
2009-05-27 23:10:18 +02:00
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
DisableQuietBoot ();
|
|
|
|
}
|
|
|
|
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// Perform system diagnostic
|
|
|
|
//
|
2009-07-13 14:07:26 +02:00
|
|
|
Status = BaseMemoryTest (MemoryTestLevel);
|
2009-05-27 23:10:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
OvmfPkg: install DxeSmmReadyToLock in PlatformBdsLib
Currently we have the following call chain in OVMF:
PlatformBdsPolicyBehavior()
[OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c]
//
// signals End-of-Dxe
//
OnEndOfDxe() [OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c]
S3Ready() [OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c]
//
// 1. saves S3 state
//
SaveS3BootScript() [OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c]
//
// 2. saves INFO opcode in S3 boot script
// 3. installs DxeSmmReadyToLockProtocol
//
The bottom of this call chain was introduced in git commit 5a217a06 (SVN
r15305, "OvmfPkg: S3 Suspend: save boot script after ACPI context"). That
patch was necessary because there was no other way, due to GenericBdsLib
calling S3Save() from BdsLibBootViaBootOption(), to perform the necessary
steps in the right order:
- save S3 system information,
- save a final (well, only) boot script opcode,
- signal DxeSmmReadyToLock, closing the boot script, and locking down
LockBox and SMM.
The GenericBdsLib bug has been fixed in the previous patch -- the call in
BdsLibBootViaBootOption() has been eliminated.
Therefore, hoist the SaveS3BootScript() code, and call, from
OvmfPkg/AcpiS3SaveDxe, to PlatformBdsLib:
PlatformBdsPolicyBehavior()
[OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c]
//
// signals End-of-Dxe
//
OnEndOfDxe() [OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c]
S3Ready() [OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c]
//
// 1. saves S3 state
//
<---
SaveS3BootScript() [OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c]
//
// 2. saves INFO opcode in S3 boot script
// 3. installs DxeSmmReadyToLockProtocol
//
The installation of DxeSmmReadyToLockProtocol belongs with Platform BDS,
not AcpiS3SaveDxe, and we can now undo the hack in SVN r15305, without
upsetting the relative order of the steps.
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18037 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-26 10:02:24 +02:00
|
|
|
/**
|
|
|
|
Save the S3 boot script.
|
|
|
|
|
|
|
|
Note that we trigger DxeSmmReadyToLock here -- otherwise the script wouldn't
|
|
|
|
be saved actually. Triggering this protocol installation event in turn locks
|
|
|
|
down SMM, so no further changes to LockBoxes or SMRAM are possible
|
|
|
|
afterwards.
|
|
|
|
**/
|
|
|
|
STATIC
|
|
|
|
VOID
|
|
|
|
SaveS3BootScript (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_S3_SAVE_STATE_PROTOCOL *BootScript;
|
|
|
|
EFI_HANDLE Handle;
|
|
|
|
STATIC CONST UINT8 Info[] = { 0xDE, 0xAD, 0xBE, 0xEF };
|
|
|
|
|
|
|
|
Status = gBS->LocateProtocol (&gEfiS3SaveStateProtocolGuid, NULL,
|
|
|
|
(VOID **) &BootScript);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Despite the opcode documentation in the PI spec, the protocol
|
|
|
|
// implementation embeds a deep copy of the info in the boot script, rather
|
|
|
|
// than storing just a pointer to runtime or NVS storage.
|
|
|
|
//
|
|
|
|
Status = BootScript->Write(BootScript, EFI_BOOT_SCRIPT_INFORMATION_OPCODE,
|
|
|
|
(UINT32) sizeof Info,
|
|
|
|
(EFI_PHYSICAL_ADDRESS)(UINTN) &Info);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
|
|
|
Handle = NULL;
|
|
|
|
Status = gBS->InstallProtocolInterface (&Handle,
|
|
|
|
&gEfiDxeSmmReadyToLockProtocolGuid, EFI_NATIVE_INTERFACE,
|
|
|
|
NULL);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-27 23:10:18 +02:00
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
PlatformBdsPolicyBehavior (
|
|
|
|
IN OUT LIST_ENTRY *DriverOptionList,
|
2009-07-13 14:07:26 +02:00
|
|
|
IN OUT LIST_ENTRY *BootOptionList,
|
|
|
|
IN PROCESS_CAPSULES ProcessCapsules,
|
|
|
|
IN BASEM_MEMORY_TEST BaseMemoryTest
|
2009-05-27 23:10:18 +02:00
|
|
|
)
|
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
The function will excute with as the platform policy, current policy
|
|
|
|
is driven by boot mode. IBV/OEM can customize this code for their specific
|
|
|
|
policy action.
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
DriverOptionList - The header of the driver option link list
|
|
|
|
|
|
|
|
BootOptionList - The header of the boot option link list
|
|
|
|
|
2009-07-13 14:07:26 +02:00
|
|
|
ProcessCapsules - A pointer to ProcessCapsules()
|
|
|
|
|
|
|
|
BaseMemoryTest - A pointer to BaseMemoryTest()
|
|
|
|
|
2009-05-27 23:10:18 +02:00
|
|
|
Returns:
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
--*/
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
2009-06-07 06:44:53 +02:00
|
|
|
EFI_BOOT_MODE BootMode;
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior\n"));
|
|
|
|
|
2015-07-14 14:01:52 +02:00
|
|
|
VisitAllInstancesOfProtocol (&gEfiPciRootBridgeIoProtocolGuid,
|
|
|
|
ConnectRootBridge, NULL);
|
2009-09-16 18:29:03 +02:00
|
|
|
|
2016-03-13 18:08:26 +01:00
|
|
|
//
|
|
|
|
// Signal the ACPI platform driver that it can download QEMU ACPI tables.
|
|
|
|
//
|
|
|
|
EfiEventGroupSignal (&gRootBridgesConnectedEventGroupGuid);
|
|
|
|
|
OvmfPkg: PlatformBdsLib: signal End-of-Dxe event group
(Paraphrasing git commit 9cd7d3c5 / SVN r17713:)
Currently, OvmfPkg fails to signal the End-of-Dxe event group when
entering the BDS phase, which results in some loss of functionality, eg.
variable reclaim in the variable driver, and the memory region splitting
in the DXE core that belongs to the properties table feature specified in
UEFI-2.5.
As discussed on the edk2-devel mailing list here:
http://thread.gmane.org/gmane.comp.bios.tianocore.devel/16088/focus=16109
it is up to the platform BDS to signal End-of-Dxe, since there may be
platform specific ordering constraints with respect to the signalling of
the event that are difficult to honor at the generic level.
(OvmfPkg specifics:)
(1) In OvmfPkg, we can't signal End-of-Dxe before PCI enumeration
completes. According to the previous patch, that would trigger
OvmfPkg/AcpiS3SaveDxe to save S3 state *before* the following chain of
action happened:
- PCI enumeration completes
- ACPI tables are installed by OvmfPkg/AcpiPlatformDxe
- the FACS table becomes available
Since OvmfPkg/AcpiS3SaveDxe can only save S3 state once the FACS table
is available, we must delay the End-of-Dxe signal until after PCI
enumeration completes (ie. root bridges are connected).
(2) Pre-patch, S3Ready() in OvmfPkg/AcpiS3SaveDxe is entered from
BdsLibBootViaBootOption()
[IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c].
After the patch, we enter S3Ready() earlier than that, by signaling
End-of-Dxe in PlatformBdsPolicyBehavior(). The timing / location of
this new call is correct as well, and the original call (that now
becomes the chronologically second call) becomes a no-op: S3Ready() is
protected against 2nd and later entries.
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18035 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-26 10:02:13 +02:00
|
|
|
//
|
|
|
|
// We can't signal End-of-Dxe earlier than this. Namely, End-of-Dxe triggers
|
|
|
|
// the preparation of S3 system information. That logic has a hard dependency
|
|
|
|
// on the presence of the FACS ACPI table. Since our ACPI tables are only
|
|
|
|
// installed after PCI enumeration completes, we must not trigger the S3 save
|
|
|
|
// earlier, hence we can't signal End-of-Dxe earlier.
|
|
|
|
//
|
2016-03-22 17:37:36 +01:00
|
|
|
EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);
|
OvmfPkg: PlatformBdsLib: signal End-of-Dxe event group
(Paraphrasing git commit 9cd7d3c5 / SVN r17713:)
Currently, OvmfPkg fails to signal the End-of-Dxe event group when
entering the BDS phase, which results in some loss of functionality, eg.
variable reclaim in the variable driver, and the memory region splitting
in the DXE core that belongs to the properties table feature specified in
UEFI-2.5.
As discussed on the edk2-devel mailing list here:
http://thread.gmane.org/gmane.comp.bios.tianocore.devel/16088/focus=16109
it is up to the platform BDS to signal End-of-Dxe, since there may be
platform specific ordering constraints with respect to the signalling of
the event that are difficult to honor at the generic level.
(OvmfPkg specifics:)
(1) In OvmfPkg, we can't signal End-of-Dxe before PCI enumeration
completes. According to the previous patch, that would trigger
OvmfPkg/AcpiS3SaveDxe to save S3 state *before* the following chain of
action happened:
- PCI enumeration completes
- ACPI tables are installed by OvmfPkg/AcpiPlatformDxe
- the FACS table becomes available
Since OvmfPkg/AcpiS3SaveDxe can only save S3 state once the FACS table
is available, we must delay the End-of-Dxe signal until after PCI
enumeration completes (ie. root bridges are connected).
(2) Pre-patch, S3Ready() in OvmfPkg/AcpiS3SaveDxe is entered from
BdsLibBootViaBootOption()
[IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c].
After the patch, we enter S3Ready() earlier than that, by signaling
End-of-Dxe in PlatformBdsPolicyBehavior(). The timing / location of
this new call is correct as well, and the original call (that now
becomes the chronologically second call) becomes a no-op: S3Ready() is
protected against 2nd and later entries.
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18035 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-26 10:02:13 +02:00
|
|
|
|
OvmfPkg: install DxeSmmReadyToLock in PlatformBdsLib
Currently we have the following call chain in OVMF:
PlatformBdsPolicyBehavior()
[OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c]
//
// signals End-of-Dxe
//
OnEndOfDxe() [OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c]
S3Ready() [OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c]
//
// 1. saves S3 state
//
SaveS3BootScript() [OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c]
//
// 2. saves INFO opcode in S3 boot script
// 3. installs DxeSmmReadyToLockProtocol
//
The bottom of this call chain was introduced in git commit 5a217a06 (SVN
r15305, "OvmfPkg: S3 Suspend: save boot script after ACPI context"). That
patch was necessary because there was no other way, due to GenericBdsLib
calling S3Save() from BdsLibBootViaBootOption(), to perform the necessary
steps in the right order:
- save S3 system information,
- save a final (well, only) boot script opcode,
- signal DxeSmmReadyToLock, closing the boot script, and locking down
LockBox and SMM.
The GenericBdsLib bug has been fixed in the previous patch -- the call in
BdsLibBootViaBootOption() has been eliminated.
Therefore, hoist the SaveS3BootScript() code, and call, from
OvmfPkg/AcpiS3SaveDxe, to PlatformBdsLib:
PlatformBdsPolicyBehavior()
[OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c]
//
// signals End-of-Dxe
//
OnEndOfDxe() [OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c]
S3Ready() [OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c]
//
// 1. saves S3 state
//
<---
SaveS3BootScript() [OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c]
//
// 2. saves INFO opcode in S3 boot script
// 3. installs DxeSmmReadyToLockProtocol
//
The installation of DxeSmmReadyToLockProtocol belongs with Platform BDS,
not AcpiS3SaveDxe, and we can now undo the hack in SVN r15305, without
upsetting the relative order of the steps.
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18037 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-26 10:02:24 +02:00
|
|
|
if (QemuFwCfgS3Enabled ()) {
|
|
|
|
//
|
|
|
|
// Save the boot script too. Note that this requires/includes emitting the
|
|
|
|
// DxeSmmReadyToLock event, which in turn locks down SMM.
|
|
|
|
//
|
|
|
|
SaveS3BootScript ();
|
|
|
|
}
|
|
|
|
|
2013-11-12 19:35:32 +01:00
|
|
|
if (PcdGetBool (PcdOvmfFlashVariablesEnable)) {
|
|
|
|
DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior: not restoring NvVars "
|
|
|
|
"from disk since flash variables appear to be supported.\n"));
|
|
|
|
} else {
|
|
|
|
//
|
|
|
|
// Try to restore variables from the hard disk early so
|
|
|
|
// they can be used for the other BDS connect operations.
|
|
|
|
//
|
|
|
|
PlatformBdsRestoreNvVarsFromHardDisk ();
|
|
|
|
}
|
2009-09-16 18:29:03 +02:00
|
|
|
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
|
|
|
// Load the driver option as the driver option list
|
|
|
|
//
|
|
|
|
PlatformBdsGetDriverOption (DriverOptionList);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Get current Boot Mode
|
|
|
|
//
|
2009-06-07 06:44:53 +02:00
|
|
|
Status = BdsLibGetBootMode (&BootMode);
|
|
|
|
DEBUG ((EFI_D_ERROR, "Boot Mode:%x\n", BootMode));
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Go the different platform policy with different boot mode
|
|
|
|
// Notes: this part code can be change with the table policy
|
|
|
|
//
|
2009-06-07 06:44:53 +02:00
|
|
|
ASSERT (BootMode == BOOT_WITH_FULL_CONFIGURATION);
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
|
|
|
// Connect platform console
|
|
|
|
//
|
|
|
|
Status = PlatformBdsConnectConsole (gPlatformConsole);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
//
|
|
|
|
// Here OEM/IBV can customize with defined action
|
|
|
|
//
|
|
|
|
PlatformBdsNoConsoleAction ();
|
|
|
|
}
|
2014-11-06 15:21:15 +01:00
|
|
|
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
|
|
|
// Memory test and Logo show
|
|
|
|
//
|
2009-07-13 14:07:26 +02:00
|
|
|
PlatformBdsDiagnostics (IGNORE, TRUE, BaseMemoryTest);
|
2009-05-27 23:10:18 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Perform some platform specific connect sequence
|
|
|
|
//
|
|
|
|
PlatformBdsConnectSequence ();
|
|
|
|
|
2012-11-02 19:28:17 +01:00
|
|
|
//
|
|
|
|
// Process QEMU's -kernel command line option
|
|
|
|
//
|
|
|
|
TryRunningQemuKernel ();
|
|
|
|
|
2009-05-27 23:10:18 +02:00
|
|
|
DEBUG ((EFI_D_INFO, "BdsLibConnectAll\n"));
|
|
|
|
BdsLibConnectAll ();
|
|
|
|
BdsLibEnumerateAllBootOption (BootOptionList);
|
|
|
|
|
2012-08-28 01:28:30 +02:00
|
|
|
SetBootOrderFromQemu (BootOptionList);
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
OvmfPkg: BDS: remove historic (now defunct) boot mode hack
When PI can distinguish the "full config" boot mode from "assume no
changes", then the following BDS logic is correct:
if BootMode == BOOT_WITH_FULL_CONFIGURATION:
//
// connect all devices
// create & append each default boot option that's missing
//
BdsLibConnectAll
BdsLibEnumerateAllBootOption
else if BootMode == BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
//
// just stick with current BootOrder and the Boot#### variables
// referenced by it
//
In theory, the first branch is intended to run infrequently, and the
"assume no changes" branch should run most of the time.
However, some platforms can't tell these two boot modes apart. The
following substitute had been introduced:
//
// Technically, always assume "full config", but the BootMode HOB is
// actually meaningless wrt. to "full config" or "assume no changes".
//
ASSERT (BootMode == BOOT_WITH_FULL_CONFIGURATION);
//
// Key off the existence of BootOrder. Try to prepare an in-memory list
// of boot options, based on BootOrder and the referenced Boot####
// variables.
//
Status = BdsLibBuildOptionFromVar()
//
// If that succeeded, we'll treat it as "assume no changes". If it
// failed (*only* if it failed), we'll build default boot options,
// calling it "full config":
//
if EFI_ERROR(Status):
BdsLibConnectAll()
BdsLibEnumerateAllBootOption(BootOptionList)
What we have now in OVMF is a mixture of the hack, and the behavior that's
theoretically correct for "full config":
- We assert "full config" -- this is OK.
- We call "connect all" and "enumerate all" deliberately -- this is OK
too. It matches "full config" which we assert.
- However, we also have the hack in place, which had been meant as an
alternative.
In order to clean this up, we either need to restore the hack to its
original form (ie. comment out the unconditional calls again), or we ought
to remove the hack altogether.
The unconditional "connect all" + "enumerate all" calls are the correct
approach for OVMF, because we want, in fact, to start with "full config".
The QEMU boot order specification and the set of emulated devices might
change "out of band", which excludes "assume no changes".
In other words, removing the hack corresponds to the "real production"
case that the comment hints at.
Because SetBootOrderFromQemu() may change the BootOrder NvVar, we must
preserve the BdsLibBuildOptionFromVar() function call, in order to
refresh the in-memory list with the new boot priorities.
(The last step of BdsLibEnumerateAllBootOption() is such a call too.)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15326 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-13 18:34:55 +01:00
|
|
|
// The BootOrder variable may have changed, reload the in-memory list with
|
|
|
|
// it.
|
2009-05-27 23:10:18 +02:00
|
|
|
//
|
OvmfPkg: BDS: remove historic (now defunct) boot mode hack
When PI can distinguish the "full config" boot mode from "assume no
changes", then the following BDS logic is correct:
if BootMode == BOOT_WITH_FULL_CONFIGURATION:
//
// connect all devices
// create & append each default boot option that's missing
//
BdsLibConnectAll
BdsLibEnumerateAllBootOption
else if BootMode == BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
//
// just stick with current BootOrder and the Boot#### variables
// referenced by it
//
In theory, the first branch is intended to run infrequently, and the
"assume no changes" branch should run most of the time.
However, some platforms can't tell these two boot modes apart. The
following substitute had been introduced:
//
// Technically, always assume "full config", but the BootMode HOB is
// actually meaningless wrt. to "full config" or "assume no changes".
//
ASSERT (BootMode == BOOT_WITH_FULL_CONFIGURATION);
//
// Key off the existence of BootOrder. Try to prepare an in-memory list
// of boot options, based on BootOrder and the referenced Boot####
// variables.
//
Status = BdsLibBuildOptionFromVar()
//
// If that succeeded, we'll treat it as "assume no changes". If it
// failed (*only* if it failed), we'll build default boot options,
// calling it "full config":
//
if EFI_ERROR(Status):
BdsLibConnectAll()
BdsLibEnumerateAllBootOption(BootOptionList)
What we have now in OVMF is a mixture of the hack, and the behavior that's
theoretically correct for "full config":
- We assert "full config" -- this is OK.
- We call "connect all" and "enumerate all" deliberately -- this is OK
too. It matches "full config" which we assert.
- However, we also have the hack in place, which had been meant as an
alternative.
In order to clean this up, we either need to restore the hack to its
original form (ie. comment out the unconditional calls again), or we ought
to remove the hack altogether.
The unconditional "connect all" + "enumerate all" calls are the correct
approach for OVMF, because we want, in fact, to start with "full config".
The QEMU boot order specification and the set of emulated devices might
change "out of band", which excludes "assume no changes".
In other words, removing the hack corresponds to the "real production"
case that the comment hints at.
Because SetBootOrderFromQemu() may change the BootOrder NvVar, we must
preserve the BdsLibBuildOptionFromVar() function call, in order to
refresh the in-memory list with the new boot priorities.
(The last step of BdsLibEnumerateAllBootOption() is such a call too.)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15326 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-13 18:34:55 +01:00
|
|
|
BdsLibBuildOptionFromVar (BootOptionList, L"BootOrder");
|
2009-05-27 23:10:18 +02:00
|
|
|
|
2015-01-14 17:25:59 +01:00
|
|
|
PlatformBdsEnterFrontPage (GetFrontPageTimeoutFromQemu(), TRUE);
|
2009-05-27 23:10:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
PlatformBdsBootSuccess (
|
|
|
|
IN BDS_COMMON_OPTION *Option
|
|
|
|
)
|
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
Hook point after a boot attempt succeeds. We don't expect a boot option to
|
|
|
|
return, so the EFI 1.0 specification defines that you will default to an
|
|
|
|
interactive mode and stop processing the BootOrder list in this case. This
|
|
|
|
is alos a platform implementation and can be customized by IBV/OEM.
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
Option - Pointer to Boot Option that succeeded to boot.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
--*/
|
|
|
|
{
|
|
|
|
CHAR16 *TmpStr;
|
|
|
|
|
|
|
|
DEBUG ((EFI_D_INFO, "PlatformBdsBootSuccess\n"));
|
|
|
|
//
|
|
|
|
// If Boot returned with EFI_SUCCESS and there is not in the boot device
|
|
|
|
// select loop then we need to pop up a UI and wait for user input.
|
|
|
|
//
|
|
|
|
TmpStr = Option->StatusString;
|
|
|
|
if (TmpStr != NULL) {
|
|
|
|
BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);
|
|
|
|
FreePool (TmpStr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
PlatformBdsBootFail (
|
|
|
|
IN BDS_COMMON_OPTION *Option,
|
|
|
|
IN EFI_STATUS Status,
|
|
|
|
IN CHAR16 *ExitData,
|
|
|
|
IN UINTN ExitDataSize
|
|
|
|
)
|
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
Hook point after a boot attempt fails.
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
Option - Pointer to Boot Option that failed to boot.
|
|
|
|
|
|
|
|
Status - Status returned from failed boot.
|
|
|
|
|
|
|
|
ExitData - Exit data returned from failed boot.
|
|
|
|
|
|
|
|
ExitDataSize - Exit data size returned from failed boot.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
--*/
|
|
|
|
{
|
|
|
|
CHAR16 *TmpStr;
|
|
|
|
|
|
|
|
DEBUG ((EFI_D_INFO, "PlatformBdsBootFail\n"));
|
|
|
|
|
|
|
|
//
|
|
|
|
// If Boot returned with failed status then we need to pop up a UI and wait
|
|
|
|
// for user input.
|
|
|
|
//
|
|
|
|
TmpStr = Option->StatusString;
|
|
|
|
if (TmpStr != NULL) {
|
|
|
|
BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);
|
|
|
|
FreePool (TmpStr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
PlatformBdsNoConsoleAction (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
This function is remained for IBV/OEM to do some platform action,
|
|
|
|
if there no console device can be connected.
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
EFI_SUCCESS - Direct return success now.
|
|
|
|
|
|
|
|
--*/
|
|
|
|
{
|
|
|
|
DEBUG ((EFI_D_INFO, "PlatformBdsNoConsoleAction\n"));
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2009-07-10 05:26:52 +02:00
|
|
|
VOID
|
2009-05-27 23:10:18 +02:00
|
|
|
EFIAPI
|
|
|
|
PlatformBdsLockNonUpdatableFlash (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
|
|
|
DEBUG ((EFI_D_INFO, "PlatformBdsLockNonUpdatableFlash\n"));
|
2009-07-10 05:26:52 +02:00
|
|
|
return;
|
2009-05-27 23:10:18 +02:00
|
|
|
}
|
2009-06-30 17:57:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
This notification function is invoked when an instance of the
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL is produced.
|
|
|
|
|
|
|
|
@param Event The event that occured
|
|
|
|
@param Context For EFI compatiblity. Not used.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
NotifyDevPath (
|
|
|
|
IN EFI_EVENT Event,
|
|
|
|
IN VOID *Context
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_HANDLE Handle;
|
|
|
|
EFI_STATUS Status;
|
|
|
|
UINTN BufferSize;
|
|
|
|
EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
|
|
|
|
ATAPI_DEVICE_PATH *Atapi;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Examine all new handles
|
|
|
|
//
|
|
|
|
for (;;) {
|
|
|
|
//
|
|
|
|
// Get the next handle
|
|
|
|
//
|
|
|
|
BufferSize = sizeof (Handle);
|
|
|
|
Status = gBS->LocateHandle (
|
|
|
|
ByRegisterNotify,
|
|
|
|
NULL,
|
|
|
|
mEfiDevPathNotifyReg,
|
|
|
|
&BufferSize,
|
|
|
|
&Handle
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// If not found, we're done
|
|
|
|
//
|
|
|
|
if (EFI_NOT_FOUND == Status) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Get the DevicePath protocol on that handle
|
|
|
|
//
|
|
|
|
Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **)&DevPathNode);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
|
|
|
while (!IsDevicePathEnd (DevPathNode)) {
|
|
|
|
//
|
|
|
|
// Find the handler to dump this device path node
|
|
|
|
//
|
|
|
|
if (
|
|
|
|
(DevicePathType(DevPathNode) == MESSAGING_DEVICE_PATH) &&
|
|
|
|
(DevicePathSubType(DevPathNode) == MSG_ATAPI_DP)
|
|
|
|
) {
|
|
|
|
Atapi = (ATAPI_DEVICE_PATH*) DevPathNode;
|
|
|
|
PciOr16 (
|
|
|
|
PCI_LIB_ADDRESS (
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
1,
|
|
|
|
(Atapi->PrimarySecondary == 1) ? 0x42: 0x40
|
|
|
|
),
|
|
|
|
BIT15
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Next device path node
|
|
|
|
//
|
|
|
|
DevPathNode = NextDevicePathNode (DevPathNode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
|
|
|
InstallDevicePathCallback (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
|
|
|
DEBUG ((EFI_D_INFO, "Registered NotifyDevPath Event\n"));
|
|
|
|
mEfiDevPathEvent = EfiCreateProtocolNotifyEvent (
|
|
|
|
&gEfiDevicePathProtocolGuid,
|
|
|
|
TPL_CALLBACK,
|
|
|
|
NotifyDevPath,
|
|
|
|
NULL,
|
|
|
|
&mEfiDevPathNotifyReg
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2009-07-10 05:26:52 +02:00
|
|
|
/**
|
|
|
|
Lock the ConsoleIn device in system table. All key
|
|
|
|
presses will be ignored until the Password is typed in. The only way to
|
|
|
|
disable the password is to type it in to a ConIn device.
|
|
|
|
|
|
|
|
@param Password Password used to lock ConIn device.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS lock the Console In Spliter virtual handle successfully.
|
|
|
|
@retval EFI_UNSUPPORTED Password not found
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
LockKeyboards (
|
|
|
|
IN CHAR16 *Password
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return EFI_UNSUPPORTED;
|
|
|
|
}
|
2009-07-15 01:32:32 +02:00
|
|
|
|