Clean up BDS lib to remove assembly files, remove R8Lib.h & R8Lib.c by applying Mde Lib.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5020 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2008-04-09 05:39:18 +00:00
parent fd6a62f3bf
commit 897f0eee20
17 changed files with 5809 additions and 6254 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,422 +1,408 @@
/** @file
Copyright (c) 2004 - 2007, 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.
Module Name:
BdsConnect.c
Abstract:
BDS Lib functions which relate with connect the device
**/
#include "InternalBdsLib.h"
/**
This function will connect all the system driver to controller
first, and then special connect the default console, this make
sure all the system controller avialbe and the platform default
console connected.
None
@return None
**/
VOID
BdsLibConnectAll (
VOID
)
{
//
// Connect the platform console first
//
BdsLibConnectAllDefaultConsoles ();
//
// Generic way to connect all the drivers
//
BdsLibConnectAllDriversToAllControllers ();
//
// Here we have the assumption that we have already had
// platform default console
//
BdsLibConnectAllDefaultConsoles ();
}
/**
This function will connect all the system drivers to all controllers
first, and then connect all the console devices the system current
have. After this we should get all the device work and console avariable
if the system have console device.
None
@return None
**/
VOID
BdsLibGenericConnectAll (
VOID
)
{
//
// Most generic way to connect all the drivers
//
BdsLibConnectAllDriversToAllControllers ();
BdsLibConnectAllConsoles ();
}
/**
This function will create all handles associate with every device
path node. If the handle associate with one device path node can not
be created success, then still give one chance to do the dispatch,
which load the missing drivers if possible.
@param DevicePathToConnect The device path which will be connected, it can be
a multi-instance device path
@retval EFI_SUCCESS All handles associate with every device path node
have been created
@retval EFI_OUT_OF_RESOURCES There is no resource to create new handles
@retval EFI_NOT_FOUND Create the handle associate with one device path
node failed
**/
EFI_STATUS
BdsLibConnectDevicePath (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
)
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *CopyOfDevicePath;
EFI_DEVICE_PATH_PROTOCOL *Instance;
EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
EFI_DEVICE_PATH_PROTOCOL *Next;
EFI_HANDLE Handle;
EFI_HANDLE PreviousHandle;
UINTN Size;
if (DevicePathToConnect == NULL) {
return EFI_SUCCESS;
}
DevicePath = DuplicateDevicePath (DevicePathToConnect);
CopyOfDevicePath = DevicePath;
if (DevicePath == NULL) {
return EFI_OUT_OF_RESOURCES;
}
do {
//
// The outer loop handles multi instance device paths.
// Only console variables contain multiple instance device paths.
//
// After this call DevicePath points to the next Instance
//
Instance = GetNextDevicePathInstance (&DevicePath, &Size);
Next = Instance;
while (!IsDevicePathEndType (Next)) {
Next = NextDevicePathNode (Next);
}
SetDevicePathEndNode (Next);
//
// Start the real work of connect with RemainingDevicePath
//
PreviousHandle = NULL;
do {
//
// Find the handle that best matches the Device Path. If it is only a
// partial match the remaining part of the device path is returned in
// RemainingDevicePath.
//
RemainingDevicePath = Instance;
Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle);
if (!EFI_ERROR (Status)) {
if (Handle == PreviousHandle) {
//
// If no forward progress is made try invoking the Dispatcher.
// A new FV may have been added to the system an new drivers
// may now be found.
// Status == EFI_SUCCESS means a driver was dispatched
// Status == EFI_NOT_FOUND means no new drivers were dispatched
//
Status = gDS->Dispatch ();
}
if (!EFI_ERROR (Status)) {
PreviousHandle = Handle;
//
// Connect all drivers that apply to Handle and RemainingDevicePath,
// the Recursive flag is FALSE so only one level will be expanded.
//
// Do not check the connect status here, if the connect controller fail,
// then still give the chance to do dispatch, because partial
// RemainingDevicepath may be in the new FV
//
// 1. If the connect fail, RemainingDevicepath and handle will not
// change, so next time will do the dispatch, then dispatch's status
// will take effect
// 2. If the connect success, the RemainingDevicepath and handle will
// change, then avoid the dispatch, we have chance to continue the
// next connection
//
gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
}
}
//
// Loop until RemainingDevicePath is an empty device path
//
} while (!EFI_ERROR (Status) && !IsDevicePathEnd (RemainingDevicePath));
} while (DevicePath != NULL);
if (CopyOfDevicePath != NULL) {
gBS->FreePool (CopyOfDevicePath);
}
//
// All handle with DevicePath exists in the handle database
//
return Status;
}
/**
This function will connect all current system handles recursively. The
connection will finish until every handle's child handle created if it have.
None
@retval EFI_SUCCESS All handles and it's child handle have been
connected
@retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().
**/
EFI_STATUS
BdsLibConnectAllEfi (
VOID
)
{
EFI_STATUS Status;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
UINTN Index;
Status = gBS->LocateHandleBuffer (
AllHandles,
NULL,
NULL,
&HandleCount,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
return Status;
}
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
}
gBS->FreePool (HandleBuffer);
return EFI_SUCCESS;
}
/**
This function will disconnect all current system handles. The disconnection
will finish until every handle have been disconnected.
None
@retval EFI_SUCCESS All handles have been disconnected
@retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().
**/
EFI_STATUS
BdsLibDisconnectAllEfi (
VOID
)
{
EFI_STATUS Status;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
UINTN Index;
//
// Disconnect all
//
Status = gBS->LocateHandleBuffer (
AllHandles,
NULL,
NULL,
&HandleCount,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
return Status;
}
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
}
gBS->FreePool (HandleBuffer);
return EFI_SUCCESS;
}
/**
Connects all drivers to all controllers.
This function make sure all the current system driver will manage
the correspoinding controllers if have. And at the same time, make
sure all the system controllers have driver to manage it if have.
None
@return None
**/
VOID
BdsLibConnectAllDriversToAllControllers (
VOID
)
{
EFI_STATUS Status;
do {
//
// Connect All EFI 1.10 drivers following EFI 1.10 algorithm
//
BdsLibConnectAllEfi ();
//
// Check to see if it's possible to dispatch an more DXE drivers.
// The BdsLibConnectAllEfi () may have made new DXE drivers show up.
// If anything is Dispatched Status == EFI_SUCCESS and we will try
// the connect again.
//
Status = gDS->Dispatch ();
} while (!EFI_ERROR (Status));
}
/**
Connect the specific Usb device which match the short form device path,
and whose bus is determined by Host Controller (Uhci or Ehci)
@param HostControllerPI Uhci (0x00) or Ehci (0x20) or Both uhci and ehci
(0xFF)
@param RemainingDevicePath a short-form device path that starts with the first
element being a USB WWID or a USB Class device
path
@return EFI_INVALID_PARAMETER
@return EFI_SUCCESS
@return EFI_NOT_FOUND
**/
EFI_STATUS
BdsLibConnectUsbDevByShortFormDP(
IN UINT8 HostControllerPI,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
EFI_HANDLE *HandleArray;
UINTN HandleArrayCount;
UINTN Index;
EFI_PCI_IO_PROTOCOL *PciIo;
UINT8 Class[3];
BOOLEAN AtLeastOneConnected;
//
// Check the passed in parameters
//
if (RemainingDevicePath == NULL) {
return EFI_INVALID_PARAMETER;
}
if ((DevicePathType (RemainingDevicePath) != MESSAGING_DEVICE_PATH) ||
((DevicePathSubType (RemainingDevicePath) != MSG_USB_CLASS_DP)
&& (DevicePathSubType (RemainingDevicePath) != MSG_USB_WWID_DP)
)) {
return EFI_INVALID_PARAMETER;
}
if (HostControllerPI != 0xFF &&
HostControllerPI != 0x00 &&
HostControllerPI != 0x20) {
return EFI_INVALID_PARAMETER;
}
//
// Find the usb host controller firstly, then connect with the remaining device path
//
AtLeastOneConnected = FALSE;
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiPciIoProtocolGuid,
NULL,
&HandleArrayCount,
&HandleArray
);
if (!EFI_ERROR (Status)) {
for (Index = 0; Index < HandleArrayCount; Index++) {
Status = gBS->HandleProtocol (
HandleArray[Index],
&gEfiPciIoProtocolGuid,
(VOID **)&PciIo
);
if (!EFI_ERROR (Status)) {
//
// Check whether the Pci device is the wanted usb host controller
//
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x09, 3, &Class);
if (!EFI_ERROR (Status)) {
if ((PCI_CLASS_SERIAL == Class[2]) &&
(PCI_CLASS_SERIAL_USB == Class[1])) {
if (HostControllerPI == Class[0] || HostControllerPI == 0xFF) {
Status = gBS->ConnectController (
HandleArray[Index],
NULL,
RemainingDevicePath,
FALSE
);
if (!EFI_ERROR(Status)) {
AtLeastOneConnected = TRUE;
}
}
}
}
}
}
if (AtLeastOneConnected) {
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
/** @file
BDS Lib functions which relate with connect the device
Copyright (c) 2004 - 2008, Intel Corporation. <BR>
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.
**/
#include "InternalBdsLib.h"
/**
This function will connect all the system driver to controller
first, and then special connect the default console, this make
sure all the system controller avialbe and the platform default
console connected.
**/
VOID
EFIAPI
BdsLibConnectAll (
VOID
)
{
//
// Connect the platform console first
//
BdsLibConnectAllDefaultConsoles ();
//
// Generic way to connect all the drivers
//
BdsLibConnectAllDriversToAllControllers ();
//
// Here we have the assumption that we have already had
// platform default console
//
BdsLibConnectAllDefaultConsoles ();
}
/**
This function will connect all the system drivers to all controllers
first, and then connect all the console devices the system current
have. After this we should get all the device work and console avariable
if the system have console device.
None
@return None
**/
VOID
BdsLibGenericConnectAll (
VOID
)
{
//
// Most generic way to connect all the drivers
//
BdsLibConnectAllDriversToAllControllers ();
BdsLibConnectAllConsoles ();
}
/**
This function will create all handles associate with every device
path node. If the handle associate with one device path node can not
be created success, then still give one chance to do the dispatch,
which load the missing drivers if possible.
@param DevicePathToConnect The device path which will be connected, it can be
a multi-instance device path
@retval EFI_SUCCESS All handles associate with every device path node
have been created
@retval EFI_OUT_OF_RESOURCES There is no resource to create new handles
@retval EFI_NOT_FOUND Create the handle associate with one device path
node failed
**/
EFI_STATUS
EFIAPI
BdsLibConnectDevicePath (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
)
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *CopyOfDevicePath;
EFI_DEVICE_PATH_PROTOCOL *Instance;
EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
EFI_DEVICE_PATH_PROTOCOL *Next;
EFI_HANDLE Handle;
EFI_HANDLE PreviousHandle;
UINTN Size;
if (DevicePathToConnect == NULL) {
return EFI_SUCCESS;
}
DevicePath = DuplicateDevicePath (DevicePathToConnect);
CopyOfDevicePath = DevicePath;
if (DevicePath == NULL) {
return EFI_OUT_OF_RESOURCES;
}
do {
//
// The outer loop handles multi instance device paths.
// Only console variables contain multiple instance device paths.
//
// After this call DevicePath points to the next Instance
//
Instance = GetNextDevicePathInstance (&DevicePath, &Size);
Next = Instance;
while (!IsDevicePathEndType (Next)) {
Next = NextDevicePathNode (Next);
}
SetDevicePathEndNode (Next);
//
// Start the real work of connect with RemainingDevicePath
//
PreviousHandle = NULL;
do {
//
// Find the handle that best matches the Device Path. If it is only a
// partial match the remaining part of the device path is returned in
// RemainingDevicePath.
//
RemainingDevicePath = Instance;
Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle);
if (!EFI_ERROR (Status)) {
if (Handle == PreviousHandle) {
//
// If no forward progress is made try invoking the Dispatcher.
// A new FV may have been added to the system an new drivers
// may now be found.
// Status == EFI_SUCCESS means a driver was dispatched
// Status == EFI_NOT_FOUND means no new drivers were dispatched
//
Status = gDS->Dispatch ();
}
if (!EFI_ERROR (Status)) {
PreviousHandle = Handle;
//
// Connect all drivers that apply to Handle and RemainingDevicePath,
// the Recursive flag is FALSE so only one level will be expanded.
//
// Do not check the connect status here, if the connect controller fail,
// then still give the chance to do dispatch, because partial
// RemainingDevicepath may be in the new FV
//
// 1. If the connect fail, RemainingDevicepath and handle will not
// change, so next time will do the dispatch, then dispatch's status
// will take effect
// 2. If the connect success, the RemainingDevicepath and handle will
// change, then avoid the dispatch, we have chance to continue the
// next connection
//
gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
}
}
//
// Loop until RemainingDevicePath is an empty device path
//
} while (!EFI_ERROR (Status) && !IsDevicePathEnd (RemainingDevicePath));
} while (DevicePath != NULL);
if (CopyOfDevicePath != NULL) {
gBS->FreePool (CopyOfDevicePath);
}
//
// All handle with DevicePath exists in the handle database
//
return Status;
}
/**
This function will connect all current system handles recursively. The
connection will finish until every handle's child handle created if it have.
@retval EFI_SUCCESS All handles and it's child handle have been
connected
@retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().
**/
EFI_STATUS
EFIAPI
BdsLibConnectAllEfi (
VOID
)
{
EFI_STATUS Status;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
UINTN Index;
Status = gBS->LocateHandleBuffer (
AllHandles,
NULL,
NULL,
&HandleCount,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
return Status;
}
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
}
gBS->FreePool (HandleBuffer);
return EFI_SUCCESS;
}
/**
This function will disconnect all current system handles. The disconnection
will finish until every handle have been disconnected.
@retval EFI_SUCCESS All handles have been disconnected
@retval EFI_STATUS Return the status of gBS->LocateHandleBuffer().
**/
EFI_STATUS
EFIAPI
BdsLibDisconnectAllEfi (
VOID
)
{
EFI_STATUS Status;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
UINTN Index;
//
// Disconnect all
//
Status = gBS->LocateHandleBuffer (
AllHandles,
NULL,
NULL,
&HandleCount,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
return Status;
}
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
}
gBS->FreePool (HandleBuffer);
return EFI_SUCCESS;
}
/**
Connects all drivers to all controllers.
This function make sure all the current system driver will manage
the correspoinding controllers if have. And at the same time, make
sure all the system controllers have driver to manage it if have.
**/
VOID
EFIAPI
BdsLibConnectAllDriversToAllControllers (
VOID
)
{
EFI_STATUS Status;
do {
//
// Connect All EFI 1.10 drivers following EFI 1.10 algorithm
//
BdsLibConnectAllEfi ();
//
// Check to see if it's possible to dispatch an more DXE drivers.
// The BdsLibConnectAllEfi () may have made new DXE drivers show up.
// If anything is Dispatched Status == EFI_SUCCESS and we will try
// the connect again.
//
Status = gDS->Dispatch ();
} while (!EFI_ERROR (Status));
}
/**
Connect the specific Usb device which match the short form device path,
and whose bus is determined by Host Controller (Uhci or Ehci)
@param HostControllerPI Uhci (0x00) or Ehci (0x20) or Both uhci and ehci
(0xFF)
@param RemainingDevicePath a short-form device path that starts with the first
element being a USB WWID or a USB Class device
path
@return EFI_INVALID_PARAMETER
@return EFI_SUCCESS
@return EFI_NOT_FOUND
**/
EFI_STATUS
EFIAPI
BdsLibConnectUsbDevByShortFormDP(
IN UINT8 HostControllerPI,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
EFI_HANDLE *HandleArray;
UINTN HandleArrayCount;
UINTN Index;
EFI_PCI_IO_PROTOCOL *PciIo;
UINT8 Class[3];
BOOLEAN AtLeastOneConnected;
//
// Check the passed in parameters
//
if (RemainingDevicePath == NULL) {
return EFI_INVALID_PARAMETER;
}
if ((DevicePathType (RemainingDevicePath) != MESSAGING_DEVICE_PATH) ||
((DevicePathSubType (RemainingDevicePath) != MSG_USB_CLASS_DP)
&& (DevicePathSubType (RemainingDevicePath) != MSG_USB_WWID_DP)
)) {
return EFI_INVALID_PARAMETER;
}
if (HostControllerPI != 0xFF &&
HostControllerPI != 0x00 &&
HostControllerPI != 0x20) {
return EFI_INVALID_PARAMETER;
}
//
// Find the usb host controller firstly, then connect with the remaining device path
//
AtLeastOneConnected = FALSE;
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiPciIoProtocolGuid,
NULL,
&HandleArrayCount,
&HandleArray
);
if (!EFI_ERROR (Status)) {
for (Index = 0; Index < HandleArrayCount; Index++) {
Status = gBS->HandleProtocol (
HandleArray[Index],
&gEfiPciIoProtocolGuid,
(VOID **)&PciIo
);
if (!EFI_ERROR (Status)) {
//
// Check whether the Pci device is the wanted usb host controller
//
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x09, 3, &Class);
if (!EFI_ERROR (Status)) {
if ((PCI_CLASS_SERIAL == Class[2]) &&
(PCI_CLASS_SERIAL_USB == Class[1])) {
if (HostControllerPI == Class[0] || HostControllerPI == 0xFF) {
Status = gBS->ConnectController (
HandleArray[Index],
NULL,
RemainingDevicePath,
FALSE
);
if (!EFI_ERROR(Status)) {
AtLeastOneConnected = TRUE;
}
}
}
}
}
}
if (AtLeastOneConnected) {
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}

