Add in the 1st version of ECP.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2832 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12
2007-06-28 07:00:39 +00:00
parent 30d4a0c7ec
commit 3eb9473ea9
1433 changed files with 266617 additions and 0 deletions

View File

@@ -0,0 +1,556 @@
/*++
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:
EdkIIGlueDxeDriverEntryPoint.c
Abstract:
DXE Driver entry point template file
--*/
#include "EdkIIGlueDxe.h"
#include "Common/EdkIIGlueDependencies.h"
STATIC EFI_EVENT _mDriverExitBootServicesNotifyEvent;
//
// Driver Model related definitions.
// LIMITATION: only support one instance of Driver Model protocols per driver.
// In case where multiple Driver Model protocols need to be installed in a single driver,
// manually edit this file and compile/link the modified file with the driver.
//
#ifdef __EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__
extern EFI_DRIVER_BINDING_PROTOCOL __EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__;
#endif
#ifdef __EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
extern EFI_COMPONENT_NAME2_PROTOCOL __EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__;
#else
extern EFI_COMPONENT_NAME_PROTOCOL __EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__;
#endif
#endif
#ifdef __EDKII_GLUE_DRIVER_CONFIGURATION_PROTOCOL_INSTANCE__
extern EFI_DRIVER_CONFIGURATION_PROTOCOL __EDKII_GLUE_DRIVER_CONFIGURATION_PROTOCOL_INSTANCE__;
#endif
#ifdef __EDKII_GLUE_DRIVER_DIAGNOSTICS_PROTOCOL_INSTANCE__
extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL __EDKII_GLUE_DRIVER_DIAGNOSTICS_PROTOCOL_INSTANCE__;
#endif
GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverModelProtocolList[] = {
{
#ifdef __EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__
&__EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__,
#else
NULL,
#endif
#ifdef __EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__
&__EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__,
#else
NULL,
#endif
#ifdef __EDKII_GLUE_DRIVER_CONFIGURATION_PROTOCOL_INSTANCE__
&__EDKII_GLUE_DRIVER_CONFIGURATION_PROTOCOL_INSTANCE__,
#else
NULL,
#endif
#ifdef __EDKII_GLUE_DRIVER_DIAGNOSTICS_PROTOCOL_INSTANCE__
&__EDKII_GLUE_DRIVER_DIAGNOSTICS_PROTOCOL_INSTANCE__,
#else
NULL,
#endif
}
};
//
// NOTE: Limitation:
// Only one handler for SetVirtualAddressMap Event and ExitBootServices Event each
//
#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__
VOID
__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__ (
IN EFI_EVENT Event,
IN VOID *Context
);
#endif
GLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {
#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__
__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__,
#endif
NULL
};
#ifdef __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__
VOID
__EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__ (
IN EFI_EVENT Event,
IN VOID *Context
);
#endif
/**
Set AtRuntime flag as TRUE after ExitBootServices
@param[in] Event The Event that is being processed
@param[in] Context Event Context
**/
VOID
EFIAPI
RuntimeDriverExitBootServices (
IN EFI_EVENT Event,
IN VOID *Context
);
GLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
//
// only Runtime drivers need to link EdkDxeRuntimeDriverLib
//
RuntimeDriverExitBootServices,
#endif
#ifdef __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__
__EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__,
#endif
NULL
};
//
// Module Unload Handler
//
#ifdef __EDKII_GLUE_MODULE_UNLOAD_HANDLER__
EFI_STATUS
EFIAPI
__EDKII_GLUE_MODULE_UNLOAD_HANDLER__ (
EFI_HANDLE ImageHandle
);
#endif
EFI_STATUS
EFIAPI
ProcessModuleUnloadList (
EFI_HANDLE ImageHandle
)
{
#ifdef __EDKII_GLUE_MODULE_UNLOAD_HANDLER__
return (__EDKII_GLUE_MODULE_UNLOAD_HANDLER__ (ImageHandle));
#else
return EFI_SUCCESS;
#endif
}
#ifdef __EDKII_GLUE_EFI_CALLER_ID_GUID__
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = __EDKII_GLUE_EFI_CALLER_ID_GUID__;
#endif
//
// Library constructors
//
VOID
ProcessLibraryConstructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
//
// Declare "Status" if any of the following libraries are used
//
#if defined(__EDKII_GLUE_DXE_HOB_LIB__) \
|| defined(__EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__) \
|| defined(__EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__) \
|| defined(__EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__) \
|| defined(__EDKII_GLUE_DXE_SERVICES_TABLE_LIB__) \
|| defined(__EDKII_GLUE_DXE_SMBUS_LIB__) \
|| defined(__EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__) \
|| defined(__EDKII_GLUE_EDK_DXE_SAL_LIB__) \
|| defined(__EDKII_GLUE_DXE_IO_LIB_CPU_IO__)
EFI_STATUS Status;
#endif
//
// EdkII Glue Library Constructors:
// NOTE: the constructors must be called according to dependency order
//
// UefiBootServicesTableLib UefiBootServicesTableLibConstructor()
// DxeIoLibCpuIo IoLibConstructor()
// DxeSalLib DxeSalLibConstructor(), IPF only
// EdkDxeRuntimeDriverLib RuntimeDriverLibConstruct()
// DxeHobLib HobLibConstructor()
// UefiDriverModelLib UefiDriverModelLibConstructor()
// DxeSmbusLib SmbusLibConstructor()
// DxeServicesTableLib DxeServicesTableLibConstructor()
// UefiRuntimeServicesTableLib UefiRuntimeServicesTableLibConstructor()
//
#ifdef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
Status = UefiBootServicesTableLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
Status = IoLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_EDK_DXE_SAL_LIB__
Status = DxeSalLibConstructor(ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
Status = RuntimeDriverLibConstruct (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
Status = UefiRuntimeServicesTableLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
Status = UefiDriverModelLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__
Status = DxeServicesTableLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_DXE_HOB_LIB__
Status = HobLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_DXE_SMBUS_LIB__
Status = SmbusLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
}
//
// Library Destructors
//
VOID
ProcessLibraryDestructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
#if defined (__EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__) || defined (__EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__)
EFI_STATUS Status;
#endif
//
// NOTE: the destructors must be called according to dependency order
//
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
Status = UefiDriverModelLibDestructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
Status = RuntimeDriverLibDeconstruct (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
}
/**
Unload function that is registered in the LoadImage protocol. It un-installs
protocols produced and deallocates pool used by the driver. Called by the core
when unloading the driver.
@param ImageHandle
@retval EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
_DriverUnloadHandler (
EFI_HANDLE ImageHandle
)
{
EFI_STATUS Status;
//
// If an UnloadImage() handler is specified, then call it
//
Status = ProcessModuleUnloadList (ImageHandle);
//
// If the driver specific unload handler does not return an error, then call all of the
// library destructors. If the unload handler returned an error, then the driver can not be
// unloaded, and the library destructors should not be called
//
if (!EFI_ERROR (Status)) {
//
// Close our ExitBootServices () notify function
//
if (_gDriverExitBootServicesEvent[0] != NULL) {
ASSERT (gBS != NULL);
Status = gBS->CloseEvent (_mDriverExitBootServicesNotifyEvent);
ASSERT_EFI_ERROR (Status);
}
//
// NOTE: To allow passing in gST here, any library instance having a destructor
// must depend on EfiDriverLib
//
ProcessLibraryDestructorList (ImageHandle, gST);
}
//
// Return the status from the driver specific unload handler
//
return Status;
}
VOID
EFIAPI
_DriverExitBootServices (
IN EFI_EVENT Event,
IN VOID *Context
)
/*++
Routine Description:
Set AtRuntime flag as TRUE after ExitBootServices
Arguments:
Event - The Event that is being processed
Context - Event Context
Returns:
None
--*/
{
EFI_EVENT_NOTIFY ChildNotifyEventHandler;
UINTN Index;
for (Index = 0; _gDriverExitBootServicesEvent[Index] != NULL; Index++) {
ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index];
ChildNotifyEventHandler (Event, NULL);
}
}
EFI_DRIVER_ENTRY_POINT (_ModuleEntryPoint);
//
// Module Entry Point
//
#ifdef __EDKII_GLUE_MODULE_ENTRY_POINT__
EFI_STATUS
EFIAPI
__EDKII_GLUE_MODULE_ENTRY_POINT__ (
EFI_HANDLE ImageHandle,
EFI_SYSTEM_TABLE *SystemTable
);
#endif
/**
Enrty point to DXE Driver.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
@retval EFI_SUCCESS One or more of the drivers returned a success code.
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
**/
EFI_STATUS
EFIAPI
_ModuleEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
// if (_gUefiDriverRevision != 0) {
// //
// // Make sure that the EFI/UEFI spec revision of the platform is >= EFI/UEFI spec revision of the driver
// //
// if (SystemTable->Hdr.Revision < _gUefiDriverRevision) {
// return EFI_INCOMPATIBLE_VERSION;
// }
// }
// DEBUG ((EFI_D_ERROR, "EdkII Glue Driver Entry - 0\n"));
//
// Call constructor for all libraries
//
ProcessLibraryConstructorList (ImageHandle, SystemTable);
//
// Register our ExitBootServices () notify function
//
if (_gDriverExitBootServicesEvent[0] != NULL) {
Status = SystemTable->BootServices->CreateEvent (
EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,
EFI_TPL_NOTIFY,
_DriverExitBootServices,
NULL,
&_mDriverExitBootServicesNotifyEvent
);
ASSERT_EFI_ERROR (Status);
}
//
// Install unload handler...
//
Status = SystemTable->BootServices->HandleProtocol (
ImageHandle,
&gEfiLoadedImageProtocolGuid,
(VOID **)&LoadedImage
);
ASSERT_EFI_ERROR (Status);
LoadedImage->Unload = _DriverUnloadHandler;
//
// Call the driver entry point
//
#ifdef __EDKII_GLUE_MODULE_ENTRY_POINT__
Status = (__EDKII_GLUE_MODULE_ENTRY_POINT__ (ImageHandle, SystemTable));
#else
Status = EFI_SUCCESS;
#endif
//
// If all of the drivers returned errors, then invoke all of the library destructors
//
if (EFI_ERROR (Status)) {
//
// Close our ExitBootServices () notify function
//
if (_gDriverExitBootServicesEvent[0] != NULL) {
EFI_STATUS CloseEventStatus;
CloseEventStatus = SystemTable->BootServices->CloseEvent (_mDriverExitBootServicesNotifyEvent);
ASSERT_EFI_ERROR (CloseEventStatus);
}
ProcessLibraryDestructorList (ImageHandle, SystemTable);
}
//
// Return the cummalative return status code from all of the driver entry points
//
return Status;
}
/**
Enrty point wrapper of DXE Driver.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
@retval EFI_SUCCESS One or more of the drivers returned a success code.
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
EBC build envrionment has /D $(IMAGE_ENTRY_POINT)=EfiMain which overrides what GlueLib
defines: /D IMAGE_ENTRY_POINT=_ModuleEntryPoint, so _ModuleEntryPoint will be replaced with
EfiMain thus the function below isn't needed in EBC envrionment.
**/
#ifndef MDE_CPU_EBC
EFI_STATUS
EFIAPI
EfiMain (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
return _ModuleEntryPoint (ImageHandle, SystemTable);
}
#endif
//
// Guids not present in R8.6 code base
//
//
// Protocol/Arch Protocol GUID globals
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gUefiDriverConfigurationProtocolGuid = { 0xbfd7dc1d, 0x24f1, 0x40d9, { 0x82, 0xe7, 0x2e, 0x09, 0xbb, 0x6b, 0x4e, 0xbe } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gUefiDriverDiagnosticsProtocolGuid = { 0x4d330321, 0x025f, 0x4aac, { 0x90, 0xd8, 0x5e, 0xd9, 0x00, 0x17, 0x3b, 0x63 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiArpProtocolGuid = { 0xf4b427bb, 0xba21, 0x4f16, { 0xbc, 0x4e, 0x43, 0xe4, 0x16, 0xab, 0x61, 0x9c } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiArpServiceBindingProtocolGuid = { 0xf44c00ee, 0x1f2c, 0x4a00, { 0xaa, 0x09, 0x1c, 0x9f, 0x3e, 0x08, 0x00, 0xa3 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDhcp4ProtocolGuid = { 0x8a219718, 0x4ef5, 0x4761, { 0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid = { 0x9d9a39d8, 0xbd42, 0x4a73, { 0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIp4ProtocolGuid = { 0x41d94cd2, 0x35b6, 0x455a, { 0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIp4ServiceBindingProtocolGuid = { 0xc51711e7, 0xb4bf, 0x404a, { 0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIp4ConfigProtocolGuid = { 0x3b95aa31, 0x3793, 0x434b, { 0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiManagedNetworkProtocolGuid = { 0x3b95aa31, 0x3793, 0x434b, { 0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiManagedNetworkServiceBindingProtocolGuid = { 0xf36ff770, 0xa7e1, 0x42cf, { 0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiMtftp4ProtocolGuid = { 0x3ad9df29, 0x4501, 0x478d, { 0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiMtftp4ServiceBindingProtocolGuid = { 0x2FE800BE, 0x8F01, 0x4aa6, { 0x94, 0x6B, 0xD7, 0x13, 0x88, 0xE1, 0x83, 0x3F } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiTcp4ProtocolGuid = { 0x65530BC7, 0xA359, 0x410f, { 0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiTcp4ServiceBindingProtocolGuid = { 0x00720665, 0x67EB, 0x4a99, { 0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiUdp4ProtocolGuid = { 0x3ad9df29, 0x4501, 0x478d, { 0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiUdp4ServiceBindingProtocolGuid = { 0x83f01464, 0x99bd, 0x45e5, { 0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiAuthenticationInfoProtocolGuid = { 0x7671d9d0, 0x53db, 0x4173, { 0xaa, 0x69, 0x23, 0x27, 0xf2, 0x1f, 0x0b, 0xc7 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDevicePathFromTextProtocolGuid = { 0x5c99a21, 0xc70f, 0x4ad2, { 0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDevicePathToTextProtocolGuid = { 0x8b843e20, 0x8132, 0x4852, { 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDevicePathUtilitiesProtocolGuid = { 0x379be4e, 0xd706, 0x437d, { 0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashProtocolGuid = { 0xc5184932, 0xdba5, 0x46db, { 0xa5, 0xba, 0xcc, 0x0b, 0xda, 0x9c, 0x14, 0x35 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashServiceBindingProtocolGuid = { 0x42881c98, 0xa4f3, 0x44b0, { 0xa3, 0x9d, 0xdf, 0xa1, 0x86, 0x67, 0xd8, 0xcd } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIScsiInitiatorNameProtocolGuid = { 0xa6a72875, 0x2962, 0x4c18, { 0x9f, 0x46, 0x8d, 0xa6, 0x44, 0xcc, 0xfe, 0x00 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiExtScsiPassThruProtocolGuid = { 0x1d3de7f0, 0x0807, 0x424f, { 0xaa, 0x69, 0x11, 0xa5, 0x4e, 0x19, 0xa4, 0x6f } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiTapeIoProtocolGuid = { 0x1e93e633, 0xd65a, 0x459e, { 0xab, 0x84, 0x93, 0xd9, 0xec, 0x26, 0x6d, 0x18 } };
#if (EFI_SPECIFICATION_VERSION < 0x00020000)
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiUsb2HcProtocolGuid = { 0x3e745226, 0x9818, 0x45b6, { 0xa2, 0xac, 0xd7, 0xcd, 0x0e, 0x8b, 0xa2, 0xbc } };
#endif
//
// PPI GUID globals
//
//
// GUID globals
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHobMemoryAllocBspStoreGuid = { 0x564b33cd, 0xc92a, 0x4593, { 0x90, 0xbf, 0x24, 0x73, 0xe4, 0x3c, 0x63, 0x22 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHobMemoryAllocStackGuid = { 0x4ed4bf27, 0x4092, 0x42e9, { 0x80, 0x7d, 0x52, 0x7b, 0x1d, 0x00, 0xc9, 0xbd } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHobMemoryAllocModuleGuid = { 0xf8e21975, 0x0899, 0x4f58, { 0xa4, 0xbe, 0x55, 0x25, 0xa9, 0xc6, 0xd7, 0x7a } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiAuthenticationChapRadiusGuid = { 0xd6062b50, 0x15ca, 0x11da, { 0x92, 0x19, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiAuthenticationChapLocalGuid = { 0xc280c73e, 0x15ca, 0x11da, { 0xb0, 0xca, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha1Guid = { 0x2ae9d80f, 0x3fb2, 0x4095, { 0xb7, 0xb1, 0xe9, 0x31, 0x57, 0xb9, 0x46, 0xb6 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha224Guid = { 0x8df01a06, 0x9bd5, 0x4bf7, { 0xb0, 0x21, 0xdb, 0x4f, 0xd9, 0xcc, 0xf4, 0x5b } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha256Guid = { 0x51aa59de, 0xfdf2, 0x4ea3, { 0xbc, 0x63, 0x87, 0x5f, 0xb7, 0x84, 0x2e, 0xe9 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha384Guid = { 0xefa96432, 0xde33, 0x4dd2, { 0xae, 0xe6, 0x32, 0x8c, 0x33, 0xdf, 0x77, 0x7a } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha512Guid = { 0xcaa4381e, 0x750c, 0x4770, { 0xb8, 0x70, 0x7a, 0x23, 0xb4, 0xe4, 0x21, 0x30 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmMD5Guid = { 0xaf7c79c, 0x65b5, 0x4319, { 0xb0, 0xae, 0x44, 0xec, 0x48, 0x4e, 0x4a, 0xd7 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gBootObjectAuthorizationParmsetGuid = { 0xedd35e31, 0x7b9, 0x11d2, { 0x83, 0xa3, 0x00, 0xa0, 0xc9, 0x1f, 0xad, 0xcf } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gSmmCommunicateHeaderGuid = { 0xf328e36c, 0x23b6, 0x4a95, { 0x85, 0x4b, 0x32, 0xe1, 0x95, 0x34, 0xcd, 0x75 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCapsuleGuid = { 0x3B6686BD, 0x0D76, 0x4030, { 0xB7, 0x0E, 0xB5, 0x51, 0x9E, 0x2F, 0xC5, 0xA0 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiConfigFileNameGuid = { 0x98B8D59B, 0xE8BA, 0x48EE, { 0x98, 0xDD, 0xC2, 0x95, 0x39, 0x2F, 0x1E, 0xDB } };

View File

@@ -0,0 +1,183 @@
/*++
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:
EdkIIGluePeimEntryPoint.c
Abstract:
PEIM entry point template file
--*/
#include "EdkIIGluePeim.h"
#include "Common/EdkIIGlueDependencies.h"
#ifdef __EDKII_GLUE_EFI_CALLER_ID_GUID__
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = __EDKII_GLUE_EFI_CALLER_ID_GUID__;
#endif
//
// Library constructors
//
VOID
ProcessLibraryConstructorList (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
)
{
//
// Declare "Status" if any of the following libraries are used
//
#if defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__) \
|| defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__) \
|| defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__)
EFI_STATUS Status;
#endif
//
// EdkII Glue Library Constructors:
// PeiServicesTablePointerLib PeiServicesTablePointerLibConstructor()
// PeiServicesTablePointerLibMm7 PeiServicesTablePointerLibConstructor()
// PeiServicesTablePointerLibKr1 PeiServicesTablePointerLibConstructor()
//
#if defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__) \
|| defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__) \
|| defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__)
Status = PeiServicesTablePointerLibConstructor (FfsHeader, PeiServices);
ASSERT_EFI_ERROR (Status);
#endif
}
EFI_PEIM_ENTRY_POINT (_ModuleEntryPoint);
EFI_STATUS
EFIAPI
__EDKII_GLUE_MODULE_ENTRY_POINT__ (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
);
/**
Image entry point of Peim.
@param FfsHeader Pointer to FFS header the loaded driver.
@param PeiServices Pointer to the PEI services.
@return Status returned by entry points of Peims.
--*/
EFI_STATUS
EFIAPI
_ModuleEntryPoint (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
)
{
// if (_gPeimRevision != 0) {
// //
// // Make sure that the PEI spec revision of the platform is >= PEI spec revision of the driver
// //
// ASSERT ((*PeiServices)->Hdr.Revision >= _gPeimRevision);
// }
//
// Call constructor for all libraries
//
ProcessLibraryConstructorList (FfsHeader, PeiServices);
//
// Call the driver entry point
//
return __EDKII_GLUE_MODULE_ENTRY_POINT__ (FfsHeader, PeiServices);
}
/**
Wrapper of Peim image entry point.
@param FfsHeader Pointer to FFS header the loaded driver.
@param PeiServices Pointer to the PEI services.
@return Status returned by entry points of Peims.
**/
EFI_STATUS
EFIAPI
EfiMain (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
)
{
return _ModuleEntryPoint (FfsHeader, PeiServices);
}
//
// Guids not present in R8.6 code base
//
//
// Protocol/Arch Protocol GUID globals
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gUefiDriverConfigurationProtocolGuid = { 0xbfd7dc1d, 0x24f1, 0x40d9, { 0x82, 0xe7, 0x2e, 0x09, 0xbb, 0x6b, 0x4e, 0xbe } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gUefiDriverDiagnosticsProtocolGuid = { 0x4d330321, 0x025f, 0x4aac, { 0x90, 0xd8, 0x5e, 0xd9, 0x00, 0x17, 0x3b, 0x63 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiArpProtocolGuid = { 0xf4b427bb, 0xba21, 0x4f16, { 0xbc, 0x4e, 0x43, 0xe4, 0x16, 0xab, 0x61, 0x9c } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiArpServiceBindingProtocolGuid = { 0xf44c00ee, 0x1f2c, 0x4a00, { 0xaa, 0x09, 0x1c, 0x9f, 0x3e, 0x08, 0x00, 0xa3 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDhcp4ProtocolGuid = { 0x8a219718, 0x4ef5, 0x4761, { 0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid = { 0x9d9a39d8, 0xbd42, 0x4a73, { 0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIp4ProtocolGuid = { 0x41d94cd2, 0x35b6, 0x455a, { 0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIp4ServiceBindingProtocolGuid = { 0xc51711e7, 0xb4bf, 0x404a, { 0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIp4ConfigProtocolGuid = { 0x3b95aa31, 0x3793, 0x434b, { 0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiManagedNetworkProtocolGuid = { 0x3b95aa31, 0x3793, 0x434b, { 0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiManagedNetworkServiceBindingProtocolGuid = { 0xf36ff770, 0xa7e1, 0x42cf, { 0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiMtftp4ProtocolGuid = { 0x3ad9df29, 0x4501, 0x478d, { 0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiMtftp4ServiceBindingProtocolGuid = { 0x2FE800BE, 0x8F01, 0x4aa6, { 0x94, 0x6B, 0xD7, 0x13, 0x88, 0xE1, 0x83, 0x3F } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiTcp4ProtocolGuid = { 0x65530BC7, 0xA359, 0x410f, { 0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiTcp4ServiceBindingProtocolGuid = { 0x00720665, 0x67EB, 0x4a99, { 0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiUdp4ProtocolGuid = { 0x3ad9df29, 0x4501, 0x478d, { 0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiUdp4ServiceBindingProtocolGuid = { 0x83f01464, 0x99bd, 0x45e5, { 0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiAuthenticationInfoProtocolGuid = { 0x7671d9d0, 0x53db, 0x4173, { 0xaa, 0x69, 0x23, 0x27, 0xf2, 0x1f, 0x0b, 0xc7 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDevicePathFromTextProtocolGuid = { 0x5c99a21, 0xc70f, 0x4ad2, { 0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDevicePathToTextProtocolGuid = { 0x8b843e20, 0x8132, 0x4852, { 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDevicePathUtilitiesProtocolGuid = { 0x379be4e, 0xd706, 0x437d, { 0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashProtocolGuid = { 0xc5184932, 0xdba5, 0x46db, { 0xa5, 0xba, 0xcc, 0x0b, 0xda, 0x9c, 0x14, 0x35 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashServiceBindingProtocolGuid = { 0x42881c98, 0xa4f3, 0x44b0, { 0xa3, 0x9d, 0xdf, 0xa1, 0x86, 0x67, 0xd8, 0xcd } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIScsiInitiatorNameProtocolGuid = { 0xa6a72875, 0x2962, 0x4c18, { 0x9f, 0x46, 0x8d, 0xa6, 0x44, 0xcc, 0xfe, 0x00 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiExtScsiPassThruProtocolGuid = { 0x1d3de7f0, 0x0807, 0x424f, { 0xaa, 0x69, 0x11, 0xa5, 0x4e, 0x19, 0xa4, 0x6f } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiTapeIoProtocolGuid = { 0x1e93e633, 0xd65a, 0x459e, { 0xab, 0x84, 0x93, 0xd9, 0xec, 0x26, 0x6d, 0x18 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiUsb2HcProtocolGuid = { 0x3e745226, 0x9818, 0x45b6, { 0xa2, 0xac, 0xd7, 0xcd, 0x0e, 0x8b, 0xa2, 0xbc } };
//
// PPI GUID globals
//
//
// GUID globals
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHobMemoryAllocBspStoreGuid = { 0x564b33cd, 0xc92a, 0x4593, { 0x90, 0xbf, 0x24, 0x73, 0xe4, 0x3c, 0x63, 0x22 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHobMemoryAllocStackGuid = { 0x4ed4bf27, 0x4092, 0x42e9, { 0x80, 0x7d, 0x52, 0x7b, 0x1d, 0x00, 0xc9, 0xbd } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHobMemoryAllocModuleGuid = { 0xf8e21975, 0x0899, 0x4f58, { 0xa4, 0xbe, 0x55, 0x25, 0xa9, 0xc6, 0xd7, 0x7a } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiAuthenticationChapRadiusGuid = { 0xd6062b50, 0x15ca, 0x11da, { 0x92, 0x19, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiAuthenticationChapLocalGuid = { 0xc280c73e, 0x15ca, 0x11da, { 0xb0, 0xca, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha1Guid = { 0x2ae9d80f, 0x3fb2, 0x4095, { 0xb7, 0xb1, 0xe9, 0x31, 0x57, 0xb9, 0x46, 0xb6 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha224Guid = { 0x8df01a06, 0x9bd5, 0x4bf7, { 0xb0, 0x21, 0xdb, 0x4f, 0xd9, 0xcc, 0xf4, 0x5b } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha256Guid = { 0x51aa59de, 0xfdf2, 0x4ea3, { 0xbc, 0x63, 0x87, 0x5f, 0xb7, 0x84, 0x2e, 0xe9 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha384Guid = { 0xefa96432, 0xde33, 0x4dd2, { 0xae, 0xe6, 0x32, 0x8c, 0x33, 0xdf, 0x77, 0x7a } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha512Guid = { 0xcaa4381e, 0x750c, 0x4770, { 0xb8, 0x70, 0x7a, 0x23, 0xb4, 0xe4, 0x21, 0x30 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmMD5Guid = { 0xaf7c79c, 0x65b5, 0x4319, { 0xb0, 0xae, 0x44, 0xec, 0x48, 0x4e, 0x4a, 0xd7 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gBootObjectAuthorizationParmsetGuid = { 0xedd35e31, 0x7b9, 0x11d2, { 0x83, 0xa3, 0x00, 0xa0, 0xc9, 0x1f, 0xad, 0xcf } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gSmmCommunicateHeaderGuid = { 0xf328e36c, 0x23b6, 0x4a95, { 0x85, 0x4b, 0x32, 0xe1, 0x95, 0x34, 0xcd, 0x75 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCapsuleGuid = { 0x3B6686BD, 0x0D76, 0x4030, { 0xB7, 0x0E, 0xB5, 0x51, 0x9E, 0x2F, 0xC5, 0xA0 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiConfigFileNameGuid = { 0x98B8D59B, 0xE8BA, 0x48EE, { 0x98, 0xDD, 0xC2, 0x95, 0x39, 0x2F, 0x1E, 0xDB } };

View File

@@ -0,0 +1,480 @@
/*++
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:
EdkIIGlueSmmDriverEntryPoint.c
Abstract:
Smm Driver entry point template file
--*/
#include "EdkIIGlueDxe.h"
#include "Common/EdkIIGlueDependencies.h"
//
// Module Unload Handler
//
#ifdef __EDKII_GLUE_MODULE_UNLOAD_HANDLER__
EFI_STATUS
EFIAPI
__EDKII_GLUE_MODULE_UNLOAD_HANDLER__ (
EFI_HANDLE ImageHandle
);
#endif
EFI_STATUS
EFIAPI
ProcessModuleUnloadList (
EFI_HANDLE ImageHandle
)
{
#ifdef __EDKII_GLUE_MODULE_UNLOAD_HANDLER__
return (__EDKII_GLUE_MODULE_UNLOAD_HANDLER__ (ImageHandle));
#else
return EFI_SUCCESS;
#endif
}
#ifdef __EDKII_GLUE_EFI_CALLER_ID_GUID__
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = __EDKII_GLUE_EFI_CALLER_ID_GUID__;
#endif
//
// Library constructors
//
VOID
ProcessLibraryConstructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
//
// Declare "Status" if any of the following libraries are used
//
#if defined(__EDKII_GLUE_DXE_HOB_LIB__) \
|| defined(__EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__) \
|| defined(__EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__) \
|| defined(__EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__) \
|| defined(__EDKII_GLUE_DXE_SERVICES_TABLE_LIB__) \
|| defined(__EDKII_GLUE_DXE_SMBUS_LIB__) \
|| defined(__EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__) \
|| defined(__EDKII_GLUE_DXE_IO_LIB_CPU_IO__)
EFI_STATUS Status;
#endif
//
// EdkII Glue Library Constructors:
// NOTE: the constructors must be called according to dependency order
//
// UefiBootServicesTableLib UefiBootServicesTableLibConstructor()
// DxeIoLibCpuIo IoLibConstructor
// EdkDxeRuntimeDriverLib RuntimeDriverLibConstruct()
// DxeHobLib HobLibConstructor()
// UefiDriverModelLib UefiDriverModelLibConstructor()
// DxeSmbusLib SmbusLibConstructor()
// DxeServicesTableLib DxeServicesTableLibConstructor()
// UefiRuntimeServicesTableLib UefiRuntimeServicesTableLibConstructor()
// check here: check lib usage
#ifdef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
Status = UefiBootServicesTableLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
Status = IoLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
Status = RuntimeDriverLibConstruct (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
Status = UefiRuntimeServicesTableLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
Status = UefiDriverModelLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__
Status = DxeServicesTableLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_DXE_HOB_LIB__
Status = HobLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
#ifdef __EDKII_GLUE_DXE_SMBUS_LIB__
Status = SmbusLibConstructor (ImageHandle, SystemTable);
ASSERT_EFI_ERROR (Status);
#endif
}
//
// Library destructors
//
VOID
ProcessLibraryDestructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
}
EFI_BOOT_SERVICES *mBS;
/**
This function returns the size, in bytes,
of the device path data structure specified by DevicePath.
If DevicePath is NULL, then 0 is returned.
@param DevicePath A pointer to a device path data structure.
@return The size of a device path in bytes.
**/
STATIC
UINTN
EFIAPI
SmmGetDevicePathSize (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
CONST EFI_DEVICE_PATH_PROTOCOL *Start;
if (DevicePath == NULL) {
return 0;
}
//
// Search for the end of the device path structure
//
Start = DevicePath;
while (!EfiIsDevicePathEnd (DevicePath)) {
DevicePath = EfiNextDevicePathNode (DevicePath);
}
//
// Compute the size and add back in the size of the end device path structure
//
return ((UINTN) DevicePath - (UINTN) Start) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
}
/**
This function appends the device path SecondDevicePath
to every device path instance in FirstDevicePath.
@param FirstDevicePath A pointer to a device path data structure.
@param SecondDevicePath A pointer to a device path data structure.
@return A pointer to the new device path is returned.
NULL is returned if space for the new device path could not be allocated from pool.
It is up to the caller to free the memory used by FirstDevicePath and SecondDevicePath
if they are no longer needed.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
SmmAppendDevicePath (
IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,
IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath
)
{
EFI_STATUS Status;
UINTN Size;
UINTN Size1;
UINTN Size2;
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
EFI_DEVICE_PATH_PROTOCOL *DevicePath2;
ASSERT (FirstDevicePath != NULL && SecondDevicePath != NULL);
//
// Allocate space for the combined device path. It only has one end node of
// length EFI_DEVICE_PATH_PROTOCOL
//
Size1 = SmmGetDevicePathSize (FirstDevicePath);
Size2 = SmmGetDevicePathSize (SecondDevicePath);
Size = Size1 + Size2 - sizeof (EFI_DEVICE_PATH_PROTOCOL);
Status = (mBS->AllocatePool) (EfiBootServicesData, Size, (VOID **) &NewDevicePath);
if (EFI_SUCCESS == Status) {
(mBS->CopyMem) ((VOID *) NewDevicePath, (VOID *) FirstDevicePath, Size1);
//
// Over write Src1 EndNode and do the copy
//
DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath + (Size1 - sizeof (EFI_DEVICE_PATH_PROTOCOL)));
(mBS->CopyMem) ((VOID *) DevicePath2, (VOID *) SecondDevicePath, Size2);
}
return NewDevicePath;
}
/**
Unload function that is registered in the LoadImage protocol. It un-installs
protocols produced and deallocates pool used by the driver. Called by the core
when unloading the driver.
@param ImageHandle ImageHandle of the unloaded driver
@return Status of the ProcessModuleUnloadList.
**/
EFI_STATUS
EFIAPI
_DriverUnloadHandler (
EFI_HANDLE ImageHandle
)
{
EFI_STATUS Status;
//
// Call the unload handlers for all the modules
//
Status = ProcessModuleUnloadList (ImageHandle);
//
// If the driver specific unload handler does not return an error, then call all of the
// library destructors. If the unload handler returned an error, then the driver can not be
// unloaded, and the library destructors should not be called
//
if (!EFI_ERROR (Status)) {
//
// NOTE: To allow passing in gST here, any library instance having a destructor
// must depend on EfiDriverLib
//
}
//
// Return the status from the driver specific unload handler
//
return Status;
}
EFI_DRIVER_ENTRY_POINT (_ModuleEntryPoint);
//
// Module Entry Point
//
#ifdef __EDKII_GLUE_MODULE_ENTRY_POINT__
EFI_STATUS
EFIAPI
__EDKII_GLUE_MODULE_ENTRY_POINT__ (
EFI_HANDLE ImageHandle,
EFI_SYSTEM_TABLE *SystemTable
);
#endif
/**
Enrty point to DXE SMM Driver.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
@retval EFI_SUCCESS One or more of the drivers returned a success code.
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
**/
EFI_STATUS
EFIAPI
_ModuleEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
EFI_SMM_BASE_PROTOCOL *SmmBase;
BOOLEAN InSmm;
EFI_DEVICE_PATH_PROTOCOL *CompleteFilePath;
EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
EFI_HANDLE Handle;
//
// Cache a pointer to the Boot Services Table
//
mBS = SystemTable->BootServices;
//
// Retrieve the Loaded Image Protocol
//
Status = mBS->HandleProtocol (
ImageHandle,
&gEfiLoadedImageProtocolGuid,
(VOID*)&LoadedImage
);
ASSERT_EFI_ERROR (Status);
//
// Retrieve SMM Base Protocol
//
Status = mBS->LocateProtocol (
&gEfiSmmBaseProtocolGuid,
NULL,
(VOID **) &SmmBase
);
ASSERT_EFI_ERROR (Status);
//
// Check to see if we are already in SMM
//
SmmBase->InSmm (SmmBase, &InSmm);
//
//
//
if (!InSmm) {
//
// Retrieve the Device Path Protocol from the DeviceHandle tha this driver was loaded from
//
Status = mBS->HandleProtocol (
LoadedImage->DeviceHandle,
&gEfiDevicePathProtocolGuid,
(VOID*)&ImageDevicePath
);
ASSERT_EFI_ERROR (Status);
//
// Build the full device path to the currently execuing image
//
CompleteFilePath = SmmAppendDevicePath (ImageDevicePath, LoadedImage->FilePath);
//
// Load the image in memory to SMRAM; it will automatically generate the
// SMI.
//
Status = SmmBase->Register (SmmBase, CompleteFilePath, NULL, 0, &Handle, FALSE);
ASSERT_EFI_ERROR (Status);
return Status;
}
//
// Call constructor for all libraries
//
ProcessLibraryConstructorList (ImageHandle, SystemTable);
//
// Install the unload handler
//
Status = mBS->HandleProtocol (
ImageHandle,
&gEfiLoadedImageProtocolGuid,
(VOID **)&LoadedImage
);
ASSERT_EFI_ERROR (Status);
LoadedImage->Unload = _DriverUnloadHandler;
//
// Call the list of driver entry points
//
#ifdef __EDKII_GLUE_MODULE_ENTRY_POINT__
Status = (__EDKII_GLUE_MODULE_ENTRY_POINT__ (ImageHandle, SystemTable));
#else
Status = EFI_SUCCESS;
#endif
if (EFI_ERROR (Status)) {
ProcessLibraryDestructorList (ImageHandle, SystemTable);
}
return Status;
}
/**
Enrty point wrapper of DXE SMM Driver.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
@retval EFI_SUCCESS One or more of the drivers returned a success code.
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
**/
EFI_STATUS
EFIAPI
EfiMain (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
return _ModuleEntryPoint (ImageHandle, SystemTable);
}
//
// Guids not present in R8.6 code base
//
//
// Protocol/Arch Protocol GUID globals
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gUefiDriverConfigurationProtocolGuid = { 0xbfd7dc1d, 0x24f1, 0x40d9, { 0x82, 0xe7, 0x2e, 0x09, 0xbb, 0x6b, 0x4e, 0xbe } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gUefiDriverDiagnosticsProtocolGuid = { 0x4d330321, 0x025f, 0x4aac, { 0x90, 0xd8, 0x5e, 0xd9, 0x00, 0x17, 0x3b, 0x63 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiArpProtocolGuid = { 0xf4b427bb, 0xba21, 0x4f16, { 0xbc, 0x4e, 0x43, 0xe4, 0x16, 0xab, 0x61, 0x9c } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiArpServiceBindingProtocolGuid = { 0xf44c00ee, 0x1f2c, 0x4a00, { 0xaa, 0x09, 0x1c, 0x9f, 0x3e, 0x08, 0x00, 0xa3 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDhcp4ProtocolGuid = { 0x8a219718, 0x4ef5, 0x4761, { 0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid = { 0x9d9a39d8, 0xbd42, 0x4a73, { 0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIp4ProtocolGuid = { 0x41d94cd2, 0x35b6, 0x455a, { 0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIp4ServiceBindingProtocolGuid = { 0xc51711e7, 0xb4bf, 0x404a, { 0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIp4ConfigProtocolGuid = { 0x3b95aa31, 0x3793, 0x434b, { 0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiManagedNetworkProtocolGuid = { 0x3b95aa31, 0x3793, 0x434b, { 0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiManagedNetworkServiceBindingProtocolGuid = { 0xf36ff770, 0xa7e1, 0x42cf, { 0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiMtftp4ProtocolGuid = { 0x3ad9df29, 0x4501, 0x478d, { 0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiMtftp4ServiceBindingProtocolGuid = { 0x2FE800BE, 0x8F01, 0x4aa6, { 0x94, 0x6B, 0xD7, 0x13, 0x88, 0xE1, 0x83, 0x3F } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiTcp4ProtocolGuid = { 0x65530BC7, 0xA359, 0x410f, { 0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiTcp4ServiceBindingProtocolGuid = { 0x00720665, 0x67EB, 0x4a99, { 0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiUdp4ProtocolGuid = { 0x3ad9df29, 0x4501, 0x478d, { 0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiUdp4ServiceBindingProtocolGuid = { 0x83f01464, 0x99bd, 0x45e5, { 0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiAuthenticationInfoProtocolGuid = { 0x7671d9d0, 0x53db, 0x4173, { 0xaa, 0x69, 0x23, 0x27, 0xf2, 0x1f, 0x0b, 0xc7 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDevicePathFromTextProtocolGuid = { 0x5c99a21, 0xc70f, 0x4ad2, { 0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDevicePathToTextProtocolGuid = { 0x8b843e20, 0x8132, 0x4852, { 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDevicePathUtilitiesProtocolGuid = { 0x379be4e, 0xd706, 0x437d, { 0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashProtocolGuid = { 0xc5184932, 0xdba5, 0x46db, { 0xa5, 0xba, 0xcc, 0x0b, 0xda, 0x9c, 0x14, 0x35 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashServiceBindingProtocolGuid = { 0x42881c98, 0xa4f3, 0x44b0, { 0xa3, 0x9d, 0xdf, 0xa1, 0x86, 0x67, 0xd8, 0xcd } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIScsiInitiatorNameProtocolGuid = { 0xa6a72875, 0x2962, 0x4c18, { 0x9f, 0x46, 0x8d, 0xa6, 0x44, 0xcc, 0xfe, 0x00 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiExtScsiPassThruProtocolGuid = { 0x1d3de7f0, 0x0807, 0x424f, { 0xaa, 0x69, 0x11, 0xa5, 0x4e, 0x19, 0xa4, 0x6f } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiTapeIoProtocolGuid = { 0x1e93e633, 0xd65a, 0x459e, { 0xab, 0x84, 0x93, 0xd9, 0xec, 0x26, 0x6d, 0x18 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiUsb2HcProtocolGuid = { 0x3e745226, 0x9818, 0x45b6, { 0xa2, 0xac, 0xd7, 0xcd, 0x0e, 0x8b, 0xa2, 0xbc } };
//
// PPI GUID globals
//
//
// GUID globals
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHobMemoryAllocBspStoreGuid = { 0x564b33cd, 0xc92a, 0x4593, { 0x90, 0xbf, 0x24, 0x73, 0xe4, 0x3c, 0x63, 0x22 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHobMemoryAllocStackGuid = { 0x4ed4bf27, 0x4092, 0x42e9, { 0x80, 0x7d, 0x52, 0x7b, 0x1d, 0x00, 0xc9, 0xbd } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHobMemoryAllocModuleGuid = { 0xf8e21975, 0x0899, 0x4f58, { 0xa4, 0xbe, 0x55, 0x25, 0xa9, 0xc6, 0xd7, 0x7a } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiAuthenticationChapRadiusGuid = { 0xd6062b50, 0x15ca, 0x11da, { 0x92, 0x19, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiAuthenticationChapLocalGuid = { 0xc280c73e, 0x15ca, 0x11da, { 0xb0, 0xca, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha1Guid = { 0x2ae9d80f, 0x3fb2, 0x4095, { 0xb7, 0xb1, 0xe9, 0x31, 0x57, 0xb9, 0x46, 0xb6 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha224Guid = { 0x8df01a06, 0x9bd5, 0x4bf7, { 0xb0, 0x21, 0xdb, 0x4f, 0xd9, 0xcc, 0xf4, 0x5b } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha256Guid = { 0x51aa59de, 0xfdf2, 0x4ea3, { 0xbc, 0x63, 0x87, 0x5f, 0xb7, 0x84, 0x2e, 0xe9 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha384Guid = { 0xefa96432, 0xde33, 0x4dd2, { 0xae, 0xe6, 0x32, 0x8c, 0x33, 0xdf, 0x77, 0x7a } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha512Guid = { 0xcaa4381e, 0x750c, 0x4770, { 0xb8, 0x70, 0x7a, 0x23, 0xb4, 0xe4, 0x21, 0x30 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmMD5Guid = { 0xaf7c79c, 0x65b5, 0x4319, { 0xb0, 0xae, 0x44, 0xec, 0x48, 0x4e, 0x4a, 0xd7 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gBootObjectAuthorizationParmsetGuid = { 0xedd35e31, 0x7b9, 0x11d2, { 0x83, 0xa3, 0x00, 0xa0, 0xc9, 0x1f, 0xad, 0xcf } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gSmmCommunicateHeaderGuid = { 0xf328e36c, 0x23b6, 0x4a95, { 0x85, 0x4b, 0x32, 0xe1, 0x95, 0x34, 0xcd, 0x75 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCapsuleGuid = { 0x3B6686BD, 0x0D76, 0x4030, { 0xB7, 0x0E, 0xB5, 0x51, 0x9E, 0x2F, 0xC5, 0xA0 } };
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiConfigFileNameGuid = { 0x98B8D59B, 0xE8BA, 0x48EE, { 0x98, 0xDD, 0xC2, 0x95, 0x39, 0x2F, 0x1E, 0xDB } };

View File

@@ -0,0 +1,50 @@
/*++
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:
AutoGen.h
Abstract:
This file is supposed to be used by a .dxe file. To write common .dxs file for R8.x
and R9, a header file named AutoGen.h musted be present. In R8.x-GlueLib code base,
this AutoGen.h plays the role as the AutoGen.h in R9. Here the AutoGen.h isn't auto-generated
by any tool.
--*/
#ifndef __EDKII_GLUELIB_AUTOGEN_H__
#define __EDKII_GLUELIB_AUTOGEN_H__
//
// Explanation:
// BUILD_WITH_GLUELIB was used at the very beginning of EdkIIGlueLib development and
// BUILD_WITH_EDKII_GLUE_LIB was introduced later with newer EDK. The old one, BUILD_WITH_GLUELIB,
// is remained here only to keep source level compatibility with modules which already use it.
//
// Both macros are of same effect: to indicate a module it's using EdkIIGlueLib. For newly created
// modules, BUILD_WITH_EDKII_GLUE_LIB is recommended to use.
//
// The macros can be used in .dxs files and source files.
//
#ifndef BUILD_WITH_EDKII_GLUE_LIB
#define BUILD_WITH_EDKII_GLUE_LIB
#endif
#ifndef BUILD_WITH_GLUELIB
#define BUILD_WITH_GLUELIB
#endif
#endif

View File

@@ -0,0 +1,90 @@
/*++
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:
EdkIIGlueBaseTypes.h
Abstract:
Defines additional data types for use by Base modules
--*/
#ifndef __EDKII_GLUE_BASE_TYPES_H__
#define __EDKII_GLUE_BASE_TYPES_H__
#include "..\EdkIIGlueConfig.h"
#define BREAKPOINT EFI_BREAKPOINT
#define DEADLOOP EFI_DEADLOOP
#define MAX_BIT EFI_MAX_BIT
#define MAX_ADDRESS EFI_MAX_ADDRESS
#ifndef UINT8_MAX
#define UINT8_MAX 0xff
#endif
//
// EFI Error Codes common to all execution phases
//
typedef INTN RETURN_STATUS;
///
/// Set the upper bit to indicate EFI Error.
///
#define ENCODE_ERROR(a) (MAX_BIT | (a))
#define ENCODE_WARNING(a) (a)
#define RETURN_ERROR(a) ((a) < 0)
#define RETURN_SUCCESS 0
#define RETURN_LOAD_ERROR ENCODE_ERROR (1)
#define RETURN_INVALID_PARAMETER ENCODE_ERROR (2)
#define RETURN_UNSUPPORTED ENCODE_ERROR (3)
#define RETURN_BAD_BUFFER_SIZE ENCODE_ERROR (4)
#define RETURN_BUFFER_TOO_SMALL ENCODE_ERROR (5)
#define RETURN_NOT_READY ENCODE_ERROR (6)
#define RETURN_DEVICE_ERROR ENCODE_ERROR (7)
#define RETURN_WRITE_PROTECTED ENCODE_ERROR (8)
#define RETURN_OUT_OF_RESOURCES ENCODE_ERROR (9)
#define RETURN_VOLUME_CORRUPTED ENCODE_ERROR (10)
#define RETURN_VOLUME_FULL ENCODE_ERROR (11)
#define RETURN_NO_MEDIA ENCODE_ERROR (12)
#define RETURN_MEDIA_CHANGED ENCODE_ERROR (13)
#define RETURN_NOT_FOUND ENCODE_ERROR (14)
#define RETURN_ACCESS_DENIED ENCODE_ERROR (15)
#define RETURN_NO_RESPONSE ENCODE_ERROR (16)
#define RETURN_NO_MAPPING ENCODE_ERROR (17)
#define RETURN_TIMEOUT ENCODE_ERROR (18)
#define RETURN_NOT_STARTED ENCODE_ERROR (19)
#define RETURN_ALREADY_STARTED ENCODE_ERROR (20)
#define RETURN_ABORTED ENCODE_ERROR (21)
#define RETURN_ICMP_ERROR ENCODE_ERROR (22)
#define RETURN_TFTP_ERROR ENCODE_ERROR (23)
#define RETURN_PROTOCOL_ERROR ENCODE_ERROR (24)
#define RETURN_INCOMPATIBLE_VERSION ENCODE_ERROR (25)
#define RETURN_SECURITY_VIOLATION ENCODE_ERROR (26)
#define RETURN_CRC_ERROR ENCODE_ERROR (27)
#define RETURN_END_OF_MEDIA ENCODE_ERROR (28)
#define RETURN_END_OF_FILE ENCODE_ERROR (31)
#define RETURN_WARN_UNKNOWN_GLYPH ENCODE_WARNING (1)
#define RETURN_WARN_DELETE_FAILURE ENCODE_WARNING (2)
#define RETURN_WARN_WRITE_FAILURE ENCODE_WARNING (3)
#define RETURN_WARN_BUFFER_TOO_SMALL ENCODE_WARNING (4)
typedef UINT64 PHYSICAL_ADDRESS;
#endif

View File

@@ -0,0 +1,113 @@
/*++
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:
EdkIIGlueDefinitionChangesBase.h
Abstract:
Data structure definition changes from EDK to EDKII
--*/
#ifndef __EDKII_GLUE_DEFINITION_CHANGES_BASE_H__
#define __EDKII_GLUE_DEFINITION_CHANGES_BASE_H__
#include "EfiInternalFormRepresentation.h"
#include "EfiPxe.h"
// ----------------------------------------------------------------------------------
// Data Hub Record GUID Name changes
// ----------------------------------------------------------------------------------
#define gEfiProcessorSubClassGuid gProcessorSubClassName
#define gEfiCacheSubClassGuid gCacheSubClassName
#define gEfiMiscSubClassGuid gMiscSubClassName
#define gEfiProcessorProducerGuid gProcessorProducerGuid
#define gEfiMemoryProducerGuid gMemoryProducerGuid
#define gEfiMiscProducerGuid gMiscProducerGuid
// ----------------------------------------------------------------------------------
// Hob.h: Get the data and data size field of GUID
// ----------------------------------------------------------------------------------
#define GET_GUID_HOB_DATA(GuidHob) ((VOID *) (((UINT8 *) &((GuidHob)->Name)) + sizeof (EFI_GUID)))
#define GET_GUID_HOB_DATA_SIZE(GuidHob) (((GuidHob)->Header).HobLength - sizeof (EFI_HOB_GUID_TYPE))
// ----------------------------------------------------------------------------------
// InternalFormRepresentation.h:
// ----------------------------------------------------------------------------------
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
UINT8 Width; // The Size of the Data being saved
STRING_REF Prompt; // The String Token for the Prompt
STRING_REF Help; // The string Token for the context-help
UINT8 Flags; // For now, if non-zero, means that it is the default option, - further definition likely
UINT16 Key; // Value to be passed to caller to identify this particular op-code
} EFI_IFR_CHECKBOX;
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT8 Flags;
} EFI_IFR_GRAY_OUT;
typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_END_EXPR;
// ------------------------
// define GUID as EFI_GUID
// ------------------------
typedef EFI_GUID GUID;
// -------------------
// EdkII Names - Edk Names
// -------------------
#define EFI_GLOBAL_VARIABLE EFI_GLOBAL_VARIABLE_GUID
#define MPS_TABLE_GUID EFI_MPS_TABLE_GUID
#define SAL_SYSTEM_TABLE_GUID EFI_SAL_SYSTEM_TABLE_GUID
#define SMBIOS_TABLE_GUID EFI_SMBIOS_TABLE_GUID
#define EFI_OPTIONAL_PTR EFI_OPTIONAL_POINTER
#define PXE_FRAME_TYPE_FILTERED_MULTICAST PXE_FRAME_TYPE_MULTICAST
#define IMAGE_FILE_MACHINE_I386 EFI_IMAGE_MACHINE_IA32
#define IMAGE_FILE_MACHINE_IA64 EFI_IMAGE_MACHINE_IA64
#define IMAGE_FILE_MACHINE_EBC EFI_IMAGE_MACHINE_EBC
#define IMAGE_FILE_MACHINE_X64 EFI_IMAGE_MACHINE_X64
#define EVENT_TIMER EFI_EVENT_TIMER
#define EVENT_RUNTIME EFI_EVENT_RUNTIME
#define EVENT_RUNTIME_CONTEXT EFI_EVENT_RUNTIME_CONTEXT
#define EVENT_NOTIFY_WAIT EFI_EVENT_NOTIFY_WAIT
#define EVENT_NOTIFY_SIGNAL EFI_EVENT_NOTIFY_SIGNAL
#define EVENT_SIGNAL_EXIT_BOOT_SERVICES EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES
#define EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE
#define TPL_APPLICATION EFI_TPL_APPLICATION
#define TPL_CALLBACK EFI_TPL_CALLBACK
#define TPL_NOTIFY EFI_TPL_NOTIFY
#define TPL_HIGH_LEVEL EFI_TPL_HIGH_LEVEL
//
// Typos in R8.x
//
#define gEfiHobMemoryAllocModuleGuid gEfiHobMemeryAllocModuleGuid
#define gEfiHobMemoryAllocStackGuid gEfiHobMemeryAllocStackGuid
#define gEfiHobMemoryAllocBspStoreGuid gEfiHobMemeryAllocBspStoreGuid
//
// typedef Edk types - EdkII types
//
typedef PXE_CPB_START PXE_CPB_START_30;
#endif

View File

@@ -0,0 +1,87 @@
/*++
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:
EdkIIGlueDefinitionChangesDxe.h
Abstract:
Data structure definition changes from EDK to EDKII
--*/
#ifndef __EDKII_GLUE_DEFINITION_CHANGES_DXE_H__
#define __EDKII_GLUE_DEFINITION_CHANGES_DXE_H__
#include "EfiInternalFormRepresentation.h"
#include "EdkIIGlueDefinitionChangesBase.h"
#if (TIANO_RELEASE_VERSION <= 0x00080005)
#define gEfiStatusCodeRuntimeProtocolGuid gEfiStatusCodeArchProtocolGuid
#endif
//
// typedef Edk types - EdkII types
//
typedef EFI_MEMORY_ARRAY_START_ADDRESS EFI_MEMORY_ARRAY_START_ADDRESS_DATA;
typedef EFI_MEMORY_DEVICE_START_ADDRESS EFI_MEMORY_DEVICE_START_ADDRESS_DATA;
typedef EFI_MISC_LAST_PCI_BUS EFI_MISC_LAST_PCI_BUS_DATA;
typedef EFI_MISC_BIOS_VENDOR EFI_MISC_BIOS_VENDOR_DATA;
typedef EFI_MISC_SYSTEM_MANUFACTURER EFI_MISC_SYSTEM_MANUFACTURER_DATA;
typedef EFI_MISC_BASE_BOARD_MANUFACTURER EFI_MISC_BASE_BOARD_MANUFACTURER_DATA;
typedef EFI_MISC_CHASSIS_MANUFACTURER EFI_MISC_CHASSIS_MANUFACTURER_DATA;
typedef EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA;
typedef EFI_MISC_SYSTEM_SLOT_DESIGNATION EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA;
typedef EFI_MISC_ONBOARD_DEVICE EFI_MISC_ONBOARD_DEVICE_DATA;
typedef EFI_MISC_ONBOARD_DEVICE_TYPE_DATA EFI_MISC_PORTING_DEVICE_TYPE_DATA;
typedef EFI_MISC_OEM_STRING EFI_MISC_OEM_STRING_DATA;
typedef EFI_MISC_SYSTEM_OPTION_STRING EFI_MISC_SYSTEM_OPTION_STRING_DATA;
typedef EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA;
typedef EFI_MISC_SYSTEM_LANGUAGE_STRING EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA;
typedef EFI_MISC_BIS_ENTRY_POINT EFI_MISC_BIS_ENTRY_POINT_DATA;
typedef EFI_MISC_BOOT_INFORMATION_STATUS EFI_MISC_BOOT_INFORMATION_STATUS_DATA;
typedef EFI_MISC_SYSTEM_POWER_SUPPLY EFI_MISC_SYSTEM_POWER_SUPPLY_DATA ;
typedef EFI_MISC_SMBIOS_STRUCT_ENCAPSULATION EFI_MISC_SMBIOS_STRUCT_ENCAPSULATION_DATA;
// -------------------
// EdkII Names - Edk Names
// -------------------
#define gEfiAcpiSupportProtocolGuid gEfiAcpiSupportGuid
#define gEfiLoadPeImageProtocolGuid gEfiLoadPeImageGuid
#define EFI_GLYPH_NON_SPACING GLYPH_NON_SPACING
#define EFI_GLYPH_WIDE GLYPH_NON_BREAKING
#define BOOT_OBJECT_AUTHORIZATION_PARMSET_GUID BOOT_OBJECT_AUTHORIZATION_PARMSET_GUIDVALUE
#define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID
#define EFI_FILE_SYSTEM_VOLUME_LABEL_ID EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID_GUID
#define EFI_LOADED_IMAGE_PROTOCOL_REVISION EFI_LOADED_IMAGE_INFORMATION_REVISION
#define EFI_LOAD_FILE_PROTOCOL_GUID LOAD_FILE_PROTOCOL_GUID
#define EFI_PXE_BASE_CODE_PROTOCOL_REVISION EFI_PXE_BASE_CODE_INTERFACE_REVISION
#define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION
#define EFI_SERIAL_IO_PROTOCOL_REVISION SERIAL_IO_INTERFACE_REVISION
#define EFI_FILE_PROTOCOL_REVISION EFI_FILE_HANDLE_REVISION
#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID EFI_SIMPLE_TEXT_IN_PROTOCOL_GUID
//
// typedef Edk types - EdkII types
//
typedef EFI_VOLUME_OPEN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME;
typedef EFI_TEXT_OUTPUT_STRING EFI_TEXT_STRING;
typedef SCREEN_DESCRIPTOR EFI_SCREEN_DESCRIPTOR;
typedef EFI_SIMPLE_TEXT_IN_PROTOCOL EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
typedef EFI_SIMPLE_TEXT_OUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
//typedef EFI_TO_LEGACY16_INIT_TABLE EFI_TO_COMPATIBILITY16_INIT_TABLE;
//typedef DISPATCH_OPROM_TABLE EFI_DISPATCH_OPROM_TABLE;
#endif

View File

@@ -0,0 +1,158 @@
/*++
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:
EdkIIGlueDefinitionChangesPeim.h
Abstract:
Data structure definition changes from EDK to EDKII
--*/
#ifndef __EDKII_GLUE_DEFINITION_CHANGES_PEIM_H__
#define __EDKII_GLUE_DEFINITION_CHANGES_PEIM_H__
#include "EfiInternalFormRepresentation.h"
#include "EdkIIGlueDefinitionChangesBase.h"
#include "EfiPciCfg.h"
//
// typedef Edk types - EdkII types
//
typedef EFI_MEMORY_ARRAY_START_ADDRESS EFI_MEMORY_ARRAY_START_ADDRESS_DATA;
typedef EFI_MEMORY_DEVICE_START_ADDRESS EFI_MEMORY_DEVICE_START_ADDRESS_DATA;
typedef EFI_MISC_LAST_PCI_BUS EFI_MISC_LAST_PCI_BUS_DATA;
typedef EFI_MISC_BIOS_VENDOR EFI_MISC_BIOS_VENDOR_DATA;
typedef EFI_MISC_SYSTEM_MANUFACTURER EFI_MISC_SYSTEM_MANUFACTURER_DATA;
typedef EFI_MISC_BASE_BOARD_MANUFACTURER EFI_MISC_BASE_BOARD_MANUFACTURER_DATA;
typedef EFI_MISC_CHASSIS_MANUFACTURER EFI_MISC_CHASSIS_MANUFACTURER_DATA;
typedef EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA;
typedef EFI_MISC_SYSTEM_SLOT_DESIGNATION EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA;
typedef EFI_MISC_ONBOARD_DEVICE EFI_MISC_ONBOARD_DEVICE_DATA;
typedef EFI_MISC_ONBOARD_DEVICE_TYPE_DATA EFI_MISC_PORTING_DEVICE_TYPE_DATA;
typedef EFI_MISC_OEM_STRING EFI_MISC_OEM_STRING_DATA;
typedef EFI_MISC_SYSTEM_OPTION_STRING EFI_MISC_SYSTEM_OPTION_STRING_DATA;
typedef EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA;
typedef EFI_MISC_SYSTEM_LANGUAGE_STRING EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA;
typedef EFI_MISC_BIS_ENTRY_POINT EFI_MISC_BIS_ENTRY_POINT_DATA;
typedef EFI_MISC_BOOT_INFORMATION_STATUS EFI_MISC_BOOT_INFORMATION_STATUS_DATA;
typedef EFI_MISC_SYSTEM_POWER_SUPPLY EFI_MISC_SYSTEM_POWER_SUPPLY_DATA ;
typedef EFI_MISC_SMBIOS_STRUCT_ENCAPSULATION EFI_MISC_SMBIOS_STRUCT_ENCAPSULATION_DATA;
// -------------------
// EdkII Names - Edk Names
// -------------------
#define gEfiPeiCpuIoPpiInServiceTableGuid gPeiCpuIoPpiInServiceTableGuid
#define gEfiEndOfPeiSignalPpiGuid gEndOfPeiSignalPpiGuid
#define gEfiPeiFvFileLoaderPpiGuid gPeiFvFileLoaderPpiGuid
#define gEfiPeiMasterBootModePpiGuid gPeiMasterBootModePpiGuid
#define gEfiPeiMemoryDiscoveredPpiGuid gPeiMemoryDiscoveredPpiGuid
#define gEfiPciCfgPpiInServiceTableGuid gPeiPciCfgPpiInServiceTableGuid
#define gEfiPeiReadOnlyVariablePpiGuid gPeiReadOnlyVariablePpiGuid
#define gEfiPeiRecoveryModulePpiGuid gPeiRecoveryModulePpiGuid
#define gEfiPeiResetPpiGuid gPeiResetPpiGuid
#define gEfiPeiS3ResumePpiGuid gPeiS3ResumePpiGuid
#define gEfiPeiSectionExtractionPpiGuid gPeiSectionExtractionPpiGuid
#define gEfiPeiSecurityPpiGuid gPeiSecurityPpiGuid
#define gEfiPeiStatusCodePpiGuid gPeiStatusCodePpiGuid
#define gEfiPeiBootScriptExecuterPpiGuid gPeiBootScriptExecuterPpiGuid
#define gEfiPeiSmbusPpiGuid gPeiSmbusPpiGuid
#define gEfiPeiBlockIoPpiGuid gPeiBlockIoPpiGuid
#define gEfiPeiDeviceRecoveryModulePpiGuid gPeiDeviceRecoveryModulePpiGuid
#define gEfiPeiStallPpiGuid gPeiStallPpiGuid
#define gEfiPeiPciCfgPpiInServiceTableGuid gPeiPciCfgPpiInServiceTableGuid
#define gEfiPeiAtaControllerPpiGuid gPeiAtaControllerPpiGuid
#define EFI_PEI_CPU_IO_PPI_INSTALLED_GUID PEI_CPU_IO_PPI_GUID
#define EFI_PEI_RESET_PPI_GUID PEI_RESET_PPI_GUID
#define EFI_PEI_PCI_CFG_PPI_INSTALLED_GUID PEI_PCI_CFG_PPI_GUID
#define EFI_PEI_REPORT_PROGRESS_CODE_PPI_GUID PEI_STATUS_CODE_PPI_GUID
#define EFI_PEI_BOOT_IN_RECOVERY_MODE_PEIM_PPI PEI_BOOT_IN_RECOVERY_MODE_PEIM_PPI
#define EFI_PEI_END_OF_PEI_PHASE_PPI_GUID PEI_END_OF_PEI_PHASE_PPI_GUID
#define EFI_PEI_MASTER_BOOT_MODE_PEIM_PPI PEI_MASTER_BOOT_MODE_PEIM_PPI
#define EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID
#define EFI_PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID
#define EFI_PEI_RECOVERY_MODULE_PPI_GUID PEI_RECOVERY_MODULE_INTERFACE_PPI
#define EFI_PEI_S3_RESUME_PPI_GUID PEI_S3_RESUME_PPI_GUID
#define EFI_PEI_SECURITY_PPI_GUID PEI_SECURITY_PPI_GUID
#define EFI_PEI_STALL_PPI_GUID PEI_STALL_PPI_GUID
#define EFI_PEI_SMBUS_PPI_GUID PEI_SMBUS_PPI_GUID
#define EFI_PEI_BOOT_SCRIPT_EXECUTER_PPI_GUID PEI_BOOT_SCRIPT_EXECUTER_PPI_GUID
#define EFI_PEI_FIND_FV_PPI_GUID EFI_FIND_FV_PPI_GUID
#define EFI_PEI_VIRTUAL_BLOCK_IO_PPI PEI_BLOCK_IO_PPI_GUID
#define EFI_PEI_DEVICE_RECOVERY_MODULE_PPI_GUID PEI_DEVICE_RECOVERY_MODULE_INTERFACE_PPI
//
// typedef Edk types - EdkII types
//
typedef PEI_RECOVERY_MODULE_INTERFACE EFI_PEI_RECOVERY_MODULE_PPI;
typedef PEI_CPU_IO_PPI EFI_PEI_CPU_IO_PPI;
typedef PEI_STALL_PPI EFI_PEI_STALL_PPI;
typedef PEI_SMBUS_PPI EFI_PEI_SMBUS_PPI;
typedef PEI_READ_ONLY_VARIABLE_PPI EFI_PEI_READ_ONLY_VARIABLE_PPI;
typedef PEI_PCI_CFG_PPI EFI_PEI_PCI_CFG_PPI;
typedef PEI_STATUS_CODE_PPI EFI_PEI_PROGRESS_CODE_PPI;
typedef PEI_CPU_IO_PPI_WIDTH EFI_PEI_CPU_IO_PPI_WIDTH;
typedef PEI_CPU_IO_PPI_IO_MEM EFI_PEI_CPU_IO_PPI_IO_MEM;
typedef PEI_CPU_IO_PPI_ACCESS EFI_PEI_CPU_IO_PPI_ACCESS;
typedef PEI_CPU_IO_PPI_IO_READ8 EFI_PEI_CPU_IO_PPI_IO_READ8;
typedef PEI_CPU_IO_PPI_IO_READ16 EFI_PEI_CPU_IO_PPI_IO_READ16;
typedef PEI_CPU_IO_PPI_IO_READ32 EFI_PEI_CPU_IO_PPI_IO_READ32;
typedef PEI_CPU_IO_PPI_IO_READ64 EFI_PEI_CPU_IO_PPI_IO_READ64;
typedef PEI_CPU_IO_PPI_IO_WRITE8 EFI_PEI_CPU_IO_PPI_IO_WRITE8;
typedef PEI_CPU_IO_PPI_IO_WRITE16 EFI_PEI_CPU_IO_PPI_IO_WRITE16;
typedef PEI_CPU_IO_PPI_IO_WRITE32 EFI_PEI_CPU_IO_PPI_IO_WRITE32;
typedef PEI_CPU_IO_PPI_IO_WRITE64 EFI_PEI_CPU_IO_PPI_IO_WRITE64;
typedef PEI_CPU_IO_PPI_MEM_READ8 EFI_PEI_CPU_IO_PPI_MEM_READ8;
typedef PEI_CPU_IO_PPI_MEM_READ16 EFI_PEI_CPU_IO_PPI_MEM_READ16;
typedef PEI_CPU_IO_PPI_MEM_READ32 EFI_PEI_CPU_IO_PPI_MEM_READ32;
typedef PEI_CPU_IO_PPI_MEM_READ64 EFI_PEI_CPU_IO_PPI_MEM_READ64;
typedef PEI_CPU_IO_PPI_MEM_WRITE8 EFI_PEI_CPU_IO_PPI_MEM_WRITE8;
typedef PEI_CPU_IO_PPI_MEM_WRITE16 EFI_PEI_CPU_IO_PPI_MEM_WRITE16;
typedef PEI_CPU_IO_PPI_MEM_WRITE32 EFI_PEI_CPU_IO_PPI_MEM_WRITE32;
typedef PEI_CPU_IO_PPI_MEM_WRITE64 EFI_PEI_CPU_IO_PPI_MEM_WRITE64;
typedef PEI_GET_VARIABLE EFI_PEI_GET_VARIABLE;
typedef PEI_GET_NEXT_VARIABLE_NAME EFI_PEI_GET_NEXT_VARIABLE_NAME;
typedef PEI_LOAD_RECOVERY_CAPSULE EFI_PEI_LOAD_RECOVERY_CAPSULE;
typedef PEI_RESET_PPI EFI_PEI_RESET_PPI;
typedef PEI_S3_RESUME_PPI EFI_PEI_S3_RESUME_PPI;
typedef PEI_S3_RESUME_PPI_RESTORE_CONFIG EFI_PEI_S3_RESUME_PPI_RESTORE_CONFIG;
typedef SEC_PLATFORM_INFORMATION EFI_SEC_PLATFORM_INFORMATION;
typedef PEI_SECURITY_PPI EFI_PEI_SECURITY_PPI;
typedef PEI_SECURITY_AUTHENTICATION_STATE EFI_PEI_SECURITY_AUTHENTICATION_STATE;
typedef PEI_STALL EFI_PEI_STALL;
typedef PEI_SMBUS_PPI_EXECUTE_OPERATION EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION;
typedef PEI_SMBUS_NOTIFY_FUNCTION EFI_PEI_SMBUS_NOTIFY_FUNCTION;
typedef PEI_SMBUS_PPI_ARP_DEVICE EFI_PEI_SMBUS_PPI_ARP_DEVICE;
typedef PEI_SMBUS_PPI_GET_ARP_MAP EFI_PEI_SMBUS_PPI_GET_ARP_MAP;
typedef PEI_SMBUS_PPI_NOTIFY EFI_PEI_SMBUS_PPI_NOTIFY;
typedef PEI_BOOT_SCRIPT_EXECUTE EFI_PEI_BOOT_SCRIPT_EXECUTE;
typedef PEI_BOOT_SCRIPT_EXECUTER_PPI EFI_PEI_BOOT_SCRIPT_EXECUTER_PPI;
typedef EFI_FIND_FV_FINDFV EFI_PEI_FIND_FV_FINDFV;
typedef EFI_FIND_FV_PPI EFI_PEI_FIND_FV_PPI;
typedef PEI_RECOVERY_BLOCK_IO_INTERFACE EFI_PEI_RECOVERY_BLOCK_IO_PPI;
typedef PEI_LBA EFI_PEI_LBA;
typedef PEI_BLOCK_IO_MEDIA EFI_PEI_BLOCK_IO_MEDIA;
typedef PEI_BLOCK_DEVICE_TYPE EFI_PEI_BLOCK_DEVICE_TYPE;
typedef PEI_GET_NUMBER_BLOCK_DEVICES EFI_PEI_GET_NUMBER_BLOCK_DEVICES;
typedef PEI_GET_DEVICE_MEDIA_INFORMATION EFI_PEI_GET_DEVICE_MEDIA_INFORMATION;
typedef PEI_READ_BLOCKS EFI_PEI_READ_BLOCKS;
typedef PEI_DEVICE_RECOVERY_MODULE_INTERFACE EFI_PEI_DEVICE_RECOVERY_MODULE_PPI;
typedef PEI_DEVICE_GET_NUMBER_RECOVERY_CAPSULE EFI_PEI_DEVICE_GET_NUMBER_RECOVERY_CAPSULE;
typedef PEI_DEVICE_GET_RECOVERY_CAPSULE_INFO EFI_PEI_DEVICE_GET_RECOVERY_CAPSULE_INFO;
typedef PEI_DEVICE_LOAD_RECOVERY_CAPSULE EFI_PEI_DEVICE_LOAD_RECOVERY_CAPSULE;
#endif

View File

@@ -0,0 +1,777 @@
/*++
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:
EdkIIGlueDepedencies.h
Abstract:
Header file that lists dependency relations among library instances
--*/
#ifndef __EDKII_GLUE_DEPENDENCIES_H__
#define __EDKII_GLUE_DEPENDENCIES_H__
#include "EdkIIGlueProcessorBind.h"
//
// Declarations of dependencies among EdkII Glue Library instances and R8 Libraries
// Pay attention to the order of following #define structures
//
//
// PeiDxeDebugLibReportStatusCode
// Actually almost every module and GlueLib instance needs this library, but GlueLib
// instances don't have to list this library in their own inf files. Module inf
// does this.
//
#ifdef __EDKII_GLUE_PEI_DXE_DEBUG_LIB_REPORT_STATUS_CODE__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#endif
//
// BaseDebugLibNull
//
#ifdef __EDKII_GLUE_BASE_DEBUG_LIB_NULL__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#ifndef __EDKII_GLUE_BASE_PRINT_LIB__
#define __EDKII_GLUE_BASE_PRINT_LIB__
#endif
#endif
//
// EdkDxeRuntimeDriverLib
//
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
#ifndef __EDKII_GLUE_UEFI_LIB__
#define __EDKII_GLUE_UEFI_LIB__
#endif
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#ifndef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#define __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#endif
#ifdef MDE_CPU_IPF // IPF
#ifndef __EDKII_GLUE_EDK_DXE_SAL_LIB__
#define __EDKII_GLUE_EDK_DXE_SAL_LIB__
#endif
#endif // IPF
#endif
//
// EdkDxeSalLib
//
#ifdef __EDKII_GLUE_EDK_DXE_SAL_LIB__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#ifndef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#define __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#endif
#endif
//
// BasePciLibCf8
//
#ifdef __EDKII_GLUE_BASE_PCI_LIB_CF8__
#ifndef __EDKII_GLUE_BASE_PCI_CF8_LIB__
#define __EDKII_GLUE_BASE_PCI_CF8_LIB__
#endif
#endif
//
// BasePciLibPciExpress
//
#ifdef __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__
#ifndef __EDKII_GLUE_BASE_PCI_EXPRESS_LIB__
#define __EDKII_GLUE_BASE_PCI_EXPRESS_LIB__
#endif
#endif
//
// BasePciCf8Lib
//
#ifdef __EDKII_GLUE_BASE_PCI_CF8_LIB__
#ifndef MDE_CPU_EBC
#ifndef __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__
#define __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__
#endif
#else
#ifndef __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
#define __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
#endif
#endif
#endif
//
// BasePciExpressLib
//
#ifdef __EDKII_GLUE_BASE_PCI_EXPRESS_LIB__
#ifndef MDE_CPU_EBC
#ifndef __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__
#define __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__
#endif
#else
#ifndef __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
#define __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
#endif
#endif
#endif
//
// BaseTimerLibLocalApic
//
#ifdef __EDKII_GLUE_BASE_TIMER_LIB_LOCAL_APIC__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#ifndef MDE_CPU_EBC
#ifndef __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__
#define __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__
#endif
#else
#ifndef __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
#define __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
#endif
#endif
#endif
//
// DxeReportStatusCodeLib
//
#ifdef __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#ifndef MDE_CPU_EBC
#ifndef __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__
#define __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__
#endif
#else
#ifndef __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
#define __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
#endif
#endif
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#ifndef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#define __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#endif
#ifndef __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
#define __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
#endif
#endif
//
// PeiReportStatusCodeLib
//
#ifdef __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#ifndef MDE_CPU_EBC
#ifndef __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__
#define __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__
#endif
#else
#ifndef __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
#define __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
#endif
#endif
#if defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)
#ifndef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
#define __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
#endif
#elif defined(MDE_CPU_IPF)
#ifndef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
#define __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
#endif
#endif
//
// If necessary, __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__ or
// __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__ can be
// replaced with __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__
//
#endif
//
// BasePeCoffLib
//
#ifdef __EDKII_GLUE_BASE_PE_COFF_LIB__
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#endif
//
// BaseUefiDecompressLib
//
#ifdef __EDKII_GLUE_BASE_UEFI_DECOMPRESS_LIB__
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#endif
//
// DxeHobLib
//
#ifdef __EDKII_GLUE_DXE_HOB_LIB__
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#ifndef __EDKII_GLUE_UEFI_LIB__
#define __EDKII_GLUE_UEFI_LIB__
#endif
#endif
//
// HiiLib
//
#ifdef __EDKII_GLUE_HII_LIB__
#ifndef __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
#define __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
#endif
#endif
//
// UefiDevicePathLib
//
#ifdef __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#ifndef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#define __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#endif
#ifndef __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
#define __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
#endif
#endif
//
// UefiLib
//
#ifdef __EDKII_GLUE_UEFI_LIB__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#ifndef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#define __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#endif
#ifndef __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
#define __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
#endif
#endif
//
// DxeMemoryAllocationLib
//
#ifdef __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#ifndef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#define __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#endif
#endif
//
// DxeSmbusLib
//
#ifdef __EDKII_GLUE_DXE_SMBUS_LIB__
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#ifndef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#define __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#endif
#endif
//
// PeiHobLib
//
#ifdef __EDKII_GLUE_PEI_HOB_LIB__
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#ifndef __EDKII_GLUE_PEI_SERVICES_LIB__
#define __EDKII_GLUE_PEI_SERVICES_LIB__
#endif
#endif
//
// PeiMemoryAllocationLib
//
#ifdef __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#if defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)
#ifndef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
#define __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
#endif
#elif defined(MDE_CPU_IPF)
#ifndef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
#define __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
#endif
#endif
//
// If necessary, __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__ or
// __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__ can be
// replaced with __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__
//
#endif
//
// PeiResourcePublicationLib
//
#ifdef __EDKII_GLUE_PEI_RESOURCE_PUBLICATION_LIB__
#ifndef __EDKII_GLUE_PEI_SERVICES_LIB__
#define __EDKII_GLUE_PEI_SERVICES_LIB__
#endif
#endif
//
// PeiServicesLib
//
#ifdef __EDKII_GLUE_PEI_SERVICES_LIB__
#if defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)
#ifndef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
#define __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
#endif
#elif defined(MDE_CPU_IPF)
#ifndef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
#define __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
#endif
#endif
//
// If necessary, __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__ or
// __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__ can be
// replaced with __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__
//
#endif
//
// PeiSmbusLib
//
#ifdef __EDKII_GLUE_PEI_SMBUS_LIB__
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#if defined(MDE_CPU_IA32) || defined(MDE_CPU_X64)
#ifndef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
#define __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
#endif
#elif defined(MDE_CPU_IPF)
#ifndef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
#define __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
#endif
#endif
//
// If necessary, __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__ or
// __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__ can be
// replaced with __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__
//
#endif
//
// PeiServicesTablePointerLibMm7
//
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#endif
//
// PeiServicesTablePointerLibKr1
//
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#endif
//
// UefiDriverModelLib
//
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
#ifndef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#define __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#endif
#endif
//
// DxeServicesTableLib
//
#ifdef __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__
#ifndef __EDKII_GLUE_UEFI_LIB__
#define __EDKII_GLUE_UEFI_LIB__
#endif
#endif
//
// BasePrintLib
//
#ifdef __EDKII_GLUE_BASE_PRINT_LIB__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#endif
//
// BaseMemoryLib
//
#ifdef __EDKII_GLUE_BASE_MEMORY_LIB__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#endif
//
// BasePostCodeLibPort80
//
#ifdef __EDKII_GLUE_BASE_POST_CODE_LIB_PORT_80__
#ifndef MDE_CPU_EBC
#ifndef __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__
#define __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__
#endif
#else
#ifndef __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
#define __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
#endif
#endif
#endif
//
// BaseIoLibIntrinsic
//
#ifdef __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#endif
//
// DxeIoLibCpuIo
//
#ifdef __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#ifndef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#define __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#endif
#endif
//
// UefiBootServicesTableLib
//
#ifdef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#endif
//
// BaseCacheMaintenanceLib
//
#ifdef __EDKII_GLUE_BASE_CACHE_MAINTENANCE_LIB__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#endif
//
// BaseLib
//
#ifdef __EDKII_GLUE_BASE_LIB__
#endif
//
// UefiRuntimeServicesTableLib
//
#ifdef __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
#endif
//
// BasePeCoffGetEntryPointLib
//
#ifdef __EDKII_GLUE_BASE_PE_COFF_GET_ENTRY_POINT_LIB__
#endif
//
// PeiServicesTablePointerLib
//
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__
#endif
//
// BasePostCodeLibDebug
//
#ifdef __EDKII_GLUE_BASE_POST_CODE_LIB_DEBUG__
//
// A DebugLib instance
// Usually EdkIIGluePeiDxeDebugLibReportStatusCodeLib is listed in module inf
//
#endif
//
// PeiDxePostCodeLibReportStatusCode
//
#ifdef __EDKII_GLUE_PEI_DXE_POST_CODE_LIB_REPORT_STATUS_CODE__
//
// PEI or DXE ReportStatusCodeLib instance
// Usually EdkIIGluePei/DxeReportStatusCodeLib is listed in module inf
//
#endif
//
// Check against multiple instances of same library class being used
//
#if defined(__EDKII_GLUE_PEI_DXE_DEBUG_LIB_REPORT_STATUS_CODE__) && defined(__EDKII_GLUE_BASE_DEBUG_LIB_NULL__)
#error EdkIIGluePeiDxeDebugLibReportStatusCode and EdkIIGlueBaseDebugLibNull: can only be mutual exclusively used.
#endif
#if defined(__EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__) && defined(__EDKII_GLUE_BASE_PCI_LIB_CF8__)
#error EdkIIGluePciLibPciExpress and EdkIIGluePciLibCf8: can only be mutual exclusively used.
#endif
#if defined (__EDKII_GLUE_DXE_HOB_LIB__) && (__EDKII_GLUE_PEI_HOB_LIB__)
#error EdkIIGlueDxeHobLib and EdkIIGluePeiHobLib: can only be mutual exclusively used.
#endif
#if defined(__EDKII_GLUE_BASE_POST_CODE_LIB_PORT_80__) && defined(__EDKII_GLUE_BASE_POST_CODE_LIB_DEBUG__)
#error EdkIIGlueBasePostCodeLibPort80 and EdkIIGlueBasePostCodeLibDebug: can only be mutual exclusively used.
#endif
#if defined(__EDKII_GLUE_BASE_POST_CODE_LIB_PORT_80__) && defined(__EDKII_GLUE_PEI_DXE_POST_CODE_LIB_REPORT_STATUS_CODE__)
#error EdkIIGlueBasePostCodeLibPort80 and EdkIIGluePeiDxePostCodeLibReportStatusCode: can only be mutual exclusively used.
#endif
#if defined(__EDKII_GLUE_BASE_POST_CODE_LIB_DEBUG__) && defined(__EDKII_GLUE_PEI_DXE_POST_CODE_LIB_REPORT_STATUS_CODE__)
#error EdkIIGlueBasePostCodeLibDebug and EdkIIGluePeiDxePostCodeLibReportStatusCode: can only be mutual exclusively used.
#endif
#if defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__) && defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__)
#error EdkIIGluePeiServicesTablePointerLib and EdkIIGluePeiServicesTablePointerLibMm7: can only be mutual exclusively used.
#endif
#if defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__) && defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__)
#error EdkIIGluePeiServicesTablePointerLib and EdkIIGluePeiServicesTablePointerLibKr1: can only be mutual exclusively used.
#endif
#if defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__) && defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__)
#error EdkIIGluePeiServicesTablePointerLibMm7 and EdkIIGluePeiServicesTablePointerLibKr1: can only be mutual exclusively used.
#endif
#if defined(__EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__) && defined(__EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__)
#error EdkIIGlueDxeReportStatusCodeLib and EdkIIGluePeiReportStatusCodeLib: can only be mutual exclusively used.
#endif
#if defined(__EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__) && defined(__EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__)
#error EdkIIGlueDxeMemoryAllocationLib and EdkIIGluePeiMemoryAllocationLib: can only be mutual exclusively used.
#endif
#if defined(__EDKII_GLUE_DXE_SMBUS_LIB__) && defined(__EDKII_GLUE_PEI_SMBUS_LIB__)
#error EdkIIGlueDxeSmbusLib and EdkIIGluePeiSmbusLib: can only be mutual exclusively used.
#endif
#if defined(__EDKII_GLUE_BASE_IO_LIB_INTRINSIC__) && defined(__EDKII_GLUE_DXE_IO_LIB_CPU_IO__)
#error EdkIIGlueBaseIoLibIntrinsic and EdkIIGlueDxeIoLibCpuIo: can only be mutual exclusively used.
#endif
//
// Some instances must be supplied
//
#ifdef __EDKII_GLUE_PEI_DXE_DEBUG_LIB_REPORT_STATUS_CODE__
#if !defined(__EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__) && !defined(__EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__)
#error You use EdkIIGluePeiDxeDebugLibReportStatusCode, so either EdkIIGlueDxeReportStatusCodeLib or EdkIIGluePeiReportStatusCodeLib must be supplied
#endif
#endif
#ifdef __EDKII_GLUE_BASE_POST_CODE_LIB_DEBUG__
#if !defined(__EDKII_GLUE_PEI_DXE_DEBUG_LIB_REPORT_STATUS_CODE__) && !defined(__EDKII_GLUE_BASE_DEBUG_LIB_NULL__)
#error You use EdkIIGlueBasePostCodeLibDebug, so either EdkIIGluePeiDxeDebugLibReportStatusCode or EdkIIGlueBaseDebugLibNull must be supplied
#endif
#endif
//
// EdkIIGlueUefiDriverModelLib used, but no Driver Binding Protocol defined
//
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
#ifndef __EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__
#error "EdkIIGlueUefiDriverModelLib used, but no Driver Binding Protocol defined. Please define __EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__."
#endif
#endif
//
// EdkII Glue Library Constructors:
// NOTE: the constructors must be called according to dependency order
//
// UefiBootServicesTableLib UefiBootServicesTableLibConstructor()
// DxeIoLibCpuIo IoLibConstructor()
// UefiRuntimeServicesTableLib UefiRuntimeServicesTableLibConstructor()
// EdkDxeRuntimeDriverLib RuntimeDriverLibConstruct()
// DxeHobLib HobLibConstructor()
// UefiDriverModelLib UefiDriverModelLibConstructor()
// PeiServicesTablePointerLib PeiServicesTablePointerLibConstructor()
// PeiServicesTablePointerLibMm7 PeiServicesTablePointerLibConstructor()
// PeiServicesTablePointerLibKr1 PeiServicesTablePointerLibConstructor()
// DxeSmbusLib SmbusLibConstructor()
// DxeServicesTableLib DxeServicesTableLibConstructor()
// DxeSalLib DxeSalLibConstructor()
//
#ifdef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
EFI_STATUS
UefiBootServicesTableLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
#endif
#ifdef __EDKII_GLUE_DXE_IO_LIB_CPU_IO__
EFI_STATUS
EFIAPI
IoLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
#endif
#ifdef __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
EFI_STATUS
UefiRuntimeServicesTableLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
#endif
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
EFI_STATUS
RuntimeDriverLibConstruct (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
#endif
#ifdef __EDKII_GLUE_DXE_HOB_LIB__
EFI_STATUS
HobLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
#endif
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
EFI_STATUS
UefiDriverModelLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
#endif
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__
EFI_STATUS
PeiServicesTablePointerLibConstructor (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
);
#endif
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
EFI_STATUS
PeiServicesTablePointerLibConstructor (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
);
#endif
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
EFI_STATUS
PeiServicesTablePointerLibConstructor (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
);
#endif
#ifdef __EDKII_GLUE_DXE_SMBUS_LIB__
EFI_STATUS
EFIAPI
SmbusLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
#endif
#ifdef __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__
EFI_STATUS
DxeServicesTableLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
#endif
#ifdef __EDKII_GLUE_EDK_DXE_SAL_LIB__
EFI_STATUS
EFIAPI
DxeSalLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
#endif
//
// EdkII Glue Library Destructors:
// NOTE: the destructors must be called according to dependency order
//
// UefiDriverModelLibDestructor UefiDriverModelLibDestructor()
// EdkDxeRuntimeDriverLib RuntimeDriverLibDeconstruct()
//
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
EFI_STATUS
UefiDriverModelLibDestructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
#endif
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
EFI_STATUS
RuntimeDriverLibDeconstruct (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
#endif
#endif

View File

@@ -0,0 +1,34 @@
/*++
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:
DxeDepex.h
Abstract:
This file is used by .dxs file. To write common .dxs for R8.x and R9, a
header file named DxeDepex.h musted be present.
--*/
#ifndef __EDKII_GLUELIB_DXEDEPEX_H__
#define __EDKII_GLUELIB_DXEDEPEX_H__
//
// this file is used by .dxs file, just a place holder
//
#endif

View File

@@ -0,0 +1,41 @@
/*++
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:
EdkIIGlueProcessorBind.h
Abstract:
Processor specific definitions
--*/
#ifndef __EDKII_GLUE_PROCESSOR_BIND_H__
#define __EDKII_GLUE_PROCESSOR_BIND_H__
//
// The Microsoft* C compiler can removed references to unreferenced data items
// if the /OPT:REF linker option is used. We defined a macro as this is a
// a non standard extension
//
#if _MSC_EXTENSIONS
#define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
#else
#define GLOBAL_REMOVE_IF_UNREFERENCED
#endif
#ifndef MDE_CPU_EBC
#define MDE_CPU_EBC
#endif
#endif

View File

@@ -0,0 +1,93 @@
/*++
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:
EdkIIGlueBase.h
Abstract:
Root include file for Base modules
--*/
#ifndef __EDKII_GLUE_BASE_H__
#define __EDKII_GLUE_BASE_H__
//
// Using this header means building with EdkIIGlueLib
//
#ifndef BUILD_WITH_EDKII_GLUE_LIB
#define BUILD_WITH_EDKII_GLUE_LIB
#endif
//
// General Type & API definitions
//
#include "EfiBind.h"
#include "EfiTypes.h"
#include "EfiError.h"
#include "Common\EdkIIGlueBaseTypes.h"
#include "EfiImage.h"
#include "EfiPeOptionalHeader.h"
#include "EfiStdArg.h"
#include "EfiDebug.h"
#include "EdkIIGlueProcessorBind.h"
//
// Some Status Code data type definitions are in TianoSpecTypes.h in R8.5
//
#if (TIANO_RELEASE_VERSION <= 0x00080005)
#include "TianoSpecTypes.h"
#endif
#include "EfiStatusCode.h"
//
// R8.x Library headers used by EdkII Glue Libraries
//
#include "LinkedList.h"
#include "EfiCommonLib.h"
#include "Common\EdkIIGlueDefinitionChangesBase.h"
//
// EdkII Glue Library Class headers
//
#include "Library\EdkIIGlueBaseLib.h"
#include "Library\EdkIIGlueBaseMemoryLib.h"
#include "Library\EdkIIGlueCacheMaintenanceLib.h"
#include "Library\EdkIIGlueIoLib.h"
#include "Library\EdkIIGluePciCf8Lib.h"
#include "Library\EdkIIGluePciExpressLib.h"
#include "Library\EdkIIGluePciLib.h"
#include "Library\EdkIIGluePeCoffGetEntryPointLib.h"
#include "Library\EdkIIGluePeCoffLib.h"
#include "Library\EdkIIGluePostCodeLib.h"
#include "Library\EdkIIGluePrintLib.h"
#include "Library\EdkIIGlueTimerLib.h"
#include "Library\EdkIIGlueUefiDecompressLib.h"
#include "Library\EdkIIGlueDebugLib.h"
//
// Publish MDE Library PCDs
//
#include "Pcd\EdkIIGluePcdBaseLib.h"
#include "Pcd\EdkIIGluePcdDebugLib.h"
#include "Pcd\EdkIIGluePcdIoLib.h"
#include "Pcd\EdkIIGluePcdPciExpressLib.h"
#include "Pcd\EdkIIGluePcdPostCodeLib.h"
#include "Pcd\EdkIIGluePcdReportStatusCodeLib.h"
#include "Pcd\EdkIIGluePcdTimerLib.h"
#endif

View File

@@ -0,0 +1,144 @@
/*++
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:
EdkIIGlueConfig.h
Abstract:
Configurable items provided by GlueLib
--*/
#ifndef __EDKII_GLUE_CONFIG_H__
#define __EDKII_GLUE_CONFIG_H__
#include "EdkIIGlueProcessorBind.h"
//
// Glue Library version
//
// 0x3000 - the 3rd release
// 0x5000 - support IPF. Jan, 2007
// 0x6000 - support EBC. Feb, 2007
//
// For reference only, don't change the value
//
#define EDKII_GLUE_LIBRARY_VERSION 0x6000
//
// Check to make sure EFI_SPECIFICATION_VERSION and TIANO_RELEASE_VERSION are defined.
//
#if !defined(EFI_SPECIFICATION_VERSION)
#error EFI_SPECIFICATION_VERSION not defined
#elif !defined(TIANO_RELEASE_VERSION)
#error TIANO_RELEASE_VERSION not defined
#elif (TIANO_RELEASE_VERSION == 0)
#error TIANO_RELEASE_VERSION can not be zero
#endif
//
// Glue Library debug flag
//
// Controls debug ON/OFF of GlueLib itself, no
// effect on any other libraries or modules
//
// Values:
// FALSE : debug off
// any TRUE value : debug on
//
#define EDKII_GLUE_LIBRARY_DEBUG_ENABLE 0
//
// max unicode string length
//
#define EDKII_GLUE_MaximumUnicodeStringLength 1000000
//
// max ascii string length
//
#define EDKII_GLUE_MaximumAsciiStringLength 1000000
//
// spin lock timeout
//
#define EDKII_GLUE_SpinLockTimeout 10000000
//
// max linked list length
//
#define EDKII_GLUE_MaximumLinkedListLength 1000000
//
// debug print level
// only when EFI_DEBUG is defined, the mask is effective
//
#define EDKII_GLUE_DebugPrintErrorLevel EFI_D_ERROR
//
// debug propery mask
// only when EFI_DEBUG is defined, the mask is effective
//
#define EDKII_GLUE_DebugPropertyMask ( DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED \
| DEBUG_PROPERTY_DEBUG_PRINT_ENABLED \
| DEBUG_PROPERTY_DEBUG_CODE_ENABLED \
| DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED \
| DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED \
| DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED \
)
//
// clear memory value
//
#define EDKII_GLUE_DebugClearMemoryValue 0xAF
//
// pci express base address
//
#define EDKII_GLUE_PciExpressBaseAddress 0xE0000000
//
//
// This value is FSB Clock frequency. Its unit is Hz and its
// default value is 200000000, that means FSB frequency is 200Mhz.
//
#define EDKII_GLUE_FSBClock 200000000
//
// post code property mask
//
#define EDKII_GLUE_PostCodePropertyMask ( POST_CODE_PROPERTY_POST_CODE_ENABLED \
| POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED \
)
//
// status code property mask
//
#define EDKII_GLUE_ReportStatusCodePropertyMask ( REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED \
| REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED \
| REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED \
)
//
// for IPF only
// The base address of IPF IO Block
//
#ifdef MDE_CPU_IPF
#define EDKII_GLUE_IoBlockBaseAddressForIpf 0x0ffffc000000
#endif
#endif

View File

@@ -0,0 +1,251 @@
/*++
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:
EdkIIGlueDxe.h
Abstract:
Root include file for DXE modules
--*/
#ifndef __EDKII_GLUE_DXE_H__
#define __EDKII_GLUE_DXE_H__
//
// General Type & API definitions
//
#include "Tiano.h"
#include "BootMode.h"
#include "EfiBootScript.h"
#include "EfiCapsule.h"
#include "EfiDependency.h"
#include "EfiImageFormat.h"
#include "EfiImage.h"
#include "EfiPeOptionalHeader.h"
#include "EfiFirmwareVolumeHeader.h"
#include "EfiFirmwareFileSystem.h"
#include "PeiHob.h"
#include "EfiInternalFormRepresentation.h"
#include "EfiStatusCode.h"
//
// IPF only
//
#ifdef MDE_CPU_IPF
#include "SalApi.h"
#endif
//
// GUID definitions
//
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
#include EFI_GUID_DEFINITION (EventGroup)
#include EFI_GUID_DEFINITION (EventLegacybios)
#include EFI_GUID_DEFINITION (FrameworkDevicePath)
#include EFI_PROTOCOL_DEFINITION (EdidActive)
#include EFI_PROTOCOL_DEFINITION (EdidDiscovered)
#include EFI_PROTOCOL_DEFINITION (EdidOverride)
#include EFI_PROTOCOL_DEFINITION (GraphicsOutput)
#include EFI_PROTOCOL_DEFINITION (Hash)
#include EFI_PROTOCOL_DEFINITION (ScsiPassThruExt)
#include EFI_PROTOCOL_DEFINITION (TapeIo)
#endif
#include EFI_GUID_DEFINITION (Acpi)
#include EFI_GUID_DEFINITION (AcpiTableStorage)
#include EFI_GUID_DEFINITION (Apriori)
#include EFI_GUID_DEFINITION (Capsule)
#include EFI_GUID_DEFINITION (DataHubRecords)
#include EFI_GUID_DEFINITION (DebugImageInfoTable)
#include EFI_GUID_DEFINITION (DxeServices)
#include EFI_GUID_DEFINITION (FirmwareFileSystem)
#include EFI_GUID_DEFINITION (GlobalVariable)
#include EFI_GUID_DEFINITION (Gpt)
#include EFI_GUID_DEFINITION (Hob)
#include EFI_GUID_DEFINITION (MemoryAllocationHob)
#include EFI_GUID_DEFINITION (Mps)
#include EFI_GUID_DEFINITION (PcAnsi)
#include EFI_GUID_DEFINITION (SalSystemTable)
#include EFI_GUID_DEFINITION (Smbios)
//#include EFI_GUID_DEFINITION (SmmCommunicate)
#include EFI_GUID_DEFINITION (SmramMemoryReserve)
//
// *** NOTE ***: StatusCodeDataTypeId definition differences need to be
// resolved when porting a module to real EDK II
//
#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
//
// Protocol definitions
//
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
#include EFI_PROTOCOL_DEFINITION (DevicePathFromText)
#include EFI_PROTOCOL_DEFINITION (DevicePathToText)
#include EFI_PROTOCOL_DEFINITION (DevicePathUtilities)
#include EFI_PROTOCOL_DEFINITION (Dhcp4)
#include EFI_PROTOCOL_DEFINITION (Ip4)
#include EFI_PROTOCOL_DEFINITION (Ip4Config)
#include EFI_PROTOCOL_DEFINITION (IScsiInitiatorName)
#include EFI_PROTOCOL_DEFINITION (UsbHostController)
#include EFI_PROTOCOL_DEFINITION (ManagedNetwork)
#include EFI_PROTOCOL_DEFINITION (Mtftp4)
#include EFI_PROTOCOL_DEFINITION (ServiceBinding)
#include EFI_PROTOCOL_DEFINITION (Tcp4)
#include EFI_PROTOCOL_DEFINITION (Udp4)
#include EFI_PROTOCOL_DEFINITION (Arp)
// check here: currently not implementated
//#include EFI_PROTOCOL_DEFINITION (AuthenticationInfo)
#endif
#include EFI_PROTOCOL_DEFINITION (AcpiSupport)
#include EFI_PROTOCOL_DEFINITION (Bis)
#include EFI_PROTOCOL_DEFINITION (BlockIo)
#include EFI_PROTOCOL_DEFINITION (BootScriptSave)
#include EFI_PROTOCOL_DEFINITION (BusSpecificDriverOverride)
#include EFI_PROTOCOL_DEFINITION (ComponentName)
#include EFI_PROTOCOL_DEFINITION (ComponentName2)
#include EFI_PROTOCOL_DEFINITION (CpuIo)
#include EFI_PROTOCOL_DEFINITION (DataHub)
#include EFI_PROTOCOL_DEFINITION (DebugPort)
#include EFI_PROTOCOL_DEFINITION (DebugSupport)
#include EFI_PROTOCOL_DEFINITION (Decompress)
#include EFI_PROTOCOL_DEFINITION (DeviceIo)
#include EFI_PROTOCOL_DEFINITION (DevicePath)
#include EFI_PROTOCOL_DEFINITION (DiskIo)
#include EFI_PROTOCOL_DEFINITION (DriverBinding)
#include EFI_PROTOCOL_DEFINITION (DriverConfiguration)
#include EFI_PROTOCOL_DEFINITION (DriverDiagnostics)
#include EFI_PROTOCOL_DEFINITION (Ebc)
#include EFI_PROTOCOL_DEFINITION (EfiNetworkInterfaceIdentifier)
#include EFI_PROTOCOL_DEFINITION (FileInfo)
#include EFI_PROTOCOL_DEFINITION (FileSystemInfo)
#include EFI_PROTOCOL_DEFINITION (FileSystemVolumeLabelInfo)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeBlock)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeDispatch)
#include EFI_PROTOCOL_DEFINITION (FormBrowser)
#include EFI_PROTOCOL_DEFINITION (FormCallback)
#include EFI_PROTOCOL_DEFINITION (GuidedSectionExtraction)
#include EFI_PROTOCOL_DEFINITION (Hii)
#include EFI_PROTOCOL_DEFINITION (IdeControllerInit)
#include EFI_PROTOCOL_DEFINITION (IncompatiblePciDeviceSupport)
#include EFI_PROTOCOL_DEFINITION (Legacy8259)
#include EFI_PROTOCOL_DEFINITION (LegacyBios)
#include EFI_PROTOCOL_DEFINITION (LegacyBiosPlatform)
#include EFI_PROTOCOL_DEFINITION (LegacyInterrupt)
#include EFI_PROTOCOL_DEFINITION (LegacyRegion)
#include EFI_PROTOCOL_DEFINITION (LoadedImage)
#include EFI_PROTOCOL_DEFINITION (LoadFile)
#include EFI_PROTOCOL_DEFINITION (PciHostBridgeResourceAllocation)
#include EFI_PROTOCOL_DEFINITION (PciHotplugInit)
#include EFI_PROTOCOL_DEFINITION (PciIo)
#include EFI_PROTOCOL_DEFINITION (PciPlatform)
#include EFI_PROTOCOL_DEFINITION (PciRootBridgeIo)
#include EFI_PROTOCOL_DEFINITION (PlatformDriverOverride)
#include EFI_PROTOCOL_DEFINITION (PxeBaseCode)
#include EFI_PROTOCOL_DEFINITION (PxeBaseCodeCallBack)
#include EFI_PROTOCOL_DEFINITION (ScsiIo)
#include EFI_PROTOCOL_DEFINITION (ScsiPassThru)
#include EFI_PROTOCOL_DEFINITION (SectionExtraction)
#include EFI_PROTOCOL_DEFINITION (SerialIo)
#include EFI_PROTOCOL_DEFINITION (SimpleFilesystem)
#include EFI_PROTOCOL_DEFINITION (SimpleNetwork)
#include EFI_PROTOCOL_DEFINITION (SimplePointer)
#include EFI_PROTOCOL_DEFINITION (SimpleTextIn)
#include EFI_PROTOCOL_DEFINITION (SimpleTextOut)
#include EFI_PROTOCOL_DEFINITION (Smbus)
#include EFI_PROTOCOL_DEFINITION (SmmAccess)
#include EFI_PROTOCOL_DEFINITION (SmmBase)
#include EFI_PROTOCOL_DEFINITION (SmmControl)
#include EFI_PROTOCOL_DEFINITION (SmmGpiDispatch)
#include EFI_PROTOCOL_DEFINITION (SmmIchnDispatch)
#include EFI_PROTOCOL_DEFINITION (SmmPeriodicTimerDispatch)
#include EFI_PROTOCOL_DEFINITION (SmmPowerButtonDispatch)
#include EFI_PROTOCOL_DEFINITION (SmmStandbyButtonDispatch)
#include EFI_PROTOCOL_DEFINITION (SmmStatusCode)
#include EFI_PROTOCOL_DEFINITION (SmmSwDispatch)
#include EFI_PROTOCOL_DEFINITION (SmmSxDispatch)
#include EFI_PROTOCOL_DEFINITION (SmmUsbDispatch)
#include EFI_PROTOCOL_DEFINITION (UgaDraw)
#include EFI_PROTOCOL_DEFINITION (UnicodeCollation)
#include EFI_PROTOCOL_DEFINITION (UsbHostController)
#include EFI_PROTOCOL_DEFINITION (UsbIo)
#include EFI_PROTOCOL_DEFINITION (SecurityPolicy)
#include EFI_PROTOCOL_DEFINITION (LoadPe32Image)
//
// Arch Protocol definitions
//
#include EFI_ARCH_PROTOCOL_DEFINITION (Bds)
#include EFI_ARCH_PROTOCOL_DEFINITION (Cpu)
#include EFI_ARCH_PROTOCOL_DEFINITION (Metronome)
#include EFI_ARCH_PROTOCOL_DEFINITION (Monotoniccounter)
#include EFI_ARCH_PROTOCOL_DEFINITION (RealTimeClock)
#include EFI_ARCH_PROTOCOL_DEFINITION (Reset)
#include EFI_ARCH_PROTOCOL_DEFINITION (Runtime)
#include EFI_ARCH_PROTOCOL_DEFINITION (Security)
#include EFI_ARCH_PROTOCOL_DEFINITION (StatusCode)
#include EFI_ARCH_PROTOCOL_DEFINITION (Timer)
#include EFI_ARCH_PROTOCOL_DEFINITION (Variable)
#include EFI_ARCH_PROTOCOL_DEFINITION (Variablewrite)
#include EFI_ARCH_PROTOCOL_DEFINITION (WatchdogTimer)
//
// IPF only
//
#ifdef MDE_CPU_IPF
#include EFI_PROTOCOL_DEFINITION (ExtendedSalGuid)
#include EFI_PROTOCOL_DEFINITION (ExtendedSalBootService)
#endif
//
// R8.x Library headers used by EdkII Glue Libraries
//
#include "EfiDriverLib.h"
#include "EfiCapsule.h"
#include "Common\EdkIIGlueDefinitionChangesDxe.h"
//
// EdkII Glue Library Class headers
//
#include "EdkIIGlueBase.h"
#include "Library\EdkIIGlueDebugLib.h"
#include "Library\EdkIIGluePostCodeLib.h"
#include "Library\EdkIIGlueReportStatusCodeLib.h"
#include "Library\EdkIIGlueHiiLib.h"
#include "Library\EdkIIGlueHobLib.h"
#include "Library\EdkIIGlueMemoryAllocationLib.h"
#include "Library\EdkIIGlueSmbusLib.h"
#include "Library\EdkIIGlueDxeRuntimeDriverLib.h"
#include "Library\EdkIIGlueDxeServicesTableLib.h"
#include "Library\EdkIIGlueDxeSmmDriverEntryPoint.h"
#include "Library\EdkIIGlueDevicePathLib.h"
#include "Library\EdkIIGlueUefiLib.h"
#include "Library\EdkIIGlueUefiDecompressLib.h"
#include "Library\EdkIIGlueUefiDriverModelLib.h"
#include "Library\EdkIIGlueUefiBootServicesTableLib.h"
#include "Library\EdkIIGlueUefiDriverEntryPoint.h"
#include "Library\EdkIIGlueUefiRuntimeServicesTableLib.h"
#endif

View File

@@ -0,0 +1,113 @@
/*++
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:
EdkIIGluePeim.h
Abstract:
Root include file for PEI Modules
**/
#ifndef __EDKII_GLUE_PEIM_H__
#define __EDKII_GLUE_PEIM_H__
//
// Check to make sure TIANO_RELEASE_VERSION is defined
//
#if !defined(TIANO_RELEASE_VERSION)
#error TIANO_RELEASE_VERSION not defined
#elif (TIANO_RELEASE_VERSION == 0)
#error TIANO_RELEASE_VERSION can not be zero
#endif
//
// General Type & API definitions
//
#include "Pei.h"
#include "EfiBootScript.h"
#include "EfiImage.h"
#include "EfiPeOptionalHeader.h"
#include "EfiCapsule.h"
#include EFI_PROTOCOL_DEFINITION (DevicePath)
#include "TianoDevicePath.h"
//
// GUID definitions
//
#include EFI_GUID_DEFINITION (Apriori)
#include EFI_GUID_DEFINITION (Capsule)
#include EFI_GUID_DEFINITION (DxeServices)
#include EFI_GUID_DEFINITION (Hob)
#include EFI_GUID_DEFINITION (MemoryAllocationHob)
#include EFI_GUID_DEFINITION (FirmwareFileSystem)
#include EFI_GUID_DEFINITION (SmramMemoryReserve)
#include EFI_GUID_DEFINITION (DataHubRecords)
//
// *** NOTE ***: StatusCodeDataTypeId definition differences need to be
// resolved when porting a module to real EDK II
//
#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
//
// Ppi definitions
//
#include EFI_PPI_DEFINITION (BlockIo)
#include EFI_PPI_DEFINITION (BootInRecoveryMode)
#include EFI_PPI_DEFINITION (BootScriptExecuter)
#include EFI_PPI_DEFINITION (CpuIo)
#include EFI_PPI_DEFINITION (DeviceRecoveryModule)
#include EFI_PPI_DEFINITION (DxeIpl)
#include EFI_PPI_DEFINITION (EndOfPeiSignal)
#include EFI_PPI_DEFINITION (FindFv)
#include EFI_PPI_DEFINITION (LoadFile)
#include EFI_PPI_DEFINITION (BootMode)
#include EFI_PPI_DEFINITION (MemoryDiscovered)
#include EFI_PPI_DEFINITION (PciCfg)
#include EFI_PPI_DEFINITION (Variable)
#include EFI_PPI_DEFINITION (RecoveryModule)
#include EFI_PPI_DEFINITION (Reset)
#include EFI_PPI_DEFINITION (S3Resume)
#include EFI_PPI_DEFINITION (SecPlatforminformation)
#include EFI_PPI_DEFINITION (SectionExtraction)
#include EFI_PPI_DEFINITION (Security)
#include EFI_PPI_DEFINITION (Smbus)
#include EFI_PPI_DEFINITION (Stall)
#include EFI_PPI_DEFINITION (StatusCode)
#include "Common\EdkIIGlueDefinitionChangesPeim.h"
//
// EdkII Glue Library Class headers
//
#include "EdkIIGlueBase.h"
#include "Library\EdkIIGlueDebugLib.h"
#include "Library\EdkIIGluePostCodeLib.h"
#include "Library\EdkIIGlueReportStatusCodeLib.h"
#include "Library\EdkIIGlueHobLib.h"
#include "Library\EdkIIGlueMemoryAllocationLib.h"
#include "Library\EdkIIGlueSmbusLib.h"
#include "Library\EdkIIGluePeiServicesLib.h"
#include "Library\EdkIIGluePeiServicesTablePointerLib.h"
#include "Library\EdkIIGlueResourcePublicationLib.h"
#include "Library\EdkIIGluePeimEntryPoint.h"
#endif

View File

@@ -0,0 +1,174 @@
/*++
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:
EdkIIGlueUefi.h
Abstract:
Root include file for UEFI modules.
**/
#ifndef __EDKII_GLUE_UEFI_H__
#define __EDKII_GLUE_UEFI_H__
//
// Check to make sure EFI_SPECIFICATION_VERSION and TIANO_RELEASE_VERSION are defined.
// also check for legal combinations
//
#if !defined(EFI_SPECIFICATION_VERSION)
#error EFI_SPECIFICATION_VERSION not defined
#elif !defined(TIANO_RELEASE_VERSION)
#error TIANO_RELEASE_VERSION not defined
#elif TIANO_RELEASE_VERSION == 0x00000000
//
// UEFI mode with no Tiano extensions is legal
//
#elif (TIANO_RELEASE_VERSION <= 0x00080005) && (EFI_SPECIFICATION_VERSION >= 0x00020000)
#error Illegal combination of EFI_SPECIFICATION_VERSION and EDK_RELEASE_VERSION versions
#endif
//
// General Type & API definitions
//
#include "EfiSpec.h"
#include "EfiPxe.h"
//
// Protocols from EFI 1.10 that got thier names fixed in UEFI 2.0
//
#include EFI_PROTOCOL_DEFINITION(LoadedImage)
#include EFI_PROTOCOL_DEFINITION(SimpleTextIn)
#include EFI_PROTOCOL_DEFINITION(SimpleTextOut)
#include EFI_PROTOCOL_DEFINITION(SerialIo)
#include EFI_PROTOCOL_DEFINITION(LoadFile)
#include EFI_PROTOCOL_DEFINITION(SimpleFileSystem)
#include EFI_PROTOCOL_DEFINITION(DiskIo)
#include EFI_PROTOCOL_DEFINITION(BlockIo)
#include EFI_PROTOCOL_DEFINITION(UnicodeCollation)
#include EFI_PROTOCOL_DEFINITION(SimpleNetwork)
#include EFI_PROTOCOL_DEFINITION(EfiNetworkInterfaceIdentifier)
#include EFI_PROTOCOL_DEFINITION(PxeBaseCode)
#include EFI_PROTOCOL_DEFINITION(PxeBaseCodeCallBack)
//
// EFI 1.10 Protocols
//
#include EFI_PROTOCOL_DEFINITION(Bis)
#include EFI_PROTOCOL_DEFINITION(BusSpecificDriverOverride)
#include EFI_PROTOCOL_DEFINITION(ComponentName)
#include EFI_PROTOCOL_DEFINITION(ComponentName2)
#include EFI_PROTOCOL_DEFINITION(DebugPort)
#include EFI_PROTOCOL_DEFINITION(DebugSupport)
#include EFI_PROTOCOL_DEFINITION(Decompress)
#include EFI_PROTOCOL_DEFINITION(DriverBinding)
#include EFI_PROTOCOL_DEFINITION(DriverConfiguration)
#include EFI_PROTOCOL_DEFINITION(DriverDiagnostics)
#include EFI_PROTOCOL_DEFINITION(Ebc)
#include EFI_PROTOCOL_DEFINITION(EfiNetworkInterfaceIdentifier)
#include EFI_PROTOCOL_DEFINITION(FileInfo)
#include EFI_PROTOCOL_DEFINITION(FileSystemInfo)
#include EFI_PROTOCOL_DEFINITION(FileSystemVolumeLabelInfo)
#include EFI_PROTOCOL_DEFINITION(PciIo)
#include EFI_PROTOCOL_DEFINITION(PciRootBridgeIo)
#include EFI_PROTOCOL_DEFINITION(PlatformDriverOverride)
#include EFI_PROTOCOL_DEFINITION(SimplePointer)
#include EFI_PROTOCOL_DEFINITION(ScsiPassThru)
#include EFI_PROTOCOL_DEFINITION(UsbIo)
#include EFI_PROTOCOL_DEFINITION(UsbHostController)
#include EFI_PROTOCOL_DEFINITION(UgaDraw)
//
// EFI 1.10 GUIDs
//
#include EFI_GUID_DEFINITION(Acpi)
#include EFI_GUID_DEFINITION(DebugImageInfoTable)
#include EFI_GUID_DEFINITION(GlobalVariable)
#include EFI_GUID_DEFINITION(Gpt)
#include EFI_GUID_DEFINITION(PcAnsi)
#include EFI_GUID_DEFINITION(SmBios)
#include EFI_GUID_DEFINITION(SalSystemTable)
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
//
// UEFI 2.0 Protocols and GUIDs
//
// check here: currently not implementated
//#include EFI_PROTOCOL_DEFINITION(AuthenticationInfo)
#include EFI_PROTOCOL_DEFINITION(DevicePathUtilities)
#include EFI_PROTOCOL_DEFINITION(DevicePathToText)
#include EFI_PROTOCOL_DEFINITION(DevicePathFromText)
#include EFI_PROTOCOL_DEFINITION(GraphicsOutput)
#include EFI_PROTOCOL_DEFINITION(EdidDiscovered)
#include EFI_PROTOCOL_DEFINITION(EdidActive)
#include EFI_PROTOCOL_DEFINITION(EdidOverride)
#include EFI_PROTOCOL_DEFINITION(ScsiIo)
#include EFI_PROTOCOL_DEFINITION(ScsiPassThruExt)
#include EFI_PROTOCOL_DEFINITION(IScsiInitiatorName)
#include EFI_PROTOCOL_DEFINITION(UsbHostController)
#include EFI_PROTOCOL_DEFINITION(TapeIo)
#include EFI_PROTOCOL_DEFINITION(ManagedNetwork)
#include EFI_PROTOCOL_DEFINITION(Arp)
#include EFI_PROTOCOL_DEFINITION(Dhcp4)
#include EFI_PROTOCOL_DEFINITION(IP4)
#include EFI_PROTOCOL_DEFINITION(IP4Config)
#include EFI_PROTOCOL_DEFINITION(Tcp4)
#include EFI_PROTOCOL_DEFINITION(Udp4)
#include EFI_PROTOCOL_DEFINITION(Mtftp4)
#include EFI_PROTOCOL_DEFINITION(ServiceBinding)
#include EFI_PROTOCOL_DEFINITION(Hash)
#include EFI_GUID_DEFINITION(EventGroup)
//#include <Guid/WinCertificateUefi.h>
#endif
#if (TIANO_RELEASE_VERSION > 0x00080005)
//
// Need due to R8.5 Tiano contamination of UEFI enumes.
// There is a UEFI library that does things the new way and the old way
// This is why these definitions are need in Uefi.h
//
#include EFI_GUID_DEFINITION (EventLegacyBios)
#include EFI_GUID_DEFINITION (FrameworkDevicePath)
#endif
//
// R8.x Library headers used by EdkII Glue Libraries
//
#include "TianoSpecTypes.h"
#include "TianoSpecApi.h"
#include "TianoSpecDevicePath.h"
#include "EfiDriverLib.h"
#include "Common\EdkIIGlueDefinitionChangesBase.h"
//
// EdkII Glue Library Class headers
//
#include "EdkIIGlueBase.h"
#include "Library\EdkIIGlueUefiDecompressLib.h"
#include "Library\EdkIIGlueDevicePathLib.h"
#include "Library\EdkIIGlueUefiBootServicesTableLib.h"
#include "Library\EdkIIGlueUefiDriverEntryPoint.h"
#include "Library\EdkIIGlueUefiDriverModelLib.h"
#include "Library\EdkIIGlueUefiLib.h"
#include "Library\EdkIIGlueUefiRuntimeServicesTableLib.h"
#endif

View File

@@ -0,0 +1,41 @@
/*++
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:
EdkIIGlueProcessorBind.h
Abstract:
Processor specific definitions
--*/
#ifndef __EDKII_GLUE_PROCESSOR_BIND_H__
#define __EDKII_GLUE_PROCESSOR_BIND_H__
//
// The Microsoft* C compiler can removed references to unreferenced data items
// if the /OPT:REF linker option is used. We defined a macro as this is a
// a non standard extension
//
#if _MSC_EXTENSIONS
#define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
#else
#define GLOBAL_REMOVE_IF_UNREFERENCED
#endif
#ifndef MDE_CPU_IA32
#define MDE_CPU_IA32
#endif
#endif

View File

@@ -0,0 +1,41 @@
/*++
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:
EdkIIGlueProcessorBind.h
Abstract:
Processor specific definitions
--*/
#ifndef __EDKII_GLUE_PROCESSOR_BIND_H__
#define __EDKII_GLUE_PROCESSOR_BIND_H__
//
// The Microsoft* C compiler can removed references to unreferenced data items
// if the /OPT:REF linker option is used. We defined a macro as this is a
// a non standard extension
//
#if _MSC_EXTENSIONS
#define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
#else
#define GLOBAL_REMOVE_IF_UNREFERENCED
#endif
#ifndef MDE_CPU_IPF
#define MDE_CPU_IPF
#endif
#endif

View File

@@ -0,0 +1,391 @@
/*++
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:
EdkIIGlueBaseMemoryLib.h
Abstract:
Memory-only library functions with no library constructor/destructor
--*/
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB_H__
#define __EDKII_GLUE_BASE_MEMORY_LIB_H__
#define CopyMem(_DESTINATIONBUFFER, _SOURCEBUFFER, _LENGTH) GlueCopyMem(_DESTINATIONBUFFER, _SOURCEBUFFER, _LENGTH)
#define ZeroMem(_BUFFER, _LENGTH) GlueZeroMem(_BUFFER, _LENGTH)
#define SetMem(_BUFFER, _LENGTH, _VALUE) GlueSetMem(_BUFFER, _LENGTH, _VALUE)
#define CompareMem(_DESTINATIONBUFFER, _SOURCEBUFFER, _LENGTH) GlueCompareMem(_DESTINATIONBUFFER, _SOURCEBUFFER, _LENGTH)
#define CompareGuid(_GUID1, _GUID2) GlueCompareGuid(_GUID1, _GUID2)
/**
Copies a source buffer to a destination buffer, and returns the destination buffer.
This function copies Length bytes from SourceBuffer to DestinationBuffer, and returns
DestinationBuffer. The implementation must be reentrant, and it must handle the case
where SourceBuffer overlaps DestinationBuffer.
If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
@param DestinationBuffer Pointer to the destination buffer of the memory copy.
@param SourceBuffer Pointer to the source buffer of the memory copy.
@param Length Number of bytes to copy from SourceBuffer to DestinationBuffer.
@return DestinationBuffer.
**/
VOID *
EFIAPI
GlueCopyMem (
OUT VOID *DestinationBuffer,
IN CONST VOID *SourceBuffer,
IN UINTN Length
);
/**
Fills a target buffer with a byte value, and returns the target buffer.
This function fills Length bytes of Buffer with Value, and returns Buffer.
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Memory to set.
@param Length Number of bytes to set.
@param Value Value of the set operation.
@return Buffer.
**/
VOID *
EFIAPI
GlueSetMem (
OUT VOID *Buffer,
IN UINTN Length,
IN UINT8 Value
);
/**
Fills a target buffer with a 16-bit value, and returns the target buffer.
This function fills Length bytes of Buffer with the 16-bit value specified by
Value, and returns Buffer. Value is repeated every 16-bits in for Length
bytes of Buffer.
If Length > 0 and Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
@param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill.
@param Value Value with which to fill Length bytes of Buffer.
@return Buffer.
**/
VOID *
EFIAPI
SetMem16 (
OUT VOID *Buffer,
IN UINTN Length,
IN UINT16 Value
);
/**
Fills a target buffer with a 32-bit value, and returns the target buffer.
This function fills Length bytes of Buffer with the 32-bit value specified by
Value, and returns Buffer. Value is repeated every 32-bits in for Length
bytes of Buffer.
If Length > 0 and Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
If Length is not aligned on a 32-bit boundary, then ASSERT().
@param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill.
@param Value Value with which to fill Length bytes of Buffer.
@return Buffer.
**/
VOID *
EFIAPI
SetMem32 (
OUT VOID *Buffer,
IN UINTN Length,
IN UINT32 Value
);
/**
Fills a target buffer with a 64-bit value, and returns the target buffer.
This function fills Length bytes of Buffer with the 64-bit value specified by
Value, and returns Buffer. Value is repeated every 64-bits in for Length
bytes of Buffer.
If Length > 0 and Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
If Length is not aligned on a 64-bit boundary, then ASSERT().
@param Buffer Pointer to the target buffer to fill.
@param Length Number of bytes in Buffer to fill.
@param Value Value with which to fill Length bytes of Buffer.
@return Buffer.
**/
VOID *
EFIAPI
SetMem64 (
OUT VOID *Buffer,
IN UINTN Length,
IN UINT64 Value
);
/**
Fills a target buffer with zeros, and returns the target buffer.
This function fills Length bytes of Buffer with zeros, and returns Buffer.
If Length > 0 and Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Pointer to the target buffer to fill with zeros.
@param Length Number of bytes in Buffer to fill with zeros.
@return Buffer.
**/
VOID *
EFIAPI
GlueZeroMem (
OUT VOID *Buffer,
IN UINTN Length
);
/**
Compares the contents of two buffers.
This function compares Length bytes of SourceBuffer to Length bytes of DestinationBuffer.
If all Length bytes of the two buffers are identical, then 0 is returned. Otherwise, the
value returned is the first mismatched byte in SourceBuffer subtracted from the first
mismatched byte in DestinationBuffer.
If Length > 0 and DestinationBuffer is NULL and Length > 0, then ASSERT().
If Length > 0 and SourceBuffer is NULL and Length > 0, then ASSERT().
If Length is greater than (MAX_ADDRESS - DestinationBuffer + 1), then ASSERT().
If Length is greater than (MAX_ADDRESS - SourceBuffer + 1), then ASSERT().
@param DestinationBuffer Pointer to the destination buffer to compare.
@param SourceBuffer Pointer to the source buffer to compare.
@param Length Number of bytes to compare.
@return 0 All Length bytes of the two buffers are identical.
@retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first
mismatched byte in DestinationBuffer.
**/
INTN
EFIAPI
GlueCompareMem (
IN CONST VOID *DestinationBuffer,
IN CONST VOID *SourceBuffer,
IN UINTN Length
);
/**
Scans a target buffer for an 8-bit value, and returns a pointer to the matching 8-bit value
in the target buffer.
This function searches target the buffer specified by Buffer and Length from the lowest
address to the highest address for an 8-bit value that matches Value. If a match is found,
then a pointer to the matching byte in the target buffer is returned. If no match is found,
then NULL is returned. If Length is 0, then NULL is returned.
If Length > 0 and Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan.
@param Value Value to search for in the target buffer.
@return A pointer to the matching byte in the target buffer or NULL otherwise.
**/
VOID *
EFIAPI
ScanMem8 (
IN CONST VOID *Buffer,
IN UINTN Length,
IN UINT8 Value
);
/**
Scans a target buffer for a 16-bit value, and returns a pointer to the matching 16-bit value
in the target buffer.
This function searches target the buffer specified by Buffer and Length from the lowest
address to the highest address for a 16-bit value that matches Value. If a match is found,
then a pointer to the matching byte in the target buffer is returned. If no match is found,
then NULL is returned. If Length is 0, then NULL is returned.
If Length > 0 and Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan.
@param Value Value to search for in the target buffer.
@return A pointer to the matching byte in the target buffer or NULL otherwise.
**/
VOID *
EFIAPI
ScanMem16 (
IN CONST VOID *Buffer,
IN UINTN Length,
IN UINT16 Value
);
/**
Scans a target buffer for a 32-bit value, and returns a pointer to the matching 32-bit value
in the target buffer.
This function searches target the buffer specified by Buffer and Length from the lowest
address to the highest address for a 32-bit value that matches Value. If a match is found,
then a pointer to the matching byte in the target buffer is returned. If no match is found,
then NULL is returned. If Length is 0, then NULL is returned.
If Length > 0 and Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
If Length is not aligned on a 32-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan.
@param Value Value to search for in the target buffer.
@return A pointer to the matching byte in the target buffer or NULL otherwise.
**/
VOID *
EFIAPI
ScanMem32 (
IN CONST VOID *Buffer,
IN UINTN Length,
IN UINT32 Value
);
/**
Scans a target buffer for a 64-bit value, and returns a pointer to the matching 64-bit value
in the target buffer.
This function searches target the buffer specified by Buffer and Length from the lowest
address to the highest address for a 64-bit value that matches Value. If a match is found,
then a pointer to the matching byte in the target buffer is returned. If no match is found,
then NULL is returned. If Length is 0, then NULL is returned.
If Length > 0 and Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
If Length is not aligned on a 64-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan.
@param Value Value to search for in the target buffer.
@return A pointer to the matching byte in the target buffer or NULL otherwise.
**/
VOID *
EFIAPI
ScanMem64 (
IN CONST VOID *Buffer,
IN UINTN Length,
IN UINT64 Value
);
/**
Copies a source GUID to a destination GUID.
This function copies the contents of the 128-bit GUID specified by SourceGuid to
DestinationGuid, and returns DestinationGuid.
If DestinationGuid is NULL, then ASSERT().
If SourceGuid is NULL, then ASSERT().
@param DestinationGuid Pointer to the destination GUID.
@param SourceGuid Pointer to the source GUID.
@return DestinationGuid.
**/
GUID *
EFIAPI
CopyGuid (
OUT GUID *DestinationGuid,
IN CONST GUID *SourceGuid
);
/**
Compares two GUIDs.
This function compares Guid1 to Guid2. If the GUIDs are identical then TRUE is returned.
If there are any bit differences in the two GUIDs, then FALSE is returned.
If Guid1 is NULL, then ASSERT().
If Guid2 is NULL, then ASSERT().
@param Guid1 A pointer to a 128 bit GUID.
@param Guid2 A pointer to a 128 bit GUID.
@retval TRUE Guid1 and Guid2 are identical.
@retval FALSE Guid1 and Guid2 are not identical.
**/
BOOLEAN
EFIAPI
GlueCompareGuid (
IN CONST GUID *Guid1,
IN CONST GUID *Guid2
);
/**
Scans a target buffer for a GUID, and returns a pointer to the matching GUID
in the target buffer.
This function searches target the buffer specified by Buffer and Length from
the lowest address to the highest address at 128-bit increments for the 128-bit
GUID value that matches Guid. If a match is found, then a pointer to the matching
GUID in the target buffer is returned. If no match is found, then NULL is returned.
If Length is 0, then NULL is returned.
If Length > 0 and Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
If Length is not aligned on a 128-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Pointer to the target buffer to scan.
@param Length Number of bytes in Buffer to scan.
@param Guid Value to search for in the target buffer.
@return A pointer to the matching Guid in the target buffer or NULL otherwise.
**/
VOID *
EFIAPI
ScanGuid (
IN CONST VOID *Buffer,
IN UINTN Length,
IN CONST GUID *Guid
);
#endif

View File

@@ -0,0 +1,224 @@
/*++
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:
EdkIIGlueCacheMaintenanceLib.h
Abstract:
Cache Maintenance Functions
--*/
#ifndef __EDKII_GLUE_CACHE_MAINTENANCE_LIB_H__
#define __EDKII_GLUE_CACHE_MAINTENANCE_LIB_H__
#define InvalidateInstructionCache() GlueInvalidateInstructionCache()
/**
Invalidates the entire instruction cache in cache coherency domain of the
calling CPU.
Invalidates the entire instruction cache in cache coherency domain of the
calling CPU.
**/
VOID
EFIAPI
GlueInvalidateInstructionCache (
VOID
);
/**
Invalidates a range of instruction cache lines in the cache coherency domain
of the calling CPU.
Invalidates the instruction cache lines specified by Address and Length. If
Address is not aligned on a cache line boundary, then entire instruction
cache line containing Address is invalidated. If Address + Length is not
aligned on a cache line boundary, then the entire instruction cache line
containing Address + Length -1 is invalidated. This function may choose to
invalidate the entire instruction cache if that is more efficient than
invalidating the specified range. If Length is 0, the no instruction cache
lines are invalidated. Address is returned.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the instruction cache lines to
invalidate. If the CPU is in a physical addressing mode, then
Address is a physical address. If the CPU is in a virtual
addressing mode, then Address is a virtual address.
@param Length The number of bytes to invalidate from the instruction cache.
@return Address
**/
VOID *
EFIAPI
InvalidateInstructionCacheRange (
IN VOID *Address,
IN UINTN Length
);
/**
Writes Back and Invalidates the entire data cache in cache coherency domain
of the calling CPU.
Writes Back and Invalidates the entire data cache in cache coherency domain
of the calling CPU. This function guarantees that all dirty cache lines are
written back to system memory, and also invalidates all the data cache lines
in the cache coherency domain of the calling CPU.
**/
VOID
EFIAPI
WriteBackInvalidateDataCache (
VOID
);
/**
Writes Back and Invalidates a range of data cache lines in the cache
coherency domain of the calling CPU.
Writes Back and Invalidate the data cache lines specified by Address and
Length. If Address is not aligned on a cache line boundary, then entire data
cache line containing Address is written back and invalidated. If Address +
Length is not aligned on a cache line boundary, then the entire data cache
line containing Address + Length -1 is written back and invalidated. This
function may choose to write back and invalidate the entire data cache if
that is more efficient than writing back and invalidating the specified
range. If Length is 0, the no data cache lines are written back and
invalidated. Address is returned.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the data cache lines to write back and
invalidate. If the CPU is in a physical addressing mode, then
Address is a physical address. If the CPU is in a virtual
addressing mode, then Address is a virtual address.
@param Length The number of bytes to write back and invalidate from the
data cache.
@return Address
**/
VOID *
EFIAPI
WriteBackInvalidateDataCacheRange (
IN VOID *Address,
IN UINTN Length
);
/**
Writes Back the entire data cache in cache coherency domain of the calling
CPU.
Writes Back the entire data cache in cache coherency domain of the calling
CPU. This function guarantees that all dirty cache lines are written back to
system memory. This function may also invalidate all the data cache lines in
the cache coherency domain of the calling CPU.
**/
VOID
EFIAPI
WriteBackDataCache (
VOID
);
/**
Writes Back a range of data cache lines in the cache coherency domain of the
calling CPU.
Writes Back the data cache lines specified by Address and Length. If Address
is not aligned on a cache line boundary, then entire data cache line
containing Address is written back. If Address + Length is not aligned on a
cache line boundary, then the entire data cache line containing Address +
Length -1 is written back. This function may choose to write back the entire
data cache if that is more efficient than writing back the specified range.
If Length is 0, the no data cache lines are written back. This function may
also invalidate all the data cache lines in the specified range of the cache
coherency domain of the calling CPU. Address is returned.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the data cache lines to write back. If
the CPU is in a physical addressing mode, then Address is a
physical address. If the CPU is in a virtual addressing
mode, then Address is a virtual address.
@param Length The number of bytes to write back from the data cache.
@return Address
**/
VOID *
EFIAPI
WriteBackDataCacheRange (
IN VOID *Address,
IN UINTN Length
);
/**
Invalidates the entire data cache in cache coherency domain of the calling
CPU.
Invalidates the entire data cache in cache coherency domain of the calling
CPU. This function must be used with care because dirty cache lines are not
written back to system memory. It is typically used for cache diagnostics. If
the CPU does not support invalidation of the entire data cache, then a write
back and invalidate operation should be performed on the entire data cache.
**/
VOID
EFIAPI
InvalidateDataCache (
VOID
);
/**
Invalidates a range of data cache lines in the cache coherency domain of the
calling CPU.
Invalidates the data cache lines specified by Address and Length. If Address
is not aligned on a cache line boundary, then entire data cache line
containing Address is invalidated. If Address + Length is not aligned on a
cache line boundary, then the entire data cache line containing Address +
Length -1 is invalidated. This function must never invalidate any cache lines
outside the specified range. If Length is 0, the no data cache lines are
invalidated. Address is returned. This function must be used with care
because dirty cache lines are not written back to system memory. It is
typically used for cache diagnostics. If the CPU does not support
invalidation of a data cache range, then a write back and invalidate
operation should be performed on the data cache range.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the data cache lines to invalidate. If
the CPU is in a physical addressing mode, then Address is a
physical address. If the CPU is in a virtual addressing mode,
then Address is a virtual address.
@param Length The number of bytes to invalidate from the data cache.
@return Address
**/
VOID *
EFIAPI
InvalidateDataCacheRange (
IN VOID *Address,
IN UINTN Length
);
#endif

View File

@@ -0,0 +1,571 @@
/*++
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:
EdkIIGlueDebugLib.h
Abstract:
Public include file for the Debug Library
--*/
#ifndef __EDKII_GLUE_DEBUG_LIB_H__
#define __EDKII_GLUE_DEBUG_LIB_H__
//
// To use EdkII code, these R8.x macros are undefined
//
#undef ASSERT
#undef DEBUG
#undef ASSERT_EFI_ERROR
#undef ASSERT_PROTOCOL_ALREADY_INSTALLED
#undef DEBUG_CODE
#undef CR
#undef EFI_D_INIT
#undef EFI_D_WARN
#undef EFI_D_LOAD
#undef EFI_D_FS
#undef EFI_D_POOL
#undef EFI_D_PAGE
#undef EFI_D_INFO
#undef EFI_D_VARIABLE
#undef EFI_D_BM
#undef EFI_D_BLKIO
#undef EFI_D_NET
#undef EFI_D_UNDI
#undef EFI_D_LOADFILE
#undef EFI_D_EVENT
#undef EFI_D_ERROR
//
// Declare bits for PcdDebugPropertyMask
//
#define DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED 0x01
#define DEBUG_PROPERTY_DEBUG_PRINT_ENABLED 0x02
#define DEBUG_PROPERTY_DEBUG_CODE_ENABLED 0x04
#define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08
#define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10
#define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20
//
// Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint()
//
#define DEBUG_INIT 0x00000001 // Initialization
#define DEBUG_WARN 0x00000002 // Warnings
#define DEBUG_LOAD 0x00000004 // Load events
#define DEBUG_FS 0x00000008 // EFI File system
#define DEBUG_POOL 0x00000010 // Alloc & Free's
#define DEBUG_PAGE 0x00000020 // Alloc & Free's
#define DEBUG_INFO 0x00000040 // Verbose
#define DEBUG_VARIABLE 0x00000100 // Variable
#define DEBUG_BM 0x00000400 // Boot Manager
#define DEBUG_BLKIO 0x00001000 // BlkIo Driver
#define DEBUG_NET 0x00004000 // SNI Driver
#define DEBUG_UNDI 0x00010000 // UNDI Driver
#define DEBUG_LOADFILE 0x00020000 // UNDI Driver
#define DEBUG_EVENT 0x00080000 // Event messages
#define DEBUG_ERROR 0x80000000 // Error
//
// Aliases of debug message mask bits
//
#define EFI_D_INIT DEBUG_INIT
#define EFI_D_WARN DEBUG_WARN
#define EFI_D_LOAD DEBUG_LOAD
#define EFI_D_FS DEBUG_FS
#define EFI_D_POOL DEBUG_POOL
#define EFI_D_PAGE DEBUG_PAGE
#define EFI_D_INFO DEBUG_INFO
#define EFI_D_VARIABLE DEBUG_VARIABLE
#define EFI_D_BM DEBUG_BM
#define EFI_D_BLKIO DEBUG_BLKIO
#define EFI_D_NET DEBUG_NET
#define EFI_D_UNDI DEBUG_UNDI
#define EFI_D_LOADFILE DEBUG_LOADFILE
#define EFI_D_EVENT DEBUG_EVENT
#define EFI_D_ERROR DEBUG_ERROR
/**
Prints a debug message to the debug output device if the specified error level is enabled.
If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print
the message specified by Format and the associated variable argument list to
the debug output device.
If Format is NULL, then ASSERT().
@param ErrorLevel The error level of the debug message.
@param Format Format string for the debug message to print.
**/
VOID
EFIAPI
DebugPrint (
IN UINTN ErrorLevel,
IN CONST CHAR8 *Format,
...
);
/**
Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop.
Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"
to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of
PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if
DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then
CpuDeadLoop() is called. If neither of these bits are set, then this function
returns immediately after the message is printed to the debug output device.
DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while
processing another DebugAssert(), then DebugAssert() must return immediately.
If FileName is NULL, then a <FileName> string of ?NULL) Filename?is printed.
If Description is NULL, then a <Description> string of ?NULL) Description?is printed.
@param FileName Pointer to the name of the source file that generated the assert condition.
@param LineNumber The line number in the source file that generated the assert condition
@param Description Pointer to the description of the assert condition.
**/
VOID
EFIAPI
DebugAssert (
IN CONST CHAR8 *FileName,
IN UINTN LineNumber,
IN CONST CHAR8 *Description
);
/**
Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
This function fills Length bytes of Buffer with the value specified by
PcdDebugClearMemoryValue, and returns Buffer.
If Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS ?Buffer + 1), then ASSERT().
@param Buffer Pointer to the target buffer to fill with PcdDebugClearMemoryValue.
@param Length Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue.
@return Buffer
**/
VOID *
EFIAPI
DebugClearMemory (
OUT VOID *Buffer,
IN UINTN Length
);
/**
Returns TRUE if ASSERT() macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugAssertEnabled (
VOID
);
/**
Returns TRUE if DEBUG()macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugPrintEnabled (
VOID
);
/**
Returns TRUE if DEBUG_CODE()macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugCodeEnabled (
VOID
);
/**
Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugClearMemoryEnabled (
VOID
);
/**
Internal worker macro that calls DebugAssert().
This macro calls DebugAssert() passing in the filename, line number, and
expression that evailated to FALSE.
@param Expression Boolean expression that evailated to FALSE
**/
#define _ASSERT(Expression) DebugAssert (__FILE__, __LINE__, #Expression)
/**
Internal worker macro that calls DebugPrint().
This macro calls DebugPrint() passing in the debug error level, a format
string, and a variable argument list.
@param Expression Expression containing an error level, a format string,
and a variable argument list based on the format string.
**/
#define _DEBUG(Expression) DebugPrint Expression
/**
Macro that calls DebugAssert() if a expression evaluates to FALSE.
If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
then this macro evaluates the Boolean expression specified by Expression. If
Expression evaluates to FALSE, then DebugAssert() is called passing in the
source filename, source line number, and Expression.
@param Expression Boolean expression
**/
#ifdef EDKII_GLUE_LIBRARY_IMPLEMENTATION
// Glue Library internal
#if EDKII_GLUE_LIBRARY_DEBUG_ENABLE
#ifdef EFI_DEBUG
#define ASSERT(Expression) \
do { \
if (DebugAssertEnabled ()) { \
if (!(Expression)) { \
_ASSERT (Expression); \
} \
} \
} while (FALSE)
#endif
#else
#define ASSERT(Expression) do{} while(0)
#endif
#else
// External usage
#ifdef EFI_DEBUG
#define ASSERT(Expression) \
do { \
if (DebugAssertEnabled ()) { \
if (!(Expression)) { \
_ASSERT (Expression); \
} \
} \
} while (FALSE)
#else
#define ASSERT(Expression) do{} while(0)
#endif
#endif
/**
Macro that calls DebugPrint().
If the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set,
then this macro passes Expression to DebugPrint().
@param Expression Expression containing an error level, a format string,
and a variable argument list based on the format string.
**/
#ifdef EDKII_GLUE_LIBRARY_IMPLEMENTATION
// Glue Library internal
#if EDKII_GLUE_LIBRARY_DEBUG_ENABLE
#ifdef EFI_DEBUG
#define DEBUG(Expression) \
do { \
if (DebugPrintEnabled ()) { \
_DEBUG (Expression); \
} \
} while (FALSE)
#endif
#else
#define DEBUG(Expression) do{} while(0)
#endif
#else
// External usage
#ifdef EFI_DEBUG
#define DEBUG(Expression) \
do { \
if (DebugPrintEnabled ()) { \
_DEBUG (Expression); \
} \
} while (FALSE)
#else
#define DEBUG(Expression) do{} while(0)
#endif
#endif
/**
Macro that calls DebugAssert() if an EFI_STATUS evaluates to an error code.
If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
then this macro evaluates the EFI_STATUS value specified by StatusParameter.
If StatusParameter is an error code, then DebugAssert() is called passing in
the source filename, source line number, and StatusParameter.
@param StatusParameter EFI_STATUS value to evaluate.
**/
#ifdef EDKII_GLUE_LIBRARY_IMPLEMENTATION
// Glue Library internal
#if EDKII_GLUE_LIBRARY_DEBUG_ENABLE
#ifdef EFI_DEBUG
#define ASSERT_EFI_ERROR(StatusParameter) \
do { \
if (DebugAssertEnabled ()) { \
if (EFI_ERROR (StatusParameter)) { \
DEBUG ((EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", StatusParameter)); \
_ASSERT (!EFI_ERROR (StatusParameter)); \
} \
} \
} while (FALSE)
#endif
#else
#define ASSERT_EFI_ERROR(Expression) do{} while(0)
#endif
#else
// External usage
#ifdef EFI_DEBUG
#define ASSERT_EFI_ERROR(StatusParameter) \
do { \
if (DebugAssertEnabled ()) { \
if (EFI_ERROR (StatusParameter)) { \
DEBUG ((EFI_D_ERROR, "\nASSERT_EFI_ERROR (Status = %r)\n", StatusParameter)); \
_ASSERT (!EFI_ERROR (StatusParameter)); \
} \
} \
} while (FALSE)
#else
#define ASSERT_EFI_ERROR(Expression) do{} while(0)
#endif
#endif
/**
Macro that calls DebugAssert() if a protocol is already installed in the
handle database.
If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear,
then return.
If Handle is NULL, then a check is made to see if the protocol specified by Guid
is present on any handle in the handle database. If Handle is not NULL, then
a check is made to see if the protocol specified by Guid is present on the
handle specified by Handle. If the check finds the protocol, then DebugAssert()
is called passing in the source filename, source line number, and Guid.
If Guid is NULL, then ASSERT().
@param Handle The handle to check for the protocol. This is an optional
parameter that may be NULL. If it is NULL, then the entire
handle database is searched.
@param Guid Pointer to a protocol GUID.
**/
#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) \
do { \
if (DebugAssertEnabled ()) { \
VOID *Instance; \
ASSERT (Guid != NULL); \
if (Handle == NULL) { \
if (!EFI_ERROR (gBS->LocateProtocol ((EFI_GUID *)Guid, NULL, &Instance))) { \
_ASSERT (Guid already installed in database); \
} \
} else { \
if (!EFI_ERROR (gBS->HandleProtocol (Handle, (EFI_GUID *)Guid, &Instance))) { \
_ASSERT (Guid already installed on Handle); \
} \
} \
} \
} while (FALSE)
/**
Macro that marks the beginning of debug source code.
If the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set,
then this macro marks the beginning of source code that is included in a module.
Otherwise, the source lines between DEBUG_CODE_BEGIN() and DEBUG_CODE_END()
are not included in a module.
**/
#define DEBUG_CODE_BEGIN() do { if (DebugCodeEnabled ()) { UINT8 __DebugCodeLocal
/**
Macro that marks the end of debug source code.
If the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set,
then this macro marks the end of source code that is included in a module.
Otherwise, the source lines between DEBUG_CODE_BEGIN() and DEBUG_CODE_END()
are not included in a module.
**/
#define DEBUG_CODE_END() __DebugCodeLocal = 0; __DebugCodeLocal++; } } while (FALSE)
/**
Macro that declares a section of debug source code.
If the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set,
then the source code specified by Expression is included in a module.
Otherwise, the source specified by Expression is not included in a module.
**/
#define DEBUG_CODE(Expression) \
DEBUG_CODE_BEGIN (); \
Expression \
DEBUG_CODE_END ()
/**
Macro that calls DebugClearMemory() to clear a buffer to a default value.
If the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set,
then this macro calls DebugClearMemory() passing in Address and Length.
@param Address Pointer to a buffer.
@param Length The number of bytes in the buffer to set.
**/
#define DEBUG_CLEAR_MEMORY(Address, Length) \
do { \
if (DebugClearMemoryEnabled ()) { \
DebugClearMemory (Address, Length); \
} \
} while (FALSE)
/**
Macro that calls DebugAssert() if the containing record does not have a
matching signature. If the signatures matches, then a pointer to the data
structure that contains a specified field of that data structure is returned.
This is a light weight method hide information by placing a public data
structure inside a larger private data structure and using a pointer to the
public data structure to retrieve a pointer to the private data structure.
If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear,
then this macro computes the offset, in bytes, of field specified by Field
from the beginning of the data structure specified by TYPE. This offset is
subtracted from Record, and is used to return a pointer to a data structure
of the type specified by TYPE.
If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
then this macro computes the offset, in bytes, of field specified by Field from
the beginning of the data structure specified by TYPE. This offset is
subtracted from Record, and is used to compute a pointer to a data structure of
the type specified by TYPE. The Signature field of the data structure specified
by TYPE is compared to TestSignature. If the signatures match, then a pointer
to the pointer to a data structure of the type specified by TYPE is returned.
If the signatures do not match, then DebugAssert() is called with a description
of "CR has a bad signature" and Record is returned.
If the data type specified by TYPE does not contain the field specified by Field,
then the module will not compile.
If TYPE does not contain a field called Signature, then the module will not
compile.
@param Record Pointer to the field specified by Field within a data
structure of type TYPE.
@param TYPE The name of the data structure type to return This
data structure must contain the field specified by Field.
@param Field The name of the field in the data structure specified
by TYPE to which Record points.
@param TestSignature The 32-bit signature value to match.
**/
#define CR(Record, TYPE, Field, TestSignature) \
(DebugAssertEnabled () && (_CR (Record, TYPE, Field)->Signature != TestSignature)) ? \
(TYPE *) (_ASSERT (CR has Bad Signature), Record) : \
_CR (Record, TYPE, Field)
#endif

View File

@@ -0,0 +1,269 @@
/*++
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:
EdkIIGlueDevicePathLib.h
Abstract:
Public header file for Device Path Lib
--*/
#ifndef __EDKII_GLUE_DEVICE_PATH_LIB_H__
#define __EDKII_GLUE_DEVICE_PATH_LIB_H__
#define GetDevicePathSize(_DEVICEPATH) GlueGetDevicePathSize(_DEVICEPATH)
#define DuplicateDevicePath(_DEVICEPATH) GlueDuplicateDevicePath(_DEVICEPATH)
#define AppendDevicePath(_FIRSTPATH, _SECONDPATH) GlueAppendDevicePath(_FIRSTPATH, _SECONDPATH)
#define AppendDevicePathNode(_DEVICEPATH, _DEVICEPATHNODE) GlueAppendDevicePathNode(_DEVICEPATH, _DEVICEPATHNODE)
#define AppendDevicePathInstance(_SOURCE, _INSTANCE) GlueAppendDevicePathInstance(_SOURCE,_INSTANCE)
#define GetNextDevicePathInstance(_DEVICEPATH, _SIZE) GlueGetNextDevicePathInstance(_DEVICEPATH, _SIZE)
#define IsDevicePathMultiInstance(_DEVICEPATH) GlueIsDevicePathMultiInstance(_DEVICEPATH)
#define DevicePathFromHandle(_HANDLE) GlueDevicePathFromHandle(_HANDLE)
#define FileDevicePath(_DEVICE, _FILENAME) GlueFileDevicePath(_DEVICE, _FILENAME)
/**
Returns the size of a device path in bytes.
This function returns the size, in bytes, of the device path data structure specified by
DevicePath including the end of device path node. If DevicePath is NULL, then 0 is returned.
@param DevicePath A pointer to a device path data structure.
@return The size of a device path in bytes.
**/
UINTN
EFIAPI
GlueGetDevicePathSize (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
/**
Creates a new device path by appending a second device path to a first device path.
This function allocates space for a new copy of the device path specified by DevicePath. If
DevicePath is NULL, then NULL is returned. If the memory is successfully allocated, then the
contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer
is returned. Otherwise, NULL is returned.
@param DevicePath A pointer to a device path data structure.
@return A pointer to the duplicated device path.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
GlueDuplicateDevicePath (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
/**
Creates a new device path by appending a second device path to a first device path.
This function creates a new device path by appending a copy of SecondDevicePath to a copy of
FirstDevicePath in a newly allocated buffer. Only the end-of-device-path device node from
SecondDevicePath is retained. The newly created device path is returned.
If FirstDevicePath is NULL, then it is ignored, and a duplicate of SecondDevicePath is returned.
If SecondDevicePath is NULL, then it is ignored, and a duplicate of FirstDevicePath is returned.
If both FirstDevicePath and SecondDevicePath are NULL, then NULL is returned.
If there is not enough memory for the newly allocated buffer, then NULL is returned.
The memory for the new device path is allocated from EFI boot services memory. It is the
responsibility of the caller to free the memory allocated.
@param FirstDevicePath A pointer to a device path data structure.
@param SecondDevicePath A pointer to a device path data structure.
@return A pointer to the new device path.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
GlueAppendDevicePath (
IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL
IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL
);
/**
Creates a new path by appending the device node to the device path.
This function creates a new device path by appending a copy of the device node specified by
DevicePathNode to a copy of the device path specified by DevicePath in an allocated buffer.
The end-of-device-path device node is moved after the end of the appended device node.
If DevicePath is NULL, then NULL is returned.
If DevicePathNode is NULL, then NULL is returned.
If there is not enough memory to allocate space for the new device path, then NULL is returned.
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
free the memory allocated.
@param DevicePath A pointer to a device path data structure.
@param DevicePathNode A pointer to a single device path node.
@return A pointer to the new device path.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
GlueAppendDevicePathNode (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL
);
/**
Creates a new device path by appending the specified device path instance to the specified device
path.
This function creates a new device path by appending a copy of the device path instance specified
by DevicePathInstance to a copy of the device path secified by DevicePath in a allocated buffer.
The end-of-device-path device node is moved after the end of the appended device path instance
and a new end-of-device-path-instance node is inserted between.
If DevicePath is NULL, then a copy if DevicePathInstance is returned.
If DevicePathInstance is NULL, then NULL is returned.
If there is not enough memory to allocate space for the new device path, then NULL is returned.
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
free the memory allocated.
@param DevicePath A pointer to a device path data structure.
@param DevicePathInstance A pointer to a device path instance.
@return A pointer to the new device path.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
GlueAppendDevicePathInstance (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL
);
/**
Creates a copy of the current device path instance and returns a pointer to the next device path
instance.
This function creates a copy of the current device path instance. It also updates DevicePath to
point to the next device path instance in the device path (or NULL if no more) and updates Size
to hold the size of the device path instance copy.
If DevicePath is NULL, then NULL is returned.
If there is not enough memory to allocate space for the new device path, then NULL is returned.
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
free the memory allocated.
If Size is NULL, then ASSERT().
@param DevicePath On input, this holds the pointer to the current device path
instance. On output, this holds the pointer to the next device
path instance or NULL if there are no more device path
instances in the device path pointer to a device path data
structure.
@param Size On output, this holds the size of the device path instance, in
bytes or zero, if DevicePath is NULL.
@return A pointer to the current device path instance.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
GlueGetNextDevicePathInstance (
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
OUT UINTN *Size
);
/**
Creates a copy of the current device path instance and returns a pointer to the next device path
instance.
This function creates a new device node in a newly allocated buffer of size NodeLength and
initializes the device path node header with NodeType and NodeSubType. The new device path node
is returned.
If NodeLength is smaller than a device path header, then NULL is returned.
If there is not enough memory to allocate space for the new device path, then NULL is returned.
The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
free the memory allocated.
@param NodeType The device node type for the new device node.
@param NodeSubType The device node sub-type for the new device node.
@param NodeLength The length of the new device node.
@return The new device path.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
CreateDeviceNode (
IN UINT8 NodeType,
IN UINT8 NodeSubType,
IN UINT16 NodeLength
);
/**
Determines if a device path is single or multi-instance.
This function returns TRUE if the device path specified by DevicePath is multi-instance.
Otherwise, FALSE is returned. If DevicePath is NULL, then FALSE is returned.
@param DevicePath A pointer to a device path data structure.
@retval TRUE DevicePath is multi-instance.
@retval FALSE DevicePath is not multi-instance or DevicePath is NULL.
**/
BOOLEAN
EFIAPI
GlueIsDevicePathMultiInstance (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
/**
Retrieves the device path protocol from a handle.
This function returns the device path protocol from the handle specified by Handle. If Handle is
NULL or Handle does not contain a device path protocol, then NULL is returned.
@param Handle The handle from which to retrieve the device path protocol.
@return The device path protocol from the handle specified by Handle.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
GlueDevicePathFromHandle (
IN EFI_HANDLE Handle
);
/**
Allocates a device path for a file and appends it to an existing device path.
If Device is a valid device handle that contains a device path protocol, then a device path for
the file specified by FileName is allocated and appended to the device path associated with the
handle Device. The allocated device path is returned. If Device is NULL or Device is a handle
that does not support the device path protocol, then a device path containing a single device
path node for the file specified by FileName is allocated and returned.
If FileName is NULL, then ASSERT().
@param Device A pointer to a device handle. This parameter is optional and
may be NULL.
@param FileName A pointer to a Null-terminated Unicode string.
@return The allocated device path.
**/
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
GlueFileDevicePath (
IN EFI_HANDLE Device, OPTIONAL
IN CONST CHAR16 *FileName
);
#endif

View File

@@ -0,0 +1,454 @@
/*++
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:
EdkIIGlueDxeRuntimeDriverLib.h
Abstract:
Library that abstracts runtime services
--*/
#ifndef __EDKII_GLUE_DXE_RUNTIME_DRIVER_LIB_H__
#define __EDKII_GLUE_DXE_RUNTIME_DRIVER_LIB_H__
#ifdef MDE_CPU_IPF
#include "EdkIIGlueEdkDxeSalLib.h"
#endif
#if (EFI_SPECIFICATION_VERSION < 0x00020000)
typedef struct {
EFI_GUID CapsuleGuid;
UINT32 HeaderSize;
UINT32 Flags;
UINT32 CapsuleImageSize;
} UEFI_CAPSULE_HEADER;
#else
typedef EFI_CAPSULE_HEADER UEFI_CAPSULE_HEADER;
#endif
extern const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[];
extern const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[];
/**
Check to see if the execute context is in Runtime phase or not.
@param None.
@retval TRUE The driver is in SMM.
@retval FALSE The driver is not in SMM.
**/
BOOLEAN
EFIAPI
EfiAtRuntime (
VOID
);
/**
Check to see if the SetVirtualAddressMsp() is invoked or not.
@retval TRUE SetVirtualAddressMsp() has been called.
@retval FALSE SetVirtualAddressMsp() has not been called.
**/
BOOLEAN
EFIAPI
EfiGoneVirtual (
VOID
);
/**
Return current time and date information, and time-keeping
capabilities of hardware platform.
@param Time A pointer to storage to receive a snapshot of the current time.
@param Capabilities An optional pointer to a buffer to receive the real time clock device's
capabilities.
@retval EFI_SUCCESS Success to execute the function.
@retval !EFI_SUCCESS Failed to e3xecute the function.
**/
EFI_STATUS
EFIAPI
EfiGetTime (
OUT EFI_TIME *Time,
OUT EFI_TIME_CAPABILITIES *Capabilities
);
/**
Set current time and date information.
@param Time A pointer to cache of time setting.
@retval EFI_SUCCESS Success to execute the function.
@retval !EFI_SUCCESS Failed to execute the function.
**/
EFI_STATUS
EFIAPI
EfiSetTime (
IN EFI_TIME *Time
);
/**
Return current wakeup alarm clock setting.
@param Enabled Indicate if the alarm clock is enabled or disabled.
@param Pending Indicate if the alarm signal is pending and requires acknowledgement.
@param Time Current alarm clock setting.
@retval EFI_SUCCESS Success to execute the function.
@retval !EFI_SUCCESS Failed to e3xecute the function.
**/
EFI_STATUS
EFIAPI
EfiGetWakeupTime (
OUT BOOLEAN *Enabled,
OUT BOOLEAN *Pending,
OUT EFI_TIME *Time
);
/**
Set current wakeup alarm clock.
@param Enable Enable or disable current alarm clock..
@param Time Point to alarm clock setting.
@retval EFI_SUCCESS Success to execute the function.
@retval !EFI_SUCCESS Failed to e3xecute the function.
**/
EFI_STATUS
EFIAPI
EfiSetWakeupTime (
IN BOOLEAN Enable,
IN EFI_TIME *Time
);
/**
Return value of variable.
@param VariableName the name of the vendor's variable, it's a
Null-Terminated Unicode String
@param VendorGuid Unify identifier for vendor.
@param Attributes Point to memory location to return the attributes of variable. If the point
is NULL, the parameter would be ignored.
@param DataSize As input, point to the maxinum size of return Data-Buffer.
As output, point to the actual size of the returned Data-Buffer.
@param Data Point to return Data-Buffer.
@retval EFI_SUCCESS Success to execute the function.
@retval !EFI_SUCCESS Failed to e3xecute the function.
**/
EFI_STATUS
EFIAPI
EfiGetVariable (
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
OUT UINT32 *Attributes,
IN OUT UINTN *DataSize,
OUT VOID *Data
)
;
/**
Enumerates variable's name.
@param VariableNameSize As input, point to maxinum size of variable name.
As output, point to actual size of varaible name.
@param VariableName As input, supplies the last VariableName that was returned by
GetNextVariableName().
As output, returns the name of variable. The name
string is Null-Terminated Unicode string.
@param VendorGuid As input, supplies the last VendorGuid that was returned by
GetNextVriableName().
As output, returns the VendorGuid of the current variable.
@retval EFI_SUCCESS Success to execute the function.
@retval !EFI_SUCCESS Failed to e3xecute the function.
**/
EFI_STATUS
EFIAPI
EfiGetNextVariableName (
IN OUT UINTN *VariableNameSize,
IN OUT CHAR16 *VariableName,
IN OUT EFI_GUID *VendorGuid
);
/**
Sets value of variable.
@param VariableName the name of the vendor's variable, it's a
Null-Terminated Unicode String
@param VendorGuid Unify identifier for vendor.
@param Attributes Point to memory location to return the attributes of variable. If the point
is NULL, the parameter would be ignored.
@param DataSize The size in bytes of Data-Buffer.
@param Data Point to the content of the variable.
@retval EFI_SUCCESS Success to execute the function.
@retval !EFI_SUCCESS Failed to e3xecute the function.
**/
EFI_STATUS
EFIAPI
EfiSetVariable (
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
);
/**
Returns the next high 32 bits of platform's monotonic counter.
@param HighCount Pointer to returned value.
@retval EFI_SUCCESS Success to execute the function.
@retval !EFI_SUCCESS Failed to e3xecute the function.
**/
EFI_STATUS
EFIAPI
EfiGetNextHighMonotonicCount (
OUT UINT32 *HighCount
);
/**
Resets the entire platform.
@param ResetType The type of reset to perform.
@param ResetStatus The status code for reset.
@param DataSize The size in bytes of reset data.
@param ResetData Pointer to data buffer that includes
Null-Terminated Unicode string.
@retval EFI_SUCCESS Success to execute the function.
@retval !EFI_SUCCESS Failed to e3xecute the function.
**/
VOID
EfiResetSystem (
IN EFI_RESET_TYPE ResetType,
IN EFI_STATUS ResetStatus,
IN UINTN DataSize,
IN CHAR16 *ResetData
);
/**
Determines the new virtual address that is to be used on subsequent memory accesses.
@param DebugDisposition Supplies type information for the pointer being converted.
@param Address The pointer to a pointer that is to be fixed to be the
value needed for the new virtual address mapping being
applied.
@retval EFI_SUCCESS Success to execute the function.
@retval !EFI_SUCCESS Failed to e3xecute the function.
**/
EFI_STATUS
EFIAPI
EfiConvertPointer (
IN UINTN DebugDisposition,
IN OUT VOID **Address
);
/**
Change the runtime addressing mode of EFI firmware from physical to virtual.
@param MemoryMapSize The size in bytes of VirtualMap.
@param DescriptorSize The size in bytes of an entry in the VirtualMap.
@param DescriptorVersion The version of the structure entries in VirtualMap.
@param VirtualMap An array of memory descriptors which contain new virtual
address mapping information for all runtime ranges. Type
EFI_MEMORY_DESCRIPTOR is defined in the
GetMemoryMap() function description.
@retval EFI_SUCCESS The virtual address map has been applied.
@retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
virtual address mapped mode.
@retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
invalid.
@retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
map that requires a mapping.
@retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
in the memory map.
**/
EFI_STATUS
EFIAPI
EfiSetVirtualAddressMap (
IN UINTN MemoryMapSize,
IN UINTN DescriptorSize,
IN UINT32 DescriptorVersion,
IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap
);
/**
Conver the standard Lib double linked list to a virtual mapping.
@param DebugDisposition Supplies type information for the pointer being converted.
@param ListHead Head of linked list to convert.
@retval EFI_SUCCESS Success to execute the function.
@retval !EFI_SUCCESS Failed to e3xecute the function.
**/
EFI_STATUS
EFIAPI
EfiConvertList (
IN UINTN DebugDisposition,
IN OUT LIST_ENTRY *ListHead
);
/**
Passes capsules to the firmware with both virtual and physical mapping.
Depending on the intended consumption, the firmware may
process the capsule immediately. If the payload should persist across a
system reset, the reset value returned from EFI_QueryCapsuleCapabilities must
be passed into ResetSystem() and will cause the capsule to be processed by
the firmware as part of the reset process.
@param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules
being passed into update capsule. Each capsules is assumed to
stored in contiguous virtual memory. The capsules in the
CapsuleHeaderArray must be the same capsules as the
ScatterGatherList. The CapsuleHeaderArray must
have the capsules in the same order as the ScatterGatherList.
@param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in
CaspuleHeaderArray.
@param ScatterGatherList Physical pointer to a set of
EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the
location in physical memory of a set of capsules. See Related
Definitions for an explanation of how more than one capsule is
passed via this interface. The capsules in the
ScatterGatherList must be in the same order as the
CapsuleHeaderArray. This parameter is only referenced if
the capsules are defined to persist across system reset.
@retval EFI_SUCCESS Valid capsule was passed. I Valid capsule was passed. If
CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the
capsule has been successfully processed by the firmware.
@retval EFI_INVALID_PARAMETER CapsuleSize is NULL or ResetTye is NULL.
@retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.
**/
EFI_STATUS
EFIAPI
EfiUpdateCapsule (
IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
IN UINTN CapsuleCount,
IN EFI_PHYSICAL_ADDRESS ScatterGatherList
);
/**
The QueryCapsuleCapabilities() function allows a caller to test to see if a capsule or
capsules can be updated via UpdateCapsule(). The Flags values in the capsule header and
size of the entire capsule is checked.
If the caller needs to query for generic capsule capability a fake EFI_CAPSULE_HEADER can be
constructed where CapsuleImageSize is equal to HeaderSize that is equal to sizeof
(EFI_CAPSULE_HEADER). To determine reset requirements,
CAPSULE_FLAGS_PERSIST_ACROSS_RESET should be set in the Flags field of the
EFI_CAPSULE_HEADER.
The firmware must support any capsule that has the
CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set in EFI_CAPSULE_HEADER. The
firmware sets the policy for what capsules are supported that do not have the
CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set.
@param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules
being passed into update capsule. The capsules are assumed to
stored in contiguous virtual memory.
@param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in
CaspuleHeaderArray.
@param MaxiumCapsuleSize On output the maximum size that UpdateCapsule() can
support as an argument to UpdateCapsule() via
CapsuleHeaderArray and ScatterGatherList.
Undefined on input.
@param ResetType Returns the type of reset required for the capsule update.
@retval EFI_SUCCESS Valid answer returned..
@retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.
@retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and
MaximumCapsuleSize and ResetType are undefined.
**/
EFI_STATUS
EFIAPI
EfiQueryCapsuleCapabilities (
IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
IN UINTN CapsuleCount,
OUT UINT64 *MaximumCapsuleSize,
OUT EFI_RESET_TYPE *ResetType
);
/**
The QueryVariableInfo() function allows a caller to obtain the information about the
maximum size of the storage space available for the EFI variables, the remaining size of the storage
space available for the EFI variables and the maximum size of each individual EFI variable,
associated with the attributes specified.
The returned MaximumVariableStorageSize, RemainingVariableStorageSize,
MaximumVariableSize information may change immediately after the call based on other
runtime activities including asynchronous error events. Also, these values associated with different
attributes are not additive in nature.
@param Attributes Attributes bitmask to specify the type of variables on
which to return information. Refer to the
GetVariable() function description.
@param MaximumVariableStorageSize
On output the maximum size of the storage space
available for the EFI variables associated with the
attributes specified.
@param RemainingVariableStorageSize
Returns the remaining size of the storage space
available for the EFI variables associated with the
attributes specified..
@param MaximumVariableSize Returns the maximum size of the individual EFI
variables associated with the attributes specified.
@retval EFI_SUCCESS Valid answer returned.
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.
@retval EFI_UNSUPPORTED EFI_UNSUPPORTED The attribute is not supported on this platform, and the
MaximumVariableStorageSize,
RemainingVariableStorageSize, MaximumVariableSize
are undefined.
**/
EFI_STATUS
EFIAPI
EfiQueryVariableInfo (
IN UINT32 Attrubutes,
OUT UINT64 *MaximumVariableStorageSize,
OUT UINT64 *RemainingVariableStorageSize,
OUT UINT64 *MaximumVariableSize
);
#endif

View File

@@ -0,0 +1,32 @@
/*++
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:
EdkIIGlueDxeServicesTableLib.h
Abstract:
Library that provides a global pointer to the DXE Services Table
--*/
#ifndef __EDKII_GLUE_DXE_SERVICES_TABLE_LIB_H__
#define __EDKII_GLUE_DXE_SERVICES_TABLE_LIB_H__
//
// Cache copy of the DXE Services Table
//
extern EFI_DXE_SERVICES *gDS;
#endif

View File

@@ -0,0 +1,147 @@
/*++
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:
EdkIIGlueDxeSmmDriverEntryPoint.h
Abstract:
Public header file for DXE SMM Driver Entry Point Lib
--*/
#ifndef __EDKII_GLUE_MODULE_ENTRY_POINT_H__
#define __EDKII_GLUE_MODULE_ENTRY_POINT_H__
//
// Declare the EFI/UEFI Specification Revision to which this driver is implemented
//
extern const UINT32 _gUefiDriverRevision;
//
// Declare the number of entry points in the image.
//
extern const UINT8 _gDriverEntryPointCount;
//
// Declare the number of unload handler in the image.
//
extern const UINT8 _gDriverUnloadImageCount;
/**
Enrty point to DXE SMM Driver.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
@retval EFI_SUCCESS One or more of the drivers returned a success code.
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
**/
EFI_STATUS
EFIAPI
_ModuleEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
Enrty point wrapper of DXE SMM Driver.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
@retval EFI_SUCCESS One or more of the drivers returned a success code.
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
**/
EFI_STATUS
EFIAPI
EfiMain (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
Computes the cummulative return status for the driver entry point and perform
a long jump back into DriverEntryPoint().
@param Status Status returned by the driver that is exiting.
**/
VOID
EFIAPI
ExitDriver (
IN EFI_STATUS Status
);
/**
Call constructs for all libraries. Automatics Generated by tool.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
**/
VOID
EFIAPI
ProcessLibraryConstructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
Call destructors for all libraries. Automatics Generated by tool.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
**/
VOID
EFIAPI
ProcessLibraryDestructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
Call the list of driver entry points. Automatics Generated by tool.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
@return Status returned by entry points of drivers.
**/
EFI_STATUS
EFIAPI
ProcessModuleEntryPointList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
Call the unload handlers for all the modules. Automatics Generated by tool.
@param ImageHandle ImageHandle of the loaded driver.
@return Status returned by unload handlers of drivers.
**/
EFI_STATUS
EFIAPI
ProcessModuleUnloadList (
IN EFI_HANDLE ImageHandle
);
#endif

View File

@@ -0,0 +1,144 @@
/*++
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:
EdkIIGlueEdkDxeSalLib.h
Abstract:
--*/
#ifndef __EDKII_GLUE_ESAL_SERVICE_LIB_H__
#define __EDKII_GLUE_ESAL_SERVICE_LIB_H__
#include EFI_PROTOCOL_DEFINITION (ExtendedSalGuid)
#include EFI_PROTOCOL_DEFINITION (ExtendedSalBootService)
EFI_STATUS
EFIAPI
RegisterEsalFunction (
IN UINT64 FunctionId,
IN EFI_GUID *ClassGuid,
IN SAL_INTERNAL_EXTENDED_SAL_PROC Function,
IN VOID *ModuleGlobal
)
/*++
Routine Description:
Register ESAL Class Function and it's asociated global.
This function is boot service only!
Arguments:
FunctionId - ID of function to register
ClassGuid - GUID of function class
Function - Function to register under ClassGuid/FunctionId pair
ModuleGlobal - Module global for Function.
Returns:
EFI_SUCCESS - If ClassGuid/FunctionId Function was registered.
--*/
;
EFI_STATUS
EFIAPI
RegisterEsalClass (
IN EFI_GUID *ClassGuid,
IN VOID *ModuleGlobal,
...
)
/*++
Routine Description:
Register ESAL Class and it's asociated global.
This function is boot service only!
Arguments:
ClassGuid - GUID of function class
ModuleGlobal - Module global for Function.
.. - SAL_INTERNAL_EXTENDED_SAL_PROC and FunctionId pairs. NULL
indicates the end of the list.
Returns:
EFI_SUCCESS - All members of ClassGuid registered
--*/
;
SAL_RETURN_REGS
EFIAPI
EfiCallEsalService (
IN EFI_GUID *ClassGuid,
IN UINT64 FunctionId,
IN UINT64 Arg2,
IN UINT64 Arg3,
IN UINT64 Arg4,
IN UINT64 Arg5,
IN UINT64 Arg6,
IN UINT64 Arg7,
IN UINT64 Arg8
)
/*++
Routine Description:
Call module that is not linked direclty to this module. This code is IP
relative and hides the binding issues of virtual or physical calling. The
function that gets dispatched has extra arguments that include the registered
module global and a boolean flag to indicate if the system is in virutal mode.
Arguments:
ClassGuid - GUID of function
FunctionId - Function in ClassGuid to call
Arg2 - Argument 2 ClassGuid/FunctionId defined
Arg3 - Argument 3 ClassGuid/FunctionId defined
Arg4 - Argument 4 ClassGuid/FunctionId defined
Arg5 - Argument 5 ClassGuid/FunctionId defined
Arg6 - Argument 6 ClassGuid/FunctionId defined
Arg7 - Argument 7 ClassGuid/FunctionId defined
Arg8 - Argument 8 ClassGuid/FunctionId defined
Returns:
Status of ClassGuid/FuncitonId
--*/
;
SAL_RETURN_REGS
EFIAPI
SetEsalVirtualEntryPoint (
IN UINT64 EntryPoint,
IN UINT64 Gp
)
;
SAL_RETURN_REGS
EFIAPI
SetEsalPhysicalEntryPoint (
IN UINT64 EntryPoint,
IN UINT64 Gp
)
;
SAL_RETURN_REGS
EFIAPI
GetEsalEntryPoint (
VOID
)
;
#endif

View File

@@ -0,0 +1,54 @@
/*++
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:
EdkIIGlueHiiLib.h
Abstract:
Public header file for Hii Lib
--*/
#ifndef __EDKII_GLUE_HII_LIB_H__
#define __EDKII_GLUE_HII_LIB_H__
#define PreparePackages GluePreparePackages
/**
This function allocates pool for an EFI_HII_PACKAGES structure
with enough space for the variable argument list of package pointers.
The allocated structure is initialized using NumberOfPackages, Guid,
and the variable length argument list of package pointers.
@param NumberOfPackages The number of HII packages to prepare.
@param Guid Package GUID.
@return
The allocated and initialized packages.
**/
EFI_HII_PACKAGES *
EFIAPI
GluePreparePackages (
IN UINTN NumberOfPackages,
IN CONST EFI_GUID *Guid OPTIONAL,
...
)
;
#endif

View File

@@ -0,0 +1,384 @@
/*++
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:
EdkIIGlueHobLib.h
Abstract:
Public header file for Hob Lib
--*/
#ifndef __EDKII_GLUE_HOB_LIB_H__
#define __EDKII_GLUE_HOB_LIB_H__
#define GetFirstGuidHob(_GUID) GlueGetFirstGuidHob(_GUID)
#define GetNextGuidHob(_GUID, _HobStart) GlueGetNextGuidHob(_GUID, _HobStart)
#define BuildModuleHob(_MODULENAME, _MEMORYALLOCATIONMODULE, _MODULELENGTH, _ENTRYPOINT) GlueBuildModuleHob(_MODULENAME, _MEMORYALLOCATIONMODULE, _MODULELENGTH, _ENTRYPOINT)
#define BuildMemoryAllocationHob(_BASEADDRESS, _LENGTH, _MEMORYTYPE) GlueBuildMemoryAllocationHob(_BASEADDRESS, _LENGTH, _MEMORYTYPE)
/**
Returns the pointer to the HOB list.
This function returns the pointer to first HOB in the list.
@return The pointer to the HOB list.
**/
VOID *
EFIAPI
GetHobList (
VOID
)
;
/**
Returns the next instance of a HOB type from the starting HOB.
This function searches the first instance of a HOB type from the starting HOB pointer.
If there does not exist such HOB type from the starting HOB pointer, it will return NULL.
In contrast with macro GET_NEXT_HOB(), 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.
If HobStart is NULL, then ASSERT().
@param Type The HOB type to return.
@param HobStart The starting HOB pointer to search from.
@return The next instance of a HOB type from the starting HOB.
**/
VOID *
EFIAPI
GetNextHob (
IN UINT16 Type,
IN CONST VOID *HobStart
)
;
/**
Returns the first instance of a HOB type among the whole HOB list.
This function searches the first instance of a HOB type among the whole HOB list.
If there does not exist such HOB type in the HOB list, it will return NULL.
@param Type The HOB type to return.
@return The next instance of a HOB type from the starting HOB.
**/
VOID *
EFIAPI
GetFirstHob (
IN UINT16 Type
)
;
/**
This function searches the first instance of a HOB from the starting HOB pointer.
Such HOB should satisfy two conditions:
its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
If there does not exist such HOB from the starting HOB pointer, it will return NULL.
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.
In contrast with macro GET_NEXT_HOB(), 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.
If Guid is NULL, then ASSERT().
If HobStart is NULL, then ASSERT().
@param Guid The GUID to match with in the HOB list.
@param HobStart A pointer to a Guid.
@return The next instance of the matched GUID HOB from the starting HOB.
**/
VOID *
EFIAPI
GlueGetNextGuidHob (
IN CONST EFI_GUID *Guid,
IN CONST VOID *HobStart
)
;
/**
This function searches the first instance of a HOB among the whole HOB list.
Such HOB should satisfy two conditions:
its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
If there does not exist such HOB from the starting HOB pointer, it will return NULL.
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.
If Guid is NULL, then ASSERT().
@param Guid The GUID to match with in the HOB list.
@return The first instance of the matched GUID HOB among the whole HOB list.
**/
VOID *
EFIAPI
GlueGetFirstGuidHob (
IN CONST EFI_GUID *Guid
)
;
/**
Get the Boot Mode from the HOB list.
This function returns the system boot mode information from the
PHIT HOB in HOB list.
@param VOID
@return The Boot Mode.
**/
EFI_BOOT_MODE
EFIAPI
GetBootModeHob (
VOID
)
;
/**
Builds a HOB for a loaded PE32 module.
This function builds a HOB for a loaded PE32 module.
It can only be invoked during PEI phase;
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
If ModuleName is NULL, then ASSERT().
If there is no additional space for HOB creation, then ASSERT().
@param ModuleName The GUID File Name of the module.
@param MemoryAllocationModule The 64 bit physical address of the module.
@param ModuleLength The length of the module in bytes.
@param EntryPoint The 64 bit physical address of the module entry point.
**/
VOID
EFIAPI
GlueBuildModuleHob (
IN CONST EFI_GUID *ModuleName,
IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,
IN UINT64 ModuleLength,
IN EFI_PHYSICAL_ADDRESS EntryPoint
)
;
/**
Builds a HOB that describes a chunk of system memory.
This function builds a HOB that describes a chunk of system memory.
It can only be invoked during PEI phase;
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
If there is no additional space for HOB creation, then ASSERT().
@param ResourceType The type of resource described by this HOB.
@param ResourceAttribute The resource attributes of the memory described by this HOB.
@param PhysicalStart The 64 bit physical address of memory described by this HOB.
@param NumberOfBytes The length of the memory described by this HOB in bytes.
**/
VOID
EFIAPI
BuildResourceDescriptorHob (
IN EFI_RESOURCE_TYPE ResourceType,
IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,
IN EFI_PHYSICAL_ADDRESS PhysicalStart,
IN UINT64 NumberOfBytes
)
;
/**
Builds a GUID HOB with a certain data length.
This function builds a customized HOB tagged with a GUID for identification
and returns the start address of GUID HOB data so that caller can fill the customized data.
The HOB Header and Name field is already stripped.
It can only be invoked during PEI phase;
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
If Guid is NULL, then ASSERT().
If there is no additional space for HOB creation, then ASSERT().
If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
@param Guid The GUID to tag the customized HOB.
@param DataLength The size of the data payload for the GUID HOB.
@return The start address of GUID HOB data.
**/
VOID *
EFIAPI
BuildGuidHob (
IN CONST EFI_GUID *Guid,
IN UINTN DataLength
)
;
/**
Copies a data buffer to a newly-built HOB.
This function builds a customized HOB tagged with a GUID for identification,
copies the input data to the HOB data field and returns the start address of the GUID HOB data.
The HOB Header and Name field is already stripped.
It can only be invoked during PEI phase;
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
If Guid is NULL, then ASSERT().
If Data is NULL and DataLength > 0, then ASSERT().
If there is no additional space for HOB creation, then ASSERT().
If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
@param Guid The GUID to tag the customized HOB.
@param Data The data to be copied into the data field of the GUID HOB.
@param DataLength The size of the data payload for the GUID HOB.
@return The start address of GUID HOB data.
**/
VOID *
EFIAPI
BuildGuidDataHob (
IN CONST EFI_GUID *Guid,
IN VOID *Data,
IN UINTN DataLength
)
;
/**
Builds a Firmware Volume HOB.
This function builds a Firmware Volume HOB.
It can only be invoked during PEI phase;
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
If there is no additional space for HOB creation, then ASSERT().
@param BaseAddress The base address of the Firmware Volume.
@param Length The size of the Firmware Volume in bytes.
**/
VOID
EFIAPI
BuildFvHob (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
;
/**
Builds a Capsule Volume HOB.
This function builds a Capsule Volume HOB.
It can only be invoked during PEI phase;
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
If there is no additional space for HOB creation, then ASSERT().
@param BaseAddress The base address of the Capsule Volume.
@param Length The size of the Capsule Volume in bytes.
**/
VOID
EFIAPI
BuildCvHob (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
;
/**
Builds a HOB for the CPU.
This function builds a HOB for the CPU.
It can only be invoked during PEI phase;
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
If there is no additional space for HOB creation, then ASSERT().
@param SizeOfMemorySpace The maximum physical memory addressability of the processor.
@param SizeOfIoSpace The maximum physical I/O addressability of the processor.
**/
VOID
EFIAPI
BuildCpuHob (
IN UINT8 SizeOfMemorySpace,
IN UINT8 SizeOfIoSpace
)
;
/**
Builds a HOB for the Stack.
This function builds a HOB for the stack.
It can only be invoked during PEI phase;
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
If there is no additional space for HOB creation, then ASSERT().
@param BaseAddress The 64 bit physical address of the Stack.
@param Length The length of the stack in bytes.
**/
VOID
EFIAPI
BuildStackHob (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length
)
;
/**
Builds a HOB for the BSP store.
This function builds a HOB for BSP store.
It can only be invoked during PEI phase;
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
If there is no additional space for HOB creation, then ASSERT().
@param BaseAddress The 64 bit physical address of the BSP.
@param Length The length of the BSP store in bytes.
@param MemoryType Type of memory allocated by this HOB.
**/
VOID
EFIAPI
BuildBspStoreHob (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length,
IN EFI_MEMORY_TYPE MemoryType
)
;
/**
Builds a HOB for the memory allocation.
This function builds a HOB for the memory allocation.
It can only be invoked during PEI phase;
for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
If there is no additional space for HOB creation, then ASSERT().
@param BaseAddress The 64 bit physical address of the memory.
@param Length The length of the memory allocation in bytes.
@param MemoryType Type of memory allocated by this HOB.
**/
VOID
EFIAPI
GlueBuildMemoryAllocationHob (
IN EFI_PHYSICAL_ADDRESS BaseAddress,
IN UINT64 Length,
IN EFI_MEMORY_TYPE MemoryType
)
;
#endif

View File

@@ -0,0 +1,637 @@
/*++
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:
EdkIIGlueMemoryAllocationLib.h
Abstract:
Public header file for Memory Allocation Lib
--*/
#ifndef __EDKII_GLUE_MEMORY_ALLOCATION_LIB_H__
#define __EDKII_GLUE_MEMORY_ALLOCATION_LIB_H__
#define AllocatePages(_PAGES) GlueAllocatePages(_PAGES)
#define FreePages(_BUFFER, _PAGES) GlueFreePages(_BUFFER, _PAGES)
#define AllocatePool(_SIZE) GlueAllocatePool(_SIZE)
#define AllocateZeroPool(_ALLOCATIONSIZE) GlueAllocateZeroPool(_ALLOCATIONSIZE)
#define AllocateCopyPool(_ALLOCATIONSIZE, _BUFFER) GlueAllocateCopyPool(_ALLOCATIONSIZE, _BUFFER)
#define FreePool(_BUFFER) GlueFreePool(_BUFFER)
/**
Allocates one or more 4KB pages of type EfiBootServicesData.
Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the
allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
is returned. If there is not enough memory remaining to satisfy the request, then NULL is
returned.
@param Pages The number of 4 KB pages to allocate.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
GlueAllocatePages (
IN UINTN Pages
);
/**
Allocates one or more 4KB pages of type EfiRuntimeServicesData.
Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the
allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
is returned. If there is not enough memory remaining to satisfy the request, then NULL is
returned.
@param Pages The number of 4 KB pages to allocate.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateRuntimePages (
IN UINTN Pages
);
/**
Allocates one or more 4KB pages of type EfiReservedMemoryType.
Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the
allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
is returned. If there is not enough memory remaining to satisfy the request, then NULL is
returned.
@param Pages The number of 4 KB pages to allocate.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateReservedPages (
IN UINTN Pages
);
/**
Frees one or more 4KB pages that were previously allocated with one of the page allocation
functions in the Memory Allocation Library.
Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
must have been allocated on a previous call to the page allocation services of the Memory
Allocation Library.
If Buffer was not allocated with a page allocation function in the Memory Allocation Library,
then ASSERT().
If Pages is zero, then ASSERT().
@param Buffer Pointer to the buffer of pages to free.
@param Pages The number of 4 KB pages to free.
**/
VOID
EFIAPI
GlueFreePages (
IN VOID *Buffer,
IN UINTN Pages
);
/**
Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.
Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an
alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
returned. If there is not enough memory at the specified alignment remaining to satisfy the
request, then NULL is returned.
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
@param Pages The number of 4 KB pages to allocate.
@param Alignment The requested alignment of the allocation. Must be a power of two.
If Alignment is zero, then byte alignment is used.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateAlignedPages (
IN UINTN Pages,
IN UINTN Alignment
);
/**
Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.
Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an
alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
returned. If there is not enough memory at the specified alignment remaining to satisfy the
request, then NULL is returned.
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
@param Pages The number of 4 KB pages to allocate.
@param Alignment The requested alignment of the allocation. Must be a power of two.
If Alignment is zero, then byte alignment is used.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateAlignedRuntimePages (
IN UINTN Pages,
IN UINTN Alignment
);
/**
Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.
Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an
alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
returned. If there is not enough memory at the specified alignment remaining to satisfy the
request, then NULL is returned.
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
@param Pages The number of 4 KB pages to allocate.
@param Alignment The requested alignment of the allocation. Must be a power of two.
If Alignment is zero, then byte alignment is used.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateAlignedReservedPages (
IN UINTN Pages,
IN UINTN Alignment
);
/**
Frees one or more 4KB pages that were previously allocated with one of the aligned page
allocation functions in the Memory Allocation Library.
Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
must have been allocated on a previous call to the aligned page allocation services of the Memory
Allocation Library.
If Buffer was not allocated with an aligned page allocation function in the Memory Allocation
Library, then ASSERT().
If Pages is zero, then ASSERT().
@param Buffer Pointer to the buffer of pages to free.
@param Pages The number of 4 KB pages to free.
**/
VOID
EFIAPI
FreeAlignedPages (
IN VOID *Buffer,
IN UINTN Pages
);
/**
Allocates a buffer of type EfiBootServicesData.
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a
pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
@param AllocationSize The number of bytes to allocate.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
GlueAllocatePool (
IN UINTN AllocationSize
);
/**
Allocates a buffer of type EfiRuntimeServicesData.
Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns
a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
@param AllocationSize The number of bytes to allocate.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateRuntimePool (
IN UINTN AllocationSize
);
/**
Allocates a buffer of type EfieservedMemoryType.
Allocates the number bytes specified by AllocationSize of type EfieservedMemoryType and returns
a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
@param AllocationSize The number of bytes to allocate.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateReservedPool (
IN UINTN AllocationSize
);
/**
Allocates and zeros a buffer of type EfiBootServicesData.
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
request, then NULL is returned.
@param AllocationSize The number of bytes to allocate and zero.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
GlueAllocateZeroPool (
IN UINTN AllocationSize
);
/**
Allocates and zeros a buffer of type EfiRuntimeServicesData.
Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the
buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
request, then NULL is returned.
@param AllocationSize The number of bytes to allocate and zero.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateRuntimeZeroPool (
IN UINTN AllocationSize
);
/**
Allocates and zeros a buffer of type EfiReservedMemoryType.
Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the
buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
request, then NULL is returned.
@param AllocationSize The number of bytes to allocate and zero.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateReservedZeroPool (
IN UINTN AllocationSize
);
/**
Copies a buffer to an allocated buffer of type EfiBootServicesData.
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, copies
AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory remaining to satisfy the request, then NULL is returned.
If Buffer is NULL, then ASSERT().
If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param AllocationSize The number of bytes to allocate and zero.
@param Buffer The buffer to copy to the allocated buffer.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
GlueAllocateCopyPool (
IN UINTN AllocationSize,
IN CONST VOID *Buffer
);
/**
Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.
Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies
AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory remaining to satisfy the request, then NULL is returned.
If Buffer is NULL, then ASSERT().
If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param AllocationSize The number of bytes to allocate and zero.
@param Buffer The buffer to copy to the allocated buffer.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateRuntimeCopyPool (
IN UINTN AllocationSize,
IN CONST VOID *Buffer
);
/**
Copies a buffer to an allocated buffer of type EfiReservedMemoryType.
Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, copies
AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory remaining to satisfy the request, then NULL is returned.
If Buffer is NULL, then ASSERT().
If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param AllocationSize The number of bytes to allocate and zero.
@param Buffer The buffer to copy to the allocated buffer.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateReservedCopyPool (
IN UINTN AllocationSize,
IN CONST VOID *Buffer
);
/**
Frees a buffer that was previously allocated with one of the pool allocation functions in the
Memory Allocation Library.
Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
pool allocation services of the Memory Allocation Library.
If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
then ASSERT().
@param Buffer Pointer to the buffer to free.
**/
VOID
EFIAPI
GlueFreePool (
IN VOID *Buffer
);
/**
Allocates a buffer of type EfiBootServicesData at a specified alignment.
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData with an
alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
then a valid buffer of 0 size is returned. If there is not enough memory at the specified
alignment remaining to satisfy the request, then NULL is returned.
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
@param AllocationSize The number of bytes to allocate.
@param Alignment The requested alignment of the allocation. Must be a power of two.
If Alignment is zero, then byte alignment is used.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateAlignedPool (
IN UINTN AllocationSize,
IN UINTN Alignment
);
/**
Allocates a buffer of type EfiRuntimeServicesData at a specified alignment.
Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData with an
alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
then a valid buffer of 0 size is returned. If there is not enough memory at the specified
alignment remaining to satisfy the request, then NULL is returned.
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
@param AllocationSize The number of bytes to allocate.
@param Alignment The requested alignment of the allocation. Must be a power of two.
If Alignment is zero, then byte alignment is used.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateAlignedRuntimePool (
IN UINTN AllocationSize,
IN UINTN Alignment
);
/**
Allocates a buffer of type EfieservedMemoryType at a specified alignment.
Allocates the number bytes specified by AllocationSize of type EfieservedMemoryType with an
alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
then a valid buffer of 0 size is returned. If there is not enough memory at the specified
alignment remaining to satisfy the request, then NULL is returned.
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
@param AllocationSize The number of bytes to allocate.
@param Alignment The requested alignment of the allocation. Must be a power of two.
If Alignment is zero, then byte alignment is used.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateAlignedReservedPool (
IN UINTN AllocationSize,
IN UINTN Alignment
);
/**
Allocates and zeros a buffer of type EfiBootServicesData at a specified alignment.
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData with an
alignment specified by Alignment, clears the buffer with zeros, and returns a pointer to the
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory at the specified alignment remaining to satisfy the request, then NULL is
returned.
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
@param AllocationSize The number of bytes to allocate.
@param Alignment The requested alignment of the allocation. Must be a power of two.
If Alignment is zero, then byte alignment is used.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateAlignedZeroPool (
IN UINTN AllocationSize,
IN UINTN Alignment
);
/**
Allocates and zeros a buffer of type EfiRuntimeServicesData at a specified alignment.
Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData with an
alignment specified by Alignment, clears the buffer with zeros, and returns a pointer to the
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory at the specified alignment remaining to satisfy the request, then NULL is
returned.
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
@param AllocationSize The number of bytes to allocate.
@param Alignment The requested alignment of the allocation. Must be a power of two.
If Alignment is zero, then byte alignment is used.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateAlignedRuntimeZeroPool (
IN UINTN AllocationSize,
IN UINTN Alignment
);
/**
Allocates and zeros a buffer of type EfieservedMemoryType at a specified alignment.
Allocates the number bytes specified by AllocationSize of type EfieservedMemoryType with an
alignment specified by Alignment, clears the buffer with zeros, and returns a pointer to the
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory at the specified alignment remaining to satisfy the request, then NULL is
returned.
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
@param AllocationSize The number of bytes to allocate.
@param Alignment The requested alignment of the allocation. Must be a power of two.
If Alignment is zero, then byte alignment is used.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateAlignedReservedZeroPool (
IN UINTN AllocationSize,
IN UINTN Alignment
);
/**
Copies a buffer to an allocated buffer of type EfiBootServicesData at a specified alignment.
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData type with an
alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
then a valid buffer of 0 size is returned. If there is not enough memory at the specified
alignment remaining to satisfy the request, then NULL is returned.
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
@param AllocationSize The number of bytes to allocate.
@param Buffer The buffer to copy to the allocated buffer.
@param Alignment The requested alignment of the allocation. Must be a power of two.
If Alignment is zero, then byte alignment is used.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateAlignedCopyPool (
IN UINTN AllocationSize,
IN CONST VOID *Buffer,
IN UINTN Alignment
);
/**
Copies a buffer to an allocated buffer of type EfiRuntimeServicesData at a specified alignment.
Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData type with an
alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
then a valid buffer of 0 size is returned. If there is not enough memory at the specified
alignment remaining to satisfy the request, then NULL is returned.
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
@param AllocationSize The number of bytes to allocate.
@param Buffer The buffer to copy to the allocated buffer.
@param Alignment The requested alignment of the allocation. Must be a power of two.
If Alignment is zero, then byte alignment is used.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateAlignedRuntimeCopyPool (
IN UINTN AllocationSize,
IN CONST VOID *Buffer,
IN UINTN Alignment
);
/**
Copies a buffer to an allocated buffer of type EfiReservedMemoryType at a specified alignment.
Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType type with an
alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,
then a valid buffer of 0 size is returned. If there is not enough memory at the specified
alignment remaining to satisfy the request, then NULL is returned.
If Alignment is not a power of two and Alignment is not zero, then ASSERT().
@param AllocationSize The number of bytes to allocate.
@param Buffer The buffer to copy to the allocated buffer.
@param Alignment The requested alignment of the allocation. Must be a power of two.
If Alignment is zero, then byte alignment is used.
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
VOID *
EFIAPI
AllocateAlignedReservedCopyPool (
IN UINTN AllocationSize,
IN CONST VOID *Buffer,
IN UINTN Alignment
);
/**
Frees a buffer that was previously allocated with one of the aligned pool allocation functions
in the Memory Allocation Library.
Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
aligned pool allocation services of the Memory Allocation Library.
If Buffer was not allocated with an aligned pool allocation function in the Memory Allocation
Library, then ASSERT().
@param Buffer Pointer to the buffer to free.
**/
VOID
EFIAPI
FreeAlignedPool (
IN VOID *Buffer
);
#endif

View File

@@ -0,0 +1,93 @@
/*++
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:
EdkIIGluePeCoffGetEntryPointLib.h
Abstract:
Public header file for PeCoff Get Entry Point Lib
--*/
#ifndef __EDKII_GLUE_PE_COFF_GET_ENTRY_POINT_LIB_H__
#define __EDKII_GLUE_PE_COFF_GET_ENTRY_POINT_LIB_H__
/**
Retrieves and returns a pointer to the entry point to a PE/COFF image that has been loaded
into system memory with the PE/COFF Loader Library functions.
Retrieves the entry point to the PE/COFF image specified by Pe32Data and returns this entry
point in EntryPoint. If the entry point could not be retrieved from the PE/COFF image, then
return RETURN_INVALID_PARAMETER. Otherwise return RETURN_SUCCESS.
If Pe32Data is NULL, then ASSERT().
If EntryPoint is NULL, then ASSERT().
@param Pe32Data Pointer to the PE/COFF image that is loaded in system memory.
@param EntryPoint Pointer to entry point to the PE/COFF image to return.
@retval RETURN_SUCCESS EntryPoint was returned.
@retval RETURN_INVALID_PARAMETER The entry point could not be found in the PE/COFF image.
**/
RETURN_STATUS
EFIAPI
PeCoffLoaderGetEntryPoint (
IN VOID *Pe32Data,
OUT VOID **EntryPoint
);
/**
Returns the machine type of a PE/COFF image.
Returns the machine type from the PE/COFF image specified by Pe32Data.
If Pe32Data is NULL, then ASSERT().
@param Pe32Data Pointer to the PE/COFF image that is loaded in system
memory.
@return Machine type or zero if not a valid iamge.
**/
UINT16
EFIAPI
PeCoffLoaderGetMachineType (
IN VOID *Pe32Data
);
/**
Returns a pointer to the PDB file name for a PE/COFF image that has been
loaded into system memory with the PE/COFF Loader Library functions.
Returns the PDB file name for the PE/COFF image specified by Pe32Data. If
the PE/COFF image specified by Pe32Data is not a valid, then NULL is
returned. If the PE/COFF image specified by Pe32Data does not contain a
debug directory entry, then NULL is returned. If the debug directory entry
in the PE/COFF image specified by Pe32Data does not contain a PDB file name,
then NULL is returned.
If Pe32Data is NULL, then ASSERT().
@param Pe32Data Pointer to the PE/COFF image that is loaded in system
memory.
@return The PDB file name for the PE/COFF image specified by Pe32Data or NULL
if it cannot be retrieved.
**/
VOID *
EFIAPI
PeCoffLoaderGetPdbPointer (
IN VOID *Pe32Data
);
#endif

View File

@@ -0,0 +1,226 @@
/*++
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:
EdkIIGluePeCoffLib.h
Abstract:
Public header file for PeCoff Lib
--*/
#ifndef __EDKII_GLUE_BASE_PE_COFF_LIB_H__
#define __EDKII_GLUE_BASE_PE_COFF_LIB_H__
#define PeCoffLoaderGetImageInfo(_IMAGECONTEXT) GluePeCoffLoaderGetImageInfo(_IMAGECONTEXT)
#define PeCoffLoaderRelocateImage(_IMAGECONTEXT) GluePeCoffLoaderRelocateImage(_IMAGECONTEXT)
#define PeCoffLoaderLoadImage(_IMAGECONTEXT) GluePeCoffLoaderLoadImage(_IMAGECONTEXT)
#define PeCoffLoaderGetPeHeader(_IMAGECONTEXT, _HDR) GluePeCoffLoaderGetPeHeader(_IMAGECONTEXT, _HDR)
#define PeCoffLoaderImageAddress(_IMAGECONTEXT, _ADR) GluePeCoffLoaderImageAddress(_IMAGECONTEXT, _ADR)
#define PeCoffLoaderRelocateImage(_IMAGECONTEXT) GluePeCoffLoaderRelocateImage(_IMAGECONTEXT)
#define PeCoffLoaderRelocateImageEx(_RELOC, _FIXUP, _FIXUPDATA, _ADJUST) \
GluePeCoffLoaderRelocateImageEx(_RELOC, _FIXUP, _FIXUPDATA, _ADJUST)
#define PeHotRelocateImageEx(_RELOC, _FIXUP, _FIXUPDATA, _ADJUST) \
GluePeHotRelocateImageEx(_RELOC, _FIXUP, _FIXUPDATA, _ADJUST)
//
// Return status codes from the PE/COFF Loader services
// BUGBUG: Find where used and see if can be replaced by RETURN_STATUS codes
//
#define IMAGE_ERROR_SUCCESS 0
#define IMAGE_ERROR_IMAGE_READ 1
#define IMAGE_ERROR_INVALID_PE_HEADER_SIGNATURE 2
#define IMAGE_ERROR_INVALID_MACHINE_TYPE 3
#define IMAGE_ERROR_INVALID_SUBSYSTEM 4
#define IMAGE_ERROR_INVALID_IMAGE_ADDRESS 5
#define IMAGE_ERROR_INVALID_IMAGE_SIZE 6
#define IMAGE_ERROR_INVALID_SECTION_ALIGNMENT 7
#define IMAGE_ERROR_SECTION_NOT_LOADED 8
#define IMAGE_ERROR_FAILED_RELOCATION 9
#define IMAGE_ERROR_FAILED_ICACHE_FLUSH 10
//
// PE/COFF Loader Read Function passed in by caller
//
typedef
RETURN_STATUS
(EFIAPI *PE_COFF_LOADER_READ_FILE) (
IN VOID *FileHandle,
IN UINTN FileOffset,
IN OUT UINTN *ReadSize,
OUT VOID *Buffer
);
//
// Context structure used while PE/COFF image is being loaded and relocated
//
typedef struct {
PHYSICAL_ADDRESS ImageAddress;
UINT64 ImageSize;
PHYSICAL_ADDRESS DestinationAddress;
PHYSICAL_ADDRESS EntryPoint;
PE_COFF_LOADER_READ_FILE ImageRead;
VOID *Handle;
VOID *FixupData;
UINT32 SectionAlignment;
UINT32 PeCoffHeaderOffset;
UINT32 DebugDirectoryEntryRva;
VOID *CodeView;
CHAR8 *PdbPointer;
UINTN SizeOfHeaders;
UINT32 ImageCodeMemoryType;
UINT32 ImageDataMemoryType;
UINT32 ImageError;
UINTN FixupDataSize;
UINT16 Machine;
UINT16 ImageType;
BOOLEAN RelocationsStripped;
BOOLEAN IsTeImage;
} PE_COFF_LOADER_IMAGE_CONTEXT;
/**
Retrieves information about a PE/COFF image.
Computes the PeCoffHeaderOffset, ImageAddress, ImageSize, DestinationAddress, CodeView,
PdbPointer, RelocationsStripped, SectionAlignment, SizeOfHeaders, and DebugDirectoryEntryRva
fields of the ImageContext structure. If ImageContext is NULL, then return RETURN_INVALID_PARAMETER.
If the PE/COFF image accessed through the ImageRead service in the ImageContext structure is not
a supported PE/COFF image type, then return RETURN_UNSUPPORTED. If any errors occur while
computing the fields of ImageContext, then the error status is returned in the ImageError field of
ImageContext.
@param ImageContext Pointer to the image context structure that describes the PE/COFF
image that needs to be examined by this function.
@retval RETURN_SUCCESS The information on the PE/COFF image was collected.
@retval RETURN_INVALID_PARAMETER ImageContext is NULL.
@retval RETURN_UNSUPPORTED The PE/COFF image is not supported.
**/
RETURN_STATUS
EFIAPI
GluePeCoffLoaderGetImageInfo (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
;
/**
Applies relocation fixups to a PE/COFF image that was loaded with PeCoffLoaderLoadImage().
If the DestinationAddress field of ImageContext is 0, then use the ImageAddress field of
ImageContext as the relocation base address. Otherwise, use the DestinationAddress field
of ImageContext as the relocation base address. The caller must allocate the relocation
fixup log buffer and fill in the FixupData field of ImageContext prior to calling this function.
If ImageContext is NULL, then ASSERT().
@param ImageContext Pointer to the image context structure that describes the PE/COFF
image that is being relocated.
@retval RETURN_SUCCESS The PE/COFF image was relocated.
Extended status information is in the ImageError field of ImageContext.
@retval RETURN_LOAD_ERROR The image in not a valid PE/COFF image.
Extended status information is in the ImageError field of ImageContext.
@retval RETURN_UNSUPPORTED A relocation record type is not supported.
Extended status information is in the ImageError field of ImageContext.
**/
RETURN_STATUS
EFIAPI
GluePeCoffLoaderRelocateImage (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
;
/**
Loads a PE/COFF image into memory.
Loads the PE/COFF image accessed through the ImageRead service of ImageContext into the buffer
specified by the ImageAddress and ImageSize fields of ImageContext. The caller must allocate
the load buffer and fill in the ImageAddress and ImageSize fields prior to calling this function.
The EntryPoint, FixupDataSize, CodeView, and PdbPointer fields of ImageContext are computed.
If ImageContext is NULL, then ASSERT().
@param ImageContext Pointer to the image context structure that describes the PE/COFF
image that is being loaded.
@retval RETURN_SUCCESS The PE/COFF image was loaded into the buffer specified by
the ImageAddress and ImageSize fields of ImageContext.
Extended status information is in the ImageError field of ImageContext.
@retval RETURN_BUFFER_TOO_SMALL The caller did not provide a large enough buffer.
Extended status information is in the ImageError field of ImageContext.
@retval RETURN_LOAD_ERROR The PE/COFF image is an EFI Runtime image with no relocations.
Extended status information is in the ImageError field of ImageContext.
@retval RETURN_INVALID_PARAMETER The image address is invalid.
Extended status information is in the ImageError field of ImageContext.
**/
RETURN_STATUS
EFIAPI
GluePeCoffLoaderLoadImage (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
;
/**
ImageRead function that operates on a memory buffer whos base is passed into
FileHandle.
@param FileHandle Ponter to baes of the input stream
@param FileOffset Offset to the start of the buffer
@param ReadSize Number of bytes to copy into the buffer
@param Buffer Location to place results of read
@retval RETURN_SUCCESS Data is read from FileOffset from the Handle into
the buffer.
**/
RETURN_STATUS
EFIAPI
PeCoffLoaderImageReadFromMemory (
IN VOID *FileHandle,
IN UINTN FileOffset,
IN OUT UINTN *ReadSize,
OUT VOID *Buffer
)
;
/**
Reapply fixups on a fixed up PE32/PE32+ image to allow virutal calling at EFI
runtime.
PE_COFF_LOADER_IMAGE_CONTEXT.FixupData stores information needed to reapply
the fixups with a virtual mapping.
@param ImageBase Base address of relocated image
@param VirtImageBase Virtual mapping for ImageBase
@param ImageSize Size of the image to relocate
@param RelocationData Location to place results of read
**/
VOID
EFIAPI
PeCoffLoaderRelocateImageForRuntime (
IN PHYSICAL_ADDRESS ImageBase,
IN PHYSICAL_ADDRESS VirtImageBase,
IN UINTN ImageSize,
IN VOID *RelocationData
)
;
#endif

View File

@@ -0,0 +1,306 @@
/*++
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:
EdkIIGluePeiServicesLib.h
Abstract:
Public header file for PEI Services Lib
--*/
#ifndef __EDKII_GLUE_PEI_SERVICES_LIB_H__
#define __EDKII_GLUE_PEI_SERVICES_LIB_H__
/**
This service enables a given PEIM to register an interface into the PEI Foundation.
@param PpiList A pointer to the list of interfaces that the caller shall install.
@retval EFI_SUCCESS The interface was successfully installed.
@retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.
@retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the
EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
**/
EFI_STATUS
EFIAPI
PeiServicesInstallPpi (
IN EFI_PEI_PPI_DESCRIPTOR *PpiList
);
/**
This service enables PEIMs to replace an entry in the PPI database with an alternate entry.
@param OldPpi Pointer to the old PEI PPI Descriptors.
@param NewPpi Pointer to the new PEI PPI Descriptors.
@retval EFI_SUCCESS The interface was successfully installed.
@retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.
@retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the
EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
@retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been
installed.
**/
EFI_STATUS
EFIAPI
PeiServicesReInstallPpi (
IN EFI_PEI_PPI_DESCRIPTOR *OldPpi,
IN EFI_PEI_PPI_DESCRIPTOR *NewPpi
);
/**
This service enables PEIMs to discover a given instance of an interface.
@param Guid A pointer to the GUID whose corresponding interface needs to be
found.
@param Instance The N-th instance of the interface that is required.
@param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.
@param Ppi A pointer to the instance of the interface.
@retval EFI_SUCCESS The interface was successfully returned.
@retval EFI_NOT_FOUND The PPI descriptor is not found in the database.
**/
EFI_STATUS
EFIAPI
PeiServicesLocatePpi (
IN EFI_GUID *Guid,
IN UINTN Instance,
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
IN OUT VOID **Ppi
);
/**
This service enables PEIMs to register a given service to be invoked when another service is
installed or reinstalled.
@param NotifyList A pointer to the list of notification interfaces that the caller
shall install.
@retval EFI_SUCCESS The interface was successfully installed.
@retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.
@retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do not have the
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.
@retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.
**/
EFI_STATUS
EFIAPI
PeiServicesNotifyPpi (
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
);
/**
This service enables PEIMs to ascertain the present value of the boot mode.
@param BootMode A pointer to contain the value of the boot mode.
@retval EFI_SUCCESS The boot mode was returned successfully.
@retval EFI_INVALID_PARAMETER BootMode is NULL.
**/
EFI_STATUS
EFIAPI
PeiServicesGetBootMode (
IN OUT EFI_BOOT_MODE *BootMode
);
/**
This service enables PEIMs to update the boot mode variable.
@param BootMode The value of the boot mode to set.
@retval EFI_SUCCESS The value was successfully updated
**/
EFI_STATUS
EFIAPI
PeiServicesSetBootMode (
IN EFI_BOOT_MODE BootMode
);
/**
This service enables a PEIM to ascertain the address of the list of HOBs in memory.
@param HobList A pointer to the list of HOBs that the PEI Foundation will initialize.
@retval EFI_SUCCESS The list was successfully returned.
@retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.
**/
EFI_STATUS
EFIAPI
PeiServicesGetHobList (
IN OUT VOID **HobList
);
/**
This service enables PEIMs to create various types of HOBs.
@param Type The type of HOB to be installed.
@param Length The length of the HOB to be added.
@param Hob The address of a pointer that will contain the HOB header.
@retval EFI_SUCCESS The HOB was successfully created.
@retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
**/
EFI_STATUS
EFIAPI
PeiServicesCreateHob (
IN UINT16 Type,
IN UINT16 Length,
IN OUT VOID **Hob
);
#if (PI_SPECIFICATION_VERSION < 0x00010000)
/**
This service enables PEIMs to discover additional firmware volumes.
@param Instance This instance of the firmware volume to find. The value 0 is the
Boot Firmware Volume (BFV).
@param FwVolHeader Pointer to the firmware volume header of the volume to return.
@retval EFI_SUCCESS The volume was found.
@retval EFI_NOT_FOUND The volume was not found.
@retval EFI_INVALID_PARAMETER FwVolHeader is NULL.
**/
EFI_STATUS
EFIAPI
PeiServicesFfsFindNextVolume (
IN UINTN Instance,
IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
);
/**
This service enables PEIMs to discover additional firmware files.
@param SearchType A filter to find files only of this type.
@param FwVolHeader Pointer to the firmware volume header of the volume to search.
This parameter must point to a valid FFS volume.
@param FileHeader Pointer to the current file from which to begin searching.
@retval EFI_SUCCESS The file was found.
@retval EFI_NOT_FOUND The file was not found.
@retval EFI_NOT_FOUND The header checksum was not zero.
**/
EFI_STATUS
EFIAPI
PeiServicesFfsFindNextFile (
IN EFI_FV_FILETYPE SearchType,
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
IN OUT EFI_FFS_FILE_HEADER **FileHeader
);
/**
This service enables PEIMs to discover sections of a given type within a valid FFS file.
@param SearchType The value of the section type to find.
@param FfsFileHeader A pointer to the file header that contains the set of sections to
be searched.
@param SectionData A pointer to the discovered section, if successful.
@retval EFI_SUCCESS The section was found.
@retval EFI_NOT_FOUND The section was not found.
**/
EFI_STATUS
EFIAPI
PeiServicesFfsFindSectionData (
IN EFI_SECTION_TYPE SectionType,
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
IN OUT VOID **SectionData
);
#endif
/**
This service enables PEIMs to register the permanent memory configuration
that has been initialized with the PEI Foundation.
@param MemoryBegin The value of a region of installed memory.
@param MemoryLength The corresponding length of a region of installed memory.
@retval EFI_SUCCESS The region was successfully installed in a HOB.
@retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.
@retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.
**/
EFI_STATUS
EFIAPI
PeiServicesInstallPeiMemory (
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
IN UINT64 MemoryLength
);
/**
This service enables PEIMs to allocate memory after the permanent memory has been installed by a
PEIM.
@param MemoryType Type of memory to allocate.
@param Pages Number of pages to allocate.
@param Memory Pointer of memory allocated.
@retval EFI_SUCCESS The memory range was successfully allocated.
@retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.
@retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.
@retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
**/
EFI_STATUS
EFIAPI
PeiServicesAllocatePages (
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages,
IN OUT EFI_PHYSICAL_ADDRESS *Memory
);
/**
This service allocates memory from the Hand-Off Block (HOB) heap.
@param Size The number of bytes to allocate from the pool.
@param Buffer If the call succeeds, a pointer to a pointer to the allocate
buffer; undefined otherwise.
@retval EFI_SUCCESS The allocation was successful
@retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.
**/
EFI_STATUS
EFIAPI
PeiServicesAllocatePool (
IN UINTN Size,
OUT VOID **Buffer
);
/**
This service resets the entire platform, including all processors and devices, and reboots the
system.
@retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.
**/
EFI_STATUS
EFIAPI
PeiServicesResetSystem (
VOID
);
#endif

View File

@@ -0,0 +1,42 @@
/*++
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:
EdkIIGluePeiServicesTablePointerLib.h
Abstract:
Public header file for PEI Services Table Pointer Lib
--*/
#ifndef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_H__
#define __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_H__
/**
The function returns the pointer to PEI services.
The function returns the pointer to PEI services.
It will ASSERT() if the pointer to PEI services is NULL.
@retval The pointer to PeiServices.
**/
EFI_PEI_SERVICES **
EFIAPI
GetPeiServicesTablePointer (
VOID
);
#endif

View File

@@ -0,0 +1,111 @@
/*++
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:
EdkIIGluePeimEntryPoint.h
Abstract:
Public header file for PEIM Entry Point Lib
--*/
#ifndef __EDKII_GLUE_PEIM_ENTRY_POINT_H__
#define __EDKII_GLUE_PEIM_ENTRY_POINT_H__
//
// Declare the EFI/UEFI Specification Revision to which this driver is implemented
//
extern const UINT32 _gPeimRevision;
/**
Image entry point of Peim.
@param FfsHeader Pointer to FFS header the loaded driver.
@param PeiServices Pointer to the PEI services.
@return Status returned by entry points of Peims.
**/
EFI_STATUS
EFIAPI
_ModuleEntryPoint (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
);
/**
Wrapper of Peim image entry point.
@param FfsHeader Pointer to FFS header the loaded driver.
@param PeiServices Pointer to the PEI services.
@return Status returned by entry points of Peims.
**/
EFI_STATUS
EFIAPI
EfiMain (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
);
/**
Call constructs for all libraries. Automatics Generated by tool.
@param FfsHeader Pointer to FFS header the loaded driver.
@param PeiServices Pointer to the PEI services.
**/
VOID
EFIAPI
ProcessLibraryConstructorList (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
);
/**
Call destructors for all libraries. Automatics Generated by tool.
@param FfsHeader Pointer to FFS header the loaded driver.
@param PeiServices Pointer to the PEI services.
**/
VOID
EFIAPI
ProcessLibraryDestructorList (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
);
/**
Call the list of driver entry points. Automatics Generated by tool.
@param FfsHeader Pointer to FFS header the loaded driver.
@param PeiServices Pointer to the PEI services.
@return Status returned by entry points of drivers.
**/
EFI_STATUS
EFIAPI
ProcessModuleEntryPointList (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
);
#endif

View File

@@ -0,0 +1,165 @@
/*++
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:
EdkIIGluePostCodeLib.h
Abstract:
Public header file for Post Code Lib
--*/
#ifndef __EDKII_GLUE_POST_CODE_LIB_H__
#define __EDKII_GLUE_POST_CODE_LIB_H__
#define PostCode(_VALUE) GluePostCode(_VALUE)
#define PostCodeWithDescription(_VALUE, _DESC) GluePostCodeWithDescription(_VALUE, _DESC)
#define PostCodeEnabled() GluePostCodeEnabled()
#define PostCodeDescriptionEnabled() GluePostCodeDescriptionEnabled()
#define POST_CODE_PROPERTY_POST_CODE_ENABLED 0x00000008
#define POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED 0x00000010
/**
Sends an 32-bit value to a POST card.
Sends the 32-bit value specified by Value to a POST card, and returns Value.
Some implementations of this library function may perform I/O operations
directly to a POST card device. Other implementations may send Value to
ReportStatusCode(), and the status code reporting mechanism will eventually
display the 32-bit value on the status reporting device.
PostCode() must actively prevent recursion. If PostCode() is called while
processing another any other Report Status Code Library function, then
PostCode() must return Value immediately.
@param Value The 32-bit value to write to the POST card.
@return Value
**/
UINT32
EFIAPI
GluePostCode (
IN UINT32 Value
);
/**
Sends an 32-bit value to a POST and associated ASCII string.
Sends the 32-bit value specified by Value to a POST card, and returns Value.
If Description is not NULL, then the ASCII string specified by Description is
also passed to the handler that displays the POST card value. Some
implementations of this library function may perform I/O operations directly
to a POST card device. Other implementations may send Value to ReportStatusCode(),
and the status code reporting mechanism will eventually display the 32-bit
value on the status reporting device.
PostCodeWithDescription()must actively prevent recursion. If
PostCodeWithDescription() is called while processing another any other Report
Status Code Library function, then PostCodeWithDescription() must return Value
immediately.
@param Value The 32-bit value to write to the POST card.
@param Description Pointer to an ASCII string that is a description of the
POST code value. This is an optional parameter that may
be NULL.
@return Value
**/
UINT32
EFIAPI
GluePostCodeWithDescription (
IN UINT32 Value,
IN CONST CHAR8 *Description OPTIONAL
);
/**
Returns TRUE if POST Codes are enabled.
This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED
bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
@retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
PcdPostCodeProperyMask is set.
@retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
PcdPostCodeProperyMask is clear.
**/
BOOLEAN
EFIAPI
GluePostCodeEnabled (
VOID
);
/**
Returns TRUE if POST code descriptions are enabled.
This function returns TRUE if the
POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
@retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED
bit of PcdPostCodeProperyMask is set.
@retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED
bit of PcdPostCodeProperyMask is clear.
**/
BOOLEAN
EFIAPI
GluePostCodeDescriptionEnabled (
VOID
);
/**
Sends an 32-bit value to a POST card.
If POST codes are enabled in PcdPostCodeProperyMask, then call PostCode()
passing in Value. Value is returned.
@param Value The 32-bit value to write to the POST card.
@return Value
**/
#define POST_CODE(Value) PostCodeEnabled() ? PostCode(Value) : Value
/**
Sends an 32-bit value to a POST and associated ASCII string.
If POST codes and POST code descriptions are enabled in
PcdPostCodeProperyMask, then call PostCodeWithDescription() passing in
Value and Description. If only POST codes are enabled, then call PostCode()
passing in Value. Value is returned.
@param Value The 32-bit value to write to the POST card.
@param Description Pointer to an ASCII string that is a description of the
POST code value.
**/
#define POST_CODE_WITH_DESCRIPTION(Value,Description) \
PostCodeEnabled() ? \
(PostCodeDescriptionEnabled() ? \
PostCodeWithDescription(Value,Description) : \
PostCode(Value)) : \
Value
#endif

View File

@@ -0,0 +1,481 @@
/*++
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:
EdkIIGluePrintLib.h
Abstract:
Public header file Print Lib
--*/
#ifndef __EDKII_GLUE_PRINT_LIB_H__
#define __EDKII_GLUE_PRINT_LIB_H__
///
/// Define the maximum number of characters that are required to
/// encode a decimal, hexidecimal, GUID, or TIME value with a NULL
/// terminator.
///
/// Maximum Length Decimal String = 28
/// "-9,223,372,036,854,775,808"
/// Maximum Length Hexidecimal String = 17
/// "FFFFFFFFFFFFFFFF"
/// Maximum Length GUID = 37
/// "00000000-0000-0000-0000-000000000000"
/// Maximum Length TIME = 18
/// "12/12/2006 12:12"
///
#define MAXIMUM_VALUE_CHARACTERS 38
///
/// Flags bitmask values use in UnicodeValueToString() and
/// AsciiValueToString()
///
#define LEFT_JUSTIFY 0x01
#define COMMA_TYPE 0x08
#define PREFIX_ZERO 0x20
#define RADIX_HEX 0x80
/**
Produces a Null-terminated Unicode string in an output buffer based on
a Null-terminated Unicode format string and a VA_LIST argument list
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
and BufferSize.
The Unicode string is produced by parsing the format string specified by FormatString.
Arguments are pulled from the variable argument list specified by Marker based on the
contents of the format string.
The number of Unicode characters in the produced output buffer is returned not including
the Null-terminator.
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
If BufferSize > 1 and FormatString is NULL, then ASSERT().
If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
Unicode string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated Unicode format string.
@param Marker VA_LIST marker for the variable argument list.
@return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
**/
UINTN
EFIAPI
UnicodeVSPrint (
OUT CHAR16 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR16 *FormatString,
IN VA_LIST Marker
);
/**
Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
Unicode format string and variable argument list.
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
and BufferSize.
The Unicode string is produced by parsing the format string specified by FormatString.
Arguments are pulled from the variable argument list based on the contents of the format string.
The number of Unicode characters in the produced output buffer is returned not including
the Null-terminator.
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
If BufferSize > 1 and FormatString is NULL, then ASSERT().
If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
Unicode string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated Unicode format string.
@return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
**/
UINTN
EFIAPI
UnicodeSPrint (
OUT CHAR16 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR16 *FormatString,
...
);
/**
Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
ASCII format string and a VA_LIST argument list
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
and BufferSize.
The Unicode string is produced by parsing the format string specified by FormatString.
Arguments are pulled from the variable argument list specified by Marker based on the
contents of the format string.
The number of Unicode characters in the produced output buffer is returned not including
the Null-terminator.
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
If BufferSize > 1 and FormatString is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
Unicode string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated Unicode format string.
@param Marker VA_LIST marker for the variable argument list.
@return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
**/
UINTN
EFIAPI
UnicodeVSPrintAsciiFormat (
OUT CHAR16 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR8 *FormatString,
IN VA_LIST Marker
);
/**
Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
ASCII format string and variable argument list.
Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
and BufferSize.
The Unicode string is produced by parsing the format string specified by FormatString.
Arguments are pulled from the variable argument list based on the contents of the
format string.
The number of Unicode characters in the produced output buffer is returned not including
the Null-terminator.
If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
If BufferSize > 1 and FormatString is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
Unicode string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated Unicode format string.
@return The number of Unicode characters in the produced output buffer not including the
Null-terminator.
**/
UINTN
EFIAPI
UnicodeSPrintAsciiFormat (
OUT CHAR16 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR8 *FormatString,
...
);
/**
Converts a decimal value to a Null-terminated Unicode string.
Converts the decimal number specified by Value to a Null-terminated Unicode
string specified by Buffer containing at most Width characters. No padding of spaces
is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
The number of Unicode characters in Buffer is returned not including the Null-terminator.
If the conversion contains more than Width characters, then only the first
Width characters are returned, and the total number of characters
required to perform the conversion is returned.
Additional conversion parameters are specified in Flags.
The Flags bit LEFT_JUSTIFY is always ignored.
All conversions are left justified in Buffer.
If Width is 0, PREFIX_ZERO is ignored in Flags.
If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
are inserted every 3rd digit starting from the right.
If HEX_RADIX is set in Flags, then the output buffer will be
formatted in hexadecimal format.
If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.
If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
then Buffer is padded with '0' characters so the combination of the optional '-'
sign character, '0' characters, digit characters for Value, and the Null-terminator
add up to Width characters.
If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
If Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
If unsupported bits are set in Flags, then ASSERT().
If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
@param Buffer Pointer to the output buffer for the produced Null-terminated
Unicode string.
@param Flags The bitmask of flags that specify left justification, zero pad, and commas.
@param Value The 64-bit signed value to convert to a string.
@param Width The maximum number of Unicode characters to place in Buffer, not including
the Null-terminator.
@return The number of Unicode characters in Buffer not including the Null-terminator.
**/
UINTN
EFIAPI
UnicodeValueToString (
IN OUT CHAR16 *Buffer,
IN UINTN Flags,
IN INT64 Value,
IN UINTN Width
);
/**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
ASCII format string and a VA_LIST argument list.
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
and BufferSize.
The ASCII string is produced by parsing the format string specified by FormatString.
Arguments are pulled from the variable argument list specified by Marker based on
the contents of the format string.
The number of ASCII characters in the produced output buffer is returned not including
the Null-terminator.
If BufferSize is 0, then no output buffer is produced and 0 is returned.
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
If BufferSize > 0 and FormatString is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
ASSERT().
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
Null-terminator, then ASSERT().
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
ASCII string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated Unicode format string.
@param Marker VA_LIST marker for the variable argument list.
@return The number of ASCII characters in the produced output buffer not including the
Null-terminator.
**/
UINTN
EFIAPI
AsciiVSPrint (
OUT CHAR8 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR8 *FormatString,
IN VA_LIST Marker
);
/**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
ASCII format string and variable argument list.
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
and BufferSize.
The ASCII string is produced by parsing the format string specified by FormatString.
Arguments are pulled from the variable argument list based on the contents of the
format string.
The number of ASCII characters in the produced output buffer is returned not including
the Null-terminator.
If BufferSize is 0, then no output buffer is produced and 0 is returned.
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
If BufferSize > 0 and FormatString is NULL, then ASSERT().
If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
ASSERT().
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
Null-terminator, then ASSERT().
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
ASCII string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated Unicode format string.
@return The number of ASCII characters in the produced output buffer not including the
Null-terminator.
**/
UINTN
EFIAPI
AsciiSPrint (
OUT CHAR8 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR8 *FormatString,
...
);
/**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
ASCII format string and a VA_LIST argument list.
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
and BufferSize.
The ASCII string is produced by parsing the format string specified by FormatString.
Arguments are pulled from the variable argument list specified by Marker based on
the contents of the format string.
The number of ASCII characters in the produced output buffer is returned not including
the Null-terminator.
If BufferSize is 0, then no output buffer is produced and 0 is returned.
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
If BufferSize > 0 and FormatString is NULL, then ASSERT().
If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
ASSERT().
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
Null-terminator, then ASSERT().
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
ASCII string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated Unicode format string.
@param Marker VA_LIST marker for the variable argument list.
@return The number of ASCII characters in the produced output buffer not including the
Null-terminator.
**/
UINTN
EFIAPI
AsciiVSPrintUnicodeFormat (
OUT CHAR8 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR16 *FormatString,
IN VA_LIST Marker
);
/**
Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
ASCII format string and variable argument list.
Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
and BufferSize.
The ASCII string is produced by parsing the format string specified by FormatString.
Arguments are pulled from the variable argument list based on the contents of the
format string.
The number of ASCII characters in the produced output buffer is returned not including
the Null-terminator.
If BufferSize is 0, then no output buffer is produced and 0 is returned.
If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
If BufferSize > 0 and FormatString is NULL, then ASSERT().
If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
ASSERT().
If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
contains more than PcdMaximumAsciiStringLength ASCII characters not including the
Null-terminator, then ASSERT().
@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
ASCII string.
@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
@param FormatString Null-terminated Unicode format string.
@return The number of ASCII characters in the produced output buffer not including the
Null-terminator.
**/
UINTN
EFIAPI
AsciiSPrintUnicodeFormat (
OUT CHAR8 *StartOfBuffer,
IN UINTN BufferSize,
IN CONST CHAR16 *FormatString,
...
);
/**
Converts a decimal value to a Null-terminated ASCII string.
Converts the decimal number specified by Value to a Null-terminated ASCII string
specified by Buffer containing at most Width characters. No padding of spaces
is ever performed.
If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
The number of ASCII characters in Buffer is returned not including the Null-terminator.
If the conversion contains more than Width characters, then only the first Width
characters are returned, and the total number of characters required to perform
the conversion is returned.
Additional conversion parameters are specified in Flags.
The Flags bit LEFT_JUSTIFY is always ignored.
All conversions are left justified in Buffer.
If Width is 0, PREFIX_ZERO is ignored in Flags.
If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
are inserted every 3rd digit starting from the right.
If HEX_RADIX is set in Flags, then the output buffer will be
formatted in hexadecimal format.
If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.
If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
then Buffer is padded with '0' characters so the combination of the optional '-'
sign character, '0' characters, digit characters for Value, and the Null-terminator
add up to Width characters.
If Buffer is NULL, then ASSERT().
If unsupported bits are set in Flags, then ASSERT().
If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
@param Buffer Pointer to the output buffer for the produced Null-terminated
ASCII string.
@param Flags The bitmask of flags that specify left justification, zero pad, and commas.
@param Value The 64-bit signed value to convert to a string.
@param Width The maximum number of ASCII characters to place in Buffer, not including
the Null-terminator.
@return The number of ASCII characters in Buffer not including the Null-terminator.
**/
UINTN
EFIAPI
AsciiValueToString (
IN OUT CHAR8 *Buffer,
IN UINTN Flags,
IN INT64 Value,
IN UINTN Width
);
#endif

View File

@@ -0,0 +1,659 @@
/*++
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:
EdkIIGlueReportStatusCodeLib.h
Abstract:
Public header file for Report Status Code Lib
--*/
#ifndef __EDKII_GLUE_REPORT_STATUS_CODE_LIB_H__
#define __EDKII_GLUE_REPORT_STATUS_CODE_LIB_H__
#define CodeTypeToPostCode(_CODETYPE, _VALUE, _POSTCODE) GlueCodeTypeToPostCode(_CODETYPE, _VALUE, _POSTCODE)
#define ReportStatusCodeExtractAssertInfo(_CODETYPE, _VALUE, _DATA, _FILENAME, _DESC, _LINENUMBER) \
GlueReportStatusCodeExtractAssertInfo(_CODETYPE, _VALUE, _DATA, _FILENAME, _DESC, _LINENUMBER)
#define ReportStatusCodeExtractDebugInfo(_DATA, _ERRORLEVEL, _MARKER, _FORMAT) \
GlueReportStatusCodeExtractDebugInfo(_DATA, _ERRORLEVEL, _MARKER, _FORMAT)
#define ReportStatusCode(_TYPE, _VALUE) GlueReportStatusCode(_TYPE, _VALUE)
#define ReportStatusCodeWithDevicePath(_TYPE, _VALUE, _DEVICEPATH) \
GlueReportStatusCodeWithDevicePath(_TYPE, _VALUE, _DEVICEPATH)
#define ReportStatusCodeWithExtendedData(_TYPE, _VALUE, _EXDATA, _EXDATASIZE) \
GlueReportStatusCodeWithExtendedData(_TYPE, _VALUE, _EXDATA, _EXDATASIZE)
#define ReportStatusCodeEx(_TYPE, _VALUE, _INSTANCE, _CALLERID, _EXDATAGUID, _EXDATA, _EXDATASIZE) \
GlueReportStatusCodeEx(_TYPE, _VALUE, _INSTANCE, _CALLERID, _EXDATAGUID, _EXDATA, _EXDATASIZE)
#define ReportProgressCodeEnabled() GlueReportProgressCodeEnabled()
#define ReportErrorCodeEnabled() GlueReportErrorCodeEnabled()
#define ReportDebugCodeEnabled() GlueReportDebugCodeEnabled()
//
// Declare bits for PcdReportStatusCodePropertyMask
//
#define REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED 0x00000001
#define REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED 0x00000002
#define REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED 0x00000004
//
// Extended Data structure definitions with EFI_STATUS_CODE_DATA headers removed
//
///
/// Voltage Extended Error Data
///
typedef struct {
EFI_EXP_BASE10_DATA Voltage;
EFI_EXP_BASE10_DATA Threshold;
} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_VOLTAGE_ERROR_DATA;
///
/// Microcode Update Extended Error Data
///
typedef struct {
UINT32 Version;
} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_MICROCODE_UPDATE_ERROR_DATA;
///
/// Asynchronous Timer Extended Error Data
///
typedef struct {
EFI_EXP_BASE10_DATA TimerLimit;
} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_TIMER_EXPIRED_ERROR_DATA;
///
/// Host Processor Mismatch Extended Error Data
///
typedef struct {
UINT32 Instance;
UINT16 Attributes;
} REPORT_STATUS_CODE_LIBRARY_HOST_PROCESSOR_MISMATCH_ERROR_DATA;
///
/// Thermal Extended Error Data
///
typedef struct {
EFI_EXP_BASE10_DATA Temperature;
EFI_EXP_BASE10_DATA Threshold;
} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_THERMAL_ERROR_DATA;
///
/// Processor Disabled Extended Error Data
///
typedef struct {
UINT32 Cause;
BOOLEAN SoftwareDisabled;
} REPORT_STATUS_CODE_LIBRARY_COMPUTING_UNIT_CPU_DISABLED_ERROR_DATA;
///
/// Embedded cache init extended data
///
typedef struct {
UINT32 Level;
EFI_INIT_CACHE_TYPE Type;
} REPORT_STATUS_CODE_LIBRARY_CACHE_INIT_DATA;
///
/// Memory Extended Error Data
///
typedef struct {
EFI_MEMORY_ERROR_GRANULARITY Granularity;
EFI_MEMORY_ERROR_OPERATION Operation;
UINTN Syndrome;
EFI_PHYSICAL_ADDRESS Address;
UINTN Resolution;
} REPORT_STATUS_CODE_LIBRARY_MEMORY_EXTENDED_ERROR_DATA;
///
/// DIMM number
///
typedef struct {
UINT16 Array;
UINT16 Device;
} REPORT_STATUS_CODE_LIBRARY_STATUS_CODE_DIMM_NUMBER;
///
/// Memory Module Mismatch Extended Error Data
///
typedef struct {
EFI_STATUS_CODE_DIMM_NUMBER Instance;
} REPORT_STATUS_CODE_LIBRARY_MEMORY_MODULE_MISMATCH_ERROR_DATA;
///
/// Memory Range Extended Data
///
typedef struct {
EFI_PHYSICAL_ADDRESS Start;
EFI_PHYSICAL_ADDRESS Length;
} REPORT_STATUS_CODE_LIBRARY_MEMORY_RANGE_EXTENDED_DATA;
///
/// Device handle Extended Data. Used for many
/// errors and progress codes to point to the device.
///
typedef struct {
EFI_HANDLE Handle;
} REPORT_STATUS_CODE_LIBRARY_DEVICE_HANDLE_EXTENDED_DATA;
typedef struct {
UINT8 *DevicePath;
} REPORT_STATUS_CODE_LIBRARY_DEVICE_PATH_EXTENDED_DATA;
typedef struct {
EFI_HANDLE ControllerHandle;
EFI_HANDLE DriverBindingHandle;
UINT16 DevicePathSize;
UINT8 *RemainingDevicePath;
} REPORT_STATUS_CODE_LIBRARY_STATUS_CODE_START_EXTENDED_DATA;
///
/// Resource Allocation Failure Extended Error Data
///
typedef struct {
UINT32 Bar;
UINT16 DevicePathSize;
UINT16 ReqResSize;
UINT16 AllocResSize;
UINT8 *DevicePath;
UINT8 *ReqRes;
UINT8 *AllocRes;
} REPORT_STATUS_CODE_LIBRARY_RESOURCE_ALLOC_FAILURE_ERROR_DATA;
///
/// Extended Error Data for Assert
///
typedef struct {
UINT32 LineNumber;
UINT32 FileNameSize;
EFI_STATUS_CODE_STRING_DATA *FileName;
} REPORT_STATUS_CODE_LIBRARY_DEBUG_ASSERT_DATA;
///
/// System Context Data EBC/IA32/IPF
///
typedef struct {
EFI_STATUS_CODE_EXCEP_SYSTEM_CONTEXT Context;
} REPORT_STATUS_CODE_LIBRARY_STATUS_CODE_EXCEP_EXTENDED_DATA;
///
/// Legacy Oprom extended data
///
typedef struct {
EFI_HANDLE DeviceHandle;
EFI_PHYSICAL_ADDRESS RomImageBase;
} REPORT_STATUS_CODE_LIBRARY_LEGACY_OPROM_EXTENDED_DATA;
//
// Extern for the modules Caller ID GUID
//
extern EFI_GUID gEfiCallerIdGuid;
/**
Converts a status code to an 8-bit POST code value.
Converts the status code specified by CodeType and Value to an 8-bit POST code
and returns the 8-bit POST code in PostCode. If CodeType is an
EFI_PROGRESS_CODE or CodeType is an EFI_ERROR_CODE, then bits 0..4 of PostCode
are set to bits 16..20 of Value, and bits 5..7 of PostCode are set to bits
24..26 of Value., and TRUE is returned. Otherwise, FALSE is returned.
If PostCode is NULL, then ASSERT().
@param CodeType The type of status code being converted.
@param Value The status code value being converted.
@param PostCode A pointer to the 8-bit POST code value to return.
@retval TRUE The status code specified by CodeType and Value was converted
to an 8-bit POST code and returned in PostCode.
@retval FALSE The status code specified by CodeType and Value could not be
converted to an 8-bit POST code value.
**/
BOOLEAN
EFIAPI
GlueCodeTypeToPostCode (
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
OUT UINT8 *PostCode
);
/**
Extracts ASSERT() information from a status code structure.
Converts the status code specified by CodeType, Value, and Data to the ASSERT()
arguments specified by Filename, Description, and LineNumber. If CodeType is
an EFI_ERROR_CODE, and CodeType has a severity of EFI_ERROR_UNRECOVERED, and
Value has an operation mask of EFI_SW_EC_ILLEGAL_SOFTWARE_STATE, extract
Filename, Description, and LineNumber from the optional data area of the
status code buffer specified by Data. The optional data area of Data contains
a Null-terminated ASCII string for the FileName, followed by a Null-terminated
ASCII string for the Description, followed by a 32-bit LineNumber. If the
ASSERT() information could be extracted from Data, then return TRUE.
Otherwise, FALSE is returned.
If Data is NULL, then ASSERT().
If Filename is NULL, then ASSERT().
If Description is NULL, then ASSERT().
If LineNumber is NULL, then ASSERT().
@param CodeType The type of status code being converted.
@param Value The status code value being converted.
@param Data Pointer to status code data buffer.
@param Filename Pointer to the source file name that generated the ASSERT().
@param Description Pointer to the description of the ASSERT().
@param LineNumber Pointer to source line number that generated the ASSERT().
@retval TRUE The status code specified by CodeType, Value, and Data was
converted ASSERT() arguments specified by Filename, Description,
and LineNumber.
@retval FALSE The status code specified by CodeType, Value, and Data could
not be converted to ASSERT() arguments.
**/
BOOLEAN
EFIAPI
GlueReportStatusCodeExtractAssertInfo (
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN CONST EFI_STATUS_CODE_DATA *Data,
OUT CHAR8 **Filename,
OUT CHAR8 **Description,
OUT UINT32 *LineNumber
);
/**
Extracts DEBUG() information from a status code structure.
Converts the status code specified by Data to the DEBUG() arguments specified
by ErrorLevel, Marker, and Format. If type GUID in Data is
EFI_STATUS_CODE_DATA_TYPE_DEBUG_GUID, then extract ErrorLevel, Marker, and
Format from the optional data area of the status code buffer specified by Data.
The optional data area of Data contains a 32-bit ErrorLevel followed by Marker
which is 12 UINTN parameters, followed by a Null-terminated ASCII string for
the Format. If the DEBUG() information could be extracted from Data, then
return TRUE. Otherwise, FALSE is returned.
If Data is NULL, then ASSERT().
If ErrorLevel is NULL, then ASSERT().
If Marker is NULL, then ASSERT().
If Format is NULL, then ASSERT().
@param Data Pointer to status code data buffer.
@param ErrorLevel Pointer to error level mask for a debug message.
@param Marker Pointer to the variable argument list associated with Format.
@param Format Pointer to a Null-terminated ASCII format string of a
debug message.
@retval TRUE The status code specified by Data was converted DEBUG() arguments
specified by ErrorLevel, Marker, and Format.
@retval FALSE The status code specified by Data could not be converted to
DEBUG() arguments.
**/
BOOLEAN
EFIAPI
GlueReportStatusCodeExtractDebugInfo (
IN CONST EFI_STATUS_CODE_DATA *Data,
OUT UINT32 *ErrorLevel,
OUT VA_LIST *Marker,
OUT CHAR8 **Format
);
/**
Reports a status code.
Reports the status code specified by the parameters Type and Value. Status
code also require an instance, caller ID, and extended data. This function
passed in a zero instance, NULL extended data, and a caller ID of
gEfiCallerIdGuid, which is the GUID for the module.
ReportStatusCode()must actively prevent recusrsion. If ReportStatusCode()
is called while processing another any other Report Status Code Library function,
then ReportStatusCode() must return immediately.
@param Type Status code type.
@param Value Status code value.
@retval EFI_SUCCESS The status code was reported.
@retval EFI_DEVICE_ERROR There status code could not be reported due to a
device error.
@retval EFI_UNSUPPORTED Report status code is not supported
**/
EFI_STATUS
EFIAPI
GlueReportStatusCode (
IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value
);
/**
Reports a status code with a Device Path Protocol as the extended data.
Allocates and fills in the extended data section of a status code with the
Device Path Protocol specified by DevicePath. This function is responsible
for allocating a buffer large enough for the standard header and the device
path. The standard header is filled in with a GUID of
gEfiStatusCodeSpecificDataGuid. The status code is reported with a zero
instance and a caller ID of gEfiCallerIdGuid.
ReportStatusCodeWithDevicePath()must actively prevent recursion. If
ReportStatusCodeWithDevicePath() is called while processing another any other
Report Status Code Library function, then ReportStatusCodeWithDevicePath()
must return EFI_DEVICE_ERROR immediately.
If DevicePath is NULL, then ASSERT().
@param Type Status code type.
@param Value Status code value.
@param DevicePath Pointer to the Device Path Protocol to be reported.
@retval EFI_SUCCESS The status code was reported with the extended
data specified by DevicePath.
@retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the
extended data section.
@retval EFI_UNSUPPORTED Report status code is not supported
**/
EFI_STATUS
EFIAPI
GlueReportStatusCodeWithDevicePath (
IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value,
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
/**
Reports a status code with an extended data buffer.
Allocates and fills in the extended data section of a status code with the
extended data specified by ExtendedData and ExtendedDataSize. ExtendedData
is assumed to be one of the data structures specified in Related Definitions.
These data structure do not have the standard header, so this function is
responsible for allocating a buffer large enough for the standard header and
the extended data passed into this function. The standard header is filled
in with a GUID of gEfiStatusCodeSpecificDataGuid. The status code is reported
with a zero instance and a caller ID of gEfiCallerIdGuid.
ReportStatusCodeWithExtendedData()must actively prevent recursion. If
ReportStatusCodeWithExtendedData() is called while processing another any other
Report Status Code Library function, then ReportStatusCodeWithExtendedData()
must return EFI_DEVICE_ERROR immediately.
If ExtendedData is NULL, then ASSERT().
If ExtendedDataSize is 0, then ASSERT().
@param Type Status code type.
@param Value Status code value.
@param ExtendedData Pointer to the extended data buffer to be reported.
@param ExtendedDataSize The size, in bytes, of the extended data buffer to
be reported.
@retval EFI_SUCCESS The status code was reported with the extended
data specified by ExtendedData and ExtendedDataSize.
@retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the
extended data section.
@retval EFI_UNSUPPORTED Report status code is not supported
**/
EFI_STATUS
EFIAPI
GlueReportStatusCodeWithExtendedData (
IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value,
IN CONST VOID *ExtendedData,
IN UINTN ExtendedDataSize
);
/**
Reports a status code with full parameters.
The function reports a status code. If ExtendedData is NULL and ExtendedDataSize
is 0, then an extended data buffer is not reported. If ExtendedData is not
NULL and ExtendedDataSize is not 0, then an extended data buffer is allocated.
ExtendedData is assumed not have the standard status code header, so this function
is responsible for allocating a buffer large enough for the standard header and
the extended data passed into this function. The standard header is filled in
with a GUID specified by ExtendedDataGuid. If ExtendedDataGuid is NULL, then a
GUID of gEfiStatusCodeSpecificDatauid is used. The status code is reported with
an instance specified by Instance and a caller ID specified by CallerId. If
CallerId is NULL, then a caller ID of gEfiCallerIdGuid is used.
ReportStatusCodeEx()must actively prevent recursion. If ReportStatusCodeEx()
is called while processing another any other Report Status Code Library function,
then ReportStatusCodeEx() must return EFI_DEVICE_ERROR immediately.
If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().
If ExtendedData is not NULL and ExtendedDataSize is zero, then ASSERT().
@param Type Status code type.
@param Value Status code value.
@param Instance Status code instance number.
@param CallerId Pointer to a GUID that identifies the caller of this
function. If this parameter is NULL, then a caller
ID of gEfiCallerIdGuid is used.
@param ExtendedDataGuid Pointer to the GUID for the extended data buffer.
If this parameter is NULL, then a the status code
standard header is filled in with
gEfiStatusCodeSpecificDataGuid.
@param ExtendedData Pointer to the extended data buffer. This is an
optional parameter that may be NULL.
@param ExtendedDataSize The size, in bytes, of the extended data buffer.
@retval EFI_SUCCESS The status code was reported.
@retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate
the extended data section if it was specified.
@retval EFI_UNSUPPORTED Report status code is not supported
**/
EFI_STATUS
EFIAPI
GlueReportStatusCodeEx (
IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN CONST EFI_GUID *CallerId OPTIONAL,
IN CONST EFI_GUID *ExtendedDataGuid OPTIONAL,
IN CONST VOID *ExtendedData OPTIONAL,
IN UINTN ExtendedDataSize
);
/**
Returns TRUE if status codes of type EFI_PROGRESS_CODE are enabled
This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED
bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of
PcdReportStatusCodeProperyMask is set.
@retval FALSE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of
PcdReportStatusCodeProperyMask is clear.
**/
BOOLEAN
EFIAPI
GlueReportProgressCodeEnabled (
VOID
);
/**
Returns TRUE if status codes of type EFI_ERROR_CODE are enabled
This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED
bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of
PcdReportStatusCodeProperyMask is set.
@retval FALSE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of
PcdReportStatusCodeProperyMask is clear.
**/
BOOLEAN
EFIAPI
GlueReportErrorCodeEnabled (
VOID
);
/**
Returns TRUE if status codes of type EFI_DEBUG_CODE are enabled
This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED
bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of
PcdReportStatusCodeProperyMask is set.
@retval FALSE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of
PcdReportStatusCodeProperyMask is clear.
**/
BOOLEAN
EFIAPI
GlueReportDebugCodeEnabled (
VOID
);
/**
Reports a status code with minimal parameters if the status code type is enabled.
If the status code type specified by Type is enabled in
PcdReportStatusCodeProperyMask, then call ReportStatusCode() passing in Type
and Value.
@param Type Status code type.
@param Value Status code value.
@retval EFI_SUCCESS The status code was reported.
@retval EFI_DEVICE_ERROR There status code could not be reported due to a device error.
@retval EFI_UNSUPPORTED Report status code is not supported
**/
#define REPORT_STATUS_CODE(Type,Value) \
(ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \
ReportStatusCode(Type,Value) : \
(ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \
ReportStatusCode(Type,Value) : \
(ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \
ReportStatusCode(Type,Value) : \
EFI_UNSUPPORTED
/**
Reports a status code with a Device Path Protocol as the extended data if the
status code type is enabled.
If the status code type specified by Type is enabled in
PcdReportStatusCodeProperyMask, then call ReportStatusCodeWithDevicePath()
passing in Type, Value, and DevicePath.
@param Type Status code type.
@param Value Status code value.
@param DevicePath Pointer to the Device Path Protocol to be reported.
@retval EFI_SUCCESS The status code was reported with the extended
data specified by DevicePath.
@retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the
extended data section.
@retval EFI_UNSUPPORTED Report status code is not supported
**/
#define REPORT_STATUS_CODE_WITH_DEVICE_PATH(Type,Value,DevicePathParameter) \
(ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \
ReportStatusCodeWithDevicePath(Type,Value,DevicePathParameter) : \
(ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \
ReportStatusCodeWithDevicePath(Type,Value,DevicePathParameter) : \
(ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \
ReportStatusCodeWithDevicePath(Type,Value,DevicePathParameter) : \
EFI_UNSUPPORTED
/**
Reports a status code with an extended data buffer if the status code type
is enabled.
If the status code type specified by Type is enabled in
PcdReportStatusCodeProperyMask, then call ReportStatusCodeWithExtendedData()
passing in Type, Value, ExtendedData, and ExtendedDataSize.
@param Type Status code type.
@param Value Status code value.
@param ExtendedData Pointer to the extended data buffer to be reported.
@param ExtendedDataSize The size, in bytes, of the extended data buffer to
be reported.
@retval EFI_SUCCESS The status code was reported with the extended
data specified by ExtendedData and ExtendedDataSize.
@retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the
extended data section.
@retval EFI_UNSUPPORTED Report status code is not supported
**/
#define REPORT_STATUS_CODE_WITH_EXTENDED_DATA(Type,Value,ExtendedData,ExtendedDataSize) \
(ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \
ReportStatusCodeWithExtendedData(Type,Value,ExtendedData,ExtendedDataSize) : \
(ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \
ReportStatusCodeWithExtendedData(Type,Value,ExtendedData,ExtendedDataSize) : \
(ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \
ReportStatusCodeWithExtendedData(Type,Value,ExtendedData,ExtendedDataSize) : \
EFI_UNSUPPORTED
/**
Reports a status code specifying all parameters if the status code type is enabled.
If the status code type specified by Type is enabled in
PcdReportStatusCodeProperyMask, then call ReportStatusCodeEx() passing in Type,
Value, Instance, CallerId, ExtendedDataGuid, ExtendedData, and ExtendedDataSize.
@param Type Status code type.
@param Value Status code value.
@param Instance Status code instance number.
@param CallerId Pointer to a GUID that identifies the caller of this
function. If this parameter is NULL, then a caller
ID of gEfiCallerIdGuid is used.
@param ExtendedDataGuid Pointer to the GUID for the extended data buffer.
If this parameter is NULL, then a the status code
standard header is filled in with
gEfiStatusCodeSpecificDataGuid.
@param ExtendedData Pointer to the extended data buffer. This is an
optional parameter that may be NULL.
@param ExtendedDataSize The size, in bytes, of the extended data buffer.
@retval EFI_SUCCESS The status code was reported.
@retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the
extended data section if it was specified.
@retval EFI_UNSUPPORTED Report status code is not supported
**/
#define REPORT_STATUS_CODE_EX(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) \
(ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ? \
ReportStatusCodeEx(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) : \
(ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ? \
ReportStatusCodeEx(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) : \
(ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) ? \
ReportStatusCodeEx(Type,Value,Instance,CallerId,ExtendedDataGuid,ExtendedData,ExtendedDataSize) : \
EFI_UNSUPPORTED
#endif

View File

@@ -0,0 +1,50 @@
/*++
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:
EdkIIGlueResourcePublicationLib.h
Abstract:
Public header file for Resource Publication Lib
--*/
#ifndef __EDKII_GLUE_RESOURCE_PUBLICATION_LIB_H__
#define __EDKII_GLUE_RESOURCE_PUBLICATION_LIB_H__
/**
Declares the presence of permanent system memory in the platform.
Declares that the system memory buffer specified by MemoryBegin and MemoryLength
as permanent memory that may be used for general purpose use by software.
The amount of memory available to software may be less than MemoryLength
if published memory has alignment restrictions.
@param MemoryBegin The start address of the memory being declared.
@param MemoryLength The number of bytes of memory being declared.
@retval RETURN_SUCCESS The memory buffer was published.
@retval RETURN_OUT_OF_RESOURCES There are not enough resources to publish the memory buffer
**/
RETURN_STATUS
EFIAPI
PublishSystemMemory (
IN PHYSICAL_ADDRESS MemoryBegin,
IN UINT64 MemoryLength
)
;
#endif

View File

@@ -0,0 +1,394 @@
/*++
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:
EdkIIGlueSmbusLib.h
Abstract:
Public header file for Smbus Lib
--*/
#ifndef __EDKII_GLUE_SMBUS_LIB_H__
#define __EDKII_GLUE_SMBUS_LIB_H__
//
// PEC BIT is bit 22 in SMBUS address
//
#define SMBUS_LIB_PEC_BIT (1 << 22)
/**
Macro that converts SMBUS slave address, SMBUS command, SMBUS data length,
and PEC to a value that can be passed to the SMBUS Library functions.
Computes an address that is compatible with the SMBUS Library functions.
The unused upper bits of SlaveAddress, Command, and Length are stripped
prior to the generation of the address.
@param SlaveAddress SMBUS Slave Address. Range 0..127.
@param Command SMBUS Command. Range 0..255.
@param Length SMBUS Data Length. Range 0..32.
@param Pec TRUE if Packet Error Checking is enabled. Otherwise FALSE.
**/
#define SMBUS_LIB_ADDRESS(SlaveAddress,Command,Length,Pec) \
( ((Pec) ? SMBUS_LIB_PEC_BIT: 0) | \
(((SlaveAddress) & 0x7f) << 1) | \
(((Command) & 0xff) << 8) | \
(((Length) & 0x3f) << 16) \
)
/**
Executes an SMBUS quick read command.
Executes an SMBUS quick read command on the SMBUS device specified by SmBusAddress.
Only the SMBUS slave address field of SmBusAddress is required.
If Status is not NULL, then the status of the executed command is returned in Status.
If PEC is set in SmBusAddress, then ASSERT().
If Command in SmBusAddress is not zero, then ASSERT().
If Length in SmBusAddress is not zero, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().
@param SmBusAddress Address that encodes the SMBUS Slave Address,
SMBUS Command, SMBUS Data Length, and PEC.
@param Status Return status for the executed command.
This is an optional parameter and may be NULL.
**/
VOID
EFIAPI
SmBusQuickRead (
IN UINTN SmBusAddress,
OUT RETURN_STATUS *Status OPTIONAL
)
;
/**
Executes an SMBUS quick write command.
Executes an SMBUS quick write command on the SMBUS device specified by SmBusAddress.
Only the SMBUS slave address field of SmBusAddress is required.
If Status is not NULL, then the status of the executed command is returned in Status.
If PEC is set in SmBusAddress, then ASSERT().
If Command in SmBusAddress is not zero, then ASSERT().
If Length in SmBusAddress is not zero, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().
@param SmBusAddress Address that encodes the SMBUS Slave Address,
SMBUS Command, SMBUS Data Length, and PEC.
@param Status Return status for the executed command.
This is an optional parameter and may be NULL.
**/
VOID
EFIAPI
SmBusQuickWrite (
IN UINTN SmBusAddress,
OUT RETURN_STATUS *Status OPTIONAL
)
;
/**
Executes an SMBUS receive byte command.
Executes an SMBUS receive byte command on the SMBUS device specified by SmBusAddress.
Only the SMBUS slave address field of SmBusAddress is required.
The byte received from the SMBUS is returned.
If Status is not NULL, then the status of the executed command is returned in Status.
If Command in SmBusAddress is not zero, then ASSERT().
If Length in SmBusAddress is not zero, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().
@param SmBusAddress Address that encodes the SMBUS Slave Address,
SMBUS Command, SMBUS Data Length, and PEC.
@param Status Return status for the executed command.
This is an optional parameter and may be NULL.
@return The byte received from the SMBUS.
**/
UINT8
EFIAPI
SmBusReceiveByte (
IN UINTN SmBusAddress,
OUT RETURN_STATUS *Status OPTIONAL
)
;
/**
Executes an SMBUS send byte command.
Executes an SMBUS send byte command on the SMBUS device specified by SmBusAddress.
The byte specified by Value is sent.
Only the SMBUS slave address field of SmBusAddress is required. Value is returned.
If Status is not NULL, then the status of the executed command is returned in Status.
If Command in SmBusAddress is not zero, then ASSERT().
If Length in SmBusAddress is not zero, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().
@param SmBusAddress Address that encodes the SMBUS Slave Address,
SMBUS Command, SMBUS Data Length, and PEC.
@param Value The 8-bit value to send.
@param Status Return status for the executed command.
This is an optional parameter and may be NULL.
@return The parameter of Value.
**/
UINT8
EFIAPI
SmBusSendByte (
IN UINTN SmBusAddress,
IN UINT8 Value,
OUT RETURN_STATUS *Status OPTIONAL
)
;
/**
Executes an SMBUS read data byte command.
Executes an SMBUS read data byte command on the SMBUS device specified by SmBusAddress.
Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
The 8-bit value read from the SMBUS is returned.
If Status is not NULL, then the status of the executed command is returned in Status.
If Length in SmBusAddress is not zero, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().
@param SmBusAddress Address that encodes the SMBUS Slave Address,
SMBUS Command, SMBUS Data Length, and PEC.
@param Status Return status for the executed command.
This is an optional parameter and may be NULL.
@return The byte read from the SMBUS.
**/
UINT8
EFIAPI
SmBusReadDataByte (
IN UINTN SmBusAddress,
OUT RETURN_STATUS *Status OPTIONAL
)
;
/**
Executes an SMBUS write data byte command.
Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress.
The 8-bit value specified by Value is written.
Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
Value is returned.
If Status is not NULL, then the status of the executed command is returned in Status.
If Length in SmBusAddress is not zero, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().
@param SmBusAddress Address that encodes the SMBUS Slave Address,
SMBUS Command, SMBUS Data Length, and PEC.
@param Value The 8-bit value to write.
@param Status Return status for the executed command.
This is an optional parameter and may be NULL.
@return The parameter of Value.
**/
UINT8
EFIAPI
SmBusWriteDataByte (
IN UINTN SmBusAddress,
IN UINT8 Value,
OUT RETURN_STATUS *Status OPTIONAL
)
;
/**
Executes an SMBUS read data word command.
Executes an SMBUS read data word command on the SMBUS device specified by SmBusAddress.
Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
The 16-bit value read from the SMBUS is returned.
If Status is not NULL, then the status of the executed command is returned in Status.
If Length in SmBusAddress is not zero, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().
@param SmBusAddress Address that encodes the SMBUS Slave Address,
SMBUS Command, SMBUS Data Length, and PEC.
@param Status Return status for the executed command.
This is an optional parameter and may be NULL.
@return The byte read from the SMBUS.
**/
UINT16
EFIAPI
SmBusReadDataWord (
IN UINTN SmBusAddress,
OUT RETURN_STATUS *Status OPTIONAL
)
;
/**
Executes an SMBUS write data word command.
Executes an SMBUS write data word command on the SMBUS device specified by SmBusAddress.
The 16-bit value specified by Value is written.
Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
Value is returned.
If Status is not NULL, then the status of the executed command is returned in Status.
If Length in SmBusAddress is not zero, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().
@param SmBusAddress Address that encodes the SMBUS Slave Address,
SMBUS Command, SMBUS Data Length, and PEC.
@param Value The 16-bit value to write.
@param Status Return status for the executed command.
This is an optional parameter and may be NULL.
@return The parameter of Value.
**/
UINT16
EFIAPI
SmBusWriteDataWord (
IN UINTN SmBusAddress,
IN UINT16 Value,
OUT RETURN_STATUS *Status OPTIONAL
)
;
/**
Executes an SMBUS process call command.
Executes an SMBUS process call command on the SMBUS device specified by SmBusAddress.
The 16-bit value specified by Value is written.
Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
The 16-bit value returned by the process call command is returned.
If Status is not NULL, then the status of the executed command is returned in Status.
If Length in SmBusAddress is not zero, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().
@param SmBusAddress Address that encodes the SMBUS Slave Address,
SMBUS Command, SMBUS Data Length, and PEC.
@param Value The 16-bit value to write.
@param Status Return status for the executed command.
This is an optional parameter and may be NULL.
@return The 16-bit value returned by the process call command.
**/
UINT16
EFIAPI
SmBusProcessCall (
IN UINTN SmBusAddress,
IN UINT16 Value,
OUT RETURN_STATUS *Status OPTIONAL
)
;
/**
Executes an SMBUS read block command.
Executes an SMBUS read block command on the SMBUS device specified by SmBusAddress.
Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
Bytes are read from the SMBUS and stored in Buffer.
The number of bytes read is returned, and will never return a value larger than 32-bytes.
If Status is not NULL, then the status of the executed command is returned in Status.
It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read.
SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.
If Length in SmBusAddress is not zero, then ASSERT().
If Buffer is NULL, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().
@param SmBusAddress Address that encodes the SMBUS Slave Address,
SMBUS Command, SMBUS Data Length, and PEC.
@param Buffer Pointer to the buffer to store the bytes read from the SMBUS.
@param Status Return status for the executed command.
This is an optional parameter and may be NULL.
@return The number of bytes read.
**/
UINTN
EFIAPI
SmBusReadBlock (
IN UINTN SmBusAddress,
OUT VOID *Buffer,
OUT RETURN_STATUS *Status OPTIONAL
)
;
/**
Executes an SMBUS write block command.
Executes an SMBUS write block command on the SMBUS device specified by SmBusAddress.
The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.
Bytes are written to the SMBUS from Buffer.
The number of bytes written is returned, and will never return a value larger than 32-bytes.
If Status is not NULL, then the status of the executed command is returned in Status.
If Length in SmBusAddress is zero or greater than 32, then ASSERT().
If Buffer is NULL, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().
@param SmBusAddress Address that encodes the SMBUS Slave Address,
SMBUS Command, SMBUS Data Length, and PEC.
@param Buffer Pointer to the buffer to store the bytes read from the SMBUS.
@param Status Return status for the executed command.
This is an optional parameter and may be NULL.
@return The number of bytes written.
**/
UINTN
EFIAPI
SmBusWriteBlock (
IN UINTN SmBusAddress,
OUT VOID *Buffer,
OUT RETURN_STATUS *Status OPTIONAL
)
;
/**
Executes an SMBUS block process call command.
Executes an SMBUS block process call command on the SMBUS device specified by SmBusAddress.
The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.
Bytes are written to the SMBUS from WriteBuffer. Bytes are then read from the SMBUS into ReadBuffer.
If Status is not NULL, then the status of the executed command is returned in Status.
It is the caller's responsibility to make sure ReadBuffer is large enough for the total number of bytes read.
SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.
If Length in SmBusAddress is zero or greater than 32, then ASSERT().
If WriteBuffer is NULL, then ASSERT().
If ReadBuffer is NULL, then ASSERT().
If any reserved bits of SmBusAddress are set, then ASSERT().
@param SmBusAddress Address that encodes the SMBUS Slave Address,
SMBUS Command, SMBUS Data Length, and PEC.
@param WriteBuffer Pointer to the buffer of bytes to write to the SMBUS.
@param ReadBuffer Pointer to the buffer of bytes to read from the SMBUS.
@param Status Return status for the executed command.
This is an optional parameter and may be NULL.
@return The number of bytes written.
**/
UINTN
EFIAPI
SmBusBlockProcessCall (
IN UINTN SmBusAddress,
IN VOID *WriteBuffer,
OUT VOID *ReadBuffer,
OUT RETURN_STATUS *Status OPTIONAL
)
;
#endif

View File

@@ -0,0 +1,106 @@
/*++
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:
EdkIIGlueTimerLib.h
Abstract:
Public header file for Timer Lib
--*/
#ifndef __EDKII_GLUE_TIMER_LIB_H__
#define __EDKII_GLUE_TIMER_LIB_H__
/**
Stalls the CPU for at least the given number of microseconds.
Stalls the CPU for the number of microseconds specified by MicroSeconds.
@param MicroSeconds The minimum number of microseconds to delay.
@return MicroSeconds
**/
UINTN
EFIAPI
MicroSecondDelay (
IN UINTN MicroSeconds
);
/**
Stalls the CPU for at least the given number of nanoseconds.
Stalls the CPU for the number of nanoseconds specified by NanoSeconds.
@param NanoSeconds The minimum number of nanoseconds to delay.
@return NanoSeconds
**/
UINTN
EFIAPI
NanoSecondDelay (
IN UINTN NanoSeconds
);
/**
Retrieves the current value of a 64-bit free running performance counter.
Retrieves the current value of a 64-bit free running performance counter. The
counter can either count up by 1 or count down by 1. If the physical
performance counter counts by a larger increment, then the counter values
must be translated. The properties of the counter can be retrieved from
GetPerformanceCounterProperties().
@return The current value of the free running performance counter.
**/
UINT64
EFIAPI
GetPerformanceCounter (
VOID
);
/**
Retrieves the 64-bit frequency in Hz and the range of performance counter
values.
If StartValue is not NULL, then the value that the performance counter starts
with immediately after is it rolls over is returned in StartValue. If
EndValue is not NULL, then the value that the performance counter end with
immediately before it rolls over is returned in EndValue. The 64-bit
frequency of the performance counter in Hz is always returned. If StartValue
is less than EndValue, then the performance counter counts up. If StartValue
is greater than EndValue, then the performance counter counts down. For
example, a 64-bit free running counter that counts up would have a StartValue
of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter
that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.
@param StartValue The value the performance counter starts with when it
rolls over.
@param EndValue The value that the performance counter ends with before
it rolls over.
@return The frequency in Hz.
**/
UINT64
EFIAPI
GetPerformanceCounterProperties (
OUT UINT64 *StartValue, OPTIONAL
OUT UINT64 *EndValue OPTIONAL
);
#endif

View File

@@ -0,0 +1,41 @@
/*++
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:
EdkIIGlueUefiBootServicesTableLib.h
Abstract:
Public header file for UEFI Boot Services Table Lib
--*/
#ifndef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB_H__
#define __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB_H__
//
// Cache the Image Handle
//
extern EFI_HANDLE gImageHandle;
//
// Cache pointer to the EFI System Table
//
extern EFI_SYSTEM_TABLE *gST;
//
// Cache pointer to the EFI Boot Services Table
//
extern EFI_BOOT_SERVICES *gBS;
#endif

View File

@@ -0,0 +1,113 @@
/*++
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:
EdkIIGlueUefiDecompressLib.h
Abstract:
Public header file for UEFI Decompress Lib
--*/
#ifndef __EDKII_GLUE_UEFI_DECPOMPRESS_LIB_H__
#define __EDKII_GLUE_UEFI_DECPOMPRESS_LIB_H__
#define FillBuf(_SD, _NUMOFBITS) GlueFillBuf(_SD, _NUMOFBITS)
#define GetBits(_SD, _NUMOFBITS) GlueGetBits(_SD, _NUMOFBITS)
#define MakeTable(_SD, _NUMOFCHAR, _BITLEN, _TABLEBITS, _TABLE) GlueMakeTable(_SD, _NUMOFCHAR, _BITLEN, _TABLEBITS, _TABLE)
#define DecodeP(_SD) GlueDecodeP(_SD)
#define ReadPTLen( _SD, _NN, _NBIT, _SPECIAL) GlueReadPTLen( _SD, _NN, _NBIT, _SPECIAL)
#define ReadCLen(_SD) GlueReadCLen(_SD)
#define DecodeC(_SD) GlueDecodeC(_SD)
#define Decode(_SD) GlueDecode(_SD)
/**
Retrieves the size of the uncompressed buffer and the size of the scratch buffer.
Retrieves the size of the uncompressed buffer and the temporary scratch buffer
required to decompress the buffer specified by Source and SourceSize.
If the size of the uncompressed buffer or the size of the scratch buffer cannot
be determined from the compressed data specified by Source and SourceData,
then RETURN_INVALID_PARAMETER is returned. Otherwise, the size of the uncompressed
buffer is returned in DestinationSize, the size of the scratch buffer is returned
in ScratchSize, and RETURN_SUCCESS is returned.
This function does not have scratch buffer available to perform a thorough
checking of the validity of the source data. It just retrieves the "Original Size"
field from the beginning bytes of the source data and output it as DestinationSize.
And ScratchSize is specific to the decompression implementation.
If Source is NULL, then ASSERT().
If DestinationSize is NULL, then ASSERT().
If ScratchSize is NULL, then ASSERT().
@param Source The source buffer containing the compressed data.
@param SourceSize The size, in bytes, of the source buffer.
@param DestinationSize A pointer to the size, in bytes, of the uncompressed buffer
that will be generated when the compressed buffer specified
by Source and SourceSize is decompressed..
@param ScratchSize A pointer to the size, in bytes, of the scratch buffer that
is required to decompress the compressed buffer specified
by Source and SourceSize.
@retval RETURN_SUCCESS The size of destination buffer and the size of scratch
buffer are successull retrieved.
@retval RETURN_INVALID_PARAMETER The source data is corrupted
**/
RETURN_STATUS
EFIAPI
UefiDecompressGetInfo (
IN CONST VOID *Source,
IN UINT32 SourceSize,
OUT UINT32 *DestinationSize,
OUT UINT32 *ScratchSize
);
/**
Decompresses a compressed source buffer.
This function is designed so that the decompression algorithm can be implemented
without using any memory services. As a result, this function is not allowed to
call any memory allocation services in its implementation. It is the caller's r
esponsibility to allocate and free the Destination and Scratch buffers.
If the compressed source data specified by Source is sucessfully decompressed
into Destination, then RETURN_SUCCESS is returned. If the compressed source data
specified by Source is not in a valid compressed data format,
then RETURN_INVALID_PARAMETER is returned.
If Source is NULL, then ASSERT().
If Destination is NULL, then ASSERT().
If the required scratch buffer size > 0 and Scratch is NULL, then ASSERT().
@param Source The source buffer containing the compressed data.
@param Destination The destination buffer to store the decompressed data
@param Scratch A temporary scratch buffer that is used to perform the decompression.
This is an optional parameter that may be NULL if the
required scratch buffer size is 0.
@retval RETURN_SUCCESS Decompression is successfull
@retval RETURN_INVALID_PARAMETER The source data is corrupted
**/
RETURN_STATUS
EFIAPI
UefiDecompress (
IN CONST VOID *Source,
IN OUT VOID *Destination,
IN OUT VOID *Scratch
);
#endif

View File

@@ -0,0 +1,162 @@
/*++
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:
EdkIIGlueUefiDriverEntryPoint.h
Abstract:
Public header file for UEFI Driver Entry Point Lib
--*/
#ifndef __EDKII_GLUE_UEFI_DRIVER_ENTRY_POINT_H__
#define __EDKII_GLUE_UEFI_DRIVER_ENTRY_POINT_H__
//
// Declare the EFI/UEFI Specification Revision to which this driver is implemented
//
extern const UINT32 _gUefiDriverRevision;
//
// Declare the number of entry points in the image.
//
extern const UINT8 _gDriverEntryPointCount;
//
// Declare the number of unload handler in the image.
//
extern const UINT8 _gDriverUnloadImageCount;
//
// Declare the arrary of Boot Sevice Exit Event callbacks .
//
extern const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[];
//
// Declare the arrary of Virtual Address Change Event callbacks .
//
extern const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[];
/**
Enrty point to DXE SMM Driver.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
@retval EFI_SUCCESS One or more of the drivers returned a success code.
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
**/
EFI_STATUS
EFIAPI
_ModuleEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
Enrty point wrapper of DXE Driver.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
@retval EFI_SUCCESS One or more of the drivers returned a success code.
@retval !EFI_SUCESS The return status from the last driver entry point in the list.
**/
EFI_STATUS
EFIAPI
EfiMain (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
Computes the cummulative return status for the driver entry point and perform
a long jump back into DriverEntryPoint().
@param Status Status returned by the driver that is exiting.
**/
VOID
EFIAPI
ExitDriver (
IN EFI_STATUS Status
);
/**
Call constructs for all libraries. Automatics Generated by tool.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
**/
VOID
EFIAPI
ProcessLibraryConstructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
Call destructors for all libraries. Automatics Generated by tool.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
**/
VOID
EFIAPI
ProcessLibraryDestructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
Call the list of driver entry points. Automatics Generated by tool.
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
@return Status returned by entry points of drivers.
**/
EFI_STATUS
EFIAPI
ProcessModuleEntryPointList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
Call the unload handlers for all the modules. Automatics Generated by tool.
@param ImageHandle ImageHandle of the loaded driver.
@return Status returned by unload handlers of drivers.
**/
EFI_STATUS
EFIAPI
ProcessModuleUnloadList (
IN EFI_HANDLE ImageHandle
);
#endif

View File

@@ -0,0 +1,53 @@
/*++
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:
EdkIIGlueUefiDriverModelLib.h
Abstract:
Public header file for UEFI Driver Model Lib
--*/
#ifndef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB_H__
#define __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB_H__
//
// Declare bitmask values for the protocols that are enabled
//
#define UEFI_DRIVER_MODEL_LIBRARY_COMPONENT_NAME_PROTOCOL_ENABLED 0x01
#define UEFI_DRIVER_MODEL_LIBRARY_DRIVER_DIAGNOSTICS_PROTOCOL_ENABLED 0x02
#define UEFI_DRIVER_MODEL_LIBRARY_DRIVER_CONFIGURATION_PROTOCOL_ENABLED 0x04
//
// Data structure that declares pointers to the Driver Model
// Protocols.
//
typedef struct {
const EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
const EFI_COMPONENT_NAME2_PROTOCOL *ComponentName;
#else
const EFI_COMPONENT_NAME_PROTOCOL *ComponentName;
#endif
const EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration;
const EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics;
} EFI_DRIVER_MODEL_PROTOCOL_LIST;
//
// UEFI Driver Model Protocols arrary
//
extern const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverModelProtocolList[];
#endif

View File

@@ -0,0 +1,722 @@
/*++
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:
EdkIIGlueUefiLib.h
Abstract:
Public header file for UEFI Lib
--*/
#ifndef __EDKII_GLUE_UEFI_LIB_H__
#define __EDKII_GLUE_UEFI_LIB_H__
#define EfiInitializeLock(_LOCK, _PRIORITY) GlueEfiInitializeLock(_LOCK, _PRIORITY)
#define EfiAcquireLock(_LOCK) GlueEfiAcquireLock(_LOCK)
#define EfiAcquireLockOrFail(_LOCK) GlueEfiAcquireLockOrFail(_LOCK)
#define EfiReleaseLock(_LOCK) GlueEfiReleaseLock(_LOCK)
#define GetGlyphWidth(_UNICODECHAR) GlueGetGlyphWidth(_UNICODECHAR)
#define EfiCreateEventLegacyBoot(_LEGACYBOOT) GlueEfiCreateEventLegacyBoot(_LEGACYBOOT)
#define EfiCreateEventReadyToBoot(_READYTOBOOTEVENT) GlueEfiCreateEventReadyToBoot(_READYTOBOOTEVENT)
#define EfiGetNameGuidFromFwVolDevicePathNode(_FVDEVICEPATHNODE) GlueEfiGetNameGuidFromFwVolDevicePathNode(_FVDEVICEPATHNODE)
#define EfiInitializeFwVolDevicepathNode(_FVDEVICEPATHNODE, _NAMEGUID) GlueEfiInitializeFwVolDevicepathNode(_FVDEVICEPATHNODE, _NAMEGUID)
//
// EFI Lock Status
//
typedef enum {
EfiLockUninitialized = 0,
EfiLockReleased = 1,
EfiLockAcquired = 2
} EFI_LOCK_STATE;
/**
This function searches the list of configuration tables stored in the EFI System
Table for a table with a GUID that matches TableGuid. If a match is found,
then a pointer to the configuration table is returned in Table, and EFI_SUCCESS
is returned. If a matching GUID is not found, then EFI_NOT_FOUND is returned.
@param TableGuid Pointer to table's GUID type..
@param Table Pointer to the table associated with TableGuid in the EFI System Table.
@retval EFI_SUCCESS A configuration table matching TableGuid was found.
@retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.
**/
EFI_STATUS
EFIAPI
EfiGetSystemConfigurationTable (
IN EFI_GUID *TableGuid,
OUT VOID **Table
);
/**
This function causes the notification function to be executed for every protocol
of type ProtocolGuid instance that exists in the system when this function is
invoked. In addition, every time a protocol of type ProtocolGuid instance is
installed or reinstalled, the notification function is also executed.
@param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.
@param NotifyTpl Supplies the task priority level of the event notifications.
@param NotifyFunction Supplies the function to notify when the event is signaled.
@param NotifyContext The context parameter to pass to NotifyFunction.
@param Registration A pointer to a memory location to receive the registration value.
@return The notification event that was created.
**/
EFI_EVENT
EFIAPI
EfiCreateProtocolNotifyEvent(
IN EFI_GUID *ProtocolGuid,
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction,
IN VOID *NotifyContext, OPTIONAL
OUT VOID **Registration
);
/**
This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.
This event is signaled with EfiNamedEventSignal(). This provide the ability for
one or more listeners on the same event named by the GUID specified by Name.
@param Name Supplies GUID name of the event.
@param NotifyTpl Supplies the task priority level of the event notifications.
@param NotifyFunction Supplies the function to notify when the event is signaled.
@param NotifyContext The context parameter to pass to NotifyFunction.
@param Registration A pointer to a memory location to receive the registration value.
@retval EFI_SUCCESS A named event was created.
@retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.
**/
EFI_STATUS
EFIAPI
EfiNamedEventListen (
IN CONST EFI_GUID *Name,
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction,
IN CONST VOID *NotifyContext, OPTIONAL
OUT VOID *Registration OPTIONAL
);
/**
This function signals the named event specified by Name. The named event must
have been created with EfiNamedEventListen().
@param Name Supplies GUID name of the event.
@retval EFI_SUCCESS A named event was signaled.
@retval EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event.
**/
EFI_STATUS
EFIAPI
EfiNamedEventSignal (
IN CONST EFI_GUID *Name
);
/**
Returns the current TPL.
This function returns the current TPL. There is no EFI service to directly
retrieve the current TPL. Instead, the RaiseTPL() function is used to raise
the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level
can then immediately be restored back to the current TPL level with a call
to RestoreTPL().
@param VOID
@retvale EFI_TPL The current TPL.
**/
EFI_TPL
EFIAPI
EfiGetCurrentTpl (
VOID
);
/**
This function initializes a basic mutual exclusion lock to the released state
and returns the lock. Each lock provides mutual exclusion access at its task
priority level. Since there is no preemption or multiprocessor support in EFI,
acquiring the lock only consists of raising to the locks TPL.
@param Lock A pointer to the lock data structure to initialize.
@param Priority EFI TPL associated with the lock.
@return The lock.
**/
EFI_LOCK *
EFIAPI
GlueEfiInitializeLock (
IN OUT EFI_LOCK *Lock,
IN EFI_TPL Priority
);
/**
This macro initializes the contents of a basic mutual exclusion lock to the
released state. Each lock provides mutual exclusion access at its task
priority level. Since there is no preemption or multiprocessor support in EFI,
acquiring the lock only consists of raising to the locks TPL.
@param Lock A pointer to the lock data structure to initialize.
@param Priority The task priority level of the lock.
@return The lock.
**/
#ifdef EFI_INITIALIZE_LOCK_VARIABLE
#undef EFI_INITIALIZE_LOCK_VARIABLE
#endif
#define EFI_INITIALIZE_LOCK_VARIABLE(Priority) \
{Priority, EFI_TPL_APPLICATION, EfiLockReleased }
/**
Macro that calls DebugAssert() if an EFI_LOCK structure is not in the locked state.
If the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set,
then this macro evaluates the EFI_LOCK structure specified by Lock. If Lock
is not in the locked state, then DebugAssert() is called passing in the source
filename, source line number, and Lock.
If Lock is NULL, then ASSERT().
@param LockParameter A pointer to the lock to acquire.
**/
#ifdef ASSERT_LOCKED
#undef ASSERT_LOCKED
#endif
#define ASSERT_LOCKED(LockParameter) \
do { \
if (DebugAssertEnabled ()) { \
ASSERT (LockParameter != NULL); \
if ((LockParameter)->Lock != EfiLockAcquired) { \
_ASSERT (LockParameter not locked); \
} \
} \
} while (FALSE)
/**
This function raises the system's current task priority level to the task
priority level of the mutual exclusion lock. Then, it places the lock in the
acquired state.
@param Priority The task priority level of the lock.
**/
VOID
EFIAPI
GlueEfiAcquireLock (
IN EFI_LOCK *Lock
);
/**
This function raises the system's current task priority level to the task
priority level of the mutual exclusion lock. Then, it attempts to place the
lock in the acquired state.
@param Lock A pointer to the lock to acquire.
@retval EFI_SUCCESS The lock was acquired.
@retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.
**/
EFI_STATUS
EFIAPI
GlueEfiAcquireLockOrFail (
IN EFI_LOCK *Lock
);
/**
This function transitions a mutual exclusion lock from the acquired state to
the released state, and restores the system's task priority level to its
previous level.
@param Lock A pointer to the lock to release.
**/
VOID
EFIAPI
GlueEfiReleaseLock (
IN EFI_LOCK *Lock
);
/**
Tests whether a controller handle is being managed by a specific driver.
This function tests whether the driver specified by DriverBindingHandle is
currently managing the controller specified by ControllerHandle. This test
is performed by evaluating if the the protocol specified by ProtocolGuid is
present on ControllerHandle and is was opened by DriverBindingHandle with an
attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
If ProtocolGuid is NULL, then ASSERT().
@param ControllerHandle A handle for a controller to test.
@param DriverBindingHandle Specifies the driver binding handle for the
driver.
@param ProtocolGuid Specifies the protocol that the driver specified
by DriverBindingHandle opens in its Start()
function.
@retval EFI_SUCCESS ControllerHandle is managed by the driver
specifed by DriverBindingHandle.
@retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
specifed by DriverBindingHandle.
**/
EFI_STATUS
EFIAPI
EfiTestManagedDevice (
IN CONST EFI_HANDLE ControllerHandle,
IN CONST EFI_HANDLE DriverBindingHandle,
IN CONST EFI_GUID *ProtocolGuid
);
/**
Tests whether a child handle is a child device of the controller.
This function tests whether ChildHandle is one of the children of
ControllerHandle. This test is performed by checking to see if the protocol
specified by ProtocolGuid is present on ControllerHandle and opened by
ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
If ProtocolGuid is NULL, then ASSERT().
@param ControllerHandle A handle for a (parent) controller to test.
@param ChildHandle A child handle to test.
@param ConsumsedGuid Supplies the protocol that the child controller
opens on its parent controller.
@retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.
@retval EFI_UNSUPPORTED ChildHandle is not a child of the
ControllerHandle.
**/
EFI_STATUS
EFIAPI
EfiTestChildHandle (
IN CONST EFI_HANDLE ControllerHandle,
IN CONST EFI_HANDLE ChildHandle,
IN CONST EFI_GUID *ProtocolGuid
);
/**
This function looks up a Unicode string in UnicodeStringTable. If Language is
a member of SupportedLanguages and a Unicode string is found in UnicodeStringTable
that matches the language code specified by Language, then it is returned in
UnicodeString.
@param Language A pointer to the ISO 639-2 language code for the
Unicode string to look up and return.
@param SupportedLanguages A pointer to the set of ISO 639-2 language codes
that the Unicode string table supports. Language
must be a member of this set.
@param UnicodeStringTable A pointer to the table of Unicode strings.
@param UnicodeString A pointer to the Unicode string from UnicodeStringTable
that matches the language specified by Language.
@retval EFI_SUCCESS The Unicode string that matches the language
specified by Language was found
in the table of Unicoide strings UnicodeStringTable,
and it was returned in UnicodeString.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER UnicodeString is NULL.
@retval EFI_UNSUPPORTED SupportedLanguages is NULL.
@retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
@retval EFI_UNSUPPORTED The language specified by Language is not a
member of SupportedLanguages.
@retval EFI_UNSUPPORTED The language specified by Language is not
supported by UnicodeStringTable.
**/
EFI_STATUS
EFIAPI
LookupUnicodeString (
IN CONST CHAR8 *Language,
IN CONST CHAR8 *SupportedLanguages,
IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,
OUT CHAR16 **UnicodeString
);
/**
This function adds a Unicode string to UnicodeStringTable.
If Language is a member of SupportedLanguages then UnicodeString is added to
UnicodeStringTable. New buffers are allocated for both Language and
UnicodeString. The contents of Language and UnicodeString are copied into
these new buffers. These buffers are automatically freed when
FreeUnicodeStringTable() is called.
@param Language A pointer to the ISO 639-2 language code for the Unicode
string to add.
@param SupportedLanguages A pointer to the set of ISO 639-2 language codes
that the Unicode string table supports.
Language must be a member of this set.
@param UnicodeStringTable A pointer to the table of Unicode strings.
@param UnicodeString A pointer to the Unicode string to add.
@retval EFI_SUCCESS The Unicode string that matches the language
specified by Language was found in the table of
Unicode strings UnicodeStringTable, and it was
returned in UnicodeString.
@retval EFI_INVALID_PARAMETER Language is NULL.
@retval EFI_INVALID_PARAMETER UnicodeString is NULL.
@retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
@retval EFI_UNSUPPORTED SupportedLanguages is NULL.
@retval EFI_ALREADY_STARTED A Unicode string with language Language is
already present in UnicodeStringTable.
@retval EFI_OUT_OF_RESOURCES There is not enough memory to add another
Unicode string to UnicodeStringTable.
@retval EFI_UNSUPPORTED The language specified by Language is not a
member of SupportedLanguages.
**/
EFI_STATUS
EFIAPI
AddUnicodeString (
IN CONST CHAR8 *Language,
IN CONST CHAR8 *SupportedLanguages,
IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
IN CONST CHAR16 *UnicodeString
);
/**
This function frees the table of Unicode strings in UnicodeStringTable.
If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.
Otherwise, each language code, and each Unicode string in the Unicode string
table are freed, and EFI_SUCCESS is returned.
@param UnicodeStringTable A pointer to the table of Unicode strings.
@retval EFI_SUCCESS The Unicode string table was freed.
**/
EFI_STATUS
EFIAPI
FreeUnicodeStringTable (
IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable
);
/**
This function computes and returns the width of the Unicode character
specified by UnicodeChar.
@param UnicodeChar A Unicode character.
@retval 0 The width if UnicodeChar could not be determined.
@retval 1 UnicodeChar is a narrow glyph.
@retval 2 UnicodeChar is a wide glyph.
**/
UINTN
EFIAPI
GlueGetGlyphWidth (
IN CHAR16 UnicodeChar
);
/**
This function computes and returns the display length of
the Null-terminated Unicode string specified by String.
If String is NULL, then 0 is returned.
If any of the widths of the Unicode characters in String
can not be determined, then 0 is returned.
@param String A pointer to a Null-terminated Unicode string.
@return The display length of the Null-terminated Unicode string specified by String.
**/
UINTN
EFIAPI
UnicodeStringDisplayLength (
IN CONST CHAR16 *String
);
//
// Functions that abstract early Framework contamination of UEFI.
//
/**
Signal a Ready to Boot Event.
Create a Ready to Boot Event. Signal it and close it. This causes other
events of the same event group to be signaled in other modules.
**/
VOID
EFIAPI
EfiSignalEventReadyToBoot (
VOID
);
/**
Signal a Legacy Boot Event.
Create a legacy Boot Event. Signal it and close it. This causes other
events of the same event group to be signaled in other modules.
**/
VOID
EFIAPI
EfiSignalEventLegacyBoot (
VOID
);
/**
Create a Legacy Boot Event.
Tiano extended the CreateEvent Type enum to add a legacy boot event type.
This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
added and now it's possible to not voilate the UEFI specification by
declaring a GUID for the legacy boot event class. This library supports
the EDK/EFI 1.10 form and EDK II/UEFI 2.0 form and allows common code to
work both ways.
@param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
@retval EFI_SUCCESS Event was created.
@retval Other Event was not created.
**/
EFI_STATUS
EFIAPI
GlueEfiCreateEventLegacyBoot (
OUT EFI_EVENT *LegacyBootEvent
);
/**
Create an EFI event in the Legacy Boot Event Group and allows
the caller to specify a notification function.
This function abstracts the creation of the Legacy Boot Event.
The Framework moved from a proprietary to UEFI 2.0 based mechanism.
This library abstracts the caller from how this event is created to prevent
to code form having to change with the version of the specification supported.
If LegacyBootEvent is NULL, then ASSERT().
@param NotifyTpl The task priority level of the event.
@param NotifyFunction The notification function to call when the event is signaled.
@param NotifyContext The content to pass to NotifyFunction when the event is signaled.
@param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
@retval EFI_SUCCESS Event was created.
@retval Other Event was not created.
**/
EFI_STATUS
EFIAPI
EfiCreateEventLegacyBootEx (
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
IN VOID *NotifyContext, OPTIONAL
OUT EFI_EVENT *LegacyBootEvent
);
/**
Create a Read to Boot Event.
Tiano extended the CreateEvent Type enum to add a ready to boot event type.
This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
added and now it's possible to not voilate the UEFI specification and use
the ready to boot event class defined in UEFI 2.0. This library supports
the EDK/EFI 1.10 form and EDKII/UEFI 2.0 form and allows common code to
work both ways.
@param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
@retval EFI_SUCCESS Event was created.
@retval Other Event was not created.
**/
EFI_STATUS
EFIAPI
GlueEfiCreateEventReadyToBoot (
OUT EFI_EVENT *ReadyToBootEvent
);
/**
Create an EFI event in the Ready To Boot Event Group and allows
the caller to specify a notification function.
This function abstracts the creation of the Ready to Boot Event.
The Framework moved from a proprietary to UEFI 2.0 based mechanism.
This library abstracts the caller from how this event is created to prevent
to code form having to change with the version of the specification supported.
If ReadyToBootEvent is NULL, then ASSERT().
@param NotifyTpl The task priority level of the event.
@param NotifyFunction The notification function to call when the event is signaled.
@param NotifyContext The content to pass to NotifyFunction when the event is signaled.
@param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
@retval EFI_SUCCESS Event was created.
@retval Other Event was not created.
**/
EFI_STATUS
EFIAPI
EfiCreateEventReadyToBootEx (
IN EFI_TPL NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
IN VOID *NotifyContext, OPTIONAL
OUT EFI_EVENT *ReadyToBootEvent
);
/**
Initialize a Firmware Volume (FV) Media Device Path node.
Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum
so as we move to UEFI 2.0 support we must use a mechanism that conforms with
the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed
device path is defined for Tiano extensions of device path. If the code
is compiled to conform with the UEFI 2.0 specification use the new device path
else use the old form for backwards compatability.
@param FvDevicePathNode Pointer to a FV device path node to initialize
@param NameGuid FV file name to use in FvDevicePathNode
**/
VOID
EFIAPI
GlueEfiInitializeFwVolDevicepathNode (
IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,
IN CONST EFI_GUID *NameGuid
);
/**
Check to see if the Firmware Volume (FV) Media Device Path is valid
Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum
so as we move to UEFI 2.0 support we must use a mechanism that conforms with
the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed
device path is defined for Tiano extensions of device path. If the code
is compiled to conform with the UEFI 2.0 specification use the new device path
else use the old form for backwards compatability. The return value to this
function points to a location in FvDevicePathNode and it does not allocate
new memory for the GUID pointer that is returned.
@param FvDevicePathNode Pointer to FV device path to check.
@retval NULL FvDevicePathNode is not valid.
@retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.
**/
EFI_GUID *
EFIAPI
GlueEfiGetNameGuidFromFwVolDevicePathNode (
IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode
);
/**
Prints a formatted Unicode string to the console output device specified by
ConOut defined in the EFI_SYSTEM_TABLE.
This function prints a formatted Unicode string to the console output device
specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
characters that printed to ConOut. If the length of the formatted Unicode
string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
@param Format Null-terminated Unicode format string.
@param ... VARARG list consumed to process Format.
If Format is NULL, then ASSERT().
If Format is not aligned on a 16-bit boundary, then ASSERT().
**/
UINTN
EFIAPI
Print (
IN CONST CHAR16 *Format,
...
);
/**
Prints a formatted Unicode string to the console output device specified by
StdErr defined in the EFI_SYSTEM_TABLE.
This function prints a formatted Unicode string to the console output device
specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
characters that printed to StdErr. If the length of the formatted Unicode
string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
@param Format Null-terminated Unicode format string.
@param ... VARARG list consumed to process Format.
If Format is NULL, then ASSERT().
If Format is not aligned on a 16-bit boundary, then ASSERT().
**/
UINTN
EFIAPI
ErrorPrint (
IN CONST CHAR16 *Format,
...
);
/**
Prints a formatted ASCII string to the console output device specified by
ConOut defined in the EFI_SYSTEM_TABLE.
This function prints a formatted ASCII string to the console output device
specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
characters that printed to ConOut. If the length of the formatted ASCII
string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
@param Format Null-terminated ASCII format string.
@param ... VARARG list consumed to process Format.
If Format is NULL, then ASSERT().
If Format is not aligned on a 16-bit boundary, then ASSERT().
**/
UINTN
EFIAPI
AsciiPrint (
IN CONST CHAR8 *Format,
...
);
/**
Prints a formatted ASCII string to the console output device specified by
StdErr defined in the EFI_SYSTEM_TABLE.
This function prints a formatted ASCII string to the console output device
specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
characters that printed to StdErr. If the length of the formatted ASCII
string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
@param Format Null-terminated ASCII format string.
@param ... VARARG list consumed to process Format.
If Format is NULL, then ASSERT().
If Format is not aligned on a 16-bit boundary, then ASSERT().
**/
UINTN
EFIAPI
AsciiErrorPrint (
IN CONST CHAR8 *Format,
...
);
#endif

View File

@@ -0,0 +1,31 @@
/*++
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:
EdkIIGlueUefiRuntimeServicesTableLib.h
Abstract:
Library that provides a global pointer to the UEFI Runtime Services Tables
--*/
#ifndef __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB_H__
#define __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB_H__
//
// Cached copy of the EFI Runtime Services Table
//
extern EFI_RUNTIME_SERVICES *gRT;
#endif

View File

@@ -0,0 +1,42 @@
/*++
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:
EdkIIGluePcd.h
Abstract:
Fixed-at-build PCD macro expansion definitions
--*/
#ifndef __EDKII_GLUE_PCD_H__
#define __EDKII_GLUE_PCD_H__
//
// Redefine Pcd functions into compile time hardcoded values
//
#define FixedPcdGet8(TokenName) __EDKII_GLUE_PCD_##TokenName##__
#define FixedPcdGet16(TokenName) __EDKII_GLUE_PCD_##TokenName##__
#define FixedPcdGet32(TokenName) __EDKII_GLUE_PCD_##TokenName##__
#define FixedPcdGet64(TokenName) __EDKII_GLUE_PCD_##TokenName##__
#define FixedPcdGetBool(TokenName) __EDKII_GLUE_PCD_##TokenName##__
#define PcdGet8(TokenName) __EDKII_GLUE_PCD_##TokenName##__
#define PcdGet16(TokenName) __EDKII_GLUE_PCD_##TokenName##__
#define PcdGet32(TokenName) __EDKII_GLUE_PCD_##TokenName##__
#define PcdGet64(TokenName) __EDKII_GLUE_PCD_##TokenName##__
#define PcdGetPtr(TokenName) __EDKII_GLUE_PCD_##TokenName##__
#define PcdGetBool(TokenName) __EDKII_GLUE_PCD_##TokenName##__
#endif

View File

@@ -0,0 +1,52 @@
/*++
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:
EdkIIGluePcdBaseLib.h
Abstract:
PCD vadues for library customization
--*/
#ifndef __EDKII_GLUE_PCD_BASE_LIB_H__
#define __EDKII_GLUE_PCD_BASE_LIB_H__
//
// Following Pcd values are hard coded at compile time.
// Override these through compiler option "/D" in PlatformTools.env if needed
//
#ifndef __EDKII_GLUE_PCD_PcdMaximumUnicodeStringLength__
#define __EDKII_GLUE_PCD_PcdMaximumUnicodeStringLength__ EDKII_GLUE_MaximumUnicodeStringLength
#endif
#ifndef __EDKII_GLUE_PCD_PcdMaximumAsciiStringLength__
#define __EDKII_GLUE_PCD_PcdMaximumAsciiStringLength__ EDKII_GLUE_MaximumAsciiStringLength
#endif
//
// SpinLock Pcds
//
#ifndef __EDKII_GLUE_PCD_PcdSpinLockTimeout__
#define __EDKII_GLUE_PCD_PcdSpinLockTimeout__ EDKII_GLUE_SpinLockTimeout
#endif
// Linked List
#ifndef __EDKII_GLUE_PCD_PcdMaximumLinkedListLength__
#define __EDKII_GLUE_PCD_PcdMaximumLinkedListLength__ EDKII_GLUE_MaximumLinkedListLength
#endif
#include "Pcd/EdkIIGluePcd.h"
#endif

View File

@@ -0,0 +1,50 @@
/*++
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:
EdkIIGluePcdDebugLib.h
Abstract:
PCD values for library customization
--*/
#ifndef __EDKII_GLUE_PCD_DEBUG_LIB_H__
#define __EDKII_GLUE_PCD_DEBUG_LIB_H__
//
// Following Pcd values are hard coded at compile time.
// Override these through compiler option "/D" in PlatformTools.env if needed
//
//
// Debug Pcds
//
#ifndef __EDKII_GLUE_PCD_PcdDebugPrintErrorLevel__
#define __EDKII_GLUE_PCD_PcdDebugPrintErrorLevel__ EDKII_GLUE_DebugPrintErrorLevel
#endif
#ifndef __EDKII_GLUE_PCD_PcdDebugPropertyMask__
#define __EDKII_GLUE_PCD_PcdDebugPropertyMask__ EDKII_GLUE_DebugPropertyMask
#endif
#ifndef __EDKII_GLUE_PCD_PcdDebugClearMemoryValue__
#define __EDKII_GLUE_PCD_PcdDebugClearMemoryValue__ EDKII_GLUE_DebugClearMemoryValue
#endif
#include "Pcd/EdkIIGluePcd.h"
#endif

View File

@@ -0,0 +1,42 @@
/*++
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:
EdkIIGluePcdIoLib.h
Abstract:
PCD values for library customization
--*/
#ifndef __EDKII_GLUE_PCD_IO_LIB_H__
#define __EDKII_GLUE_PCD_IO_LIB_H__
//
// Following Pcd values are hard coded at compile time.
// Override these through compiler option "/D" in PlatformTools.env if needed
//
//
// IoBlockBaseAddressForIpf Pcd
//
#ifdef MDE_CPU_IPF
#ifndef __EDKII_GLUE_PCD_PcdIoBlockBaseAddressForIpf__
#define __EDKII_GLUE_PCD_PcdIoBlockBaseAddressForIpf__ EDKII_GLUE_IoBlockBaseAddressForIpf
#endif
#endif
#include "Pcd/EdkIIGluePcd.h"
#endif

View File

@@ -0,0 +1,40 @@
/*++
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:
EdkIIGluePcdPciExpressLib.h
Abstract:
PCD values for library customization
--*/
#ifndef __EDKII_GLUE_PCD_PCI_EXPRESS_LIB_H__
#define __EDKII_GLUE_PCD_PCI_EXPRESS_LIB_H__
//
// Following Pcd values are hard coded at compile time.
// Override these through compiler option "/D" in PlatformTools.env if needed
//
//
// PciExpress Pcds
//
#ifndef __EDKII_GLUE_PCD_PcdPciExpressBaseAddress__
#define __EDKII_GLUE_PCD_PcdPciExpressBaseAddress__ EDKII_GLUE_PciExpressBaseAddress
#endif
#include "Pcd/EdkIIGluePcd.h"
#endif

View File

@@ -0,0 +1,40 @@
/*++
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:
EdkIIGluePcdPostCodeLib.h
Abstract:
PCD values for library customization
--*/
#ifndef __EDKII_GLUE_PCD_POST_CODE_LIB_H__
#define __EDKII_GLUE_PCD_POST_CODE_LIB_H__
//
// Following Pcd values are hard coded at compile time.
// Override these through compiler option "/D" in PlatformTools.env if needed
//
//
// PostCode Pcds
//
#ifndef __EDKII_GLUE_PCD_PcdPostCodePropertyMask__
#define __EDKII_GLUE_PCD_PcdPostCodePropertyMask__ EDKII_GLUE_PostCodePropertyMask
#endif
#include "Pcd/EdkIIGluePcd.h"
#endif

View File

@@ -0,0 +1,40 @@
/*++
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:
EdkIIGluePcdReportStatusCodeLib.h
Abstract:
Pcd values for library customization
--*/
#ifndef __EDKII_GLUE_PCD_REPORT_STATUS_CODE_LIB_H__
#define __EDKII_GLUE_PCD_REPORT_STATUS_CODE_LIB_H__
//
// Following Pcd values are hard coded at compile time.
// Override these through compiler option "/D" in PlatformTools.env if needed
//
//
// ReportStatusCode Pcds
//
#ifndef __EDKII_GLUE_PCD_PcdReportStatusCodePropertyMask__
#define __EDKII_GLUE_PCD_PcdReportStatusCodePropertyMask__ EDKII_GLUE_ReportStatusCodePropertyMask
#endif
#include "Pcd/EdkIIGluePcd.h"
#endif

View File

@@ -0,0 +1,40 @@
/*++
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:
EdkIIGluePcdTimerLib.h
Abstract:
PCD values for library customization
--*/
#ifndef __EDKII_GLUE_PCD_TIMER_LIB_H__
#define __EDKII_GLUE_PCD_TIMER_LIB_H__
//
// Following Pcd values are hard coded at compile time.
// Override these through compiler option "/D" in PlatformTools.env if needed
//
//
// Timer Lib Pcds
//
#ifndef __EDKII_GLUE_PCD_PcdFSBClock__
#define __EDKII_GLUE_PCD_PcdFSBClock__ EDKII_GLUE_FSBClock
#endif
#include "Pcd/EdkIIGluePcd.h"
#endif

View File

@@ -0,0 +1,34 @@
/*++
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:
PeimDepex.h
Abstract:
This file is used by .dxs file. To write common .dxs for R8.x and R9, a
header file named PeimDepex.h musted be present.
--*/
#ifndef __EDKII_GLUELIB_PEIMDEPEX_H__
#define __EDKII_GLUELIB_PEIMDEPEX_H__
//
// this file is used by .dxs file, just a place holder
//
#endif

View File

@@ -0,0 +1,41 @@
/*++
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:
EdkIIGlueProcessorBind.h
Abstract:
Processor specific definitions
--*/
#ifndef __EDKII_GLUE_PROCESSOR_BIND_H__
#define __EDKII_GLUE_PROCESSOR_BIND_H__
//
// The Microsoft* C compiler can removed references to unreferenced data items
// if the /OPT:REF linker option is used. We defined a macro as this is a
// a non standard extension
//
#if _MSC_EXTENSIONS
#define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
#else
#define GLOBAL_REMOVE_IF_UNREFERENCED
#endif
#ifndef MDE_CPU_X64
#define MDE_CPU_X64
#endif
#endif

View File

@@ -0,0 +1,81 @@
#/*++
#
# 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:
#
# BaseCacheMaintenanceLib.inf
#
# Abstract:
#
# Component description file for BaseCacheMaintenanceLib.
#
#--*/
[defines]
BASE_NAME = EdkIIGlueBaseCacheMaintenanceLib
COMPONENT_TYPE = LIBRARY
[sources.common]
[sources.ia32]
x86Cache.c
[sources.x64]
x86Cache.c
[sources.ipf]
IpfCache.c
[sources.ebc]
EbcCache.c
[includes.common]
.
..\..\Include
..\..\Include\Library
$(EDK_SOURCE)\Foundation
$(EDK_SOURCE)\Foundation\Framework
$(EDK_SOURCE)\Foundation\Efi
$(EDK_SOURCE)\Foundation\Include
$(EDK_SOURCE)\Foundation\Efi\Include
$(EDK_SOURCE)\Foundation\Framework\Include
$(EDK_SOURCE)\Foundation\Include\IndustryStandard
$(EDK_SOURCE)\Foundation\Core\Dxe
$(EDK_SOURCE)\Foundation\Library\Dxe\Include
$(EDK_SOURCE)\Foundation\Cpu\Pentium\Include
[libraries.common]
EdkIIGlueBaseLib
[libraries.ia32]
[libraries.x64]
[nmake.common]
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006
[nmake.ia32]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
[nmake.x64]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_X64
[nmake.ipf]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IPF
[nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC

View File

@@ -0,0 +1,241 @@
/*++
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:
x86Cache.c
Abstract:
Cache Maintenance Functions.
--*/
#include "EdkIIGlueBase.h"
/**
Invalidates the entire instruction cache in cache coherency domain of the
calling CPU.
Invalidates the entire instruction cache in cache coherency domain of the
calling CPU.
**/
VOID
EFIAPI
GlueInvalidateInstructionCache (
VOID
)
{
}
/**
Invalidates a range of instruction cache lines in the cache coherency domain
of the calling CPU.
Invalidates the instruction cache lines specified by Address and Length. If
Address is not aligned on a cache line boundary, then entire instruction
cache line containing Address is invalidated. If Address + Length is not
aligned on a cache line boundary, then the entire instruction cache line
containing Address + Length -1 is invalidated. This function may choose to
invalidate the entire instruction cache if that is more efficient than
invalidating the specified range. If Length is 0, the no instruction cache
lines are invalidated. Address is returned.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the instruction cache lines to
invalidate. If the CPU is in a physical addressing mode, then
Address is a physical address. If the CPU is in a virtual
addressing mode, then Address is a virtual address.
@param Length The number of bytes to invalidate from the instruction cache.
@return Address
**/
VOID *
EFIAPI
InvalidateInstructionCacheRange (
IN VOID *Address,
IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
return Address;
}
/**
Writes Back and Invalidates the entire data cache in cache coherency domain
of the calling CPU.
Writes Back and Invalidates the entire data cache in cache coherency domain
of the calling CPU. This function guarantees that all dirty cache lines are
written back to system memory, and also invalidates all the data cache lines
in the cache coherency domain of the calling CPU.
**/
VOID
EFIAPI
WriteBackInvalidateDataCache (
VOID
)
{
}
/**
Writes Back and Invalidates a range of data cache lines in the cache
coherency domain of the calling CPU.
Writes Back and Invalidate the data cache lines specified by Address and
Length. If Address is not aligned on a cache line boundary, then entire data
cache line containing Address is written back and invalidated. If Address +
Length is not aligned on a cache line boundary, then the entire data cache
line containing Address + Length -1 is written back and invalidated. This
function may choose to write back and invalidate the entire data cache if
that is more efficient than writing back and invalidating the specified
range. If Length is 0, the no data cache lines are written back and
invalidated. Address is returned.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the data cache lines to write back and
invalidate. If the CPU is in a physical addressing mode, then
Address is a physical address. If the CPU is in a virtual
addressing mode, then Address is a virtual address.
@param Length The number of bytes to write back and invalidate from the
data cache.
@return Address
**/
VOID *
EFIAPI
WriteBackInvalidateDataCacheRange (
IN VOID *Address,
IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
return Address;
}
/**
Writes Back the entire data cache in cache coherency domain of the calling
CPU.
Writes Back the entire data cache in cache coherency domain of the calling
CPU. This function guarantees that all dirty cache lines are written back to
system memory. This function may also invalidate all the data cache lines in
the cache coherency domain of the calling CPU.
**/
VOID
EFIAPI
WriteBackDataCache (
VOID
)
{
}
/**
Writes Back a range of data cache lines in the cache coherency domain of the
calling CPU.
Writes Back the data cache lines specified by Address and Length. If Address
is not aligned on a cache line boundary, then entire data cache line
containing Address is written back. If Address + Length is not aligned on a
cache line boundary, then the entire data cache line containing Address +
Length -1 is written back. This function may choose to write back the entire
data cache if that is more efficient than writing back the specified range.
If Length is 0, the no data cache lines are written back. This function may
also invalidate all the data cache lines in the specified range of the cache
coherency domain of the calling CPU. Address is returned.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the data cache lines to write back. If
the CPU is in a physical addressing mode, then Address is a
physical address. If the CPU is in a virtual addressing
mode, then Address is a virtual address.
@param Length The number of bytes to write back from the data cache.
@return Address
**/
VOID *
EFIAPI
WriteBackDataCacheRange (
IN VOID *Address,
IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
return Address;
}
/**
Invalidates the entire data cache in cache coherency domain of the calling
CPU.
Invalidates the entire data cache in cache coherency domain of the calling
CPU. This function must be used with care because dirty cache lines are not
written back to system memory. It is typically used for cache diagnostics. If
the CPU does not support invalidation of the entire data cache, then a write
back and invalidate operation should be performed on the entire data cache.
**/
VOID
EFIAPI
InvalidateDataCache (
VOID
)
{
}
/**
Invalidates a range of data cache lines in the cache coherency domain of the
calling CPU.
Invalidates the data cache lines specified by Address and Length. If Address
is not aligned on a cache line boundary, then entire data cache line
containing Address is invalidated. If Address + Length is not aligned on a
cache line boundary, then the entire data cache line containing Address +
Length -1 is invalidated. This function must never invalidate any cache lines
outside the specified range. If Length is 0, the no data cache lines are
invalidated. Address is returned. This function must be used with care
because dirty cache lines are not written back to system memory. It is
typically used for cache diagnostics. If the CPU does not support
invalidation of a data cache range, then a write back and invalidate
operation should be performed on the data cache range.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the data cache lines to invalidate. If
the CPU is in a physical addressing mode, then Address is a
physical address. If the CPU is in a virtual addressing mode,
then Address is a virtual address.
@param Length The number of bytes to invalidate from the data cache.
@return Address
**/
VOID *
EFIAPI
InvalidateDataCacheRange (
IN VOID *Address,
IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
return Address;
}

View File

@@ -0,0 +1,245 @@
/*++
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:
x86Cache.c
Abstract:
Cache Maintenance Functions.
--*/
#include "EdkIIGlueBase.h"
/**
Invalidates the entire instruction cache in cache coherency domain of the
calling CPU.
Invalidates the entire instruction cache in cache coherency domain of the
calling CPU.
**/
VOID
EFIAPI
GlueInvalidateInstructionCache (
VOID
)
{
PalCallStatic (NULL, 1, 1, 1, 0);
}
/**
Invalidates a range of instruction cache lines in the cache coherency domain
of the calling CPU.
Invalidates the instruction cache lines specified by Address and Length. If
Address is not aligned on a cache line boundary, then entire instruction
cache line containing Address is invalidated. If Address + Length is not
aligned on a cache line boundary, then the entire instruction cache line
containing Address + Length -1 is invalidated. This function may choose to
invalidate the entire instruction cache if that is more efficient than
invalidating the specified range. If Length is 0, the no instruction cache
lines are invalidated. Address is returned.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the instruction cache lines to
invalidate. If the CPU is in a physical addressing mode, then
Address is a physical address. If the CPU is in a virtual
addressing mode, then Address is a virtual address.
@param Length The number of bytes to invalidate from the instruction cache.
@return Address
**/
VOID *
EFIAPI
InvalidateInstructionCacheRange (
IN VOID *Address,
IN UINTN Length
)
{
return IpfFlushCacheRange (Address, Length);
}
/**
Writes Back and Invalidates the entire data cache in cache coherency domain
of the calling CPU.
Writes Back and Invalidates the entire data cache in cache coherency domain
of the calling CPU. This function guarantees that all dirty cache lines are
written back to system memory, and also invalidates all the data cache lines
in the cache coherency domain of the calling CPU.
**/
VOID
EFIAPI
WriteBackInvalidateDataCache (
VOID
)
{
PalCallStatic (NULL, 1, 2, 1, 0);
}
/**
Writes Back and Invalidates a range of data cache lines in the cache
coherency domain of the calling CPU.
Writes Back and Invalidate the data cache lines specified by Address and
Length. If Address is not aligned on a cache line boundary, then entire data
cache line containing Address is written back and invalidated. If Address +
Length is not aligned on a cache line boundary, then the entire data cache
line containing Address + Length -1 is written back and invalidated. This
function may choose to write back and invalidate the entire data cache if
that is more efficient than writing back and invalidating the specified
range. If Length is 0, the no data cache lines are written back and
invalidated. Address is returned.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the data cache lines to write back and
invalidate. If the CPU is in a physical addressing mode, then
Address is a physical address. If the CPU is in a virtual
addressing mode, then Address is a virtual address.
@param Length The number of bytes to write back and invalidate from the
data cache.
@return Address
**/
VOID *
EFIAPI
WriteBackInvalidateDataCacheRange (
IN VOID *Address,
IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
return IpfFlushCacheRange (Address, Length);
}
/**
Writes Back the entire data cache in cache coherency domain of the calling
CPU.
Writes Back the entire data cache in cache coherency domain of the calling
CPU. This function guarantees that all dirty cache lines are written back to
system memory. This function may also invalidate all the data cache lines in
the cache coherency domain of the calling CPU.
**/
VOID
EFIAPI
WriteBackDataCache (
VOID
)
{
PalCallStatic (NULL, 1, 2, 0, 0);
}
/**
Writes Back a range of data cache lines in the cache coherency domain of the
calling CPU.
Writes Back the data cache lines specified by Address and Length. If Address
is not aligned on a cache line boundary, then entire data cache line
containing Address is written back. If Address + Length is not aligned on a
cache line boundary, then the entire data cache line containing Address +
Length -1 is written back. This function may choose to write back the entire
data cache if that is more efficient than writing back the specified range.
If Length is 0, the no data cache lines are written back. This function may
also invalidate all the data cache lines in the specified range of the cache
coherency domain of the calling CPU. Address is returned.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the data cache lines to write back. If
the CPU is in a physical addressing mode, then Address is a
physical address. If the CPU is in a virtual addressing
mode, then Address is a virtual address.
@param Length The number of bytes to write back from the data cache.
@return Address
**/
VOID *
EFIAPI
WriteBackDataCacheRange (
IN VOID *Address,
IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
return IpfFlushCacheRange (Address, Length);
}
/**
Invalidates the entire data cache in cache coherency domain of the calling
CPU.
Invalidates the entire data cache in cache coherency domain of the calling
CPU. This function must be used with care because dirty cache lines are not
written back to system memory. It is typically used for cache diagnostics. If
the CPU does not support invalidation of the entire data cache, then a write
back and invalidate operation should be performed on the entire data cache.
**/
VOID
EFIAPI
InvalidateDataCache (
VOID
)
{
WriteBackInvalidateDataCache ();
}
/**
Invalidates a range of data cache lines in the cache coherency domain of the
calling CPU.
Invalidates the data cache lines specified by Address and Length. If Address
is not aligned on a cache line boundary, then entire data cache line
containing Address is invalidated. If Address + Length is not aligned on a
cache line boundary, then the entire data cache line containing Address +
Length -1 is invalidated. This function must never invalidate any cache lines
outside the specified range. If Length is 0, the no data cache lines are
invalidated. Address is returned. This function must be used with care
because dirty cache lines are not written back to system memory. It is
typically used for cache diagnostics. If the CPU does not support
invalidation of a data cache range, then a write back and invalidate
operation should be performed on the data cache range.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the data cache lines to invalidate. If
the CPU is in a physical addressing mode, then Address is a
physical address. If the CPU is in a virtual addressing mode,
then Address is a virtual address.
@param Length The number of bytes to invalidate from the data cache.
@return Address
**/
VOID *
EFIAPI
InvalidateDataCacheRange (
IN VOID *Address,
IN UINTN Length
)
{
return IpfFlushCacheRange (Address, Length);
}

View File

@@ -0,0 +1,262 @@
/*++
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:
x86Cache.c
Abstract:
Cache Maintenance Functions.
--*/
#include "EdkIIGlueBase.h"
//
// This size must be at or below the smallest cache size possible among all
// supported processors
//
#define CACHE_LINE_SIZE 0x20
/**
Invalidates the entire instruction cache in cache coherency domain of the
calling CPU.
Invalidates the entire instruction cache in cache coherency domain of the
calling CPU.
**/
VOID
EFIAPI
GlueInvalidateInstructionCache (
VOID
)
{
}
/**
Invalidates a range of instruction cache lines in the cache coherency domain
of the calling CPU.
Invalidates the instruction cache lines specified by Address and Length. If
Address is not aligned on a cache line boundary, then entire instruction
cache line containing Address is invalidated. If Address + Length is not
aligned on a cache line boundary, then the entire instruction cache line
containing Address + Length -1 is invalidated. This function may choose to
invalidate the entire instruction cache if that is more efficient than
invalidating the specified range. If Length is 0, the no instruction cache
lines are invalidated. Address is returned.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the instruction cache lines to
invalidate. If the CPU is in a physical addressing mode, then
Address is a physical address. If the CPU is in a virtual
addressing mode, then Address is a virtual address.
@param Length The number of bytes to invalidate from the instruction cache.
@return Address
**/
VOID *
EFIAPI
InvalidateInstructionCacheRange (
IN VOID *Address,
IN UINTN Length
)
{
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
return Address;
}
/**
Writes Back and Invalidates the entire data cache in cache coherency domain
of the calling CPU.
Writes Back and Invalidates the entire data cache in cache coherency domain
of the calling CPU. This function guarantees that all dirty cache lines are
written back to system memory, and also invalidates all the data cache lines
in the cache coherency domain of the calling CPU.
**/
VOID
EFIAPI
WriteBackInvalidateDataCache (
VOID
)
{
AsmWbinvd ();
}
/**
Writes Back and Invalidates a range of data cache lines in the cache
coherency domain of the calling CPU.
Writes Back and Invalidate the data cache lines specified by Address and
Length. If Address is not aligned on a cache line boundary, then entire data
cache line containing Address is written back and invalidated. If Address +
Length is not aligned on a cache line boundary, then the entire data cache
line containing Address + Length -1 is written back and invalidated. This
function may choose to write back and invalidate the entire data cache if
that is more efficient than writing back and invalidating the specified
range. If Length is 0, the no data cache lines are written back and
invalidated. Address is returned.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the data cache lines to write back and
invalidate. If the CPU is in a physical addressing mode, then
Address is a physical address. If the CPU is in a virtual
addressing mode, then Address is a virtual address.
@param Length The number of bytes to write back and invalidate from the
data cache.
@return Address
**/
VOID *
EFIAPI
WriteBackInvalidateDataCacheRange (
IN VOID *Address,
IN UINTN Length
)
{
UINTN Start, End;
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
if (Length == 0) {
return Address;
}
Start = (UINTN)Address;
End = (Start + Length + (CACHE_LINE_SIZE - 1)) & ~(CACHE_LINE_SIZE - 1);
Start &= ~(CACHE_LINE_SIZE - 1);
do {
Start = (UINTN)AsmFlushCacheLine ((VOID*)Start) + CACHE_LINE_SIZE;
} while (Start != End);
return Address;
}
/**
Writes Back the entire data cache in cache coherency domain of the calling
CPU.
Writes Back the entire data cache in cache coherency domain of the calling
CPU. This function guarantees that all dirty cache lines are written back to
system memory. This function may also invalidate all the data cache lines in
the cache coherency domain of the calling CPU.
**/
VOID
EFIAPI
WriteBackDataCache (
VOID
)
{
WriteBackInvalidateDataCache ();
}
/**
Writes Back a range of data cache lines in the cache coherency domain of the
calling CPU.
Writes Back the data cache lines specified by Address and Length. If Address
is not aligned on a cache line boundary, then entire data cache line
containing Address is written back. If Address + Length is not aligned on a
cache line boundary, then the entire data cache line containing Address +
Length -1 is written back. This function may choose to write back the entire
data cache if that is more efficient than writing back the specified range.
If Length is 0, the no data cache lines are written back. This function may
also invalidate all the data cache lines in the specified range of the cache
coherency domain of the calling CPU. Address is returned.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the data cache lines to write back. If
the CPU is in a physical addressing mode, then Address is a
physical address. If the CPU is in a virtual addressing
mode, then Address is a virtual address.
@param Length The number of bytes to write back from the data cache.
@return Address
**/
VOID *
EFIAPI
WriteBackDataCacheRange (
IN VOID *Address,
IN UINTN Length
)
{
return WriteBackInvalidateDataCacheRange (Address, Length);
}
/**
Invalidates the entire data cache in cache coherency domain of the calling
CPU.
Invalidates the entire data cache in cache coherency domain of the calling
CPU. This function must be used with care because dirty cache lines are not
written back to system memory. It is typically used for cache diagnostics. If
the CPU does not support invalidation of the entire data cache, then a write
back and invalidate operation should be performed on the entire data cache.
**/
VOID
EFIAPI
InvalidateDataCache (
VOID
)
{
AsmInvd ();
}
/**
Invalidates a range of data cache lines in the cache coherency domain of the
calling CPU.
Invalidates the data cache lines specified by Address and Length. If Address
is not aligned on a cache line boundary, then entire data cache line
containing Address is invalidated. If Address + Length is not aligned on a
cache line boundary, then the entire data cache line containing Address +
Length -1 is invalidated. This function must never invalidate any cache lines
outside the specified range. If Length is 0, the no data cache lines are
invalidated. Address is returned. This function must be used with care
because dirty cache lines are not written back to system memory. It is
typically used for cache diagnostics. If the CPU does not support
invalidation of a data cache range, then a write back and invalidate
operation should be performed on the data cache range.
If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
@param Address The base address of the data cache lines to invalidate. If
the CPU is in a physical addressing mode, then Address is a
physical address. If the CPU is in a virtual addressing mode,
then Address is a virtual address.
@param Length The number of bytes to invalidate from the data cache.
@return Address
**/
VOID *
EFIAPI
InvalidateDataCacheRange (
IN VOID *Address,
IN UINTN Length
)
{
return WriteBackInvalidateDataCacheRange (Address, Length);
}

View File

@@ -0,0 +1,79 @@
#/*++
#
# 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:
#
# BaseDebugLibNull.inf
#
# Abstract:
#
# Component description file for BaseDebugLibNull.
#
#--*/
[defines]
BASE_NAME = EdkIIGlueBaseDebugLibNull
COMPONENT_TYPE = LIBRARY
[sources.common]
DebugLib.c
[sources.ia32]
[sources.x64]
[sources.ipf]
[sources.ebc]
[includes.common]
.
..\..\Include
..\..\Include\Library
$(EDK_SOURCE)\Foundation
$(EDK_SOURCE)\Foundation\Framework
$(EDK_SOURCE)\Foundation\Efi
$(EDK_SOURCE)\Foundation\Include
$(EDK_SOURCE)\Foundation\Efi\Include
$(EDK_SOURCE)\Foundation\Framework\Include
$(EDK_SOURCE)\Foundation\Include\IndustryStandard
$(EDK_SOURCE)\Foundation\Core\Dxe
$(EDK_SOURCE)\Foundation\Library\Dxe\Include
$(EDK_SOURCE)\Foundation\Cpu\Pentium\Include
[libraries.common]
EdkIIGlueBaseLib
EdkIIGlueBaseMemoryLib
EdkIIGlueBasePrintLib
[libraries.ia32]
[libraries.x64]
[nmake.common]
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006
[nmake.ia32]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
[nmake.x64]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_X64
[nmake.ipf]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IPF
[nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC

View File

@@ -0,0 +1,193 @@
/*++
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:
DebugLib.c
Abstract:
Base Debug Library that uses PrintLib to print messages to a memory buffer.
--*/
#include "EdkIIGlueBase.h"
/**
Prints a debug message to the debug output device if the specified error level is enabled.
If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print
the message specified by Format and the associated variable argument list to
the debug output device.
If Format is NULL, then ASSERT().
@param ErrorLevel The error level of the debug message.
@param Format Format string for the debug message to print.
**/
VOID
EFIAPI
DebugPrint (
IN UINTN ErrorLevel,
IN CONST CHAR8 *Format,
...
)
{
}
/**
Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop.
Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"
to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of
PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if
DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then
CpuDeadLoop() is called. If neither of these bits are set, then this function
returns immediately after the message is printed to the debug output device.
DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while
processing another DebugAssert(), then DebugAssert() must return immediately.
If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.
If Description is NULL, then a <Description> string of "(NULL) Description" is printed.
@param FileName Pointer to the name of the source file that generated the assert condition.
@param LineNumber The line number in the source file that generated the assert condition
@param Description Pointer to the description of the assert condition.
**/
VOID
EFIAPI
DebugAssert (
IN CONST CHAR8 *FileName,
IN UINTN LineNumber,
IN CONST CHAR8 *Description
)
{
}
/**
Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
This function fills Length bytes of Buffer with the value specified by
PcdDebugClearMemoryValue, and returns Buffer.
If Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
@param Buffer Pointer to the target buffer to fill with PcdDebugClearMemoryValue.
@param Length Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue.
@return Buffer
**/
VOID *
EFIAPI
DebugClearMemory (
OUT VOID *Buffer,
IN UINTN Length
)
{
return Buffer;
}
/**
Returns TRUE if ASSERT() macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugAssertEnabled (
VOID
)
{
return FALSE;
}
/**
Returns TRUE if DEBUG()macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugPrintEnabled (
VOID
)
{
return FALSE;
}
/**
Returns TRUE if DEBUG_CODE()macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugCodeEnabled (
VOID
)
{
return FALSE;
}
/**
Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugClearMemoryEnabled (
VOID
)
{
return FALSE;
}

View File

@@ -0,0 +1,85 @@
#/*++
#
# 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:
#
# BaseIoLibIntrinsic.inf
#
# Abstract:
#
# Component description file for BaseIoLibIntrinsic.
#
#--*/
[defines]
BASE_NAME = EdkIIGlueBaseIoLibIntrinsic
COMPONENT_TYPE = LIBRARY
[sources.common]
[sources.ia32]
IoLib.c
IoLibMsc.c
IoHighLevel.c
[sources.x64]
IoLib.c
IoLibMsc.c
IoHighLevel.c
[sources.ipf]
IoLibIpf.c
IoHighLevel.c
[sources.ebc]
# doesn't support EBC
[includes.common]
.
..\..\Include
..\..\include\Library
$(EDK_SOURCE)\Foundation
$(EDK_SOURCE)\Foundation\Framework
$(EDK_SOURCE)\Foundation\Efi
$(EDK_SOURCE)\Foundation\Include
$(EDK_SOURCE)\Foundation\Efi\Include
$(EDK_SOURCE)\Foundation\Framework\Include
$(EDK_SOURCE)\Foundation\Include\IndustryStandard
$(EDK_SOURCE)\Foundation\Core\Dxe
$(EDK_SOURCE)\Foundation\Library\Dxe\Include
$(EDK_SOURCE)\Foundation\Cpu\Pentium\Include
[libraries.common]
EdkIIGlueBaseLib
[libraries.ia32]
[libraries.x64]
[nmake.common]
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006
[nmake.ia32]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
[nmake.x64]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_X64
[nmake.ipf]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IPF
[nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC

View File

@@ -0,0 +1,74 @@
/*++
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:
IoLib.c
Abstract:
Common I/O Library routines.
--*/
#include "EdkIIGlueBase.h"
/**
Reads a 64-bit I/O port.
Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
This function must guarantee that all I/O read and write operations are
serialized.
If 64-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to read.
@return The value read.
**/
UINT64
EFIAPI
IoRead64 (
IN UINTN Port
)
{
ASSERT (FALSE);
return 0;
}
/**
Writes a 64-bit I/O port.
Writes the 64-bit I/O port specified by Port with the value specified by Value
and returns Value. This function must guarantee that all I/O read and write
operations are serialized.
If 64-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@return The value written the I/O port.
**/
UINT64
EFIAPI
IoWrite64 (
IN UINTN Port,
IN UINT64 Value
)
{
ASSERT (FALSE);
return 0;
}

View File

@@ -0,0 +1,490 @@
/*++
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:
IoLibIpf.c
Abstract:
--*/
#include "EdkIIGlueBase.h"
#define BIT63 0x8000000000000000UL
#define MAP_PORT_BASE_TO_MEM(_Port) \
((((_Port) & 0xfffc) << 10) | ((_Port) & 0x0fff))
/**
Reads a 8-bit I/O port.
Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
This function must guarantee that all I/O read and write operations are
serialized.
@param Port The I/O port to read.
@return The value read.
**/
UINT8
EFIAPI
IoRead8 (
IN UINT64 Port
)
{
UINT64 Address;
//
// Add the 64MB aligned IO Port space to the IO address
//
Address = MAP_PORT_BASE_TO_MEM (Port);
Address += PcdGet64(PcdIoBlockBaseAddressForIpf);
return MmioRead8 (Address);
}
/**
Reads a 16-bit I/O port.
Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
This function must guarantee that all I/O read and write operations are
serialized.
@param Port The I/O port to read.
@return The value read.
**/
UINT16
EFIAPI
IoRead16 (
IN UINT64 Port
)
{
UINT64 Address;
//
// Add the 64MB aligned IO Port space to the IO address
//
Address = MAP_PORT_BASE_TO_MEM (Port);
Address += PcdGet64(PcdIoBlockBaseAddressForIpf);
return MmioRead16 (Address);
}
/**
Reads a 32-bit I/O port.
Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
This function must guarantee that all I/O read and write operations are
serialized.
@param Port The I/O port to read.
@return The value read.
**/
UINT32
EFIAPI
IoRead32 (
IN UINT64 Port
)
{
UINT64 Address;
//
// Add the 64MB aligned IO Port space to the IO address
//
Address = MAP_PORT_BASE_TO_MEM (Port);
Address += PcdGet64(PcdIoBlockBaseAddressForIpf);
return MmioRead32 (Address);
}
/**
Reads a 64-bit I/O port.
Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
This function must guarantee that all I/O read and write operations are
serialized.
If 64-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to read.
@return The value read.
**/
UINT64
EFIAPI
IoRead64 (
IN UINTN Port
)
{
ASSERT (FALSE);
return 0;
}
/**
Writes a 8-bit I/O port.
Writes the 8-bit I/O port specified by Port with the value specified by Value
and returns Value. This function must guarantee that all I/O read and write
operations are serialized.
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@return The value written the I/O port.
**/
UINT8
EFIAPI
IoWrite8 (
IN UINT64 Port,
IN UINT8 Data
)
{
UINT64 Address;
//
// Add the 64MB aligned IO Port space to the IO address
//
Address = MAP_PORT_BASE_TO_MEM (Port);
Address += PcdGet64(PcdIoBlockBaseAddressForIpf);
return MmioWrite8 (Address, Data);
}
/**
Writes a 16-bit I/O port.
Writes the 16-bit I/O port specified by Port with the value specified by Value
and returns Value. This function must guarantee that all I/O read and write
operations are serialized.
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@return The value written the I/O port.
**/
UINT16
EFIAPI
IoWrite16 (
IN UINT64 Port,
IN UINT16 Data
)
{
UINT64 Address;
//
// Add the 64MB aligned IO Port space to the IO address
//
Address = MAP_PORT_BASE_TO_MEM (Port);
Address += PcdGet64(PcdIoBlockBaseAddressForIpf);
return MmioWrite16 (Address, Data);
}
/**
Writes a 32-bit I/O port.
Writes the 32-bit I/O port specified by Port with the value specified by Value
and returns Value. This function must guarantee that all I/O read and write
operations are serialized.
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@return The value written the I/O port.
**/
UINT32
EFIAPI
IoWrite32 (
IN UINT64 Port,
IN UINT32 Data
)
{
UINT64 Address;
//
// Add the 64MB aligned IO Port space to the IO address
//
Address = MAP_PORT_BASE_TO_MEM (Port);
Address += PcdGet64(PcdIoBlockBaseAddressForIpf);
return MmioWrite32 (Address, Data);
}
/**
Writes a 64-bit I/O port.
Writes the 64-bit I/O port specified by Port with the value specified by Value
and returns Value. This function must guarantee that all I/O read and write
operations are serialized.
If 64-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@return The value written the I/O port.
**/
UINT64
EFIAPI
IoWrite64 (
IN UINTN Port,
IN UINT64 Value
)
{
ASSERT (FALSE);
return 0;
}
/**
Reads a 8-bit MMIO register.
Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
returned. This function must guarantee that all MMIO read and write
operations are serialized.
@param Address The MMIO register to read.
@return The value read.
**/
UINT8
EFIAPI
MmioRead8 (
IN UINT64 Address
)
{
UINT8 Data;
Address |= BIT63;
MemoryFence ();
Data = *((volatile UINT8 *) Address);
MemoryFence ();
return Data;
}
/**
Reads a 16-bit MMIO register.
Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
returned. This function must guarantee that all MMIO read and write
operations are serialized.
@param Address The MMIO register to read.
@return The value read.
**/
UINT16
EFIAPI
MmioRead16 (
IN UINT64 Address
)
{
UINT16 Data;
Address |= BIT63;
MemoryFence ();
Data = *((volatile UINT16 *) Address);
MemoryFence ();
return Data;
}
/**
Reads a 32-bit MMIO register.
Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
returned. This function must guarantee that all MMIO read and write
operations are serialized.
@param Address The MMIO register to read.
@return The value read.
**/
UINT32
EFIAPI
MmioRead32 (
IN UINT64 Address
)
{
UINT32 Data;
Address |= BIT63;
MemoryFence ();
Data = *((volatile UINT32 *) Address);
MemoryFence ();
return Data;
}
/**
Reads a 64-bit MMIO register.
Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
returned. This function must guarantee that all MMIO read and write
operations are serialized.
@param Address The MMIO register to read.
@return The value read.
**/
UINT64
EFIAPI
MmioRead64 (
IN UINT64 Address
)
{
UINT64 Data;
Address |= BIT63;
MemoryFence ();
Data = *((volatile UINT64 *) Address);
MemoryFence ();
return Data;
}
/**
Writes a 8-bit MMIO register.
Writes the 8-bit MMIO register specified by Address with the value specified
by Value and returns Value. This function must guarantee that all MMIO read
and write operations are serialized.
@param Address The MMIO register to write.
@param Data The value to write to the MMIO register.
@return The value written the memory address.
**/
UINT8
EFIAPI
MmioWrite8 (
IN UINT64 Address,
IN UINT8 Data
)
{
Address |= BIT63;
MemoryFence ();
*((volatile UINT8 *) Address) = Data;
MemoryFence ();
return Data;
}
/**
Writes a 16-bit MMIO register.
Writes the 16-bit MMIO register specified by Address with the value specified
by Value and returns Value. This function must guarantee that all MMIO read
and write operations are serialized.
@param Address The MMIO register to write.
@param Data The value to write to the MMIO register.
@return The value written the memory address.
**/
UINT16
EFIAPI
MmioWrite16 (
IN UINT64 Address,
IN UINT16 Data
)
{
Address |= BIT63;
MemoryFence ();
*((volatile UINT16 *) Address) = Data;
MemoryFence ();
return Data;
}
/**
Writes a 32-bit MMIO register.
Writes the 32-bit MMIO register specified by Address with the value specified
by Value and returns Value. This function must guarantee that all MMIO read
and write operations are serialized.
@param Address The MMIO register to write.
@param Data The value to write to the MMIO register.
@return The value written the memory address.
**/
UINT32
EFIAPI
MmioWrite32 (
IN UINT64 Address,
IN UINT32 Data
)
{
Address |= BIT63;
MemoryFence ();
*((volatile UINT32 *) Address) = Data;
MemoryFence ();
return Data;
}
/**
Writes a 64-bit MMIO register.
Writes the 64-bit MMIO register specified by Address with the value specified
by Value and returns Value. This function must guarantee that all MMIO read
and write operations are serialized.
@param Address The MMIO register to write.
@param Data The value to write to the MMIO register.
@return The value written the memory address.
**/
UINT64
EFIAPI
MmioWrite64 (
IN UINT64 Address,
IN UINT64 Data
)
{
Address |= BIT63;
MemoryFence ();
*((volatile UINT64 *) Address) = Data;
MemoryFence ();
return Data;
}

View File

@@ -0,0 +1,436 @@
/*++
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:
IoLibMsc.c
Abstract:
I/O Library. This file has compiler specifics for Microsft C as there is no
ANSI C standard for doing IO.
MSC - uses intrinsic functions and the optimize will remove the function call
overhead.
We don't advocate putting compiler specifics in libraries or drivers but there
is no other way to make this work.
--*/
#include "EdkIIGlueBase.h"
#if _MSC_EXTENSIONS
//
// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics
//
int _inp (unsigned short port);
unsigned short _inpw (unsigned short port);
unsigned long _inpd (unsigned short port);
int _outp (unsigned short port, int databyte );
unsigned short _outpw (unsigned short port, unsigned short dataword );
unsigned long _outpd (unsigned short port, unsigned long dataword );
void _ReadWriteBarrier (void);
#pragma intrinsic(_inp)
#pragma intrinsic(_inpw)
#pragma intrinsic(_inpd)
#pragma intrinsic(_outp)
#pragma intrinsic(_outpw)
#pragma intrinsic(_outpd)
#pragma intrinsic(_ReadWriteBarrier)
//
// _ReadWriteBarrier() forces memory reads and writes to complete at the point
// in the call. This is only a hint to the compiler and does emit code.
// In past versions of the compiler, _ReadWriteBarrier was enforced only
// locally and did not affect functions up the call tree. In Visual C++
// 2005, _ReadWriteBarrier is enforced all the way up the call tree.
//
/**
Reads an 8-bit I/O port.
Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
This function must guarantee that all I/O read and write operations are
serialized.
If 8-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to read.
@return The value read.
**/
UINT8
EFIAPI
GlueIoRead8 (
IN UINTN Port
)
{
UINT8 Value;
_ReadWriteBarrier ();
Value = (UINT8)_inp ((UINT16)Port);
_ReadWriteBarrier ();
return Value;
}
/**
Writes an 8-bit I/O port.
Writes the 8-bit I/O port specified by Port with the value specified by Value
and returns Value. This function must guarantee that all I/O read and write
operations are serialized.
If 8-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@return The value written the I/O port.
**/
UINT8
EFIAPI
GlueIoWrite8 (
IN UINTN Port,
IN UINT8 Value
)
{
_ReadWriteBarrier ();
(UINT8)_outp ((UINT16)Port, Value);
_ReadWriteBarrier ();
return Value;
}
/**
Reads a 16-bit I/O port.
Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
This function must guarantee that all I/O read and write operations are
serialized.
If 16-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to read.
@return The value read.
**/
UINT16
EFIAPI
GlueIoRead16 (
IN UINTN Port
)
{
UINT16 Value;
ASSERT ((Port & 1) == 0);
_ReadWriteBarrier ();
Value = _inpw ((UINT16)Port);
_ReadWriteBarrier ();
return Value;
}
/**
Writes a 16-bit I/O port.
Writes the 16-bit I/O port specified by Port with the value specified by Value
and returns Value. This function must guarantee that all I/O read and write
operations are serialized.
If 16-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@return The value written the I/O port.
**/
UINT16
EFIAPI
GlueIoWrite16 (
IN UINTN Port,
IN UINT16 Value
)
{
ASSERT ((Port & 1) == 0);
_ReadWriteBarrier ();
_outpw ((UINT16)Port, Value);
_ReadWriteBarrier ();
return Value;
}
/**
Reads a 32-bit I/O port.
Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
This function must guarantee that all I/O read and write operations are
serialized.
If 32-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to read.
@return The value read.
**/
UINT32
EFIAPI
GlueIoRead32 (
IN UINTN Port
)
{
UINT32 Value;
ASSERT ((Port & 3) == 0);
_ReadWriteBarrier ();
Value = _inpd ((UINT16)Port);
_ReadWriteBarrier ();
return Value;
}
/**
Writes a 32-bit I/O port.
Writes the 32-bit I/O port specified by Port with the value specified by Value
and returns Value. This function must guarantee that all I/O read and write
operations are serialized.
If 32-bit I/O port operations are not supported, then ASSERT().
@param Port The I/O port to write.
@param Value The value to write to the I/O port.
@return The value written the I/O port.
**/
UINT32
EFIAPI
GlueIoWrite32 (
IN UINTN Port,
IN UINT32 Value
)
{
ASSERT ((Port & 3) == 0);
_ReadWriteBarrier ();
_outpd ((UINT16)Port, Value);
_ReadWriteBarrier ();
return Value;
}
/**
Reads an 8-bit MMIO register.
Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
returned. This function must guarantee that all MMIO read and write
operations are serialized.
If 8-bit MMIO register operations are not supported, then ASSERT().
@param Address The MMIO register to read.
@return The value read.
**/
UINT8
EFIAPI
MmioRead8 (
IN UINTN Address
)
{
UINT8 Value;
Value = *(volatile UINT8*)Address;
return Value;
}
/**
Writes an 8-bit MMIO register.
Writes the 8-bit MMIO register specified by Address with the value specified
by Value and returns Value. This function must guarantee that all MMIO read
and write operations are serialized.
If 8-bit MMIO register operations are not supported, then ASSERT().
@param Address The MMIO register to write.
@param Value The value to write to the MMIO register.
**/
UINT8
EFIAPI
MmioWrite8 (
IN UINTN Address,
IN UINT8 Value
)
{
return *(volatile UINT8*)Address = Value;
}
/**
Reads a 16-bit MMIO register.
Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
returned. This function must guarantee that all MMIO read and write
operations are serialized.
If 16-bit MMIO register operations are not supported, then ASSERT().
@param Address The MMIO register to read.
@return The value read.
**/
UINT16
EFIAPI
MmioRead16 (
IN UINTN Address
)
{
UINT16 Value;
ASSERT ((Address & 1) == 0);
Value = *(volatile UINT16*)Address;
return Value;
}
/**
Writes a 16-bit MMIO register.
Writes the 16-bit MMIO register specified by Address with the value specified
by Value and returns Value. This function must guarantee that all MMIO read
and write operations are serialized.
If 16-bit MMIO register operations are not supported, then ASSERT().
@param Address The MMIO register to write.
@param Value The value to write to the MMIO register.
**/
UINT16
EFIAPI
MmioWrite16 (
IN UINTN Address,
IN UINT16 Value
)
{
ASSERT ((Address & 1) == 0);
return *(volatile UINT16*)Address = Value;
}
/**
Reads a 32-bit MMIO register.
Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
returned. This function must guarantee that all MMIO read and write
operations are serialized.
If 32-bit MMIO register operations are not supported, then ASSERT().
@param Address The MMIO register to read.
@return The value read.
**/
UINT32
EFIAPI
MmioRead32 (
IN UINTN Address
)
{
UINT32 Value;
ASSERT ((Address & 3) == 0);
Value = *(volatile UINT32*)Address;
return Value;
}
/**
Writes a 32-bit MMIO register.
Writes the 32-bit MMIO register specified by Address with the value specified
by Value and returns Value. This function must guarantee that all MMIO read
and write operations are serialized.
If 32-bit MMIO register operations are not supported, then ASSERT().
@param Address The MMIO register to write.
@param Value The value to write to the MMIO register.
**/
UINT32
EFIAPI
MmioWrite32 (
IN UINTN Address,
IN UINT32 Value
)
{
ASSERT ((Address & 3) == 0);
return *(volatile UINT32*)Address = Value;
}
/**
Reads a 64-bit MMIO register.
Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
returned. This function must guarantee that all MMIO read and write
operations are serialized.
If 64-bit MMIO register operations are not supported, then ASSERT().
@param Address The MMIO register to read.
@return The value read.
**/
UINT64
EFIAPI
MmioRead64 (
IN UINTN Address
)
{
UINT64 Value;
ASSERT ((Address & 7) == 0);
Value = *(volatile UINT64*)Address;
return Value;
}
/**
Writes a 64-bit MMIO register.
Writes the 64-bit MMIO register specified by Address with the value specified
by Value and returns Value. This function must guarantee that all MMIO read
and write operations are serialized.
If 64-bit MMIO register operations are not supported, then ASSERT().
@param Address The MMIO register to write.
@param Value The value to write to the MMIO register.
**/
UINT64
EFIAPI
MmioWrite64 (
IN UINTN Address,
IN UINT64 Value
)
{
ASSERT ((Address & 7) == 0);
return *(volatile UINT64*)Address = Value;
}
#endif

View File

@@ -0,0 +1,49 @@
/*++
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:
ARShiftU64.c
Abstract:
Math worker functions.
--*/
#include "BaseLibInternal.h"
/**
Shifts a 64-bit integer right between 0 and 63 bits. The high bits are filled
with original integer's bit 63. The shifted value is returned.
This function shifts the 64-bit value Operand to the right by Count bits. The
high Count bits are set to bit 63 of Operand. The shifted value is returned.
If Count is greater than 63, then ASSERT().
@param Operand The 64-bit operand to shift right.
@param Count The number of bits to shift right.
@return Operand arithmetically shifted right by Count
**/
UINT64
EFIAPI
ARShiftU64 (
IN UINT64 Operand,
IN UINTN Count
)
{
ASSERT (Count < sizeof (Operand) * 8);
return InternalMathARShiftU64 (Operand, Count);
}

View File

@@ -0,0 +1,361 @@
#/*++
#
# 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:
#
# BaseLib.inf
#
# Abstract:
#
# Component description file for BaseLib.
#
#--*/
[defines]
BASE_NAME = EdkIIGlueBaseLib
COMPONENT_TYPE = LIBRARY
[sources.common]
String.c
LinkedList.c
Synchronization.c
Cpu.c
CpuDeadLoop.c
BitField.c
ARShiftU64.c
DivS64x64Remainder.c
DivU64x32.c
DivU64x32Remainder.c
DivU64x64Remainder.c
GetPowerOfTwo32.c
GetPowerOfTwo64.c
HighBitSet32.c
HighBitSet64.c
LowBitSet32.c
LowBitSet64.c
LRotU32.c
LRotU64.c
LShiftU64.c
ModU64x32.c
MultS64x64.c
MultU64x32.c
MultU64x64.c
RRotU32.c
RRotU64.c
RShiftU64.c
SetJump.c
LongJump.c
SwapBytes16.c
SwapBytes32.c
SwapBytes64.c
SwitchStack.c
[sources.ia32]
x86DisablePaging32.c
x86DisablePaging64.c
x86EnablePaging32.c
x86EnablePaging64.c
x86FxRestore.c
x86FxSave.c
x86GetInterruptState.c
x86MemoryFence.c
x86Msr.c
x86ReadGdtr.c
x86ReadIdtr.c
x86Thunk.c
x86WriteGdtr.c
x86WriteIdtr.c
Unaligned.c
Ia32\Non-existing.c
Ia32\InternalSwitchStack.c
Ia32\DivS64x64Remainder.c
Ia32\ARShiftU64.asm
Ia32\CpuBreakpoint.asm
Ia32\CpuFlushTlb.asm
Ia32\CpuSleep.asm
Ia32\CpuId.asm
Ia32\CpuIdEx.asm
Ia32\CpuPause.asm
Ia32\DisableInterrupts.asm
Ia32\DisablePaging32.asm
Ia32\DivU64x32.asm
Ia32\DivU64x32Remainder.asm
Ia32\DivU64x64Remainder.asm
Ia32\EnableDisableInterrupts.asm
Ia32\EnableInterrupts.asm
Ia32\EnablePaging32.asm
Ia32\EnablePaging64.asm
Ia32\FlushCacheLine.asm
Ia32\FxSave.asm
Ia32\FxRestore.asm
Ia32\InterlockedIncrement.asm
Ia32\InterlockedDecrement.asm
Ia32\InterlockedCompareExchange32.asm
Ia32\InterlockedCompareExchange64.asm
Ia32\Invd.asm
Ia32\LongJump.asm
Ia32\LRotU64.asm
Ia32\LShiftU64.asm
Ia32\MultU64x32.asm
Ia32\MultU64x64.asm
Ia32\ModU64x32.asm
Ia32\Monitor.asm
Ia32\Mwait.asm
Ia32\ReadCr0.asm
Ia32\ReadCr2.asm
Ia32\ReadCr3.asm
Ia32\ReadCr4.asm
Ia32\ReadDr0.asm
Ia32\ReadDr1.asm
Ia32\ReadDr2.asm
Ia32\ReadDr3.asm
Ia32\ReadDr4.asm
Ia32\ReadDr5.asm
Ia32\ReadDr6.asm
Ia32\ReadDr7.asm
Ia32\ReadEflags.asm
Ia32\ReadMm0.asm
Ia32\ReadMm1.asm
Ia32\ReadMm2.asm
Ia32\ReadMm3.asm
Ia32\ReadMm4.asm
Ia32\ReadMm5.asm
Ia32\ReadMm6.asm
Ia32\ReadMm7.asm
Ia32\ReadMsr64.asm
Ia32\ReadCs.asm
Ia32\ReadDs.asm
Ia32\ReadEs.asm
Ia32\ReadFs.asm
Ia32\ReadGs.asm
Ia32\ReadSs.asm
Ia32\ReadTr.asm
Ia32\ReadGdtr.asm
Ia32\ReadIdtr.asm
Ia32\ReadLdtr.asm
Ia32\ReadTsc.asm
Ia32\ReadPmc.asm
Ia32\RShiftU64.asm
Ia32\RRotU64.asm
Ia32\SetJump.asm
Ia32\SwapBytes64.asm
Ia32\Thunk16.asm
Ia32\WriteMsr64.asm
Ia32\WriteCr0.asm
Ia32\WriteCr2.asm
Ia32\WriteCr3.asm
Ia32\WriteCr4.asm
Ia32\WriteDr0.asm
Ia32\WriteDr1.asm
Ia32\WriteDr2.asm
Ia32\WriteDr3.asm
Ia32\WriteDr4.asm
Ia32\WriteDr5.asm
Ia32\WriteDr6.asm
Ia32\WriteDr7.asm
Ia32\WriteGdtr.asm
Ia32\WriteIdtr.asm
Ia32\WriteLdtr.asm
Ia32\WriteMm0.asm
Ia32\WriteMm1.asm
Ia32\WriteMm2.asm
Ia32\WriteMm3.asm
Ia32\WriteMm4.asm
Ia32\WriteMm5.asm
Ia32\WriteMm6.asm
Ia32\WriteMm7.asm
Ia32\Wbinvd.asm
[sources.x64]
x86DisablePaging32.c
x86DisablePaging64.c
x86EnablePaging32.c
x86EnablePaging64.c
x86FxRestore.c
x86FxSave.c
x86GetInterruptState.c
x86MemoryFence.c
x86Msr.c
x86ReadGdtr.c
x86ReadIdtr.c
x86Thunk.c
x86WriteGdtr.c
x86WriteIdtr.c
Unaligned.c
Math64.c
X64\Non-existing.c
X64\SwitchStack.asm
X64\SetJump.asm
X64\LongJump.asm
X64\CpuId.asm
X64\CpuIdEx.asm
X64\ReadEflags.asm
X64\ReadMsr64.asm
X64\WriteMsr64.asm
X64\ReadCr0.asm
X64\ReadCr2.asm
X64\ReadCr3.asm
X64\ReadCr4.asm
X64\WriteCr0.asm
X64\WriteCr2.asm
X64\WriteCr3.asm
X64\WriteCr4.asm
X64\ReadDr0.asm
X64\ReadDr1.asm
X64\ReadDr2.asm
X64\ReadDr3.asm
X64\ReadDr4.asm
X64\ReadDr5.asm
X64\ReadDr6.asm
X64\ReadDr7.asm
X64\WriteDr0.asm
X64\WriteDr1.asm
X64\WriteDr2.asm
X64\WriteDr3.asm
X64\WriteDr4.asm
X64\WriteDr5.asm
X64\WriteDr6.asm
X64\WriteDr7.asm
X64\ReadCs.asm
X64\ReadDs.asm
X64\ReadEs.asm
X64\ReadFs.asm
X64\ReadGs.asm
X64\ReadSs.asm
X64\ReadTr.asm
X64\ReadGdtr.asm
X64\WriteGdtr.asm
X64\ReadIdtr.asm
X64\WriteIdtr.asm
X64\ReadLdtr.asm
X64\WriteLdtr.asm
X64\FxSave.asm
X64\FxRestore.asm
X64\ReadMm0.asm
X64\ReadMm1.asm
X64\ReadMm2.asm
X64\ReadMm3.asm
X64\ReadMm4.asm
X64\ReadMm5.asm
X64\ReadMm6.asm
X64\ReadMm7.asm
X64\WriteMm0.asm
X64\WriteMm1.asm
X64\WriteMm2.asm
X64\WriteMm3.asm
X64\WriteMm4.asm
X64\WriteMm5.asm
X64\WriteMm6.asm
X64\WriteMm7.asm
X64\ReadTsc.asm
X64\ReadPmc.asm
X64\Monitor.asm
X64\Mwait.asm
X64\EnablePaging64.asm
X64\DisablePaging64.asm
X64\Wbinvd.asm
X64\Invd.asm
X64\FlushCacheLine.asm
X64\InterlockedIncrement.asm
X64\InterlockedDecrement.asm
X64\InterlockedCompareExchange32.asm
X64\InterlockedCompareExchange64.asm
X64\EnableInterrupts.asm
X64\DisableInterrupts.asm
X64\EnableDisableInterrupts.asm
X64\CpuSleep.asm
X64\CpuPause.asm
X64\CpuBreakpoint.asm
X64\CpuFlushTlb.asm
X64\Thunk16.asm
[sources.ipf]
Math64.c
Ipf\asm.h
Ipf\ia_64gen.h
Ipf\PalCallStatic.s
Ipf\setjmp.s
Ipf\longjmp.s
Ipf\SwitchStack.s
Ipf\Unaligned.c
Ipf\CpuBreakpoint.c
Ipf\InterlockedCompareExchange32.s
Ipf\InterlockedCompareExchange64.s
Ipf\Synchronization.c
Ipf\CpuPause.s
Ipf\CpuFlushTlb.s
Ipf\GetInterruptState.s
Ipf\Non-existing.c
Ipf\FlushCacheRange.s
Ipf\ReadItc.s
[sources.ebc]
Math64.c
Unaligned.c
Ebc\SwitchStack.c
Ebc\SetJumpLongJump.c
Ebc\CpuBreakpoint.c
Ebc\Synchronization.c
[includes.common]
.
..\..\Include
..\..\Include\Library
$(EDK_SOURCE)\Foundation
$(EDK_SOURCE)\Foundation\Framework
$(EDK_SOURCE)\Foundation\Efi
$(EDK_SOURCE)\Foundation\Include
$(EDK_SOURCE)\Foundation\Efi\Include
$(EDK_SOURCE)\Foundation\Framework\Include
$(EDK_SOURCE)\Foundation\Include\IndustryStandard
$(EDK_SOURCE)\Foundation\Core\Dxe
$(EDK_SOURCE)\Foundation\Library\Dxe\Include
$(EDK_SOURCE)\Foundation\Cpu\Pentium\Include
[includes.IA32]
..\..\Include\Ia32
[includes.X64]
..\..\Include\x64
[libraries.common]
#
# Actually, BaesLib may refer
# BaseTimerLibLocalApic::GetPerformanceCounter()in AcquireSpinLock()
# BaseMemoryLib::ZeroMem() in StrnCpy()
#
[libraries.ia32]
[libraries.x64]
[nmake.common]
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006
[nmake.ia32]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
[nmake.x64]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_X64
[nmake.ipf]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IPF
[nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC

View File

@@ -0,0 +1,813 @@
/*++
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:
BaseLibInternal.h
Abstract:
Declaration of internal functions in BaseLib.
--*/
#ifndef __BASE_LIB_INTERNAL_H__
#define __BASE_LIB_INTERNAL_H__
#include "EdkIIGlueBase.h"
#define QUIENT_MAX_UINTN_DIVIDED_BY_10 ((UINTN) -1 / 10)
#define REMINDER_MAX_UINTN_DIVIDED_BY_10 ((UINTN) -1 % 10)
#define QUIENT_MAX_UINTN_DIVIDED_BY_16 ((UINTN) -1 / 16)
#define REMINDER_MAX_UINTN_DIVIDED_BY_16 ((UINTN) -1 % 16)
#define QUIENT_MAX_UINT64_DIVIDED_BY_10 ((UINT64) -1 / 10)
#define REMINDER_MAX_UINT64_DIVIDED_BY_10 ((UINT64) -1 % 10)
#define QUIENT_MAX_UINT64_DIVIDED_BY_16 ((UINT64) -1 / 16)
#define REMINDER_MAX_UINT64_DIVIDED_BY_16 ((UINT64) -1 % 16)
//
// Math functions
//
/**
Shifts a 64-bit integer left between 0 and 63 bits. The low bits
are filled with zeros. The shifted value is returned.
This function shifts the 64-bit value Operand to the left by Count bits. The
low Count bits are set to zero. The shifted value is returned.
@param Operand The 64-bit operand to shift left.
@param Count The number of bits to shift left.
@return Operand << Count
**/
UINT64
EFIAPI
InternalMathLShiftU64 (
IN UINT64 Operand,
IN UINTN Count
);
/**
Shifts a 64-bit integer right between 0 and 63 bits. This high bits
are filled with zeros. The shifted value is returned.
This function shifts the 64-bit value Operand to the right by Count bits. The
high Count bits are set to zero. The shifted value is returned.
@param Operand The 64-bit operand to shift right.
@param Count The number of bits to shift right.
@return Operand >> Count
**/
UINT64
EFIAPI
InternalMathRShiftU64 (
IN UINT64 Operand,
IN UINTN Count
);
/**
Shifts a 64-bit integer right between 0 and 63 bits. The high bits
are filled with original integer's bit 63. The shifted value is returned.
This function shifts the 64-bit value Operand to the right by Count bits. The
high Count bits are set to bit 63 of Operand. The shifted value is returned.
@param Operand The 64-bit operand to shift right.
@param Count The number of bits to shift right.
@return Operand arithmetically shifted right by Count
**/
UINT64
EFIAPI
InternalMathARShiftU64 (
IN UINT64 Operand,
IN UINTN Count
);
/**
Rotates a 64-bit integer left between 0 and 63 bits, filling
the low bits with the high bits that were rotated.
This function rotates the 64-bit value Operand to the left by Count bits. The
low Count bits are fill with the high Count bits of Operand. The rotated
value is returned.
@param Operand The 64-bit operand to rotate left.
@param Count The number of bits to rotate left.
@return Operand <<< Count
**/
UINT64
EFIAPI
InternalMathLRotU64 (
IN UINT64 Operand,
IN UINTN Count
);
/**
Rotates a 64-bit integer right between 0 and 63 bits, filling
the high bits with the high low bits that were rotated.
This function rotates the 64-bit value Operand to the right by Count bits.
The high Count bits are fill with the low Count bits of Operand. The rotated
value is returned.
@param Operand The 64-bit operand to rotate right.
@param Count The number of bits to rotate right.
@return Operand >>> Count
**/
UINT64
EFIAPI
InternalMathRRotU64 (
IN UINT64 Operand,
IN UINTN Count
);
/**
Switches the endianess of a 64-bit integer.
This function swaps the bytes in a 64-bit unsigned value to switch the value
from little endian to big endian or vice versa. The byte swapped value is
returned.
@param Operand A 64-bit unsigned value.
@return The byte swaped Operand.
**/
UINT64
EFIAPI
InternalMathSwapBytes64 (
IN UINT64 Operand
);
/**
Multiples a 64-bit unsigned integer by a 32-bit unsigned integer
and generates a 64-bit unsigned result.
This function multiples the 64-bit unsigned value Multiplicand by the 32-bit
unsigned value Multiplier and generates a 64-bit unsigned result. This 64-
bit unsigned result is returned.
@param Multiplicand A 64-bit unsigned value.
@param Multiplier A 32-bit unsigned value.
@return Multiplicand * Multiplier
**/
UINT64
EFIAPI
InternalMathMultU64x32 (
IN UINT64 Multiplicand,
IN UINT32 Multiplier
);
/**
Multiples a 64-bit unsigned integer by a 64-bit unsigned integer
and generates a 64-bit unsigned result.
This function multiples the 64-bit unsigned value Multiplicand by the 64-bit
unsigned value Multiplier and generates a 64-bit unsigned result. This 64-
bit unsigned result is returned.
@param Multiplicand A 64-bit unsigned value.
@param Multiplier A 64-bit unsigned value.
@return Multiplicand * Multiplier
**/
UINT64
EFIAPI
InternalMathMultU64x64 (
IN UINT64 Multiplicand,
IN UINT64 Multiplier
);
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
generates a 64-bit unsigned result.
This function divides the 64-bit unsigned value Dividend by the 32-bit
unsigned value Divisor and generates a 64-bit unsigned quotient. This
function returns the 64-bit unsigned quotient.
@param Dividend A 64-bit unsigned value.
@param Divisor A 32-bit unsigned value.
@return Dividend / Divisor
**/
UINT64
EFIAPI
InternalMathDivU64x32 (
IN UINT64 Dividend,
IN UINT32 Divisor
);
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
generates a 32-bit unsigned remainder.
This function divides the 64-bit unsigned value Dividend by the 32-bit
unsigned value Divisor and generates a 32-bit remainder. This function
returns the 32-bit unsigned remainder.
@param Dividend A 64-bit unsigned value.
@param Divisor A 32-bit unsigned value.
@return Dividend % Divisor
**/
UINT32
EFIAPI
InternalMathModU64x32 (
IN UINT64 Dividend,
IN UINT32 Divisor
);
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and
generates a 64-bit unsigned result and an optional 32-bit unsigned remainder.
This function divides the 64-bit unsigned value Dividend by the 32-bit
unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder
is not NULL, then the 32-bit unsigned remainder is returned in Remainder.
This function returns the 64-bit unsigned quotient.
@param Dividend A 64-bit unsigned value.
@param Divisor A 32-bit unsigned value.
@param Remainder A pointer to a 32-bit unsigned value. This parameter is
optional and may be NULL.
@return Dividend / Divisor
**/
UINT64
EFIAPI
InternalMathDivRemU64x32 (
IN UINT64 Dividend,
IN UINT32 Divisor,
OUT UINT32 *Remainder
);
/**
Divides a 64-bit unsigned integer by a 64-bit unsigned integer and
generates a 64-bit unsigned result and an optional 64-bit unsigned remainder.
This function divides the 64-bit unsigned value Dividend by the 64-bit
unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder
is not NULL, then the 64-bit unsigned remainder is returned in Remainder.
This function returns the 64-bit unsigned quotient.
@param Dividend A 64-bit unsigned value.
@param Divisor A 64-bit unsigned value.
@param Remainder A pointer to a 64-bit unsigned value. This parameter is
optional and may be NULL.
@return Dividend / Divisor
**/
UINT64
EFIAPI
InternalMathDivRemU64x64 (
IN UINT64 Dividend,
IN UINT64 Divisor,
OUT UINT64 *Remainder
);
/**
Divides a 64-bit signed integer by a 64-bit signed integer and
generates a 64-bit signed result and a optional 64-bit signed remainder.
This function divides the 64-bit unsigned value Dividend by the 64-bit
unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder
is not NULL, then the 64-bit unsigned remainder is returned in Remainder.
This function returns the 64-bit unsigned quotient.
@param Dividend A 64-bit signed value.
@param Divisor A 64-bit signed value.
@param Remainder A pointer to a 64-bit signed value. This parameter is
optional and may be NULL.
@return Dividend / Divisor
**/
INT64
InternalMathDivRemS64x64 (
IN INT64 Dividend,
IN INT64 Divisor,
OUT INT64 *Remainder OPTIONAL
);
/**
Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack
specified by NewStack and passing in the parameters specified by Context1 and
Context2. Context1 and Context2 are optional and may be NULL. The function
EntryPoint must never return.
@param EntryPoint A pointer to function to call with the new stack.
@param Context1 A pointer to the context to pass into the EntryPoint
function.
@param Context2 A pointer to the context to pass into the EntryPoint
function.
@param NewStack A pointer to the new stack to use for the EntryPoint
function.
**/
VOID
EFIAPI
InternalSwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1,
IN VOID *Context2,
IN VOID *NewStack
);
//
// Ia32 and x64 specific functions
//
/**
Reads the current Global Descriptor Table Register(GDTR) descriptor.
Reads and returns the current GDTR descriptor and returns it in Gdtr. This
function is only available on IA-32 and X64.
@param Gdtr Pointer to a GDTR descriptor.
**/
VOID
EFIAPI
InternalX86ReadGdtr (
OUT IA32_DESCRIPTOR *Gdtr
);
/**
Writes the current Global Descriptor Table Register (GDTR) descriptor.
Writes and the current GDTR descriptor specified by Gdtr. This function is
only available on IA-32 and X64.
@param Gdtr Pointer to a GDTR descriptor.
**/
VOID
EFIAPI
InternalX86WriteGdtr (
IN CONST IA32_DESCRIPTOR *Gdtr
);
/**
Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
Reads and returns the current IDTR descriptor and returns it in Idtr. This
function is only available on IA-32 and X64.
@param Idtr Pointer to a IDTR descriptor.
**/
VOID
EFIAPI
InternalX86ReadIdtr (
OUT IA32_DESCRIPTOR *Idtr
);
/**
Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
Writes the current IDTR descriptor and returns it in Idtr. This function is
only available on IA-32 and X64.
@param Idtr Pointer to a IDTR descriptor.
**/
VOID
EFIAPI
InternalX86WriteIdtr (
IN CONST IA32_DESCRIPTOR *Idtr
);
/**
Save the current floating point/SSE/SSE2 context to a buffer.
Saves the current floating point/SSE/SSE2 state to the buffer specified by
Buffer. Buffer must be aligned on a 16-byte boundary. This function is only
available on IA-32 and X64.
@param Buffer Pointer to a buffer to save the floating point/SSE/SSE2 context.
**/
VOID
EFIAPI
InternalX86FxSave (
OUT IA32_FX_BUFFER *Buffer
);
/**
Restores the current floating point/SSE/SSE2 context from a buffer.
Restores the current floating point/SSE/SSE2 state from the buffer specified
by Buffer. Buffer must be aligned on a 16-byte boundary. This function is
only available on IA-32 and X64.
@param Buffer Pointer to a buffer to save the floating point/SSE/SSE2 context.
**/
VOID
EFIAPI
InternalX86FxRestore (
IN CONST IA32_FX_BUFFER *Buffer
);
/**
Enables the 32-bit paging mode on the CPU.
Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
must be properly initialized prior to calling this service. This function
assumes the current execution mode is 32-bit protected mode. This function is
only available on IA-32. After the 32-bit paging mode is enabled, control is
transferred to the function specified by EntryPoint using the new stack
specified by NewStack and passing in the parameters specified by Context1 and
Context2. Context1 and Context2 are optional and may be NULL. The function
EntryPoint must never return.
There are a number of constraints that must be followed before calling this
function:
1) Interrupts must be disabled.
2) The caller must be in 32-bit protected mode with flat descriptors. This
means all descriptors must have a base of 0 and a limit of 4GB.
3) CR0 and CR4 must be compatible with 32-bit protected mode with flat
descriptors.
4) CR3 must point to valid page tables that will be used once the transition
is complete, and those page tables must guarantee that the pages for this
function and the stack are identity mapped.
@param EntryPoint A pointer to function to call with the new stack after
paging is enabled.
@param Context1 A pointer to the context to pass into the EntryPoint
function as the first parameter after paging is enabled.
@param Context2 A pointer to the context to pass into the EntryPoint
function as the second parameter after paging is enabled.
@param NewStack A pointer to the new stack to use for the EntryPoint
function after paging is enabled.
**/
VOID
EFIAPI
InternalX86EnablePaging32 (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack
);
/**
Disables the 32-bit paging mode on the CPU.
Disables the 32-bit paging mode on the CPU and returns to 32-bit protected
mode. This function assumes the current execution mode is 32-paged protected
mode. This function is only available on IA-32. After the 32-bit paging mode
is disabled, control is transferred to the function specified by EntryPoint
using the new stack specified by NewStack and passing in the parameters
specified by Context1 and Context2. Context1 and Context2 are optional and
may be NULL. The function EntryPoint must never return.
There are a number of constraints that must be followed before calling this
function:
1) Interrupts must be disabled.
2) The caller must be in 32-bit paged mode.
3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.
4) CR3 must point to valid page tables that guarantee that the pages for
this function and the stack are identity mapped.
@param EntryPoint A pointer to function to call with the new stack after
paging is disabled.
@param Context1 A pointer to the context to pass into the EntryPoint
function as the first parameter after paging is disabled.
@param Context2 A pointer to the context to pass into the EntryPoint
function as the second parameter after paging is
disabled.
@param NewStack A pointer to the new stack to use for the EntryPoint
function after paging is disabled.
**/
VOID
EFIAPI
InternalX86DisablePaging32 (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack
);
/**
Enables the 64-bit paging mode on the CPU.
Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
must be properly initialized prior to calling this service. This function
assumes the current execution mode is 32-bit protected mode with flat
descriptors. This function is only available on IA-32. After the 64-bit
paging mode is enabled, control is transferred to the function specified by
EntryPoint using the new stack specified by NewStack and passing in the
parameters specified by Context1 and Context2. Context1 and Context2 are
optional and may be 0. The function EntryPoint must never return.
@param Cs The 16-bit selector to load in the CS before EntryPoint
is called. The descriptor in the GDT that this selector
references must be setup for long mode.
@param EntryPoint The 64-bit virtual address of the function to call with
the new stack after paging is enabled.
@param Context1 The 64-bit virtual address of the context to pass into
the EntryPoint function as the first parameter after
paging is enabled.
@param Context2 The 64-bit virtual address of the context to pass into
the EntryPoint function as the second parameter after
paging is enabled.
@param NewStack The 64-bit virtual address of the new stack to use for
the EntryPoint function after paging is enabled.
**/
VOID
EFIAPI
InternalX86EnablePaging64 (
IN UINT16 Cs,
IN UINT64 EntryPoint,
IN UINT64 Context1, OPTIONAL
IN UINT64 Context2, OPTIONAL
IN UINT64 NewStack
);
/**
Disables the 64-bit paging mode on the CPU.
Disables the 64-bit paging mode on the CPU and returns to 32-bit protected
mode. This function assumes the current execution mode is 64-paging mode.
This function is only available on X64. After the 64-bit paging mode is
disabled, control is transferred to the function specified by EntryPoint
using the new stack specified by NewStack and passing in the parameters
specified by Context1 and Context2. Context1 and Context2 are optional and
may be 0. The function EntryPoint must never return.
@param Cs The 16-bit selector to load in the CS before EntryPoint
is called. The descriptor in the GDT that this selector
references must be setup for 32-bit protected mode.
@param EntryPoint The 64-bit virtual address of the function to call with
the new stack after paging is disabled.
@param Context1 The 64-bit virtual address of the context to pass into
the EntryPoint function as the first parameter after
paging is disabled.
@param Context2 The 64-bit virtual address of the context to pass into
the EntryPoint function as the second parameter after
paging is disabled.
@param NewStack The 64-bit virtual address of the new stack to use for
the EntryPoint function after paging is disabled.
**/
VOID
EFIAPI
InternalX86DisablePaging64 (
IN UINT16 Cs,
IN UINT32 EntryPoint,
IN UINT32 Context1, OPTIONAL
IN UINT32 Context2, OPTIONAL
IN UINT32 NewStack
);
/**
Worker function that locates the Node in the List
By searching the List, finds the location of the Node in List. At the same time,
verifies the validity of this list.
If List is NULL, then ASSERT().
If List->ForwardLink is NULL, then ASSERT().
If List->backLink is NULL, then ASSERT().
If Node is NULL, then ASSERT();
If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
of nodes in ListHead, including the ListHead node, is greater than or
equal to PcdMaximumLinkedListLength, then ASSERT().
@param List A pointer to a node in a linked list.
@param Node A pointer to one nod.
@retval TRUE Node is in List
@retval FALSE Node isn't in List, or List is invalid
**/
BOOLEAN
IsNodeInList (
IN CONST LIST_ENTRY *List,
IN CONST LIST_ENTRY *Node
);
/**
Performs an atomic increment of an 32-bit unsigned integer.
Performs an atomic increment of the 32-bit unsigned integer specified by
Value and returns the incremented value. The increment operation must be
performed using MP safe mechanisms. The state of the return value is not
guaranteed to be MP safe.
@param Value A pointer to the 32-bit value to increment.
@return The incremented value.
**/
UINT32
EFIAPI
InternalSyncIncrement (
IN volatile UINT32 *Value
);
/**
Performs an atomic decrement of an 32-bit unsigned integer.
Performs an atomic decrement of the 32-bit unsigned integer specified by
Value and returns the decrement value. The decrement operation must be
performed using MP safe mechanisms. The state of the return value is not
guaranteed to be MP safe.
@param Value A pointer to the 32-bit value to decrement.
@return The decrement value.
**/
UINT32
EFIAPI
InternalSyncDecrement (
IN volatile UINT32 *Value
);
/**
Performs an atomic compare exchange operation on a 32-bit unsigned integer.
Performs an atomic compare exchange operation on the 32-bit unsigned integer
specified by Value. If Value is equal to CompareValue, then Value is set to
ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
then Value is returned. The compare exchange operation must be performed using
MP safe mechanisms.
@param Value A pointer to the 32-bit value for the compare exchange
operation.
@param CompareValue 32-bit value used in compare operation.
@param ExchangeValue 32-bit value used in exchange operation.
@return The original *Value before exchange.
**/
UINT32
EFIAPI
InternalSyncCompareExchange32 (
IN volatile UINT32 *Value,
IN UINT32 CompareValue,
IN UINT32 ExchangeValue
);
/**
Performs an atomic compare exchange operation on a 64-bit unsigned integer.
Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
The compare exchange operation must be performed using MP safe mechanisms.
@param Value A pointer to the 64-bit value for the compare exchange
operation.
@param CompareValue 64-bit value used in compare operation.
@param ExchangeValue 64-bit value used in exchange operation.
@return The original *Value before exchange.
**/
UINT64
EFIAPI
InternalSyncCompareExchange64 (
IN volatile UINT64 *Value,
IN UINT64 CompareValue,
IN UINT64 ExchangeValue
);
/**
Worker function that returns a bit field from Operand
Returns the bitfield specified by the StartBit and the EndBit from Operand.
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@param EndBit The ordinal of the most significant bit in the bit field.
@return The bit field read.
**/
unsigned int
BitFieldReadUint (
IN unsigned int Operand,
IN UINTN StartBit,
IN UINTN EndBit
);
/**
Worker function that reads a bit field from Operand, performs a bitwise OR,
and returns the result.
Performs a bitwise OR between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData. All other bits in Operand are
preserved. The new value is returned.
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@param EndBit The ordinal of the most significant bit in the bit field.
@param OrData The value to OR with the read value from the value
@return The new value.
**/
unsigned int
BitFieldOrUint (
IN unsigned int Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN unsigned int OrData
);
/**
Worker function that reads a bit field from Operand, performs a bitwise AND,
and returns the result.
Performs a bitwise AND between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData. All other bits in Operand are
preserved. The new value is returned.
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@param EndBit The ordinal of the most significant bit in the bit field.
@param AndData The value to And with the read value from the value
@return The new value.
**/
unsigned int
BitFieldAndUint (
IN unsigned int Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN unsigned int AndData
);
/**
Worker function that checks ASSERT condition for JumpBuffer
Checks ASSERT condition for JumpBuffer.
If JumpBuffer is NULL, then ASSERT().
For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().
@param JumpBuffer A pointer to CPU context buffer.
**/
VOID
InternalAssertJumpBuffer (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
);
/**
Restores the CPU context that was saved with SetJump().
Restores the CPU context from the buffer specified by JumpBuffer.
This function never returns to the caller.
Instead is resumes execution based on the state of JumpBuffer.
@param JumpBuffer A pointer to CPU context buffer.
@param Value The value to return when the SetJump() context is restored.
**/
VOID
EFIAPI
InternalLongJump (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
IN UINTN Value
);
#endif

View File

@@ -0,0 +1,873 @@
/*++
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:
BitField.c
Abstract:
Bit field functions of BaseLib.
--*/
#include "BaseLibInternal.h"
/**
Worker function that returns a bit field from Operand
Returns the bitfield specified by the StartBit and the EndBit from Operand.
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@param EndBit The ordinal of the most significant bit in the bit field.
@return The bit field read.
**/
unsigned int
BitFieldReadUint (
IN unsigned int Operand,
IN UINTN StartBit,
IN UINTN EndBit
)
{
//
// ~((unsigned int)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]
// are 1's while bit[EndBit + 1] thru the most significant bit are 0's.
//
return (Operand & ~((unsigned int)-2 << EndBit)) >> StartBit;
}
/**
Worker function that reads a bit field from Operand, performs a bitwise OR,
and returns the result.
Performs a bitwise OR between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData. All other bits in Operand are
preserved. The new value is returned.
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@param EndBit The ordinal of the most significant bit in the bit field.
@param OrData The value to OR with the read value from the value
@return The new value.
**/
unsigned int
BitFieldOrUint (
IN unsigned int Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN unsigned int OrData
)
{
//
// ~((unsigned int)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]
// are 1's while bit[EndBit + 1] thru the most significant bit are 0's.
//
return Operand | ((OrData << StartBit) & ~((unsigned int) -2 << EndBit));
}
/**
Worker function that reads a bit field from Operand, performs a bitwise AND,
and returns the result.
Performs a bitwise AND between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData. All other bits in Operand are
preserved. The new value is returned.
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@param EndBit The ordinal of the most significant bit in the bit field.
@param AndData The value to And with the read value from the value
@return The new value.
**/
unsigned int
BitFieldAndUint (
IN unsigned int Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN unsigned int AndData
)
{
//
// ~((unsigned int)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]
// are 1's while bit[EndBit + 1] thru the most significant bit are 0's.
//
return Operand & ~((~AndData << StartBit) & ~((unsigned int) -2 << EndBit));
}
/**
Returns a bit field from an 8-bit value.
Returns the bitfield specified by the StartBit and the EndBit from Operand.
If 8-bit operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..7.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..7.
@return The bit field read.
**/
UINT8
EFIAPI
BitFieldRead8 (
IN UINT8 Operand,
IN UINTN StartBit,
IN UINTN EndBit
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return (UINT8)BitFieldReadUint (Operand, StartBit, EndBit);
}
/**
Writes a bit field to an 8-bit value, and returns the result.
Writes Value to the bit field specified by the StartBit and the EndBit in
Operand. All other bits in Operand are preserved. The new 8-bit value is
returned.
If 8-bit operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..7.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..7.
@param Value New value of the bit field.
@return The new 8-bit value.
**/
UINT8
EFIAPI
BitFieldWrite8 (
IN UINT8 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT8 Value
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return BitFieldAndThenOr8 (Operand, StartBit, EndBit, 0, Value);
}
/**
Reads a bit field from an 8-bit value, performs a bitwise OR, and returns the
result.
Performs a bitwise inclusive OR between the bit field specified by StartBit
and EndBit in Operand and the value specified by OrData. All other bits in
Operand are preserved. The new 8-bit value is returned.
If 8-bit operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..7.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..7.
@param OrData The value to OR with the read value from the value
@return The new 8-bit value.
**/
UINT8
EFIAPI
BitFieldOr8 (
IN UINT8 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT8 OrData
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return (UINT8)BitFieldOrUint (Operand, StartBit, EndBit, OrData);
}
/**
Reads a bit field from an 8-bit value, performs a bitwise AND, and returns
the result.
Performs a bitwise AND between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData. All other bits in Operand are
preserved. The new 8-bit value is returned.
If 8-bit operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..7.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..7.
@param AndData The value to AND with the read value from the value.
@return The new 8-bit value.
**/
UINT8
EFIAPI
BitFieldAnd8 (
IN UINT8 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT8 AndData
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return (UINT8)BitFieldAndUint (Operand, StartBit, EndBit, AndData);
}
/**
Reads a bit field from an 8-bit value, performs a bitwise AND followed by a
bitwise OR, and returns the result.
Performs a bitwise AND between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData, followed by a bitwise
inclusive OR with value specified by OrData. All other bits in Operand are
preserved. The new 8-bit value is returned.
If 8-bit operations are not supported, then ASSERT().
If StartBit is greater than 7, then ASSERT().
If EndBit is greater than 7, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..7.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..7.
@param AndData The value to AND with the read value from the value.
@param OrData The value to OR with the result of the AND operation.
@return The new 8-bit value.
**/
UINT8
EFIAPI
BitFieldAndThenOr8 (
IN UINT8 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT8 AndData,
IN UINT8 OrData
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return BitFieldOr8 (
BitFieldAnd8 (Operand, StartBit, EndBit, AndData),
StartBit,
EndBit,
OrData
);
}
/**
Returns a bit field from a 16-bit value.
Returns the bitfield specified by the StartBit and the EndBit from Operand.
If 16-bit operations are not supported, then ASSERT().
If StartBit is greater than 15, then ASSERT().
If EndBit is greater than 15, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..15.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..15.
@return The bit field read.
**/
UINT16
EFIAPI
BitFieldRead16 (
IN UINT16 Operand,
IN UINTN StartBit,
IN UINTN EndBit
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return (UINT16)BitFieldReadUint (Operand, StartBit, EndBit);
}
/**
Writes a bit field to a 16-bit value, and returns the result.
Writes Value to the bit field specified by the StartBit and the EndBit in
Operand. All other bits in Operand are preserved. The new 16-bit value is
returned.
If 16-bit operations are not supported, then ASSERT().
If StartBit is greater than 15, then ASSERT().
If EndBit is greater than 15, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..15.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..15.
@param Value New value of the bit field.
@return The new 16-bit value.
**/
UINT16
EFIAPI
BitFieldWrite16 (
IN UINT16 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT16 Value
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return BitFieldAndThenOr16 (Operand, StartBit, EndBit, 0, Value);
}
/**
Reads a bit field from a 16-bit value, performs a bitwise OR, and returns the
result.
Performs a bitwise inclusive OR between the bit field specified by StartBit
and EndBit in Operand and the value specified by OrData. All other bits in
Operand are preserved. The new 16-bit value is returned.
If 16-bit operations are not supported, then ASSERT().
If StartBit is greater than 15, then ASSERT().
If EndBit is greater than 15, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..15.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..15.
@param OrData The value to OR with the read value from the value
@return The new 16-bit value.
**/
UINT16
EFIAPI
BitFieldOr16 (
IN UINT16 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT16 OrData
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return (UINT16)BitFieldOrUint (Operand, StartBit, EndBit, OrData);
}
/**
Reads a bit field from a 16-bit value, performs a bitwise AND, and returns
the result.
Performs a bitwise AND between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData. All other bits in Operand are
preserved. The new 16-bit value is returned.
If 16-bit operations are not supported, then ASSERT().
If StartBit is greater than 15, then ASSERT().
If EndBit is greater than 15, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..15.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..15.
@param AndData The value to AND with the read value from the value
@return The new 16-bit value.
**/
UINT16
EFIAPI
BitFieldAnd16 (
IN UINT16 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT16 AndData
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return (UINT16)BitFieldAndUint (Operand, StartBit, EndBit, AndData);
}
/**
Reads a bit field from a 16-bit value, performs a bitwise AND followed by a
bitwise OR, and returns the result.
Performs a bitwise AND between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData, followed by a bitwise
inclusive OR with value specified by OrData. All other bits in Operand are
preserved. The new 16-bit value is returned.
If 16-bit operations are not supported, then ASSERT().
If StartBit is greater than 15, then ASSERT().
If EndBit is greater than 15, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..15.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..15.
@param AndData The value to AND with the read value from the value.
@param OrData The value to OR with the result of the AND operation.
@return The new 16-bit value.
**/
UINT16
EFIAPI
BitFieldAndThenOr16 (
IN UINT16 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT16 AndData,
IN UINT16 OrData
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return BitFieldOr16 (
BitFieldAnd16 (Operand, StartBit, EndBit, AndData),
StartBit,
EndBit,
OrData
);
}
/**
Returns a bit field from a 32-bit value.
Returns the bitfield specified by the StartBit and the EndBit from Operand.
If 32-bit operations are not supported, then ASSERT().
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..31.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..31.
@return The bit field read.
**/
UINT32
EFIAPI
BitFieldRead32 (
IN UINT32 Operand,
IN UINTN StartBit,
IN UINTN EndBit
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return (UINT32)BitFieldReadUint (Operand, StartBit, EndBit);
}
/**
Writes a bit field to a 32-bit value, and returns the result.
Writes Value to the bit field specified by the StartBit and the EndBit in
Operand. All other bits in Operand are preserved. The new 32-bit value is
returned.
If 32-bit operations are not supported, then ASSERT().
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..31.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..31.
@param Value New value of the bit field.
@return The new 32-bit value.
**/
UINT32
EFIAPI
BitFieldWrite32 (
IN UINT32 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT32 Value
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return BitFieldAndThenOr32 (Operand, StartBit, EndBit, 0, Value);
}
/**
Reads a bit field from a 32-bit value, performs a bitwise OR, and returns the
result.
Performs a bitwise inclusive OR between the bit field specified by StartBit
and EndBit in Operand and the value specified by OrData. All other bits in
Operand are preserved. The new 32-bit value is returned.
If 32-bit operations are not supported, then ASSERT().
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..31.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..31.
@param OrData The value to OR with the read value from the value
@return The new 32-bit value.
**/
UINT32
EFIAPI
BitFieldOr32 (
IN UINT32 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT32 OrData
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return (UINT32)BitFieldOrUint (Operand, StartBit, EndBit, OrData);
}
/**
Reads a bit field from a 32-bit value, performs a bitwise AND, and returns
the result.
Performs a bitwise AND between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData. All other bits in Operand are
preserved. The new 32-bit value is returned.
If 32-bit operations are not supported, then ASSERT().
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..31.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..31.
@param AndData The value to AND with the read value from the value
@return The new 32-bit value.
**/
UINT32
EFIAPI
BitFieldAnd32 (
IN UINT32 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT32 AndData
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return (UINT32)BitFieldAndUint (Operand, StartBit, EndBit, AndData);
}
/**
Reads a bit field from a 32-bit value, performs a bitwise AND followed by a
bitwise OR, and returns the result.
Performs a bitwise AND between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData, followed by a bitwise
inclusive OR with value specified by OrData. All other bits in Operand are
preserved. The new 32-bit value is returned.
If 32-bit operations are not supported, then ASSERT().
If StartBit is greater than 31, then ASSERT().
If EndBit is greater than 31, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..31.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..31.
@param AndData The value to AND with the read value from the value.
@param OrData The value to OR with the result of the AND operation.
@return The new 32-bit value.
**/
UINT32
EFIAPI
BitFieldAndThenOr32 (
IN UINT32 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT32 AndData,
IN UINT32 OrData
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return BitFieldOr32 (
BitFieldAnd32 (Operand, StartBit, EndBit, AndData),
StartBit,
EndBit,
OrData
);
}
/**
Returns a bit field from a 64-bit value.
Returns the bitfield specified by the StartBit and the EndBit from Operand.
If 64-bit operations are not supported, then ASSERT().
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..63.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..63.
@return The bit field read.
**/
UINT64
EFIAPI
BitFieldRead64 (
IN UINT64 Operand,
IN UINTN StartBit,
IN UINTN EndBit
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return RShiftU64 (Operand & ~LShiftU64 ((UINT64)-2, EndBit), StartBit);
}
/**
Writes a bit field to a 64-bit value, and returns the result.
Writes Value to the bit field specified by the StartBit and the EndBit in
Operand. All other bits in Operand are preserved. The new 64-bit value is
returned.
If 64-bit operations are not supported, then ASSERT().
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..63.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..63.
@param Value New value of the bit field.
@return The new 64-bit value.
**/
UINT64
EFIAPI
BitFieldWrite64 (
IN UINT64 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT64 Value
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return BitFieldAndThenOr64 (Operand, StartBit, EndBit, 0, Value);
}
/**
Reads a bit field from a 64-bit value, performs a bitwise OR, and returns the
result.
Performs a bitwise inclusive OR between the bit field specified by StartBit
and EndBit in Operand and the value specified by OrData. All other bits in
Operand are preserved. The new 64-bit value is returned.
If 64-bit operations are not supported, then ASSERT().
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..63.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..63.
@param OrData The value to OR with the read value from the value
@return The new 64-bit value.
**/
UINT64
EFIAPI
BitFieldOr64 (
IN UINT64 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT64 OrData
)
{
UINT64 Value1;
UINT64 Value2;
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
Value1 = LShiftU64 (OrData, StartBit);
Value2 = LShiftU64 ((UINT64) - 2, EndBit);
return Operand | (Value1 & ~Value2);
}
/**
Reads a bit field from a 64-bit value, performs a bitwise AND, and returns
the result.
Performs a bitwise AND between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData. All other bits in Operand are
preserved. The new 64-bit value is returned.
If 64-bit operations are not supported, then ASSERT().
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..63.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..63.
@param AndData The value to AND with the read value from the value
@return The new 64-bit value.
**/
UINT64
EFIAPI
BitFieldAnd64 (
IN UINT64 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT64 AndData
)
{
UINT64 Value1;
UINT64 Value2;
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
Value1 = LShiftU64 (~AndData, StartBit);
Value2 = LShiftU64 ((UINT64)-2, EndBit);
return Operand & ~(Value1 & ~Value2);
}
/**
Reads a bit field from a 64-bit value, performs a bitwise AND followed by a
bitwise OR, and returns the result.
Performs a bitwise AND between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData, followed by a bitwise
inclusive OR with value specified by OrData. All other bits in Operand are
preserved. The new 64-bit value is returned.
If 64-bit operations are not supported, then ASSERT().
If StartBit is greater than 63, then ASSERT().
If EndBit is greater than 63, then ASSERT().
If EndBit is less than StartBit, then ASSERT().
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
Range 0..63.
@param EndBit The ordinal of the most significant bit in the bit field.
Range 0..63.
@param AndData The value to AND with the read value from the value.
@param OrData The value to OR with the result of the AND operation.
@return The new 64-bit value.
**/
UINT64
EFIAPI
BitFieldAndThenOr64 (
IN UINT64 Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT64 AndData,
IN UINT64 OrData
)
{
ASSERT (EndBit < sizeof (Operand) * 8);
ASSERT (StartBit <= EndBit);
return BitFieldOr64 (
BitFieldAnd64 (Operand, StartBit, EndBit, AndData),
StartBit,
EndBit,
OrData
);
}

View File

@@ -0,0 +1,75 @@
/*++
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:
Cpu.c
Abstract:
Base Library CPU Functions for all architectures.
--*/
#include "BaseLibInternal.h"
/**
Disables CPU interrupts and returns the interrupt state prior to the disable
operation.
Disables CPU interrupts and returns the interrupt state prior to the disable
operation.
@retval TRUE CPU interrupts were enabled on entry to this call.
@retval FALSE CPU interrupts were disabled on entry to this call.
**/
BOOLEAN
EFIAPI
SaveAndDisableInterrupts (
VOID
)
{
BOOLEAN InterruptState;
InterruptState = GetInterruptState ();
DisableInterrupts ();
return InterruptState;
}
/**
Set the current CPU interrupt state.
Sets the current CPU interrupt state to the state specified by
InterruptState. If InterruptState is TRUE, then interrupts are enabled. If
InterruptState is FALSE, then interrupts are disabled. InterruptState is
returned.
@param InterruptState TRUE if interrupts should enabled. FALSE if
interrupts should be disabled.
@return InterruptState
**/
BOOLEAN
EFIAPI
SetInterruptState (
IN BOOLEAN InterruptState
)
{
if (InterruptState) {
EnableInterrupts ();
} else {
DisableInterrupts ();
}
return InterruptState;
}

View File

@@ -0,0 +1,42 @@
/*++
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:
CpuDeadLoop.c
Abstract:
Base Library CPU Functions for all architectures.
--*/
#include "BaseLibInternal.h"
/**
Executes an infinite loop.
Forces the CPU to execute an infinite loop. A debugger may be used to skip
past the loop and the code that follows the loop must execute properly. This
implies that the infinite loop must not cause the code that follow it to be
optimized away.
**/
VOID
EFIAPI
CpuDeadLoop (
VOID
)
{
volatile UINTN Index;
for (Index = 0; Index == 0;);
}

View File

@@ -0,0 +1,54 @@
/*++
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:
DivS64x64Remainder.c
Abstract:
Math worker functions.
--*/
#include "BaseLibInternal.h"
/**
Divides a 64-bit signed integer by a 64-bit signed integer and generates a
64-bit signed result and a optional 64-bit signed remainder.
This function divides the 64-bit signed value Dividend by the 64-bit signed
value Divisor and generates a 64-bit signed quotient. If Remainder is not
NULL, then the 64-bit signed remainder is returned in Remainder. This
function returns the 64-bit signed quotient.
If Divisor is 0, then ASSERT().
@param Dividend A 64-bit signed value.
@param Divisor A 64-bit signed value.
@param Remainder A pointer to a 64-bit signed value. This parameter is
optional and may be NULL.
@return Dividend / Divisor
**/
INT64
EFIAPI
DivS64x64Remainder (
IN INT64 Dividend,
IN INT64 Divisor,
OUT INT64 *Remainder OPTIONAL
)
{
ASSERT (Divisor != 0);
return InternalMathDivRemS64x64 (Dividend, Divisor, Remainder);
}

View File

@@ -0,0 +1,50 @@
/*++
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:
DivU64x32.c
Abstract:
Math worker functions.
--*/
#include "BaseLibInternal.h"
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
a 64-bit unsigned result.
This function divides the 64-bit unsigned value Dividend by the 32-bit
unsigned value Divisor and generates a 64-bit unsigned quotient. This
function returns the 64-bit unsigned quotient.
If Divisor is 0, then ASSERT().
@param Dividend A 64-bit unsigned value.
@param Divisor A 32-bit unsigned value.
@return Dividend / Divisor
**/
UINT64
EFIAPI
GlueDivU64x32 (
IN UINT64 Dividend,
IN UINT32 Divisor
)
{
ASSERT (Divisor != 0);
return InternalMathDivU64x32 (Dividend, Divisor);
}

View File

@@ -0,0 +1,54 @@
/*++
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:
DivU64x32Remainder.c
Abstract:
Math worker functions
--*/
#include "BaseLibInternal.h"
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
a 64-bit unsigned result and an optional 32-bit unsigned remainder.
This function divides the 64-bit unsigned value Dividend by the 32-bit
unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder
is not NULL, then the 32-bit unsigned remainder is returned in Remainder.
This function returns the 64-bit unsigned quotient.
If Divisor is 0, then ASSERT().
@param Dividend A 64-bit unsigned value.
@param Divisor A 32-bit unsigned value.
@param Remainder A pointer to a 32-bit unsigned value. This parameter is
optional and may be NULL.
@return Dividend / Divisor
**/
UINT64
EFIAPI
DivU64x32Remainder (
IN UINT64 Dividend,
IN UINT32 Divisor,
OUT UINT32 *Remainder OPTIONAL
)
{
ASSERT (Divisor != 0);
return InternalMathDivRemU64x32 (Dividend, Divisor, Remainder);
}

View File

@@ -0,0 +1,53 @@
/*++
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:
DivU64x64Remainder.c
Abstract:
Math worker functions.
--*/
#include "BaseLibInternal.h"
/**
Divides a 64-bit unsigned integer by a 64-bit unsigned integer and generates
a 64-bit unsigned result and an optional 64-bit unsigned remainder.
This function divides the 64-bit unsigned value Dividend by the 64-bit
unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder
is not NULL, then the 64-bit unsigned remainder is returned in Remainder.
This function returns the 64-bit unsigned quotient.
If Divisor is 0, then ASSERT().
@param Dividend A 64-bit unsigned value.
@param Divisor A 64-bit unsigned value.
@param Remainder A pointer to a 64-bit unsigned value. This parameter is
optional and may be NULL.
@return Dividend / Divisor
**/
UINT64
EFIAPI
DivU64x64Remainder (
IN UINT64 Dividend,
IN UINT64 Divisor,
OUT UINT64 *Remainder OPTIONAL
)
{
ASSERT (Divisor != 0);
return InternalMathDivRemU64x64 (Dividend, Divisor, Remainder);
}

View File

@@ -0,0 +1,173 @@
/*++
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:
CpuBreakpoint.c
Abstract:
--*/
#include "..\BaseLibInternal.h"
extern
UINT64
_break (
CHAR8 BreakCode
);
/**
Generates a breakpoint on the CPU.
Generates a breakpoint on the CPU. The breakpoint must be implemented such
that code can resume normal execution after the breakpoint.
**/
VOID
EFIAPI
CpuBreakpoint (
VOID
)
{
_break (3);
}
/**
Used to serialize load and store operations.
All loads and stores that proceed calls to this function are guaranteed to be
globally visible when this function returns.
**/
VOID
EFIAPI
MemoryFence (
VOID
)
{
}
/**
Disables CPU interrupts.
Disables CPU interrupts.
**/
VOID
EFIAPI
DisableInterrupts (
VOID
)
{
ASSERT (FALSE);
}
/**
Enables CPU interrupts.
Enables CPU interrupts.
**/
VOID
EFIAPI
EnableInterrupts (
VOID
)
{
ASSERT (FALSE);
}
/**
Retrieves the current CPU interrupt state.
Retrieves the current CPU interrupt state. Returns TRUE is interrupts are
currently enabled. Otherwise returns FALSE.
@retval TRUE CPU interrupts are enabled.
@retval FALSE CPU interrupts are disabled.
**/
BOOLEAN
EFIAPI
GlueGetInterruptState (
VOID
)
{
ASSERT (FALSE);
return FALSE;
}
/**
Enables CPU interrupts for the smallest window required to capture any
pending interrupts.
Enables CPU interrupts for the smallest window required to capture any
pending interrupts.
**/
VOID
EFIAPI
EnableDisableInterrupts (
VOID
)
{
EnableInterrupts ();
DisableInterrupts ();
}
/**
Requests CPU to pause for a short period of time.
Requests CPU to pause for a short period of time. Typically used in MP
systems to prevent memory starvation while waiting for a spin lock.
**/
VOID
EFIAPI
CpuPause (
VOID
)
{
}
/**
Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
**/
VOID
EFIAPI
CpuFlushTlb (
VOID
)
{
ASSERT (FALSE);
}
/**
Places the CPU in a sleep state until an interrupt is received.
Places the CPU in a sleep state until an interrupt is received. If interrupts
are disabled prior to calling this function, then the CPU will be placed in a
sleep state indefinitely.
**/
VOID
EFIAPI
CpuSleep (
VOID
)
{
}

View File

@@ -0,0 +1,85 @@
/*++
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:
SetJumpLongJump.c
Abstract:
--*/
#include "..\BaseLibInternal.h"
/**
Worker function that checks ASSERT condition for JumpBuffer
Checks ASSERT condition for JumpBuffer.
If JumpBuffer is NULL, then ASSERT().
For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().
@param JumpBuffer A pointer to CPU context buffer.
**/
VOID
InternalAssertJumpBuffer (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
);
/**
Saves the current CPU context that can be restored with a call to LongJump() and returns 0.
Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial
call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero
value to be returned by SetJump().
If JumpBuffer is NULL, then ASSERT().
For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().
@param JumpBuffer A pointer to CPU context buffer.
**/
UINTN
EFIAPI
SetJump (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
)
{
InternalAssertJumpBuffer (JumpBuffer);
return 0;
}
/**
Restores the CPU context that was saved with SetJump().
Restores the CPU context from the buffer specified by JumpBuffer.
This function never returns to the caller.
Instead is resumes execution based on the state of JumpBuffer.
@param JumpBuffer A pointer to CPU context buffer.
@param Value The value to return when the SetJump() context is restored.
**/
VOID
EFIAPI
InternalLongJump (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
IN UINTN Value
)
{
//
// This function cannot work on EBC
//
ASSERT (FALSE);
}

View File

@@ -0,0 +1,59 @@
/*++
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:
SwitchStack.c
Abstract:
--*/
#include "..\BaseLibInternal.h"
/**
Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack
specified by NewStack and passing in the parameters specified by Context1 and
Context2. Context1 and Context2 are optional and may be NULL. The function
EntryPoint must never return.
If EntryPoint is NULL, then ASSERT().
If NewStack is NULL, then ASSERT().
@param EntryPoint A pointer to function to call with the new stack.
@param Context1 A pointer to the context to pass into the EntryPoint
function.
@param Context2 A pointer to the context to pass into the EntryPoint
function.
@param NewStack A pointer to the new stack to use for the EntryPoint
function.
**/
VOID
EFIAPI
InternalSwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack
)
{
//
// This version of this function does not actually change the stack pointer
// This is to support compilation of CPU types that do not support assemblers
// such as EBC
//
EntryPoint (Context1, Context2);
}

View File

@@ -0,0 +1,106 @@
/*++
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:
Synchronization.c
Abstract:
--*/
#include "..\BaseLibInternal.h"
UINT32
EFIAPI
InternalSyncCompareExchange32 (
IN volatile UINT32 *Value,
IN UINT32 CompareValue,
IN UINT32 ExchangeValue
)
{
return *Value != CompareValue ? *Value :
((*Value = ExchangeValue), CompareValue);
}
/**
Performs an atomic compare exchange operation on a 64-bit unsigned integer.
Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
The compare exchange operation must be performed using MP safe mechanisms.
@param Value A pointer to the 64-bit value for the compare exchange
operation.
@param CompareValue 64-bit value used in compare operation.
@param ExchangeValue 64-bit value used in exchange operation.
@return The original *Value before exchange.
**/
UINT64
EFIAPI
InternalSyncCompareExchange64 (
IN volatile UINT64 *Value,
IN UINT64 CompareValue,
IN UINT64 ExchangeValue
)
{
return *Value != CompareValue ? *Value :
((*Value = ExchangeValue), CompareValue);
}
/**
Performs an atomic increment of an 32-bit unsigned integer.
Performs an atomic increment of the 32-bit unsigned integer specified by
Value and returns the incremented value. The increment operation must be
performed using MP safe mechanisms. The state of the return value is not
guaranteed to be MP safe.
@param Value A pointer to the 32-bit value to increment.
@return The incremented value.
**/
UINT32
EFIAPI
InternalSyncIncrement (
IN volatile UINT32 *Value
)
{
return ++*Value;
}
/**
Performs an atomic decrement of an 32-bit unsigned integer.
Performs an atomic decrement of the 32-bit unsigned integer specified by
Value and returns the decrement value. The decrement operation must be
performed using MP safe mechanisms. The state of the return value is not
guaranteed to be MP safe.
@param Value A pointer to the 32-bit value to decrement.
@return The decrement value.
**/
UINT32
EFIAPI
InternalSyncDecrement (
IN volatile UINT32 *Value
)
{
return --*Value;
}

View File

@@ -0,0 +1,48 @@
/*++
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:
GetPowerOfTwo32.c
Abstract:
Math worker functions.
--*/
#include "BaseLibInternal.h"
/**
Returns the value of the highest bit set in a 32-bit value. Equivalent to
1 << HighBitSet32(x).
This function computes the value of the highest bit set in the 32-bit value
specified by Operand. If Operand is zero, then zero is returned.
@param Operand The 32-bit operand to evaluate.
@return 1 << HighBitSet32(Operand)
@retval 0 Operand is zero.
**/
UINT32
EFIAPI
GetPowerOfTwo32 (
IN UINT32 Operand
)
{
if (Operand == 0) {
return 0;
}
return 1ul << HighBitSet32 (Operand);
}

View File

@@ -0,0 +1,49 @@
/*++
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:
GetPowerOfTwo64.c
Abstract:
Math worker functions.
--*/
#include "BaseLibInternal.h"
/**
Returns the value of the highest bit set in a 64-bit value. Equivalent to
1 << HighBitSet64(x).
This function computes the value of the highest bit set in the 64-bit value
specified by Operand. If Operand is zero, then zero is returned.
@param Operand The 64-bit operand to evaluate.
@return 1 << HighBitSet64(Operand)
@retval 0 Operand is zero.
**/
UINT64
EFIAPI
GetPowerOfTwo64 (
IN UINT64 Operand
)
{
if (Operand == 0) {
return 0;
}
return LShiftU64 (1, HighBitSet64 (Operand));
}

View File

@@ -0,0 +1,52 @@
/*++
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:
HighBitSet32.c
Abstract:
Math worker functions.
--*/
#include "BaseLibInternal.h"
/**
Returns the bit position of the highest bit set in a 32-bit value. Equivalent
to log2(x).
This function computes the bit position of the highest bit set in the 32-bit
value specified by Operand. If Operand is zero, then -1 is returned.
Otherwise, a value between 0 and 31 is returned.
@param Operand The 32-bit operand to evaluate.
@return Position of the highest bit set in Operand if found.
@retval -1 Operand is zero.
**/
INTN
EFIAPI
HighBitSet32 (
IN UINT32 Operand
)
{
INTN BitIndex;
if (Operand == 0) {
return - 1;
}
for (BitIndex = 31; (INT32)Operand > 0; BitIndex--, Operand <<= 1);
return BitIndex;
}

View File

@@ -0,0 +1,60 @@
/*++
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:
HighBitSet64.c
Abstract:
Math worker functions.
--*/
#include "BaseLibInternal.h"
/**
Returns the bit position of the highest bit set in a 64-bit value. Equivalent
to log2(x).
This function computes the bit position of the highest bit set in the 64-bit
value specified by Operand. If Operand is zero, then -1 is returned.
Otherwise, a value between 0 and 63 is returned.
@param Operand The 64-bit operand to evaluate.
@return Position of the highest bit set in Operand if found.
@retval -1 Operand is zero.
**/
INTN
EFIAPI
HighBitSet64 (
IN UINT64 Operand
)
{
if (Operand == (UINT32)Operand) {
//
// Operand is just a 32-bit integer
//
return HighBitSet32 ((UINT32)Operand);
}
//
// Operand is really a 64-bit integer
//
if (sizeof (UINTN) == sizeof (UINT32)) {
return HighBitSet32 (((UINT32*)&Operand)[1]) + 32;
} else {
return HighBitSet32 ((UINT32)RShiftU64 (Operand, 32)) + 32;
}
}

View File

@@ -0,0 +1,44 @@
; 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:
;
; ARShiftU64.asm
;
; Abstract:
;
; 64-bit arithmetic right shift function for IA-32
;
;------------------------------------------------------------------------------
.686
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathARShiftU64 (
; IN UINT64 Operand,
; IN UINTN Count
; );
;------------------------------------------------------------------------------
InternalMathARShiftU64 PROC
mov cl, [esp + 12]
mov eax, [esp + 8]
cdq
test cl, 32
cmovz edx, eax
cmovz eax, [esp + 4]
shrd eax, edx, cl
sar edx, cl
ret
InternalMathARShiftU64 ENDP
END

View File

@@ -0,0 +1,39 @@
; 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:
;
; CpuBreakpoint.Asm
;
; Abstract:
;
; CpuBreakpoint function
;
; Notes:
;
;------------------------------------------------------------------------------
.686
.model flat
.xmm
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; CpuBreakpoint (
; VOID
; );
;------------------------------------------------------------------------------
_CpuBreakpoint PROC
int 3
ret
_CpuBreakpoint ENDP
END

View File

@@ -0,0 +1,39 @@
; 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:
;
; CpuFlushTlb.Asm
;
; Abstract:
;
; CpuFlushTlb function
;
; Notes:
;
;------------------------------------------------------------------------------
.386p
.model flat,C
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; CpuFlushTlb (
; VOID
; );
;------------------------------------------------------------------------------
CpuFlushTlb PROC
mov eax, cr3
mov cr3, eax ; moving to CR3 flushes TLB
ret
CpuFlushTlb ENDP
END

View File

@@ -0,0 +1,64 @@
; 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:
;
; CpuId.Asm
;
; Abstract:
;
; AsmCpuid function
;
; Notes:
;
;------------------------------------------------------------------------------
.586P
.model flat,C
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmCpuid (
; IN UINT32 RegisterInEax,
; OUT UINT32 *RegisterOutEax OPTIONAL,
; OUT UINT32 *RegisterOutEbx OPTIONAL,
; OUT UINT32 *RegisterOutEcx OPTIONAL,
; OUT UINT32 *RegisterOutEdx OPTIONAL
; );
;------------------------------------------------------------------------------
AsmCpuid PROC USES ebx
push ebp
mov ebp, esp
mov eax, [ebp + 12]
cpuid
push ecx
mov ecx, [ebp + 16]
jecxz @F
mov [ecx], eax
@@:
mov ecx, [ebp + 20]
jecxz @F
mov [ecx], ebx
@@:
mov ecx, [ebp + 24]
jecxz @F
pop [ecx]
@@:
mov ecx, [ebp + 28]
jecxz @F
mov [ecx], edx
@@:
mov eax, [ebp + 12]
leave
ret
AsmCpuid ENDP
END

View File

@@ -0,0 +1,66 @@
; 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:
;
; CpuIdEx.Asm
;
; Abstract:
;
; AsmCpuidEx function
;
; Notes:
;
;------------------------------------------------------------------------------
.686
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT32
; EFIAPI
; AsmCpuidEx (
; IN UINT32 RegisterInEax,
; IN UINT32 RegisterInEcx,
; OUT UINT32 *RegisterOutEax OPTIONAL,
; OUT UINT32 *RegisterOutEbx OPTIONAL,
; OUT UINT32 *RegisterOutEcx OPTIONAL,
; OUT UINT32 *RegisterOutEdx OPTIONAL
; )
;------------------------------------------------------------------------------
AsmCpuidEx PROC USES ebx
push ebp
mov ebp, esp
mov eax, [ebp + 12]
mov ecx, [ebp + 16]
cpuid
push ecx
mov ecx, [ebp + 20]
jecxz @F
mov [ecx], eax
@@:
mov ecx, [ebp + 24]
jecxz @F
mov [ecx], ebx
@@:
mov ecx, [ebp + 28]
jecxz @F
pop [ecx]
@@:
mov edx, [ebp + 32]
jecxz @F
mov [ecx], edx
@@:
mov eax, [ebp + 12]
leave
ret
AsmCpuidEx ENDP
END

View File

@@ -0,0 +1,39 @@
; 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:
;
; CpuPause.Asm
;
; Abstract:
;
; CpuPause function
;
; Notes:
;
;------------------------------------------------------------------------------
.686
.model flat,C
.xmm
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; CpuPause (
; VOID
; );
;------------------------------------------------------------------------------
CpuPause PROC
pause
ret
CpuPause ENDP
END

View File

@@ -0,0 +1,38 @@
; 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:
;
; CpuSleep.Asm
;
; Abstract:
;
; CpuSleep function
;
; Notes:
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; CpuSleep (
; VOID
; );
;------------------------------------------------------------------------------
CpuSleep PROC
hlt
ret
CpuSleep ENDP
END

View File

@@ -0,0 +1,38 @@
; 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:
;
; DisableInterrupts.Asm
;
; Abstract:
;
; DisableInterrupts function
;
; Notes:
;
;------------------------------------------------------------------------------
.386p
.model flat,C
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; DisableInterrupts (
; VOID
; );
;------------------------------------------------------------------------------
DisableInterrupts PROC
cli
ret
DisableInterrupts ENDP
END

View File

@@ -0,0 +1,55 @@
; 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:
;
; DisablePaging32.Asm
;
; Abstract:
;
; AsmDisablePaging32 function
;
; Notes:
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalX86DisablePaging32 (
; IN SWITCH_STACK_ENTRY_POINT EntryPoint,
; IN VOID *Context1, OPTIONAL
; IN VOID *Context2, OPTIONAL
; IN VOID *NewStack
; );
;------------------------------------------------------------------------------
InternalX86DisablePaging32 PROC
mov ebx, [esp + 4]
mov ecx, [esp + 8]
mov edx, [esp + 12]
pushfd
pop edi ; save EFLAGS to edi
cli
mov eax, cr0
btr eax, 31
mov esp, [esp + 16]
mov cr0, eax
push edi
popfd ; restore EFLAGS from edi
push edx
push ecx
call ebx
jmp $ ; EntryPoint() should not return
InternalX86DisablePaging32 ENDP
END

View File

@@ -0,0 +1,60 @@
/*++
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:
DivS64x64Remainder.c
Abstract:
Integer division worker functions for Ia32.
--*/
#include "..\BaseLibInternal.h"
/**
Worker function that Divides a 64-bit signed integer by a 64-bit signed integer and
generates a 64-bit signed result and a optional 64-bit signed remainder.
This function divides the 64-bit unsigned value Dividend by the 64-bit
unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder
is not NULL, then the 64-bit unsigned remainder is returned in Remainder.
This function returns the 64-bit unsigned quotient.
@param Dividend A 64-bit signed value.
@param Divisor A 64-bit signed value.
@param Remainder A pointer to a 64-bit signed value. This parameter is
optional and may be NULL.
@return Dividend / Divisor
**/
INT64
InternalMathDivRemS64x64 (
IN INT64 Dividend,
IN INT64 Divisor,
OUT INT64 *Remainder OPTIONAL
)
{
INT64 Quot;
Quot = InternalMathDivRemU64x64 (
Dividend >= 0 ? Dividend : -Dividend,
Divisor >= 0 ? Divisor : -Divisor,
(UINT64 *) Remainder
);
if (Remainder != NULL && Dividend < 0) {
*Remainder = -*Remainder;
}
return (Dividend ^ Divisor) >= 0 ? Quot : -Quot;
}

Some files were not shown because too many files have changed in this diff Show More