View File

@ -1,396 +1,386 @@
/** @file
Copyright (c) 2004 - 2007, 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.
Module Name:
BdsConsole.c
Abstract:
BDS Lib functions which contain all the code to connect console device
**/
#include "InternalBdsLib.h"
BOOLEAN
IsNvNeed (
IN CHAR16 *ConVarName
)
{
CHAR16 *Ptr;
Ptr = ConVarName;
//
// If the variable includes "Dev" at last, we consider
// it does not support NV attribute.
//
while (*Ptr) {
Ptr++;
}
if ((*(Ptr-3) == 'D') && (*(Ptr-2) == 'e') && (*(Ptr-1) == 'v')) {
return FALSE;
} else {
return TRUE;
}
}
/**
This function update console variable based on ConVarName, it can
add or remove one specific console device path from the variable
@param ConVarName Console related variable name, ConIn, ConOut,
ErrOut.
@param CustomizedConDevicePath The console device path which will be added to
the console variable ConVarName, this parameter
can not be multi-instance.
@param ExclusiveDevicePath The console device path which will be removed
from the console variable ConVarName, this
parameter can not be multi-instance.
@retval EFI_UNSUPPORTED Add or remove the same device path.
@retval EFI_SUCCESS Success add or remove the device path from the
console variable.
**/
EFI_STATUS
BdsLibUpdateConsoleVariable (
IN CHAR16 *ConVarName,
IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
)
{
EFI_DEVICE_PATH_PROTOCOL *VarConsole;
UINTN DevicePathSize;
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
EFI_DEVICE_PATH_PROTOCOL *TempNewDevicePath;
UINT32 Attributes;
VarConsole = NULL;
DevicePathSize = 0;
//
// Notes: check the device path point, here should check
// with compare memory
//
if (CustomizedConDevicePath == ExclusiveDevicePath) {
return EFI_UNSUPPORTED;
}
//
// Delete the ExclusiveDevicePath from current default console
//
VarConsole = BdsLibGetVariableAndSize (
ConVarName,
&gEfiGlobalVariableGuid,
&DevicePathSize
);
//
// Initialize NewDevicePath
//
NewDevicePath = VarConsole;
//
// If ExclusiveDevicePath is even the part of the instance in VarConsole, delete it.
// In the end, NewDevicePath is the final device path.
//
if (ExclusiveDevicePath != NULL && VarConsole != NULL) {
NewDevicePath = BdsLibDelPartMatchInstance (VarConsole, ExclusiveDevicePath);
}
//
// Try to append customized device path to NewDevicePath.
//
if (CustomizedConDevicePath != NULL) {
if (!BdsLibMatchDevicePaths (NewDevicePath, CustomizedConDevicePath)) {
//
// Check if there is part of CustomizedConDevicePath in NewDevicePath, delete it.
//
NewDevicePath = BdsLibDelPartMatchInstance (NewDevicePath, CustomizedConDevicePath);
//
// In the first check, the default console variable will be _ModuleEntryPoint,
// just append current customized device path
//
TempNewDevicePath = NewDevicePath;
NewDevicePath = AppendDevicePathInstance (NewDevicePath, CustomizedConDevicePath);
SafeFreePool(TempNewDevicePath);
}
}
//
// The attribute for ConInDev, ConOutDev and ErrOutDev does not include NV.
//
if (IsNvNeed(ConVarName)) {
//
// ConVarName has NV attribute.
//
Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;
} else {
//
// ConVarName does not have NV attribute.
//
Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
}
//
// Finally, Update the variable of the default console by NewDevicePath
//
gRT->SetVariable (
ConVarName,
&gEfiGlobalVariableGuid,
Attributes,
GetDevicePathSize (NewDevicePath),
NewDevicePath
);
if (VarConsole == NewDevicePath) {
SafeFreePool(VarConsole);
} else {
SafeFreePool(VarConsole);
SafeFreePool(NewDevicePath);
}
return EFI_SUCCESS;
}
/**
Connect the console device base on the variable ConVarName, if
device path of the ConVarName is multi-instance device path, if
anyone of the instances is connected success, then this function
will return success.
@param ConVarName Console related variable name, ConIn, ConOut,
ErrOut.
@retval EFI_NOT_FOUND There is not any console devices connected
success
@retval EFI_SUCCESS Success connect any one instance of the console
device path base on the variable ConVarName.
**/
EFI_STATUS
BdsLibConnectConsoleVariable (
IN CHAR16 *ConVarName
)
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *StartDevicePath;
UINTN VariableSize;
EFI_DEVICE_PATH_PROTOCOL *Instance;
EFI_DEVICE_PATH_PROTOCOL *Next;
EFI_DEVICE_PATH_PROTOCOL *CopyOfDevicePath;
UINTN Size;
BOOLEAN DeviceExist;
Status = EFI_SUCCESS;
DeviceExist = FALSE;
//
// Check if the console variable exist
//
StartDevicePath = BdsLibGetVariableAndSize (
ConVarName,
&gEfiGlobalVariableGuid,
&VariableSize
);
if (StartDevicePath == NULL) {
return EFI_UNSUPPORTED;
}
CopyOfDevicePath = StartDevicePath;
do {
//
// Check every instance of the console variable
//
Instance = GetNextDevicePathInstance (&CopyOfDevicePath, &Size);
Next = Instance;
while (!IsDevicePathEndType (Next)) {
Next = NextDevicePathNode (Next);
}
SetDevicePathEndNode (Next);
//
// Check USB1.1 console
//
if ((DevicePathType (Instance) == MESSAGING_DEVICE_PATH) &&
((DevicePathSubType (Instance) == MSG_USB_CLASS_DP)
|| (DevicePathSubType (Instance) == MSG_USB_WWID_DP)
)) {
//
// Check the Usb console in Usb2.0 bus firstly, then Usb1.1 bus
//
Status = BdsLibConnectUsbDevByShortFormDP (PCI_CLASSC_PI_EHCI, Instance);
if (!EFI_ERROR (Status)) {
DeviceExist = TRUE;
}
Status = BdsLibConnectUsbDevByShortFormDP (PCI_CLASSC_PI_UHCI, Instance);
if (!EFI_ERROR (Status)) {
DeviceExist = TRUE;
}
} else {
//
// Connect the instance device path
//
Status = BdsLibConnectDevicePath (Instance);
if (EFI_ERROR (Status)) {
//
// Delete the instance from the console varialbe
//
BdsLibUpdateConsoleVariable (ConVarName, NULL, Instance);
} else {
DeviceExist = TRUE;
}
}
SafeFreePool(Instance);
} while (CopyOfDevicePath != NULL);
gBS->FreePool (StartDevicePath);
if (DeviceExist == FALSE) {
return EFI_NOT_FOUND;
}
return EFI_SUCCESS;
}
/**
This function will search every simpletxt devive in current system,
and make every simpletxt device as pertantial console device.
None
@return None
**/
VOID
BdsLibConnectAllConsoles (
VOID
)
{
UINTN Index;
EFI_DEVICE_PATH_PROTOCOL *ConDevicePath;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
Index = 0;
HandleCount = 0;
HandleBuffer = NULL;
ConDevicePath = NULL;
//
// Update all the console varables
//
gBS->LocateHandleBuffer (
ByProtocol,
&gEfiSimpleTextInProtocolGuid,
NULL,
&HandleCount,
&HandleBuffer
);
for (Index = 0; Index < HandleCount; Index++) {
gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
(VOID **) &ConDevicePath
);
BdsLibUpdateConsoleVariable (L"ConIn", ConDevicePath, NULL);
}
SafeFreePool(HandleBuffer);
gBS->LocateHandleBuffer (
ByProtocol,
&gEfiSimpleTextOutProtocolGuid,
NULL,
&HandleCount,
&HandleBuffer
);
for (Index = 0; Index < HandleCount; Index++) {
gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
(VOID **) &ConDevicePath
);
BdsLibUpdateConsoleVariable (L"ConOut", ConDevicePath, NULL);
BdsLibUpdateConsoleVariable (L"ErrOut", ConDevicePath, NULL);
}
SafeFreePool(HandleBuffer);
//
// Connect all console variables
//
BdsLibConnectAllDefaultConsoles ();
}
/**
This function will connect console device base on the console
device variable ConIn, ConOut and ErrOut.
None
@retval EFI_SUCCESS At least one of the ConIn and ConOut device have
been connected success.
@retval EFI_STATUS Return the status of
BdsLibConnectConsoleVariable ().
**/
EFI_STATUS
BdsLibConnectAllDefaultConsoles (
VOID
)
{
EFI_STATUS Status;
//
// Connect all default console variables
//
//
// It seems impossible not to have any ConOut device on platform,
// so we check the status here.
//
Status = BdsLibConnectConsoleVariable (L"ConOut");
if (EFI_ERROR (Status)) {
return Status;
}
//
// Insert the performance probe for Console Out
//
PERF_START (NULL, "ConOut", "BDS", 1);
PERF_END (NULL, "ConOut", "BDS", 0);
//
// Because possibly the platform is legacy free, in such case,
// ConIn devices (Serial Port and PS2 Keyboard ) does not exist,
// so we need not check the status.
//
BdsLibConnectConsoleVariable (L"ConIn");
//
// The _ModuleEntryPoint err out var is legal.
//
BdsLibConnectConsoleVariable (L"ErrOut");
return EFI_SUCCESS;
}
/** @file
BDS Lib functions which contain all the code to connect console device
Copyright (c) 2004 - 2008, Intel Corporation. <BR>
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.
**/
#include "InternalBdsLib.h"
BOOLEAN
IsNvNeed (
IN CHAR16 *ConVarName
)
{
CHAR16 *Ptr;
Ptr = ConVarName;
//
// If the variable includes "Dev" at last, we consider
// it does not support NV attribute.
//
while (*Ptr) {
Ptr++;
}
if ((*(Ptr-3) == 'D') && (*(Ptr-2) == 'e') && (*(Ptr-1) == 'v')) {
return FALSE;
} else {
return TRUE;
}
}
/**
This function update console variable based on ConVarName, it can
add or remove one specific console device path from the variable
@param ConVarName Console related variable name, ConIn, ConOut,
ErrOut.
@param CustomizedConDevicePath The console device path which will be added to
the console variable ConVarName, this parameter
can not be multi-instance.
@param ExclusiveDevicePath The console device path which will be removed
from the console variable ConVarName, this
parameter can not be multi-instance.
@retval EFI_UNSUPPORTED Add or remove the same device path.
@retval EFI_SUCCESS Success add or remove the device path from the
console variable.
**/
EFI_STATUS
EFIAPI
BdsLibUpdateConsoleVariable (
IN CHAR16 *ConVarName,
IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
)
{
EFI_DEVICE_PATH_PROTOCOL *VarConsole;
UINTN DevicePathSize;
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
EFI_DEVICE_PATH_PROTOCOL *TempNewDevicePath;
UINT32 Attributes;
VarConsole = NULL;
DevicePathSize = 0;
//
// Notes: check the device path point, here should check
// with compare memory
//
if (CustomizedConDevicePath == ExclusiveDevicePath) {
return EFI_UNSUPPORTED;
}
//
// Delete the ExclusiveDevicePath from current default console
//
VarConsole = BdsLibGetVariableAndSize (
ConVarName,
&gEfiGlobalVariableGuid,
&DevicePathSize
);
//
// Initialize NewDevicePath
//
NewDevicePath = VarConsole;
//
// If ExclusiveDevicePath is even the part of the instance in VarConsole, delete it.
// In the end, NewDevicePath is the final device path.
//
if (ExclusiveDevicePath != NULL && VarConsole != NULL) {
NewDevicePath = BdsLibDelPartMatchInstance (VarConsole, ExclusiveDevicePath);
}
//
// Try to append customized device path to NewDevicePath.
//
if (CustomizedConDevicePath != NULL) {
if (!BdsLibMatchDevicePaths (NewDevicePath, CustomizedConDevicePath)) {
//
// Check if there is part of CustomizedConDevicePath in NewDevicePath, delete it.
//
NewDevicePath = BdsLibDelPartMatchInstance (NewDevicePath, CustomizedConDevicePath);
//
// In the first check, the default console variable will be _ModuleEntryPoint,
// just append current customized device path
//
TempNewDevicePath = NewDevicePath;
NewDevicePath = AppendDevicePathInstance (NewDevicePath, CustomizedConDevicePath);
SafeFreePool(TempNewDevicePath);
}
}
//
// The attribute for ConInDev, ConOutDev and ErrOutDev does not include NV.
//
if (IsNvNeed(ConVarName)) {
//
// ConVarName has NV attribute.
//
Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;
} else {
//
// ConVarName does not have NV attribute.
//
Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
}
//
// Finally, Update the variable of the default console by NewDevicePath
//
gRT->SetVariable (
ConVarName,
&gEfiGlobalVariableGuid,
Attributes,
GetDevicePathSize (NewDevicePath),
NewDevicePath
);
if (VarConsole == NewDevicePath) {
SafeFreePool(VarConsole);
} else {
SafeFreePool(VarConsole);
SafeFreePool(NewDevicePath);
}
return EFI_SUCCESS;
}
/**
Connect the console device base on the variable ConVarName, if
device path of the ConVarName is multi-instance device path, if
anyone of the instances is connected success, then this function
will return success.
@param ConVarName Console related variable name, ConIn, ConOut,
ErrOut.
@retval EFI_NOT_FOUND There is not any console devices connected
success
@retval EFI_SUCCESS Success connect any one instance of the console
device path base on the variable ConVarName.
**/
EFI_STATUS
EFIAPI
BdsLibConnectConsoleVariable (
IN CHAR16 *ConVarName
)
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *StartDevicePath;
UINTN VariableSize;
EFI_DEVICE_PATH_PROTOCOL *Instance;
EFI_DEVICE_PATH_PROTOCOL *Next;
EFI_DEVICE_PATH_PROTOCOL *CopyOfDevicePath;
UINTN Size;
BOOLEAN DeviceExist;
Status = EFI_SUCCESS;
DeviceExist = FALSE;
//
// Check if the console variable exist
//
StartDevicePath = BdsLibGetVariableAndSize (
ConVarName,
&gEfiGlobalVariableGuid,
&VariableSize
);
if (StartDevicePath == NULL) {
return EFI_UNSUPPORTED;
}
CopyOfDevicePath = StartDevicePath;
do {
//
// Check every instance of the console variable
//
Instance = GetNextDevicePathInstance (&CopyOfDevicePath, &Size);
Next = Instance;
while (!IsDevicePathEndType (Next)) {
Next = NextDevicePathNode (Next);
}
SetDevicePathEndNode (Next);
//
// Check USB1.1 console
//
if ((DevicePathType (Instance) == MESSAGING_DEVICE_PATH) &&
((DevicePathSubType (Instance) == MSG_USB_CLASS_DP)
|| (DevicePathSubType (Instance) == MSG_USB_WWID_DP)
)) {
//
// Check the Usb console in Usb2.0 bus firstly, then Usb1.1 bus
//
Status = BdsLibConnectUsbDevByShortFormDP (PCI_CLASSC_PI_EHCI, Instance);
if (!EFI_ERROR (Status)) {
DeviceExist = TRUE;
}
Status = BdsLibConnectUsbDevByShortFormDP (PCI_CLASSC_PI_UHCI, Instance);
if (!EFI_ERROR (Status)) {
DeviceExist = TRUE;
}
} else {
//
// Connect the instance device path
//
Status = BdsLibConnectDevicePath (Instance);
if (EFI_ERROR (Status)) {
//
// Delete the instance from the console varialbe
//
BdsLibUpdateConsoleVariable (ConVarName, NULL, Instance);
} else {
DeviceExist = TRUE;
}
}
SafeFreePool(Instance);
} while (CopyOfDevicePath != NULL);
gBS->FreePool (StartDevicePath);
if (DeviceExist == FALSE) {
return EFI_NOT_FOUND;
}
return EFI_SUCCESS;
}
/**
This function will search every simpletxt devive in current system,
and make every simpletxt device as pertantial console device.
**/
VOID
EFIAPI
BdsLibConnectAllConsoles (
VOID
)
{
UINTN Index;
EFI_DEVICE_PATH_PROTOCOL *ConDevicePath;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
Index = 0;
HandleCount = 0;
HandleBuffer = NULL;
ConDevicePath = NULL;
//
// Update all the console varables
//
gBS->LocateHandleBuffer (
ByProtocol,
&gEfiSimpleTextInProtocolGuid,
NULL,
&HandleCount,
&HandleBuffer
);
for (Index = 0; Index < HandleCount; Index++) {
gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
(VOID **) &ConDevicePath
);
BdsLibUpdateConsoleVariable (L"ConIn", ConDevicePath, NULL);
}
SafeFreePool(HandleBuffer);
gBS->LocateHandleBuffer (
ByProtocol,
&gEfiSimpleTextOutProtocolGuid,
NULL,
&HandleCount,
&HandleBuffer
);
for (Index = 0; Index < HandleCount; Index++) {
gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
(VOID **) &ConDevicePath
);
BdsLibUpdateConsoleVariable (L"ConOut", ConDevicePath, NULL);
BdsLibUpdateConsoleVariable (L"ErrOut", ConDevicePath, NULL);
}
SafeFreePool(HandleBuffer);
//
// Connect all console variables
//
BdsLibConnectAllDefaultConsoles ();
}
/**
This function will connect console device base on the console
device variable ConIn, ConOut and ErrOut.
@retval EFI_SUCCESS At least one of the ConIn and ConOut device have
been connected success.
@retval EFI_STATUS Return the status of
BdsLibConnectConsoleVariable ().
**/
EFI_STATUS
EFIAPI
BdsLibConnectAllDefaultConsoles (
VOID
)
{
EFI_STATUS Status;
//
// Connect all default console variables
//
//
// It seems impossible not to have any ConOut device on platform,
// so we check the status here.
//
Status = BdsLibConnectConsoleVariable (L"ConOut");
if (EFI_ERROR (Status)) {
return Status;
}
//
// Insert the performance probe for Console Out
//
PERF_START (NULL, "ConOut", "BDS", 1);
PERF_END (NULL, "ConOut", "BDS", 0);
//
// Because possibly the platform is legacy free, in such case,
// ConIn devices (Serial Port and PS2 Keyboard ) does not exist,
// so we need not check the status.
//
BdsLibConnectConsoleVariable (L"ConIn");
//
// The _ModuleEntryPoint err out var is legal.
//
BdsLibConnectConsoleVariable (L"ErrOut");
return EFI_SUCCESS;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +1,23 @@
/** @file
Copyright (c) 2007, 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.
Module Name:
BmMachine.h
Abstract:
Boot Manager Machine type
Revision History
**/
#ifndef _BM_MACHINE_H
#define _BM_MACHINE_H
//
// NOTE: This is not defined in UEFI spec.
//
#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTEBC.EFI"
#endif
/** @file
Boot Manager Machine type
Copyright (c) 2007 - 2008, Intel Corporation. <BR>
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.
**/
#ifndef _BM_MACHINE_H
#define _BM_MACHINE_H
//
// NOTE: This is not defined in UEFI spec.
//
#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTEBC.EFI"
#endif

View File

@ -1,18 +1,16 @@
#/** @file
# Component name for module GenericBdsLib
#
# FIX ME!
# Copyright (c) 2007, Intel Corporation. All rights reserved.
#
# 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,
# Component name for module GenericBdsLib
#
# Copyright (c) 2007 - 2008, Intel Corporation. <BR>
# 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.
#
#
#
#**/
[Defines]
@ -37,18 +35,14 @@
Performance.c
BdsConnect.c
BdsMisc.c
R8Lib.c
BdsConsole.c
BdsBoot.c
InternalBdsLib.h
R8Lib.h
[Sources.Ia32]
Ia32/ClearDr.asm
Ia32/BmMachine.h
[Sources.X64]
x64/ClearDr.asm
x64/BmMachine.h
[Sources.IPF]

View File

@ -1,34 +1,22 @@
/** @file
Copyright (c) 2004 - 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.
Module Name:
BmMachine.h
Abstract:
Boot Manager Machine type
Revision History
**/
#ifndef _BM_MACHINE_H
#define _BM_MACHINE_H
//@MT:#include "CpuIA32.h"
#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTIA32.EFI"
#endif
/** @file
Boot Manager Machine type
Copyright (c) 2004 - 2008, Intel Corporation. <BR>
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.
**/
#ifndef _BM_MACHINE_H
#define _BM_MACHINE_H
//@MT:#include "CpuIA32.h"
#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTIA32.EFI"
#endif

View File

@ -1,43 +0,0 @@
title ClearDr.asm
;------------------------------------------------------------------------------
;
; Copyright (c) 2004, 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.
;
; Module Name:
;
; ClearDr.asm
;
; Abstract:
;
; Clear dr0 dr1 register
;
;------------------------------------------------------------------------------
.686
.MODEL FLAT,C
.CODE
;------------------------------------------------------------------------------
; VOID
; ClearDebugRegisters (
; VOID
; )
;------------------------------------------------------------------------------
ClearDebugRegisters PROC PUBLIC
push eax
xor eax, eax
mov dr0, eax
mov dr1, eax
pop eax
ret
ClearDebugRegisters ENDP
END

View File

@ -1,103 +1,93 @@
/** @file
Copyright (c) 2004 - 2007, 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.
Module Name:
InternalBdsLib.h
Abstract:
BDS library definition, include the file and data structure
**/
#ifndef _INTERNAL_BDS_LIB_H_
#define _INTERNAL_BDS_LIB_H_
#include <PiDxe.h>
#include <IndustryStandard/Pci22.h>
#include <Protocol/BlockIo.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/Cpu.h>
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/DebugPort.h>
#include <Protocol/DevicePath.h>
#include <Protocol/SimpleTextIn.h>
#include <Protocol/LegacyBios.h>
#include <Protocol/SimpleTextOut.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/DevicePathToText.h>
#include <Protocol/FirmwareVolume2.h>
#include <Protocol/PciIo.h>
#include <Protocol/AcpiS3Save.h>
#include <Protocol/Performance.h>
#include <Protocol/FirmwareVolumeDispatch.h>
#include <Guid/MemoryTypeInformation.h>
#include <Guid/FileInfo.h>
#include <Guid/GlobalVariable.h>
#include <Guid/PcAnsi.h>
#include <Guid/ShellFile.h>
#include <Guid/HobList.h>
#include <Guid/GenericPlatformVariable.h>
#include <Library/PrintLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/HobLib.h>
#include <Library/BaseLib.h>
#include <Library/DevicePathLib.h>
#include <Library/PerformanceLib.h>
#include <Library/PcdLib.h>
#include <Library/IfrSupportLib.h>
#include <Library/PeCoffGetEntryPointLib.h>
#include <Library/GenericBdsLib.h>
#include <Library/TimerLib.h>
#include "BmMachine.h"
#include "R8Lib.h"
#define PERFORMANCE_SIGNATURE EFI_SIGNATURE_32 ('P', 'e', 'r', 'f')
#define PERF_TOKEN_SIZE 28
#define PERF_TOKEN_LENGTH (PERF_TOKEN_SIZE - 1)
#define PERF_PEI_ENTRY_MAX_NUM 50
typedef struct {
CHAR8 Token[PERF_TOKEN_SIZE];
UINT32 Duration;
} PERF_DATA;
typedef struct {
UINT64 BootToOs;
UINT64 S3Resume;
UINT32 S3EntryNum;
PERF_DATA S3Entry[PERF_PEI_ENTRY_MAX_NUM];
UINT64 CpuFreq;
UINT64 BDSRaw;
UINT32 Count;
UINT32 Signiture;
} PERF_HEADER;
VOID
WriteBootToOsPerformanceData (
VOID
);
#endif // _BDS_LIB_H_
/** @file
BDS library definition, include the file and data structure
Copyright (c) 2004 - 2008, Intel Corporation. <BR>
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.
**/
#ifndef _INTERNAL_BDS_LIB_H_
#define _INTERNAL_BDS_LIB_H_
#include <PiDxe.h>
#include <IndustryStandard/Pci22.h>
#include <Protocol/BlockIo.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/Cpu.h>
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/DebugPort.h>
#include <Protocol/DevicePath.h>
#include <Protocol/SimpleTextIn.h>
#include <Protocol/LegacyBios.h>
#include <Protocol/SimpleTextOut.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/DevicePathToText.h>
#include <Protocol/FirmwareVolume2.h>
#include <Protocol/PciIo.h>
#include <Protocol/AcpiS3Save.h>
#include <Protocol/Performance.h>
#include <Protocol/FirmwareVolumeDispatch.h>
#include <Guid/MemoryTypeInformation.h>
#include <Guid/FileInfo.h>
#include <Guid/GlobalVariable.h>
#include <Guid/PcAnsi.h>
#include <Guid/ShellFile.h>
#include <Guid/HobList.h>
#include <Guid/GenericPlatformVariable.h>
#include <Library/PrintLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/HobLib.h>
#include <Library/BaseLib.h>
#include <Library/DevicePathLib.h>
#include <Library/PerformanceLib.h>
#include <Library/PcdLib.h>
#include <Library/IfrSupportLib.h>
#include <Library/PeCoffGetEntryPointLib.h>
#include <Library/GenericBdsLib.h>
#include <Library/TimerLib.h>
#include "BmMachine.h"
#define PERFORMANCE_SIGNATURE EFI_SIGNATURE_32 ('P', 'e', 'r', 'f')
#define PERF_TOKEN_SIZE 28
#define PERF_TOKEN_LENGTH (PERF_TOKEN_SIZE - 1)
#define PERF_PEI_ENTRY_MAX_NUM 50
typedef struct {
CHAR8 Token[PERF_TOKEN_SIZE];
UINT32 Duration;
} PERF_DATA;
typedef struct {
UINT64 BootToOs;
UINT64 S3Resume;
UINT32 S3EntryNum;
PERF_DATA S3Entry[PERF_PEI_ENTRY_MAX_NUM];
UINT64 CpuFreq;
UINT64 BDSRaw;
UINT32 Count;
UINT32 Signiture;
} PERF_HEADER;
VOID
WriteBootToOsPerformanceData (
VOID
);
#endif // _BDS_LIB_H_

View File

@ -1,34 +1,22 @@
/** @file
Copyright (c) 2004 - 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.
Module Name:
BmMachine.h
Abstract:
Boot Manager Machine type
Revision History
**/
#ifndef _BM_MACHINE_H
#define _BM_MACHINE_H
//@MT:#include "CpuIA64.h"
#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTIA64.EFI"
#endif
/** @file
Boot Manager Machine type
Copyright (c) 2004 - 2008, Intel Corporation. <BR>
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.
**/
#ifndef _BM_MACHINE_H
#define _BM_MACHINE_H
//@MT:#include "CpuIA64.h"
#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTIA64.EFI"
#endif

View File

@ -1,56 +1,46 @@
/** @file
Copyright (c) 2004, 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.
Module Name:
ShadowRom.c
Abstract:
Shadow all option rom
Revision History
**/
//@MT:#include "Tiano.h"
//@MT:#include "EfiDriverLib.h"
//@MT:#include EFI_PROTOCOL_DEFINITION (LegacyBios)
#include "InternalBdsLib.h"
UINT8 mShadowRomFlag = 0;
VOID
ShadowAllOptionRom()
{
EFI_STATUS Status;
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
//
// Rom shadow only do once.
//
if (mShadowRomFlag == 0) {
Status = gBS->LocateProtocol (
&gEfiLegacyBiosProtocolGuid,
NULL,
(VOID **) &LegacyBios
);
if (!EFI_ERROR (Status)) {
LegacyBios->PrepareToBootEfi (LegacyBios, NULL, NULL);
}
mShadowRomFlag = 1;
}
return ;
}
/** @file
Shadow all option rom
Copyright (c) 2004 - 2008, Intel Corporation. <BR>
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.
**/
//@MT:#include "Tiano.h"
//@MT:#include "EfiDriverLib.h"
//@MT:#include EFI_PROTOCOL_DEFINITION (LegacyBios)
#include "InternalBdsLib.h"
UINT8 mShadowRomFlag = 0;
VOID
ShadowAllOptionRom()
{
EFI_STATUS Status;
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
//
// Rom shadow only do once.
//
if (mShadowRomFlag == 0) {
Status = gBS->LocateProtocol (
&gEfiLegacyBiosProtocolGuid,
NULL,
(VOID **) &LegacyBios
);
if (!EFI_ERROR (Status)) {
LegacyBios->PrepareToBootEfi (LegacyBios, NULL, NULL);
}
mShadowRomFlag = 1;
}
return ;
}

View File

@ -1,326 +1,318 @@
/** @file
Copyright (c) 2004 - 2007, 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.
Module Name:
Performance.c
Abstract:
This file include the file which can help to get the system
performance, all the function will only include if the performance
switch is set.
**/
#include "InternalBdsLib.h"
STATIC PERF_HEADER mPerfHeader;
STATIC PERF_DATA mPerfData;
STATIC
VOID
GetShortPdbFileName (
CHAR8 *PdbFileName,
CHAR8 *GaugeString
)
/*++
Routine Description:
Arguments:
Returns:
--*/
{
UINTN Index;
UINTN Index1;
UINTN StartIndex;
UINTN EndIndex;
if (PdbFileName == NULL) {
AsciiStrCpy (GaugeString, " ");
} else {
StartIndex = 0;
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
;
for (Index = 0; PdbFileName[Index] != 0; Index++) {
if (PdbFileName[Index] == '\\') {
StartIndex = Index + 1;
}
if (PdbFileName[Index] == '.') {
EndIndex = Index;
}
}
Index1 = 0;
for (Index = StartIndex; Index < EndIndex; Index++) {
GaugeString[Index1] = PdbFileName[Index];
Index1++;
if (Index1 == PERF_TOKEN_LENGTH - 1) {
break;
}
}
GaugeString[Index1] = 0;
}
return ;
}
STATIC
VOID
GetNameFromHandle (
IN EFI_HANDLE Handle,
OUT CHAR8 *GaugeString
)
{
EFI_STATUS Status;
EFI_LOADED_IMAGE_PROTOCOL *Image;
CHAR8 *PdbFileName;
EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
AsciiStrCpy (GaugeString, " ");
//
// Get handle name from image protocol
//
Status = gBS->HandleProtocol (
Handle,
&gEfiLoadedImageProtocolGuid,
(VOID **) &Image
);
if (EFI_ERROR (Status)) {
Status = gBS->OpenProtocol (
Handle,
&gEfiDriverBindingProtocolGuid,
(VOID **) &DriverBinding,
NULL,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return ;
}
//
// Get handle name from image protocol
//
Status = gBS->HandleProtocol (
DriverBinding->ImageHandle,
&gEfiLoadedImageProtocolGuid,
(VOID **) &Image
);
}
PdbFileName = PeCoffLoaderGetPdbPointer (Image->ImageBase);
if (PdbFileName != NULL) {
GetShortPdbFileName (PdbFileName, GaugeString);
}
return ;
}
VOID
WriteBootToOsPerformanceData (
VOID
)
/*++
Routine Description:
Allocates a block of memory and writes performance data of booting to OS into it.
Arguments:
None
Returns:
None
--*/
{
EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS AcpiLowMemoryBase;
UINT32 AcpiLowMemoryLength;
UINT32 LimitCount;
EFI_HANDLE *Handles;
UINTN NoHandles;
CHAR8 GaugeString[PERF_TOKEN_LENGTH];
UINT8 *Ptr;
UINT32 Index;
UINT64 Ticker;
UINT64 Freq;
UINT32 Duration;
UINTN LogEntryKey;
CONST VOID *Handle;
CONST CHAR8 *Token;
CONST CHAR8 *Module;
UINT64 StartTicker;
UINT64 EndTicker;
UINT64 StartValue;
UINT64 EndValue;
BOOLEAN CountUp;
//
// Retrive time stamp count as early as possilbe
//
Ticker = GetPerformanceCounter ();
Freq = GetPerformanceCounterProperties (&StartValue, &EndValue);
Freq = DivU64x32 (Freq, 1000);
mPerfHeader.CpuFreq = Freq;
//
// Record BDS raw performance data
//
if (EndValue >= StartValue) {
mPerfHeader.BDSRaw = Ticker - StartValue;
CountUp = TRUE;
} else {
mPerfHeader.BDSRaw = StartValue - Ticker;
CountUp = FALSE;
}
AcpiLowMemoryLength = 0x2000;
//
// Allocate a block of memory that contain performance data to OS
//
Status = gBS->AllocatePages (
AllocateAnyPages,
EfiACPIReclaimMemory,
EFI_SIZE_TO_PAGES (AcpiLowMemoryLength),
&AcpiLowMemoryBase
);
if (EFI_ERROR (Status)) {
return ;
}
Ptr = (UINT8 *) ((UINT32) AcpiLowMemoryBase + sizeof (PERF_HEADER));
LimitCount = (AcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);
//
// Put Detailed performance data into memory
//
Handles = NULL;
Status = gBS->LocateHandleBuffer (
AllHandles,
NULL,
NULL,
&NoHandles,
&Handles
);
if (EFI_ERROR (Status)) {
gBS->FreePages (AcpiLowMemoryBase, 1);
return ;
}
//
// Get DXE drivers performance
//
for (Index = 0; Index < NoHandles; Index++) {
Ticker = 0;
LogEntryKey = 0;
while ((LogEntryKey = GetPerformanceMeasurement (
LogEntryKey,
&Handle,
&Token,
&Module,
&StartTicker,
&EndTicker)) != 0) {
if ((Handle == Handles[Index]) && (EndTicker != 0)) {
Ticker += CountUp ? (EndTicker - StartTicker) : (StartTicker - EndTicker);
}
}
Duration = (UINT32) DivU64x32 (Ticker, (UINT32) Freq);
if (Duration > 0) {
GetNameFromHandle (Handles[Index], GaugeString);
AsciiStrCpy (mPerfData.Token, GaugeString);
mPerfData.Duration = Duration;
CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));
Ptr += sizeof (PERF_DATA);
mPerfHeader.Count++;
if (mPerfHeader.Count == LimitCount) {
goto Done;
}
}
}
FreePool (Handles);
//
// Get inserted performance data
//
LogEntryKey = 0;
while ((LogEntryKey = GetPerformanceMeasurement (
LogEntryKey,
&Handle,
&Token,
&Module,
&StartTicker,
&EndTicker)) != 0) {
if (Handle == NULL && EndTicker != 0) {
ZeroMem (&mPerfData, sizeof (PERF_DATA));
AsciiStrnCpy (mPerfData.Token, Token, PERF_TOKEN_LENGTH);
Ticker = CountUp ? (EndTicker - StartTicker) : (StartTicker - EndTicker);
mPerfData.Duration = (UINT32) DivU64x32 (Ticker, (UINT32) Freq);
CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));
Ptr += sizeof (PERF_DATA);
mPerfHeader.Count++;
if (mPerfHeader.Count == LimitCount) {
goto Done;
}
}
}
Done:
mPerfHeader.Signiture = PERFORMANCE_SIGNATURE;
//
// Put performance data to memory
//
CopyMem (
(UINTN *) (UINTN) AcpiLowMemoryBase,
&mPerfHeader,
sizeof (PERF_HEADER)
);
gRT->SetVariable (
L"PerfDataMemAddr",
&gEfiGenericPlatformVariableGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
sizeof (EFI_PHYSICAL_ADDRESS),
&AcpiLowMemoryBase
);
return ;
}
/** @file
This file include the file which can help to get the system
performance, all the function will only include if the performance
switch is set.
Copyright (c) 2004 - 2008, Intel Corporation. <BR>
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.
**/
#include "InternalBdsLib.h"
STATIC PERF_HEADER mPerfHeader;
STATIC PERF_DATA mPerfData;
STATIC
VOID
GetShortPdbFileName (
CHAR8 *PdbFileName,
CHAR8 *GaugeString
)
/*++
Routine Description:
Arguments:
Returns:
--*/
{
UINTN Index;
UINTN Index1;
UINTN StartIndex;
UINTN EndIndex;
if (PdbFileName == NULL) {
AsciiStrCpy (GaugeString, " ");
} else {
StartIndex = 0;
for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
;
for (Index = 0; PdbFileName[Index] != 0; Index++) {
if (PdbFileName[Index] == '\\') {
StartIndex = Index + 1;
}
if (PdbFileName[Index] == '.') {
EndIndex = Index;
}
}
Index1 = 0;
for (Index = StartIndex; Index < EndIndex; Index++) {
GaugeString[Index1] = PdbFileName[Index];
Index1++;
if (Index1 == PERF_TOKEN_LENGTH - 1) {
break;
}
}
GaugeString[Index1] = 0;
}
return ;
}
STATIC
VOID
GetNameFromHandle (
IN EFI_HANDLE Handle,
OUT CHAR8 *GaugeString
)
{
EFI_STATUS Status;
EFI_LOADED_IMAGE_PROTOCOL *Image;
CHAR8 *PdbFileName;
EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
AsciiStrCpy (GaugeString, " ");
//
// Get handle name from image protocol
//
Status = gBS->HandleProtocol (
Handle,
&gEfiLoadedImageProtocolGuid,
(VOID **) &Image
);
if (EFI_ERROR (Status)) {
Status = gBS->OpenProtocol (
Handle,
&gEfiDriverBindingProtocolGuid,
(VOID **) &DriverBinding,
NULL,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return ;
}
//
// Get handle name from image protocol
//
Status = gBS->HandleProtocol (
DriverBinding->ImageHandle,
&gEfiLoadedImageProtocolGuid,
(VOID **) &Image
);
}
PdbFileName = PeCoffLoaderGetPdbPointer (Image->ImageBase);
if (PdbFileName != NULL) {
GetShortPdbFileName (PdbFileName, GaugeString);
}
return ;
}
VOID
WriteBootToOsPerformanceData (
VOID
)
/*++
Routine Description:
Allocates a block of memory and writes performance data of booting to OS into it.
Arguments:
None
Returns:
None
--*/
{
EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS AcpiLowMemoryBase;
UINT32 AcpiLowMemoryLength;
UINT32 LimitCount;
EFI_HANDLE *Handles;
UINTN NoHandles;
CHAR8 GaugeString[PERF_TOKEN_LENGTH];
UINT8 *Ptr;
UINT32 Index;
UINT64 Ticker;
UINT64 Freq;
UINT32 Duration;
UINTN LogEntryKey;
CONST VOID *Handle;
CONST CHAR8 *Token;
CONST CHAR8 *Module;
UINT64 StartTicker;
UINT64 EndTicker;
UINT64 StartValue;
UINT64 EndValue;
BOOLEAN CountUp;
//
// Retrive time stamp count as early as possilbe
//
Ticker = GetPerformanceCounter ();
Freq = GetPerformanceCounterProperties (&StartValue, &EndValue);
Freq = DivU64x32 (Freq, 1000);
mPerfHeader.CpuFreq = Freq;
//
// Record BDS raw performance data
//
if (EndValue >= StartValue) {
mPerfHeader.BDSRaw = Ticker - StartValue;
CountUp = TRUE;
} else {
mPerfHeader.BDSRaw = StartValue - Ticker;
CountUp = FALSE;
}
AcpiLowMemoryLength = 0x2000;
//
// Allocate a block of memory that contain performance data to OS
//
Status = gBS->AllocatePages (
AllocateAnyPages,
EfiACPIReclaimMemory,
EFI_SIZE_TO_PAGES (AcpiLowMemoryLength),
&AcpiLowMemoryBase
);
if (EFI_ERROR (Status)) {
return ;
}
Ptr = (UINT8 *) ((UINT32) AcpiLowMemoryBase + sizeof (PERF_HEADER));
LimitCount = (AcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);
//
// Put Detailed performance data into memory
//
Handles = NULL;
Status = gBS->LocateHandleBuffer (
AllHandles,
NULL,
NULL,
&NoHandles,
&Handles
);
if (EFI_ERROR (Status)) {
gBS->FreePages (AcpiLowMemoryBase, 1);
return ;
}
//
// Get DXE drivers performance
//
for (Index = 0; Index < NoHandles; Index++) {
Ticker = 0;
LogEntryKey = 0;
while ((LogEntryKey = GetPerformanceMeasurement (
LogEntryKey,
&Handle,
&Token,
&Module,
&StartTicker,
&EndTicker)) != 0) {
if ((Handle == Handles[Index]) && (EndTicker != 0)) {
Ticker += CountUp ? (EndTicker - StartTicker) : (StartTicker - EndTicker);
}
}
Duration = (UINT32) DivU64x32 (Ticker, (UINT32) Freq);
if (Duration > 0) {
GetNameFromHandle (Handles[Index], GaugeString);
AsciiStrCpy (mPerfData.Token, GaugeString);
mPerfData.Duration = Duration;
CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));
Ptr += sizeof (PERF_DATA);
mPerfHeader.Count++;
if (mPerfHeader.Count == LimitCount) {
goto Done;
}
}
}
FreePool (Handles);
//
// Get inserted performance data
//
LogEntryKey = 0;
while ((LogEntryKey = GetPerformanceMeasurement (
LogEntryKey,
&Handle,
&Token,
&Module,
&StartTicker,
&EndTicker)) != 0) {
if (Handle == NULL && EndTicker != 0) {
ZeroMem (&mPerfData, sizeof (PERF_DATA));
AsciiStrnCpy (mPerfData.Token, Token, PERF_TOKEN_LENGTH);
Ticker = CountUp ? (EndTicker - StartTicker) : (StartTicker - EndTicker);
mPerfData.Duration = (UINT32) DivU64x32 (Ticker, (UINT32) Freq);
CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));
Ptr += sizeof (PERF_DATA);
mPerfHeader.Count++;
if (mPerfHeader.Count == LimitCount) {
goto Done;
}
}
}
Done:
mPerfHeader.Signiture = PERFORMANCE_SIGNATURE;
//
// Put performance data to memory
//
CopyMem (
(UINTN *) (UINTN) AcpiLowMemoryBase,
&mPerfHeader,
sizeof (PERF_HEADER)
);
gRT->SetVariable (
L"PerfDataMemAddr",
&gEfiGenericPlatformVariableGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
sizeof (EFI_PHYSICAL_ADDRESS),
&AcpiLowMemoryBase
);
return ;
}

View File

@ -1,114 +0,0 @@
/**@file
Copyright (c) 2007, 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.
**/
#include "InternalBdsLib.h"
/**
Get current boot mode.
@param HobStart Start pointer of hob list
@param BootMode Current boot mode recorded in PHIT hob
@retval EFI_NOT_FOUND Invalid hob header
@retval EFI_SUCCESS Boot mode found
**/
EFI_STATUS
R8_GetHobBootMode (
IN VOID *HobStart,
OUT EFI_BOOT_MODE *BootMode
)
{
//
// Porting Guide:
// This library interface is simply obsolete.
// Include the source code to user code.
// In fact, since EFI_HANDOFF_HOB must be the first Hob,
// the following code can retrieve boot mode.
//
// EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
//
// HandOffHob = GetHobList ();
// ASSERT (HandOffHob->Header.HobType == EFI_HOB_TYPE_HANDOFF);
//
// BootMode = HandOffHob->BootMode;
//
EFI_PEI_HOB_POINTERS Hob;
Hob.Raw = HobStart;
if (Hob.Header->HobType != EFI_HOB_TYPE_HANDOFF) {
return EFI_NOT_FOUND;
}
*BootMode = Hob.HandoffInformationTable->BootMode;
return EFI_SUCCESS;
}
/**
Get the next guid hob.
@param HobStart A pointer to the start hob.
@param Guid A pointer to a guid.
@param Buffer A pointer to the buffer.
@param BufferSize Buffer size.
@retval EFI_NOT_FOUND Next Guid hob not found
@retval EFI_SUCCESS Next Guid hob found and data for this Guid got
@retval EFI_INVALID_PARAMETER invalid parameter
**/
EFI_STATUS
R8_GetNextGuidHob (
IN OUT VOID **HobStart,
IN EFI_GUID * Guid,
OUT VOID **Buffer,
OUT UINTN *BufferSize OPTIONAL
)
{
//
// Porting Guide:
// This library interface is changed substantially with R9 counerpart GetNextGuidHob ().
// 1. R9 GetNextGuidHob has two parameters and returns the matched GUID HOB from the StartHob.
// 2. R9 GetNextGuidHob does not strip the HOB header, so caller is required to apply
// GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE () to extract the data section and its
// size info respectively.
// 3. this function does not skip the starting HOB pointer unconditionally:
// it returns HobStart back if HobStart itself meets the requirement;
// caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.
//
EFI_PEI_HOB_POINTERS GuidHob;
if (Buffer == NULL) {
return EFI_INVALID_PARAMETER;
}
GuidHob.Raw = GetNextGuidHob (Guid, *HobStart);
if (GuidHob.Raw == NULL) {
return EFI_NOT_FOUND;
}
*Buffer = GET_GUID_HOB_DATA (GuidHob.Guid);
if (BufferSize != NULL) {
*BufferSize = GET_GUID_HOB_DATA_SIZE (GuidHob.Guid);
}
*HobStart = GET_NEXT_HOB (GuidHob);
return EFI_SUCCESS;
}

View File

@ -1,59 +0,0 @@
/**@file
Copyright (c) 2007, 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.
**/
/**
Get current boot mode.
@param HobStart Start pointer of hob list
@param BootMode Current boot mode recorded in PHIT hob
@retval EFI_NOT_FOUND Invalid hob header
@retval EFI_SUCCESS Boot mode found
**/
EFI_STATUS
R8_GetHobBootMode (
IN VOID *HobStart,
OUT EFI_BOOT_MODE *BootMode
)
;
/**
Get the next guid hob.
@param HobStart A pointer to the start hob.
@param Guid A pointer to a guid.
@param Buffer A pointer to the buffer.
@param BufferSize Buffer size.
@retval EFI_NOT_FOUND Next Guid hob not found
@retval EFI_SUCCESS Next Guid hob found and data for this Guid got
@retval EFI_INVALID_PARAMETER invalid parameter
**/
EFI_STATUS
R8_GetNextGuidHob (
IN OUT VOID **HobStart,
IN EFI_GUID * Guid,
OUT VOID **Buffer,
OUT UINTN *BufferSize OPTIONAL
)
;

View File

@ -1,34 +1,22 @@
/** @file
Copyright (c) 2005 - 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.
Module Name:
BmMachine.h
Abstract:
Boot Manager Machine type
Revision History
**/
#ifndef _BM_MACHINE_H
#define _BM_MACHINE_H
//@MT:#include "CpuIA32.h"
#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTX64.EFI"
#endif
/** @file
Boot Manager Machine type
Copyright (c) 2005 - 2008, Intel Corporation. <BR>
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.
**/
#ifndef _BM_MACHINE_H
#define _BM_MACHINE_H
//@MT:#include "CpuIA32.h"
#define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTX64.EFI"
#endif

View File

@ -1,41 +0,0 @@
title ClearDr.asm
;------------------------------------------------------------------------------
;
; Copyright (c) 2005, 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.
;
; Module Name:
;
; ClearDr.asm
;
; Abstract:
;
; Clear dr0 dr1 register
;
;------------------------------------------------------------------------------
text SEGMENT
;------------------------------------------------------------------------------
; VOID
; ClearDebugRegisters (
; VOID
; )
;------------------------------------------------------------------------------
ClearDebugRegisters PROC PUBLIC
push rax
xor rax, rax
mov dr0, rax
mov dr1, rax
pop rax
ret
ClearDebugRegisters ENDP
END