1) Sync EdkCompatibilityPkg with EDK 1.04. The changes includes:
1.1) Bug fixes. (For details, please check Documents & files: Snapshot/Release Notes at https://edk.tianocore.org/servlets/ProjectDocumentList?folderID=43&expandFolder=43&folderID=6) 1.2) Add new UEFI protocol definitions for AbsolutePointer, FormBrowser2, HiiConfigAccess, HiiConfigRouting, HiiDatabase, HiiFont, HiiImage, HiiString, SimpleTextInputEx, DPC protocol. 1.3) Add Smbios 2.5, 2.6 supports. Incompatible changes hilighted: 1) EFI_MANAGED_NETWORK_PROTOCOL_GUID changed. 2) EFI_IP4_IPCONFIG_DATA changed. 2) Add in EdkCompatibilityPkg/EdkCompatibilityPkg.dsc to build all libraries in this package. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4623 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
58
EdkCompatibilityPkg/Foundation/Include/EfiCompNameSupport.h
Normal file
58
EdkCompatibilityPkg/Foundation/Include/EfiCompNameSupport.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/*++
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
EfiCompNameSupport.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Private data structures for the Console Splitter driver
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#ifndef EFI_COMPONENT_NAME_SUPPORT_H
|
||||||
|
#define EFI_COMPONENT_NAME_SUPPORT_H
|
||||||
|
|
||||||
|
#include "Tiano.h"
|
||||||
|
|
||||||
|
#ifndef EFI_SIZE_REDUCTION_APPLIED
|
||||||
|
|
||||||
|
#define INSTALL_ALL_DRIVER_PROTOCOLS(ImageHandle, \
|
||||||
|
SystemTable, \
|
||||||
|
DriverBinding, \
|
||||||
|
DriverBindingHandle, \
|
||||||
|
ComponentName, \
|
||||||
|
DriverConfiguration, \
|
||||||
|
DriverDiagnostics) \
|
||||||
|
EfiLibInstallAllDriverProtocols ((ImageHandle), \
|
||||||
|
(SystemTable), \
|
||||||
|
(DriverBinding), \
|
||||||
|
(DriverBindingHandle), \
|
||||||
|
(ComponentName), \
|
||||||
|
(DriverConfiguration), \
|
||||||
|
(DriverDiagnostics))
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define INSTALL_ALL_DRIVER_PROTOCOLS(ImageHandle, \
|
||||||
|
SystemTable, \
|
||||||
|
DriverBinding, \
|
||||||
|
DriverBindingHandle, \
|
||||||
|
ComponentName, \
|
||||||
|
DriverConfiguration, \
|
||||||
|
DriverDiagnostics) \
|
||||||
|
EfiLibInstallDriverBinding ((ImageHandle), \
|
||||||
|
(SystemTable), \
|
||||||
|
(DriverBinding), \
|
||||||
|
(DriverBindingHandle))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -24,13 +24,13 @@ Abstract:
|
|||||||
#ifndef _EFI_TPM_H_
|
#ifndef _EFI_TPM_H_
|
||||||
#define _EFI_TPM_H_
|
#define _EFI_TPM_H_
|
||||||
|
|
||||||
#include <Tiano.h>
|
#include "Tiano.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The start of TPM return codes
|
// The start of TPM return codes
|
||||||
//
|
//
|
||||||
#define TPM_BASE (EFI_MAX_BIT + (EFI_MAX_BIT >> 1))
|
#define TPM_BASE (EFI_MAX_BIT + (EFI_MAX_BIT >> 1))
|
||||||
#include <IndustryStandard/Tpm12.h>
|
#include "IndustryStandard/Tpm12.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Standard event types
|
// Standard event types
|
||||||
@ -117,7 +117,7 @@ typedef struct tdEFI_IMAGE_LOAD_EVENT {
|
|||||||
// the measurement of given configuration tables.
|
// the measurement of given configuration tables.
|
||||||
//
|
//
|
||||||
typedef struct tdEFI_HANDOFF_TABLE_POINTERS {
|
typedef struct tdEFI_HANDOFF_TABLE_POINTERS {
|
||||||
UINTN NumberOfTables;
|
UINTN NumberOfTables;
|
||||||
EFI_CONFIGURATION_TABLE TableEntry[1];
|
EFI_CONFIGURATION_TABLE TableEntry[1];
|
||||||
} EFI_HANDOFF_TABLE_POINTERS;
|
} EFI_HANDOFF_TABLE_POINTERS;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2004 - 2006, Intel Corporation
|
Copyright (c) 2004 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -49,12 +49,12 @@ Abstract:
|
|||||||
return 1; \
|
return 1; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
EFI_STATUS \
|
EFI_STATUS \
|
||||||
__declspec( dllexport ) \
|
__declspec( dllexport ) \
|
||||||
__cdecl \
|
__cdecl \
|
||||||
InitializeDriver ( \
|
InitializeDriver ( \
|
||||||
VOID *ImageHandle, \
|
EFI_HANDLE ImageHandle, \
|
||||||
VOID *SystemTable \
|
EFI_SYSTEM_TABLE *SystemTable \
|
||||||
) \
|
) \
|
||||||
{ \
|
{ \
|
||||||
return InitFunction(ImageHandle, SystemTable); \
|
return InitFunction(ImageHandle, SystemTable); \
|
||||||
|
@ -676,6 +676,16 @@ typedef struct {
|
|||||||
//
|
//
|
||||||
#define EFI_ACPI_3_0_WATCHDOG_RESOURCE_TABLE_SIGNATURE 0x54524457
|
#define EFI_ACPI_3_0_WATCHDOG_RESOURCE_TABLE_SIGNATURE 0x54524457
|
||||||
|
|
||||||
|
//
|
||||||
|
// "WDAT" Watchdog Action Table
|
||||||
|
//
|
||||||
|
#define EFI_ACPI_3_0_WATCHDOG_ACTION_TABLE_SIGNATURE 0x54414457
|
||||||
|
|
||||||
|
//
|
||||||
|
// "iBFT" iSCSI Boot Firmware Table
|
||||||
|
//
|
||||||
|
#define EFI_ACPI_3_0_ISCSI_BOOT_FIRMWARE_TABLE_SIGNATURE 0x54464269
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -0,0 +1,146 @@
|
|||||||
|
/*++
|
||||||
|
|
||||||
|
Copyright (c) 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
IScsiBootFirmwareTable.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
The definition for iSCSI Boot Firmware Table, it's defined in
|
||||||
|
Microsoft iBFT document.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#ifndef _ISCSI_BOOT_FIRMWARE_TABLE_H_
|
||||||
|
#define _ISCSI_BOOT_FIRMWARE_TABLE_H_
|
||||||
|
|
||||||
|
#include "Tiano.h"
|
||||||
|
#include "Acpi3_0.h"
|
||||||
|
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_REVISION 0x01
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_ALIGNMENT 8
|
||||||
|
|
||||||
|
enum {
|
||||||
|
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_RESERVED_STRUCTURE_ID = 0,
|
||||||
|
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE_ID,
|
||||||
|
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_ID,
|
||||||
|
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_ID,
|
||||||
|
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_ID,
|
||||||
|
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_EXTERNSIONS_STRUCTURE_ID,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
IpPrefixOriginOther = 0,
|
||||||
|
IpPrefixOriginManual,
|
||||||
|
IpPrefixOriginWellKnown,
|
||||||
|
IpPrefixOriginDhcp,
|
||||||
|
IpPrefixOriginRouterAdvertisement,
|
||||||
|
IpPrefixOriginUnchanged = 16
|
||||||
|
};
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT32 Signature;
|
||||||
|
UINT32 Length;
|
||||||
|
UINT8 Revision;
|
||||||
|
UINT8 Checksum;
|
||||||
|
UINT8 OemId[6];
|
||||||
|
UINT64 OemTableId;
|
||||||
|
UINT8 Reserved[24];
|
||||||
|
} EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_HEADER;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT8 StructureId;
|
||||||
|
UINT8 Version;
|
||||||
|
UINT16 Length;
|
||||||
|
UINT8 Index;
|
||||||
|
UINT8 Flags;
|
||||||
|
} EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_HEADER;
|
||||||
|
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE_VERSION 0x1
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE_FLAG_BOOT_FAILOVER 0x1
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_HEADER Header;
|
||||||
|
UINT16 Extensions;
|
||||||
|
UINT16 InitiatorOffset;
|
||||||
|
UINT16 NIC0Offset;
|
||||||
|
UINT16 Target0Offset;
|
||||||
|
UINT16 NIC1Offset;
|
||||||
|
UINT16 Target1Offset;
|
||||||
|
} EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_CONTROL_STRUCTURE;
|
||||||
|
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_VERSION 0x1
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_FLAG_BLOCK_VALID 0x1
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE_FLAG_BOOT_SELECTED 0x2
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_HEADER Header;
|
||||||
|
EFI_IPv6_ADDRESS ISnsServer;
|
||||||
|
EFI_IPv6_ADDRESS SlpServer;
|
||||||
|
EFI_IPv6_ADDRESS PrimaryRadiusServer;
|
||||||
|
EFI_IPv6_ADDRESS SecondaryRadiusServer;
|
||||||
|
UINT16 IScsiNameLength;
|
||||||
|
UINT16 IScsiNameOffset;
|
||||||
|
} EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_INITIATOR_STRUCTURE;
|
||||||
|
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_VERSION 0x1
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_FLAG_BLOCK_VALID 0x1
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_FLAG_BOOT_SELECTED 0x2
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE_FLAG_GLOBAL 0x4
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_HEADER Header;
|
||||||
|
EFI_IPv6_ADDRESS Ip;
|
||||||
|
UINT8 SubnetMaskPrefixLength;
|
||||||
|
UINT8 Origin;
|
||||||
|
EFI_IPv6_ADDRESS Gateway;
|
||||||
|
EFI_IPv6_ADDRESS PrimaryDns;
|
||||||
|
EFI_IPv6_ADDRESS SecondaryDns;
|
||||||
|
EFI_IPv6_ADDRESS DhcpServer;
|
||||||
|
UINT16 VLanTag;
|
||||||
|
UINT8 Mac[6];
|
||||||
|
UINT16 PciLocation;
|
||||||
|
UINT16 HostNameLength;
|
||||||
|
UINT16 HostNameOffset;
|
||||||
|
} EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_NIC_STRUCTURE;
|
||||||
|
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_VERSION 0x1
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_BLOCK_VALID 0x1
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_BOOT_SELECTED 0x2
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_RADIUS_CHAP 0x4
|
||||||
|
#define EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE_FLAG_RADIUS_RCHAP 0x8
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_STRUCTURE_HEADER Header;
|
||||||
|
EFI_IPv6_ADDRESS Ip;
|
||||||
|
UINT16 Port;
|
||||||
|
UINT8 BootLun[8];
|
||||||
|
UINT8 CHAPType;
|
||||||
|
UINT8 NicIndex;
|
||||||
|
UINT16 IScsiNameLength;
|
||||||
|
UINT16 IScsiNameOffset;
|
||||||
|
UINT16 CHAPNameLength;
|
||||||
|
UINT16 CHAPNameOffset;
|
||||||
|
UINT16 CHAPSecretLength;
|
||||||
|
UINT16 CHAPSecretOffset;
|
||||||
|
UINT16 ReverseCHAPNameLength;
|
||||||
|
UINT16 ReverseCHAPNameOffset;
|
||||||
|
UINT16 ReverseCHAPSecretLength;
|
||||||
|
UINT16 ReverseCHAPSecretOffset;
|
||||||
|
} EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_TARGET_STRUCTURE;
|
||||||
|
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -136,6 +136,17 @@ typedef struct {
|
|||||||
SMBIOS_TABLE_STRING SerialNumber;
|
SMBIOS_TABLE_STRING SerialNumber;
|
||||||
SMBIOS_TABLE_STRING AssetTag;
|
SMBIOS_TABLE_STRING AssetTag;
|
||||||
SMBIOS_TABLE_STRING PartNumber;
|
SMBIOS_TABLE_STRING PartNumber;
|
||||||
|
//
|
||||||
|
// Add for smbios 2.5
|
||||||
|
//
|
||||||
|
UINT8 CoreCount;
|
||||||
|
UINT8 EnabledCoreCount;
|
||||||
|
UINT8 ThreadCount;
|
||||||
|
UINT16 ProcessorCharacteristics;
|
||||||
|
//
|
||||||
|
// Add for smbios 2.6
|
||||||
|
//
|
||||||
|
UINT16 ProcessorFamily2;
|
||||||
} SMBIOS_TABLE_TYPE4;
|
} SMBIOS_TABLE_TYPE4;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -197,6 +208,12 @@ typedef struct {
|
|||||||
UINT16 SlotID;
|
UINT16 SlotID;
|
||||||
UINT8 SlotCharacteristics1;
|
UINT8 SlotCharacteristics1;
|
||||||
UINT8 SlotCharacteristics2;
|
UINT8 SlotCharacteristics2;
|
||||||
|
//
|
||||||
|
// Add for smbios 2.6
|
||||||
|
//
|
||||||
|
UINT16 SegmentGroupNum;
|
||||||
|
UINT8 BusNum;
|
||||||
|
UINT8 DevFuncNum;
|
||||||
} SMBIOS_TABLE_TYPE9;
|
} SMBIOS_TABLE_TYPE9;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -286,6 +303,10 @@ typedef struct {
|
|||||||
SMBIOS_TABLE_STRING SerialNumber;
|
SMBIOS_TABLE_STRING SerialNumber;
|
||||||
SMBIOS_TABLE_STRING AssetTag;
|
SMBIOS_TABLE_STRING AssetTag;
|
||||||
SMBIOS_TABLE_STRING PartNumber;
|
SMBIOS_TABLE_STRING PartNumber;
|
||||||
|
//
|
||||||
|
// Add for smbios 2.6
|
||||||
|
//
|
||||||
|
UINT8 Attributes;
|
||||||
} SMBIOS_TABLE_TYPE17;
|
} SMBIOS_TABLE_TYPE17;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -516,6 +537,33 @@ typedef struct {
|
|||||||
UINT16 InputCurrentProbeHandle;
|
UINT16 InputCurrentProbeHandle;
|
||||||
} SMBIOS_TABLE_TYPE39;
|
} SMBIOS_TABLE_TYPE39;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add type 40 and type 41 for smbios 2.6
|
||||||
|
//
|
||||||
|
typedef struct {
|
||||||
|
UINT8 EntryLength;
|
||||||
|
UINT16 ReferencedHandle;
|
||||||
|
UINT8 ReferencedOffset;
|
||||||
|
SMBIOS_TABLE_STRING EntryString;
|
||||||
|
UINT8 Value[1];
|
||||||
|
}ADDITIONAL_INFORMATION_ENTRY;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
SMBIOS_TABLE_HEADER Hdr;
|
||||||
|
UINT8 NumberOfAdditionalInformationEntries;
|
||||||
|
ADDITIONAL_INFORMATION_ENTRY AdditionalInfoEntries[1];
|
||||||
|
} SMBIOS_TABLE_TYPE40;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
SMBIOS_TABLE_HEADER Hdr;
|
||||||
|
SMBIOS_TABLE_STRING ReferenceDesignation;
|
||||||
|
UINT8 DeviceType;
|
||||||
|
UINT8 DeviceTypeInstance;
|
||||||
|
UINT16 SegmentGroupNum;
|
||||||
|
UINT8 BusNum;
|
||||||
|
UINT8 DevFuncNum;
|
||||||
|
} SMBIOS_TABLE_TYPE41;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SMBIOS_TABLE_HEADER Hdr;
|
SMBIOS_TABLE_HEADER Hdr;
|
||||||
} SMBIOS_TABLE_TYPE126;
|
} SMBIOS_TABLE_TYPE126;
|
||||||
@ -566,6 +614,8 @@ typedef union {
|
|||||||
SMBIOS_TABLE_TYPE37 *Type37;
|
SMBIOS_TABLE_TYPE37 *Type37;
|
||||||
SMBIOS_TABLE_TYPE38 *Type38;
|
SMBIOS_TABLE_TYPE38 *Type38;
|
||||||
SMBIOS_TABLE_TYPE39 *Type39;
|
SMBIOS_TABLE_TYPE39 *Type39;
|
||||||
|
SMBIOS_TABLE_TYPE40 *Type40;
|
||||||
|
SMBIOS_TABLE_TYPE41 *Type41;
|
||||||
SMBIOS_TABLE_TYPE126 *Type126;
|
SMBIOS_TABLE_TYPE126 *Type126;
|
||||||
SMBIOS_TABLE_TYPE127 *Type127;
|
SMBIOS_TABLE_TYPE127 *Type127;
|
||||||
UINT8 *Raw;
|
UINT8 *Raw;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2004 - 2006, Intel Corporation
|
Copyright (c) 2004 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -14,7 +14,7 @@ Module Name:
|
|||||||
usb.h
|
usb.h
|
||||||
|
|
||||||
Abstract:
|
Abstract:
|
||||||
Support for USB 1.1 standard.
|
Support for USB standard.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -23,8 +23,237 @@ Revision History
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#ifndef _USB_H
|
#ifndef _USB_INDUSTRY_H_
|
||||||
#define _USB_H
|
#define _USB_INDUSTRY_H_
|
||||||
|
|
||||||
|
//
|
||||||
|
// USB Transfer Results
|
||||||
|
//
|
||||||
|
#define EFI_USB_NOERROR 0x00
|
||||||
|
#define EFI_USB_ERR_NOTEXECUTE 0x01
|
||||||
|
#define EFI_USB_ERR_STALL 0x02
|
||||||
|
#define EFI_USB_ERR_BUFFER 0x04
|
||||||
|
#define EFI_USB_ERR_BABBLE 0x08
|
||||||
|
#define EFI_USB_ERR_NAK 0x10
|
||||||
|
#define EFI_USB_ERR_CRC 0x20
|
||||||
|
#define EFI_USB_ERR_TIMEOUT 0x40
|
||||||
|
#define EFI_USB_ERR_BITSTUFF 0x80
|
||||||
|
#define EFI_USB_ERR_SYSTEM 0x100
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constant value for Port Status & Port Change Status
|
||||||
|
//
|
||||||
|
#define USB_PORT_STAT_CONNECTION 0x0001
|
||||||
|
#define USB_PORT_STAT_ENABLE 0x0002
|
||||||
|
#define USB_PORT_STAT_SUSPEND 0x0004
|
||||||
|
#define USB_PORT_STAT_OVERCURRENT 0x0008
|
||||||
|
#define USB_PORT_STAT_RESET 0x0010
|
||||||
|
#define USB_PORT_STAT_POWER 0x0100
|
||||||
|
#define USB_PORT_STAT_LOW_SPEED 0x0200
|
||||||
|
#define USB_PORT_STAT_HIGH_SPEED 0x0400
|
||||||
|
#define USB_PORT_STAT_OWNER 0x0800
|
||||||
|
|
||||||
|
#define USB_PORT_STAT_C_CONNECTION 0x0001
|
||||||
|
#define USB_PORT_STAT_C_ENABLE 0x0002
|
||||||
|
#define USB_PORT_STAT_C_SUSPEND 0x0004
|
||||||
|
#define USB_PORT_STAT_C_OVERCURRENT 0x0008
|
||||||
|
#define USB_PORT_STAT_C_RESET 0x0010
|
||||||
|
|
||||||
|
//
|
||||||
|
// Usb data transfer direction
|
||||||
|
//
|
||||||
|
typedef enum {
|
||||||
|
EfiUsbDataIn,
|
||||||
|
EfiUsbDataOut,
|
||||||
|
EfiUsbNoData
|
||||||
|
} EFI_USB_DATA_DIRECTION;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Usb data recipient type
|
||||||
|
//
|
||||||
|
typedef enum {
|
||||||
|
EfiUsbDevice,
|
||||||
|
EfiUsbInterface,
|
||||||
|
EfiUsbEndpoint
|
||||||
|
} EFI_USB_RECIPIENT;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Usb port features
|
||||||
|
//
|
||||||
|
typedef enum {
|
||||||
|
EfiUsbPortEnable = 1,
|
||||||
|
EfiUsbPortSuspend = 2,
|
||||||
|
EfiUsbPortReset = 4,
|
||||||
|
EfiUsbPortPower = 8,
|
||||||
|
EfiUsbPortOwner = 13,
|
||||||
|
EfiUsbPortConnectChange = 16,
|
||||||
|
EfiUsbPortEnableChange = 17,
|
||||||
|
EfiUsbPortSuspendChange = 18,
|
||||||
|
EfiUsbPortOverCurrentChange = 19,
|
||||||
|
EfiUsbPortResetChange = 20
|
||||||
|
} EFI_USB_PORT_FEATURE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Following are definitions not specified by UEFI spec.
|
||||||
|
// Add new definitions below this line
|
||||||
|
//
|
||||||
|
enum {
|
||||||
|
//
|
||||||
|
// USB request type
|
||||||
|
//
|
||||||
|
USB_REQ_TYPE_STANDARD = (0x00 << 5),
|
||||||
|
USB_REQ_TYPE_CLASS = (0x01 << 5),
|
||||||
|
USB_REQ_TYPE_VENDOR = (0x02 << 5),
|
||||||
|
|
||||||
|
//
|
||||||
|
// Standard control transfer request type, or the value
|
||||||
|
// to fill in EFI_USB_DEVICE_REQUEST.Request
|
||||||
|
//
|
||||||
|
USB_REQ_GET_STATUS = 0x00,
|
||||||
|
USB_REQ_CLEAR_FEATURE = 0x01,
|
||||||
|
USB_REQ_SET_FEATURE = 0x03,
|
||||||
|
USB_REQ_SET_ADDRESS = 0x05,
|
||||||
|
USB_REQ_GET_DESCRIPTOR = 0x06,
|
||||||
|
USB_REQ_SET_DESCRIPTOR = 0x07,
|
||||||
|
USB_REQ_GET_CONFIG = 0x08,
|
||||||
|
USB_REQ_SET_CONFIG = 0x09,
|
||||||
|
USB_REQ_GET_INTERFACE = 0x0A,
|
||||||
|
USB_REQ_SET_INTERFACE = 0x0B,
|
||||||
|
USB_REQ_SYNCH_FRAME = 0x0C,
|
||||||
|
|
||||||
|
//
|
||||||
|
// Usb control transfer target
|
||||||
|
//
|
||||||
|
USB_TARGET_DEVICE = 0,
|
||||||
|
USB_TARGET_INTERFACE = 0x01,
|
||||||
|
USB_TARGET_ENDPOINT = 0x02,
|
||||||
|
USB_TARGET_OTHER = 0x03,
|
||||||
|
|
||||||
|
//
|
||||||
|
// USB Descriptor types
|
||||||
|
//
|
||||||
|
USB_DESC_TYPE_DEVICE = 0x01,
|
||||||
|
USB_DESC_TYPE_CONFIG = 0x02,
|
||||||
|
USB_DESC_TYPE_STRING = 0x03,
|
||||||
|
USB_DESC_TYPE_INTERFACE = 0x04,
|
||||||
|
USB_DESC_TYPE_ENDPOINT = 0x05,
|
||||||
|
USB_DESC_TYPE_HID = 0x21,
|
||||||
|
|
||||||
|
//
|
||||||
|
// Features to be cleared by CLEAR_FEATURE requests
|
||||||
|
//
|
||||||
|
USB_FEATURE_ENDPOINT_HALT = 0,
|
||||||
|
|
||||||
|
//
|
||||||
|
// USB endpoint types: 00: control, 01: isochronous, 10: bulk, 11: interrupt
|
||||||
|
//
|
||||||
|
USB_ENDPOINT_CONTROL = 0x00,
|
||||||
|
USB_ENDPOINT_ISO = 0x01,
|
||||||
|
USB_ENDPOINT_BULK = 0x02,
|
||||||
|
USB_ENDPOINT_INTERRUPT = 0x03,
|
||||||
|
|
||||||
|
USB_ENDPOINT_TYPE_MASK = 0x03,
|
||||||
|
USB_ENDPOINT_DIR_IN = 0x80,
|
||||||
|
|
||||||
|
MAXBYTES = 8,
|
||||||
|
|
||||||
|
//
|
||||||
|
//Use 200 ms to increase the error handling response time
|
||||||
|
//
|
||||||
|
EFI_USB_INTERRUPT_DELAY = 2000000,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// USB standard descriptors and reqeust
|
||||||
|
//
|
||||||
|
#pragma pack(1)
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT8 RequestType;
|
||||||
|
UINT8 Request;
|
||||||
|
UINT16 Value;
|
||||||
|
UINT16 Index;
|
||||||
|
UINT16 Length;
|
||||||
|
} EFI_USB_DEVICE_REQUEST;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT8 Length;
|
||||||
|
UINT8 DescriptorType;
|
||||||
|
UINT16 BcdUSB;
|
||||||
|
UINT8 DeviceClass;
|
||||||
|
UINT8 DeviceSubClass;
|
||||||
|
UINT8 DeviceProtocol;
|
||||||
|
UINT8 MaxPacketSize0;
|
||||||
|
UINT16 IdVendor;
|
||||||
|
UINT16 IdProduct;
|
||||||
|
UINT16 BcdDevice;
|
||||||
|
UINT8 StrManufacturer;
|
||||||
|
UINT8 StrProduct;
|
||||||
|
UINT8 StrSerialNumber;
|
||||||
|
UINT8 NumConfigurations;
|
||||||
|
} EFI_USB_DEVICE_DESCRIPTOR;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT8 Length;
|
||||||
|
UINT8 DescriptorType;
|
||||||
|
UINT16 TotalLength;
|
||||||
|
UINT8 NumInterfaces;
|
||||||
|
UINT8 ConfigurationValue;
|
||||||
|
UINT8 Configuration;
|
||||||
|
UINT8 Attributes;
|
||||||
|
UINT8 MaxPower;
|
||||||
|
} EFI_USB_CONFIG_DESCRIPTOR;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT8 Length;
|
||||||
|
UINT8 DescriptorType;
|
||||||
|
UINT8 InterfaceNumber;
|
||||||
|
UINT8 AlternateSetting;
|
||||||
|
UINT8 NumEndpoints;
|
||||||
|
UINT8 InterfaceClass;
|
||||||
|
UINT8 InterfaceSubClass;
|
||||||
|
UINT8 InterfaceProtocol;
|
||||||
|
UINT8 Interface;
|
||||||
|
} EFI_USB_INTERFACE_DESCRIPTOR;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT8 Length;
|
||||||
|
UINT8 DescriptorType;
|
||||||
|
UINT8 EndpointAddress;
|
||||||
|
UINT8 Attributes;
|
||||||
|
UINT16 MaxPacketSize;
|
||||||
|
UINT8 Interval;
|
||||||
|
} EFI_USB_ENDPOINT_DESCRIPTOR;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT8 Length;
|
||||||
|
UINT8 DescriptorType;
|
||||||
|
CHAR16 String[1];
|
||||||
|
} EFI_USB_STRING_DESCRIPTOR;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT16 PortStatus;
|
||||||
|
UINT16 PortChangeStatus;
|
||||||
|
} EFI_USB_PORT_STATUS;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT8 Length;
|
||||||
|
UINT8 DescriptorType;
|
||||||
|
UINT8 NbrPorts;
|
||||||
|
UINT8 HubCharacteristics[2];
|
||||||
|
UINT8 PwrOn2PwrGood;
|
||||||
|
UINT8 HubContrCurrent;
|
||||||
|
UINT8 Filler[MAXBYTES];
|
||||||
|
} EFI_USB_HUB_DESCRIPTOR;
|
||||||
|
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
/////////////////// Backward Compatibility ///////////////////
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//
|
//
|
||||||
// USB Descriptor types
|
// USB Descriptor types
|
||||||
//
|
//
|
||||||
@ -61,161 +290,35 @@ Revision History
|
|||||||
#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
|
#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
|
||||||
#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
|
#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
|
||||||
|
|
||||||
//
|
|
||||||
// USB Transfer Results
|
|
||||||
//
|
|
||||||
#define EFI_USB_NOERROR 0x00
|
|
||||||
#define EFI_USB_ERR_NOTEXECUTE 0x01
|
|
||||||
#define EFI_USB_ERR_STALL 0x02
|
|
||||||
#define EFI_USB_ERR_BUFFER 0x04
|
|
||||||
#define EFI_USB_ERR_BABBLE 0x08
|
|
||||||
#define EFI_USB_ERR_NAK 0x10
|
|
||||||
#define EFI_USB_ERR_CRC 0x20
|
|
||||||
#define EFI_USB_ERR_TIMEOUT 0x40
|
|
||||||
#define EFI_USB_ERR_BITSTUFF 0x80
|
|
||||||
#define EFI_USB_ERR_SYSTEM 0x100
|
|
||||||
|
|
||||||
//
|
|
||||||
//Use 200 ms to increase the error handling response time
|
|
||||||
//
|
|
||||||
#define EFI_USB_INTERRUPT_DELAY 2000000
|
|
||||||
|
|
||||||
//
|
|
||||||
// USB transation direction
|
|
||||||
//
|
|
||||||
typedef enum {
|
|
||||||
EfiUsbDataIn,
|
|
||||||
EfiUsbDataOut,
|
|
||||||
EfiUsbNoData
|
|
||||||
} EFI_USB_DATA_DIRECTION;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Usb Data recipient type
|
|
||||||
//
|
|
||||||
typedef enum {
|
|
||||||
EfiUsbDevice,
|
|
||||||
EfiUsbInterface,
|
|
||||||
EfiUsbEndpoint
|
|
||||||
} EFI_USB_RECIPIENT;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EfiUsbEndpointHalt,
|
EfiUsbEndpointHalt,
|
||||||
EfiUsbDeviceRemoteWakeup
|
EfiUsbDeviceRemoteWakeup
|
||||||
} EFI_USB_STANDARD_FEATURE_SELECTOR;
|
} EFI_USB_STANDARD_FEATURE_SELECTOR;
|
||||||
|
|
||||||
#pragma pack(1)
|
|
||||||
//
|
|
||||||
// Usb device request structure
|
|
||||||
//
|
|
||||||
typedef struct {
|
|
||||||
UINT8 RequestType;
|
|
||||||
UINT8 Request;
|
|
||||||
UINT16 Value;
|
|
||||||
UINT16 Index;
|
|
||||||
UINT16 Length;
|
|
||||||
} EFI_USB_DEVICE_REQUEST;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Standard USB request
|
// Standard USB request
|
||||||
//
|
//
|
||||||
#define USB_DEV_GET_STATUS 0x00
|
#define USB_DEV_GET_STATUS 0x00
|
||||||
|
|
||||||
#define USB_DEV_CLEAR_FEATURE 0x01
|
#define USB_DEV_CLEAR_FEATURE 0x01
|
||||||
|
|
||||||
#define USB_DEV_SET_FEATURE 0x03
|
#define USB_DEV_SET_FEATURE 0x03
|
||||||
|
|
||||||
#define USB_DEV_SET_ADDRESS 0x05
|
#define USB_DEV_SET_ADDRESS 0x05
|
||||||
#define USB_DEV_SET_ADDRESS_REQ_TYPE 0x00
|
#define USB_DEV_SET_ADDRESS_REQ_TYPE 0x00
|
||||||
|
|
||||||
#define USB_DEV_GET_DESCRIPTOR 0x06
|
#define USB_DEV_GET_DESCRIPTOR 0x06
|
||||||
#define USB_DEV_GET_DESCRIPTOR_REQ_TYPE 0x80
|
#define USB_DEV_GET_DESCRIPTOR_REQ_TYPE 0x80
|
||||||
|
|
||||||
#define USB_DEV_SET_DESCRIPTOR 0x07
|
#define USB_DEV_SET_DESCRIPTOR 0x07
|
||||||
#define USB_DEV_SET_DESCRIPTOR_REQ_TYPE 0x00
|
#define USB_DEV_SET_DESCRIPTOR_REQ_TYPE 0x00
|
||||||
|
|
||||||
#define USB_DEV_GET_CONFIGURATION 0x08
|
#define USB_DEV_GET_CONFIGURATION 0x08
|
||||||
#define USB_DEV_GET_CONFIGURATION_REQ_TYPE 0x80
|
#define USB_DEV_GET_CONFIGURATION_REQ_TYPE 0x80
|
||||||
|
|
||||||
#define USB_DEV_SET_CONFIGURATION 0x09
|
#define USB_DEV_SET_CONFIGURATION 0x09
|
||||||
#define USB_DEV_SET_CONFIGURATION_REQ_TYPE 0x00
|
#define USB_DEV_SET_CONFIGURATION_REQ_TYPE 0x00
|
||||||
|
|
||||||
#define USB_DEV_GET_INTERFACE 0x0A
|
#define USB_DEV_GET_INTERFACE 0x0A
|
||||||
#define USB_DEV_GET_INTERFACE_REQ_TYPE 0x81
|
#define USB_DEV_GET_INTERFACE_REQ_TYPE 0x81
|
||||||
|
|
||||||
#define USB_DEV_SET_INTERFACE 0x0B
|
#define USB_DEV_SET_INTERFACE 0x0B
|
||||||
#define USB_DEV_SET_INTERFACE_REQ_TYPE 0x01
|
#define USB_DEV_SET_INTERFACE_REQ_TYPE 0x01
|
||||||
|
|
||||||
#define USB_DEV_SYNCH_FRAME 0x0C
|
#define USB_DEV_SYNCH_FRAME 0x0C
|
||||||
#define USB_DEV_SYNCH_FRAME_REQ_TYPE 0x82
|
#define USB_DEV_SYNCH_FRAME_REQ_TYPE 0x82
|
||||||
|
|
||||||
//
|
#pragma pack(1)
|
||||||
// Device descriptor. refer USB1.1
|
|
||||||
//
|
|
||||||
typedef struct usb_device_descriptor {
|
|
||||||
UINT8 Length;
|
|
||||||
UINT8 DescriptorType;
|
|
||||||
UINT16 BcdUSB;
|
|
||||||
UINT8 DeviceClass;
|
|
||||||
UINT8 DeviceSubClass;
|
|
||||||
UINT8 DeviceProtocol;
|
|
||||||
UINT8 MaxPacketSize0;
|
|
||||||
UINT16 IdVendor;
|
|
||||||
UINT16 IdProduct;
|
|
||||||
UINT16 BcdDevice;
|
|
||||||
UINT8 StrManufacturer;
|
|
||||||
UINT8 StrProduct;
|
|
||||||
UINT8 StrSerialNumber;
|
|
||||||
UINT8 NumConfigurations;
|
|
||||||
} EFI_USB_DEVICE_DESCRIPTOR;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Endpoint descriptor
|
|
||||||
//
|
|
||||||
typedef struct {
|
|
||||||
UINT8 Length;
|
|
||||||
UINT8 DescriptorType;
|
|
||||||
UINT8 EndpointAddress;
|
|
||||||
UINT8 Attributes;
|
|
||||||
UINT16 MaxPacketSize;
|
|
||||||
UINT8 Interval;
|
|
||||||
} EFI_USB_ENDPOINT_DESCRIPTOR;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Interface descriptor
|
|
||||||
//
|
|
||||||
typedef struct {
|
|
||||||
UINT8 Length;
|
|
||||||
UINT8 DescriptorType;
|
|
||||||
UINT8 InterfaceNumber;
|
|
||||||
UINT8 AlternateSetting;
|
|
||||||
UINT8 NumEndpoints;
|
|
||||||
UINT8 InterfaceClass;
|
|
||||||
UINT8 InterfaceSubClass;
|
|
||||||
UINT8 InterfaceProtocol;
|
|
||||||
UINT8 Interface;
|
|
||||||
} EFI_USB_INTERFACE_DESCRIPTOR;
|
|
||||||
|
|
||||||
//
|
|
||||||
// USB alternate setting
|
|
||||||
//
|
|
||||||
typedef struct {
|
|
||||||
EFI_USB_INTERFACE_DESCRIPTOR *Interface;
|
|
||||||
} USB_ALT_SETTING;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Configuration descriptor
|
|
||||||
//
|
|
||||||
typedef struct {
|
|
||||||
UINT8 Length;
|
|
||||||
UINT8 DescriptorType;
|
|
||||||
UINT16 TotalLength;
|
|
||||||
UINT8 NumInterfaces;
|
|
||||||
UINT8 ConfigurationValue;
|
|
||||||
UINT8 Configuration;
|
|
||||||
UINT8 Attributes;
|
|
||||||
UINT8 MaxPower;
|
|
||||||
} EFI_USB_CONFIG_DESCRIPTOR;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Supported String Languages
|
// Supported String Languages
|
||||||
//
|
//
|
||||||
@ -226,68 +329,16 @@ typedef struct {
|
|||||||
} EFI_USB_SUPPORTED_LANGUAGES;
|
} EFI_USB_SUPPORTED_LANGUAGES;
|
||||||
|
|
||||||
//
|
//
|
||||||
// String descriptor
|
// USB alternate setting
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT8 Length;
|
EFI_USB_INTERFACE_DESCRIPTOR *Interface;
|
||||||
UINT8 DescriptorType;
|
} USB_ALT_SETTING;
|
||||||
CHAR16 String[1];
|
|
||||||
} EFI_USB_STRING_DESCRIPTOR;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Hub descriptor
|
|
||||||
//
|
|
||||||
#define MAXBYTES 8
|
|
||||||
typedef struct {
|
|
||||||
UINT8 Length;
|
|
||||||
UINT8 DescriptorType;
|
|
||||||
UINT8 NbrPorts;
|
|
||||||
UINT8 HubCharacteristics[2];
|
|
||||||
UINT8 PwrOn2PwrGood;
|
|
||||||
UINT8 HubContrCurrent;
|
|
||||||
UINT8 Filler[MAXBYTES];
|
|
||||||
} EFI_USB_HUB_DESCRIPTOR;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT16 PortStatus;
|
|
||||||
UINT16 PortChangeStatus;
|
|
||||||
} EFI_USB_PORT_STATUS;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constant value for Port Status & Port Change Status
|
|
||||||
//
|
|
||||||
#define USB_PORT_STAT_CONNECTION 0x0001
|
|
||||||
#define USB_PORT_STAT_ENABLE 0x0002
|
|
||||||
#define USB_PORT_STAT_SUSPEND 0x0004
|
|
||||||
#define USB_PORT_STAT_OVERCURRENT 0x0008
|
|
||||||
#define USB_PORT_STAT_RESET 0x0010
|
|
||||||
#define USB_PORT_STAT_POWER 0x0100
|
|
||||||
#define USB_PORT_STAT_LOW_SPEED 0x0200
|
|
||||||
#define USB_PORT_STAT_HIGH_SPEED 0x0400
|
|
||||||
#define USB_PORT_STAT_OWNER 0x0800
|
|
||||||
|
|
||||||
#define USB_PORT_STAT_C_CONNECTION 0x0001
|
|
||||||
#define USB_PORT_STAT_C_ENABLE 0x0002
|
|
||||||
#define USB_PORT_STAT_C_SUSPEND 0x0004
|
|
||||||
#define USB_PORT_STAT_C_OVERCURRENT 0x0008
|
|
||||||
#define USB_PORT_STAT_C_RESET 0x0010
|
|
||||||
|
|
||||||
//
|
|
||||||
// Used for set/clear port feature request
|
|
||||||
//
|
|
||||||
typedef enum {
|
|
||||||
EfiUsbPortEnable = 1,
|
|
||||||
EfiUsbPortSuspend = 2,
|
|
||||||
EfiUsbPortReset = 4,
|
|
||||||
EfiUsbPortPower = 8,
|
|
||||||
EfiUsbPortOwner = 13,
|
|
||||||
EfiUsbPortConnectChange = 16,
|
|
||||||
EfiUsbPortEnableChange = 17,
|
|
||||||
EfiUsbPortSuspendChange = 18,
|
|
||||||
EfiUsbPortOverCurrentChange = 19,
|
|
||||||
EfiUsbPortResetChange = 20
|
|
||||||
} EFI_USB_PORT_FEATURE;
|
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
66
EdkCompatibilityPkg/Foundation/Include/Pei/PeiPerf.h
Normal file
66
EdkCompatibilityPkg/Foundation/Include/Pei/PeiPerf.h
Normal 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:
|
||||||
|
|
||||||
|
PeiPerf.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
PeiPerf.h provides performance primitives for PEI modules
|
||||||
|
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#ifndef _PEI_PERF_H_
|
||||||
|
#define _PEI_PERF_H_
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
PeiPerfMeasure (
|
||||||
|
EFI_PEI_SERVICES **PeiServices,
|
||||||
|
IN UINT16 *Token,
|
||||||
|
IN EFI_FFS_FILE_HEADER *FileHeader,
|
||||||
|
IN BOOLEAN EntryExit,
|
||||||
|
IN UINT64 Value
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Log a timestamp count.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
PeiServices - Pointer to the PEI Core Services table
|
||||||
|
|
||||||
|
Token - Pointer to Token Name
|
||||||
|
|
||||||
|
FileHeader - Pointer to the file header
|
||||||
|
|
||||||
|
EntryExit - Indicates start or stop measurement
|
||||||
|
|
||||||
|
Value - The start time or the stop time
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
;
|
||||||
|
|
||||||
|
#ifdef EFI_PEI_PERFORMANCE
|
||||||
|
#define PEI_PERF_START(Ps, Token, FileHeader, Value) PeiPerfMeasure (Ps, Token, FileHeader, FALSE, Value)
|
||||||
|
#define PEI_PERF_END(Ps, Token, FileHeader, Value) PeiPerfMeasure (Ps, Token, FileHeader, TRUE, Value)
|
||||||
|
#else
|
||||||
|
#define PEI_PERF_START(Ps, Token, FileHeader, Value)
|
||||||
|
#define PEI_PERF_END(Ps, Token, FileHeader, Value)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
118
EdkCompatibilityPkg/Foundation/Include/TianoHii.h
Normal file
118
EdkCompatibilityPkg/Foundation/Include/TianoHii.h
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
/*++
|
||||||
|
|
||||||
|
Copyright (c) 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
TianoHii.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Tiano specific HII relative definition.
|
||||||
|
|
||||||
|
Revision History
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#ifndef _TIANO_HII_H_
|
||||||
|
#define _TIANO_HII_H_
|
||||||
|
|
||||||
|
#include "EfiHii.h"
|
||||||
|
|
||||||
|
#define NARROW_CHAR 0xFFF0
|
||||||
|
#define WIDE_CHAR 0xFFF1
|
||||||
|
#define NON_BREAKING_CHAR 0xFFF2
|
||||||
|
|
||||||
|
#define GLYPH_WIDTH EFI_GLYPH_WIDTH
|
||||||
|
#define GLYPH_HEIGHT EFI_GLYPH_HEIGHT
|
||||||
|
|
||||||
|
//
|
||||||
|
// State defined for password statemachine
|
||||||
|
//
|
||||||
|
#define BROWSER_STATE_VALIDATE_PASSWORD 0
|
||||||
|
#define BROWSER_STATE_SET_PASSWORD 1
|
||||||
|
|
||||||
|
//
|
||||||
|
// References to string tokens must use this macro to enable scanning for
|
||||||
|
// token usages.
|
||||||
|
//
|
||||||
|
#define STRING_TOKEN(t) t
|
||||||
|
|
||||||
|
//
|
||||||
|
// GUIDed opcodes defined for Tiano
|
||||||
|
//
|
||||||
|
#define EFI_IFR_TIANO_GUID \
|
||||||
|
{ 0xf0b1735, 0x87a0, 0x4193, 0xb2, 0x66, 0x53, 0x8c, 0x38, 0xaf, 0x48, 0xce }
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
|
||||||
|
#define EFI_IFR_EXTEND_OP_LABEL 0x0
|
||||||
|
#define EFI_IFR_EXTEND_OP_BANNER 0x1
|
||||||
|
#define EFI_IFR_EXTEND_OP_TIMEOUT 0x2
|
||||||
|
#define EFI_IFR_EXTEND_OP_CLASS 0x3
|
||||||
|
#define EFI_IFR_EXTEND_OP_SUBCLASS 0x4
|
||||||
|
|
||||||
|
typedef struct _EFI_IFR_GUID_LABEL {
|
||||||
|
EFI_IFR_OP_HEADER Header;
|
||||||
|
EFI_GUID Guid;
|
||||||
|
UINT8 ExtendOpCode;
|
||||||
|
UINT16 Number;
|
||||||
|
} EFI_IFR_GUID_LABEL;
|
||||||
|
|
||||||
|
#define EFI_IFR_BANNER_ALIGN_LEFT 0
|
||||||
|
#define EFI_IFR_BANNER_ALIGN_CENTER 1
|
||||||
|
#define EFI_IFR_BANNER_ALIGN_RIGHT 2
|
||||||
|
|
||||||
|
typedef struct _EFI_IFR_GUID_BANNER {
|
||||||
|
EFI_IFR_OP_HEADER Header;
|
||||||
|
EFI_GUID Guid;
|
||||||
|
UINT8 ExtendOpCode; // Extended opcode is EFI_IFR_EXTEND_OP_BANNER
|
||||||
|
EFI_STRING_ID Title; // The string token for the banner title
|
||||||
|
UINT16 LineNumber; // 1-based line number
|
||||||
|
UINT8 Alignment; // left, center, or right-aligned
|
||||||
|
} EFI_IFR_GUID_BANNER;
|
||||||
|
|
||||||
|
typedef struct _EFI_IFR_GUID_TIMEOUT {
|
||||||
|
EFI_IFR_OP_HEADER Header;
|
||||||
|
EFI_GUID Guid;
|
||||||
|
UINT8 ExtendOpCode;
|
||||||
|
UINT16 TimeOut;
|
||||||
|
} EFI_IFR_GUID_TIMEOUT;
|
||||||
|
|
||||||
|
#define EFI_NON_DEVICE_CLASS 0x00
|
||||||
|
#define EFI_DISK_DEVICE_CLASS 0x01
|
||||||
|
#define EFI_VIDEO_DEVICE_CLASS 0x02
|
||||||
|
#define EFI_NETWORK_DEVICE_CLASS 0x04
|
||||||
|
#define EFI_INPUT_DEVICE_CLASS 0x08
|
||||||
|
#define EFI_ON_BOARD_DEVICE_CLASS 0x10
|
||||||
|
#define EFI_OTHER_DEVICE_CLASS 0x20
|
||||||
|
|
||||||
|
typedef struct _EFI_IFR_GUID_CLASS {
|
||||||
|
EFI_IFR_OP_HEADER Header;
|
||||||
|
EFI_GUID Guid;
|
||||||
|
UINT8 ExtendOpCode;
|
||||||
|
UINT16 Class;
|
||||||
|
} EFI_IFR_GUID_CLASS;
|
||||||
|
|
||||||
|
#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
|
||||||
|
#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
|
||||||
|
#define EFI_FRONT_PAGE_SUBCLASS 0x02
|
||||||
|
#define EFI_SINGLE_USE_SUBCLASS 0x03
|
||||||
|
|
||||||
|
typedef struct _EFI_IFR_GUID_SUBCLASS {
|
||||||
|
EFI_IFR_OP_HEADER Header;
|
||||||
|
EFI_GUID Guid;
|
||||||
|
UINT8 ExtendOpCode;
|
||||||
|
UINT16 SubClass;
|
||||||
|
} EFI_IFR_GUID_SUBCLASS;
|
||||||
|
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
#endif
|
@ -22,16 +22,20 @@
|
|||||||
[defines]
|
[defines]
|
||||||
BASE_NAME = CompilerStub
|
BASE_NAME = CompilerStub
|
||||||
COMPONENT_TYPE = LIBRARY
|
COMPONENT_TYPE = LIBRARY
|
||||||
|
|
||||||
[sources.common]
|
[sources.common]
|
||||||
|
|
||||||
[sources.ia32]
|
[sources.ia32]
|
||||||
Ia32\memcpy.asm
|
Ia32\memcpyRep1.asm
|
||||||
Ia32\memset.asm
|
Ia32\memsetRep4.asm
|
||||||
|
# Ia32\memcpy.asm
|
||||||
|
# Ia32\memset.asm
|
||||||
|
|
||||||
[sources.x64]
|
[sources.x64]
|
||||||
x64\memcpy.asm
|
x64\memcpyRep1.asm
|
||||||
x64\memset.asm
|
x64\memsetRep4.asm
|
||||||
|
# x64\memcpy.asm
|
||||||
|
# x64\memset.asm
|
||||||
|
|
||||||
[sources.Ipf]
|
[sources.Ipf]
|
||||||
memcpy.c
|
memcpy.c
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2007, Intel Corporation
|
||||||
|
; All rights reserved. This program and the accompanying materials
|
||||||
|
; are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
|
;
|
||||||
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
;
|
||||||
|
; Module Name:
|
||||||
|
;
|
||||||
|
; CopyMem.asm
|
||||||
|
;
|
||||||
|
; Abstract:
|
||||||
|
;
|
||||||
|
; memcpy function
|
||||||
|
;
|
||||||
|
; Notes:
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.686
|
||||||
|
.model flat,C
|
||||||
|
.code
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID *
|
||||||
|
; memcpy (
|
||||||
|
; IN VOID *Destination,
|
||||||
|
; IN VOID *Source,
|
||||||
|
; IN UINTN Count
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
memcpy PROC USES esi edi
|
||||||
|
mov esi, [esp + 16] ; esi <- Source
|
||||||
|
mov edi, [esp + 12] ; edi <- Destination
|
||||||
|
mov edx, [esp + 20] ; edx <- Count
|
||||||
|
cmp esi, edi
|
||||||
|
je @CopyDone
|
||||||
|
cmp edx, 0
|
||||||
|
je @CopyDone
|
||||||
|
lea eax, [esi + edx - 1] ; eax <- End of Source
|
||||||
|
cmp esi, edi
|
||||||
|
jae @F
|
||||||
|
cmp eax, edi
|
||||||
|
jb @F ; Copy backward if overlapped
|
||||||
|
mov esi, eax ; esi <- End of Source
|
||||||
|
lea edi, [edi + edx - 1] ; edi <- End of Destination
|
||||||
|
std
|
||||||
|
@@:
|
||||||
|
mov ecx, edx
|
||||||
|
rep movsb ; Copy bytes backward
|
||||||
|
cld
|
||||||
|
@CopyDone:
|
||||||
|
mov eax, [esp + 12]
|
||||||
|
ret
|
||||||
|
memcpy ENDP
|
||||||
|
|
||||||
|
END
|
@ -0,0 +1,70 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2007, Intel Corporation
|
||||||
|
; All rights reserved. This program and the accompanying materials
|
||||||
|
; are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
|
;
|
||||||
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
;
|
||||||
|
; Module Name:
|
||||||
|
;
|
||||||
|
; CopyMem.asm
|
||||||
|
;
|
||||||
|
; Abstract:
|
||||||
|
;
|
||||||
|
; memcpy function
|
||||||
|
;
|
||||||
|
; Notes:
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.686
|
||||||
|
.model flat,C
|
||||||
|
.mmx
|
||||||
|
.code
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID *
|
||||||
|
; memcpy (
|
||||||
|
; IN VOID *Destination,
|
||||||
|
; IN VOID *Source,
|
||||||
|
; IN UINTN Count
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
memcpy PROC USES esi edi
|
||||||
|
mov esi, [esp + 16] ; esi <- Source
|
||||||
|
mov edi, [esp + 12] ; edi <- Destination
|
||||||
|
mov edx, [esp + 20] ; edx <- Count
|
||||||
|
cmp esi, edi
|
||||||
|
je @CopyDone
|
||||||
|
cmp edx, 0
|
||||||
|
je @CopyDone
|
||||||
|
lea eax, [esi + edx - 1] ; eax <- End of Source
|
||||||
|
cmp esi, edi
|
||||||
|
jae @F
|
||||||
|
cmp eax, edi
|
||||||
|
jae @CopyBackward ; Copy backward if overlapped
|
||||||
|
@@:
|
||||||
|
mov ecx, edx
|
||||||
|
and edx, 3
|
||||||
|
shr ecx, 2
|
||||||
|
rep movsd ; Copy as many Dwords as possible
|
||||||
|
jmp @CopyBytes
|
||||||
|
@CopyBackward:
|
||||||
|
mov esi, eax ; esi <- End of Source
|
||||||
|
lea edi, [edi + edx - 1] ; edi <- End of Destination
|
||||||
|
std
|
||||||
|
@CopyBytes:
|
||||||
|
mov ecx, edx
|
||||||
|
rep movsb ; Copy bytes backward
|
||||||
|
cld
|
||||||
|
@CopyDone:
|
||||||
|
mov eax, [esp + 12]
|
||||||
|
ret
|
||||||
|
|
||||||
|
memcpy ENDP
|
||||||
|
|
||||||
|
END
|
@ -1,19 +1,21 @@
|
|||||||
; 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
|
; Copyright (c) 2007, Intel Corporation
|
||||||
; which accompanies this distribution. The full text of the license may be found at
|
; All rights reserved. This program and the accompanying materials
|
||||||
; http://opensource.org/licenses/bsd-license.php
|
; 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
|
||||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
;
|
||||||
|
; 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:
|
; Module Name:
|
||||||
;
|
;
|
||||||
; CpuPause.Asm
|
; SetMem.asm
|
||||||
;
|
;
|
||||||
; Abstract:
|
; Abstract:
|
||||||
;
|
;
|
||||||
; CpuPause function
|
; memset function
|
||||||
;
|
;
|
||||||
; Notes:
|
; Notes:
|
||||||
;
|
;
|
||||||
@ -21,19 +23,26 @@
|
|||||||
|
|
||||||
.686
|
.686
|
||||||
.model flat,C
|
.model flat,C
|
||||||
.xmm
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; VOID
|
; VOID *
|
||||||
; EFIAPI
|
; memset (
|
||||||
; CpuPause (
|
; OUT VOID *Buffer,
|
||||||
; VOID
|
; IN UINT8 Value,
|
||||||
; );
|
; IN UINTN Count
|
||||||
|
; )
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
CpuPause PROC
|
memset PROC USES edi
|
||||||
pause
|
mov ecx, [esp + 16]
|
||||||
|
test ecx, ecx
|
||||||
|
je @F
|
||||||
|
mov al, [esp + 12]
|
||||||
|
mov edi, [esp + 8]
|
||||||
|
rep stosb
|
||||||
|
@@:
|
||||||
|
mov eax, [esp + 8]
|
||||||
ret
|
ret
|
||||||
CpuPause ENDP
|
memset ENDP
|
||||||
|
|
||||||
END
|
END
|
@ -0,0 +1,56 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2007, Intel Corporation
|
||||||
|
; All rights reserved. This program and the accompanying materials
|
||||||
|
; are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
|
;
|
||||||
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
;
|
||||||
|
; Module Name:
|
||||||
|
;
|
||||||
|
; SetMem.asm
|
||||||
|
;
|
||||||
|
; Abstract:
|
||||||
|
;
|
||||||
|
; memset function
|
||||||
|
;
|
||||||
|
; Notes:
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.686
|
||||||
|
.model flat,C
|
||||||
|
.code
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID *
|
||||||
|
; memset (
|
||||||
|
; OUT VOID *Buffer,
|
||||||
|
; IN UINT8 Value,
|
||||||
|
; IN UINTN Count
|
||||||
|
; )
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
memset PROC USES edi
|
||||||
|
mov ecx, [esp + 16]
|
||||||
|
test ecx, ecx
|
||||||
|
je @F
|
||||||
|
mov al, [esp + 12]
|
||||||
|
mov ah, al
|
||||||
|
shrd edx, eax, 16
|
||||||
|
shld eax, edx, 16
|
||||||
|
mov edx, ecx
|
||||||
|
mov edi, [esp + 8]
|
||||||
|
shr ecx, 2
|
||||||
|
rep stosd
|
||||||
|
mov ecx, edx
|
||||||
|
and ecx, 3
|
||||||
|
rep stosb
|
||||||
|
@@:
|
||||||
|
mov eax, [esp + 8]
|
||||||
|
ret
|
||||||
|
memset ENDP
|
||||||
|
|
||||||
|
END
|
@ -0,0 +1,59 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2007, Intel Corporation
|
||||||
|
; All rights reserved. This program and the accompanying materials
|
||||||
|
; are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
|
;
|
||||||
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
;
|
||||||
|
; Module Name:
|
||||||
|
;
|
||||||
|
; memcpyRep1.asm
|
||||||
|
;
|
||||||
|
; Abstract:
|
||||||
|
;
|
||||||
|
; CopyMem function
|
||||||
|
;
|
||||||
|
; Notes:
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; memcpy (
|
||||||
|
; OUT VOID *Destination,
|
||||||
|
; IN VOID *Source,
|
||||||
|
; IN UINTN Count
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
memcpy PROC USES rsi rdi
|
||||||
|
mov rax, rcx
|
||||||
|
cmp rdx, rcx ; if Source == Destination, do nothing
|
||||||
|
je @CopyMemDone
|
||||||
|
cmp r8, 0 ; if Count == 0, do nothing
|
||||||
|
je @CopyMemDone
|
||||||
|
mov rsi, rdx ; rsi <- Source
|
||||||
|
mov rdi, rcx ; rdi <- Destination
|
||||||
|
lea r9, [rsi + r8 - 1] ; r9 <- End of Source
|
||||||
|
cmp rsi, rdi
|
||||||
|
jae @F
|
||||||
|
cmp r9, rdi
|
||||||
|
jb @F ; Copy backward if overlapped
|
||||||
|
mov rsi, r9 ; rsi <- End of Source
|
||||||
|
lea rdi, [rdi + r8 - 1] ; esi <- End of Destination
|
||||||
|
std ; set direction flag
|
||||||
|
@@:
|
||||||
|
mov rcx, r8
|
||||||
|
rep movsb ; Copy bytes backward
|
||||||
|
cld
|
||||||
|
@CopyMemDone:
|
||||||
|
ret
|
||||||
|
memcpy ENDP
|
||||||
|
|
||||||
|
END
|
||||||
|
|
@ -0,0 +1,65 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2007, Intel Corporation
|
||||||
|
; All rights reserved. This program and the accompanying materials
|
||||||
|
; are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
|
;
|
||||||
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
;
|
||||||
|
; Module Name:
|
||||||
|
;
|
||||||
|
; memcpyRep8.asm
|
||||||
|
;
|
||||||
|
; Abstract:
|
||||||
|
;
|
||||||
|
; CopyMem function
|
||||||
|
;
|
||||||
|
; Notes:
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; memcpy (
|
||||||
|
; OUT VOID *Destination,
|
||||||
|
; IN VOID *Source,
|
||||||
|
; IN UINTN Count
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
memcpy PROC USES rsi rdi
|
||||||
|
mov rax, rcx
|
||||||
|
cmp rdx, rcx ; if Source == Destination, do nothing
|
||||||
|
je @CopyMemDone
|
||||||
|
cmp r8, 0 ; if Count == 0, do nothing
|
||||||
|
je @CopyMemDone
|
||||||
|
mov rsi, rdx ; rsi <- Source
|
||||||
|
mov rdi, rcx ; rdi <- Destination
|
||||||
|
lea r9, [rsi + r8 - 1] ; r9 <- End of Source
|
||||||
|
cmp rsi, rdi
|
||||||
|
jae @F
|
||||||
|
cmp r9, rdi
|
||||||
|
jae @CopyBackward ; Copy backward if overlapped
|
||||||
|
@@:
|
||||||
|
mov rcx, r8
|
||||||
|
and r8, 3
|
||||||
|
shr rcx, 2
|
||||||
|
rep movsd ; Copy as many Dwords as possible
|
||||||
|
jmp @CopyBytes
|
||||||
|
@CopyBackward:
|
||||||
|
mov rsi, r9 ; rsi <- End of Source
|
||||||
|
lea rdi, [rdi + r8 - 1] ; esi <- End of Destination
|
||||||
|
std ; set direction flag
|
||||||
|
@CopyBytes:
|
||||||
|
mov rcx, r8
|
||||||
|
rep movsb ; Copy bytes backward
|
||||||
|
cld
|
||||||
|
@CopyMemDone:
|
||||||
|
ret
|
||||||
|
memcpy ENDP
|
||||||
|
|
||||||
|
END
|
@ -0,0 +1,66 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2007, Intel Corporation
|
||||||
|
; All rights reserved. This program and the accompanying materials
|
||||||
|
; are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
|
;
|
||||||
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
;
|
||||||
|
; Module Name:
|
||||||
|
;
|
||||||
|
; memcpyRep8.asm
|
||||||
|
;
|
||||||
|
; Abstract:
|
||||||
|
;
|
||||||
|
; CopyMem function
|
||||||
|
;
|
||||||
|
; Notes:
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; memcpy (
|
||||||
|
; OUT VOID *Destination,
|
||||||
|
; IN VOID *Source,
|
||||||
|
; IN UINTN Count
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
memcpy PROC USES rsi rdi
|
||||||
|
mov rax, rcx
|
||||||
|
cmp rdx, rcx ; if Source == Destination, do nothing
|
||||||
|
je @CopyMemDone
|
||||||
|
cmp r8, 0 ; if Count == 0, do nothing
|
||||||
|
je @CopyMemDone
|
||||||
|
mov rsi, rdx ; rsi <- Source
|
||||||
|
mov rdi, rcx ; rdi <- Destination
|
||||||
|
lea r9, [rsi + r8 - 1] ; r9 <- End of Source
|
||||||
|
cmp rsi, rdi
|
||||||
|
jae @F
|
||||||
|
cmp r9, rdi
|
||||||
|
jae @CopyBackward ; Copy backward if overlapped
|
||||||
|
@@:
|
||||||
|
mov rcx, r8
|
||||||
|
and r8, 7
|
||||||
|
shr rcx, 3
|
||||||
|
rep movsq ; Copy as many Qwords as possible
|
||||||
|
jmp @CopyBytes
|
||||||
|
@CopyBackward:
|
||||||
|
mov rsi, r9 ; rsi <- End of Source
|
||||||
|
lea rdi, [rdi + r8 - 1] ; esi <- End of Destination
|
||||||
|
std ; set direction flag
|
||||||
|
@CopyBytes:
|
||||||
|
mov rcx, r8
|
||||||
|
rep movsb ; Copy bytes backward
|
||||||
|
cld
|
||||||
|
@CopyMemDone:
|
||||||
|
ret
|
||||||
|
memcpy ENDP
|
||||||
|
|
||||||
|
END
|
||||||
|
|
@ -0,0 +1,48 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2007, Intel Corporation
|
||||||
|
; All rights reserved. This program and the accompanying materials
|
||||||
|
; are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
|
;
|
||||||
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
;
|
||||||
|
; Module Name:
|
||||||
|
;
|
||||||
|
; memsetRep1.asm
|
||||||
|
;
|
||||||
|
; Abstract:
|
||||||
|
;
|
||||||
|
; SetMem function
|
||||||
|
;
|
||||||
|
; Notes:
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID *
|
||||||
|
; memset (
|
||||||
|
; OUT VOID *Buffer,
|
||||||
|
; IN UINTN Size,
|
||||||
|
; IN UINT8 Value
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
memset PROC USES rdi
|
||||||
|
cmp rdx, 0 ; if Size == 0, do nothing
|
||||||
|
mov r9, rcx
|
||||||
|
je @SetDone
|
||||||
|
mov rax, r8
|
||||||
|
mov rdi, rcx
|
||||||
|
mov rcx, rdx
|
||||||
|
rep stosb
|
||||||
|
@SetDone:
|
||||||
|
mov rax, r9
|
||||||
|
ret
|
||||||
|
memset ENDP
|
||||||
|
|
||||||
|
END
|
||||||
|
|
@ -0,0 +1,55 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2007, Intel Corporation
|
||||||
|
; All rights reserved. This program and the accompanying materials
|
||||||
|
; are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
|
;
|
||||||
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
;
|
||||||
|
; Module Name:
|
||||||
|
;
|
||||||
|
; SetMem.asm
|
||||||
|
;
|
||||||
|
; Abstract:
|
||||||
|
;
|
||||||
|
; memset function
|
||||||
|
;
|
||||||
|
; Notes:
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID *
|
||||||
|
; memset (
|
||||||
|
; OUT VOID *Buffer,
|
||||||
|
; IN UINT8 Value,
|
||||||
|
; IN UINTN Count
|
||||||
|
; )
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
memset PROC USES rdi
|
||||||
|
cmp r8, 0 ; if Size == 0, do nothing
|
||||||
|
mov r9, rcx
|
||||||
|
je @SetDone
|
||||||
|
mov al, dl
|
||||||
|
mov ah, al
|
||||||
|
shrd edx, eax, 16
|
||||||
|
shld eax, edx, 16
|
||||||
|
mov rdi, rcx
|
||||||
|
mov rcx, r8
|
||||||
|
shr rcx, 2
|
||||||
|
rep stosd
|
||||||
|
mov rcx, r8
|
||||||
|
and rcx, 3
|
||||||
|
rep stosb
|
||||||
|
@SetDone:
|
||||||
|
mov rax, r9
|
||||||
|
ret
|
||||||
|
memset ENDP
|
||||||
|
|
||||||
|
END
|
||||||
|
|
@ -0,0 +1,60 @@
|
|||||||
|
;------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Copyright (c) 2007, Intel Corporation
|
||||||
|
; All rights reserved. This program and the accompanying materials
|
||||||
|
; are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
|
;
|
||||||
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
;
|
||||||
|
; Module Name:
|
||||||
|
;
|
||||||
|
; memsetRep8.asm
|
||||||
|
;
|
||||||
|
; Abstract:
|
||||||
|
;
|
||||||
|
; SetMem function
|
||||||
|
;
|
||||||
|
; Notes:
|
||||||
|
;
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; VOID
|
||||||
|
; memset (
|
||||||
|
; OUT VOID *Buffer,
|
||||||
|
; IN UINT8 Value,
|
||||||
|
; IN UINTN Length
|
||||||
|
; );
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
memset PROC USES rdi rbx
|
||||||
|
cmp r8, 0 ; if Size == 0, do nothing
|
||||||
|
mov r9, rcx
|
||||||
|
je @SetDone
|
||||||
|
mov rax, rdx
|
||||||
|
mov bl, al
|
||||||
|
mov bh, bl
|
||||||
|
mov ax, bx
|
||||||
|
shl rax, 10h
|
||||||
|
mov ax, bx
|
||||||
|
mov ebx, eax
|
||||||
|
shl rax, 20h
|
||||||
|
mov eax, ebx
|
||||||
|
mov rdi, rcx
|
||||||
|
mov rcx, r8
|
||||||
|
shr rcx, 3
|
||||||
|
rep stosq
|
||||||
|
mov rcx, rdx
|
||||||
|
and rcx, 7
|
||||||
|
rep stosb
|
||||||
|
@SetDone:
|
||||||
|
mov rax, r9
|
||||||
|
ret
|
||||||
|
memset ENDP
|
||||||
|
|
||||||
|
END
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2006, Intel Corporation
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -24,6 +24,7 @@ Abstract:
|
|||||||
EFI_BOOT_SCRIPT_SAVE_PROTOCOL *mBootScriptSave;
|
EFI_BOOT_SCRIPT_SAVE_PROTOCOL *mBootScriptSave;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveInitialize (
|
BootScriptSaveInitialize (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
@ -60,6 +61,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveIoWrite (
|
BootScriptSaveIoWrite (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
@ -109,6 +111,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveIoReadWrite (
|
BootScriptSaveIoReadWrite (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
@ -158,6 +161,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveMemWrite (
|
BootScriptSaveMemWrite (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
@ -207,6 +211,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveMemReadWrite (
|
BootScriptSaveMemReadWrite (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
@ -256,6 +261,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSavePciCfgWrite (
|
BootScriptSavePciCfgWrite (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
@ -305,6 +311,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSavePciCfgReadWrite (
|
BootScriptSavePciCfgReadWrite (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
@ -354,6 +361,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveSmbusExecute (
|
BootScriptSaveSmbusExecute (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
|
IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
|
||||||
@ -409,6 +417,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveStall (
|
BootScriptSaveStall (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN UINTN Duration
|
IN UINTN Duration
|
||||||
@ -449,6 +458,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveDispatch (
|
BootScriptSaveDispatch (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_PHYSICAL_ADDRESS EntryPoint
|
IN EFI_PHYSICAL_ADDRESS EntryPoint
|
||||||
@ -486,6 +496,61 @@ Returns:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
BootScriptMemPoll (
|
||||||
|
IN UINT16 TableName,
|
||||||
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
|
IN UINT64 Address,
|
||||||
|
IN VOID *BitMask,
|
||||||
|
IN VOID *BitValue,
|
||||||
|
IN UINTN Duration,
|
||||||
|
IN UINTN LoopTimes
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Save I/O write to boot script
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
TableName - Desired boot script table
|
||||||
|
|
||||||
|
Width - The width of the memory operations.
|
||||||
|
|
||||||
|
Address - The base address of the memory operations.
|
||||||
|
|
||||||
|
BitMask - A pointer to the bit mask to be AND-ed with the data read from the register.
|
||||||
|
|
||||||
|
BitValue - A pointer to the data value after to be Masked.
|
||||||
|
|
||||||
|
Duration - Duration in microseconds of the stall.
|
||||||
|
|
||||||
|
LoopTimes - The times of the register polling.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
EFI_NOT_FOUND - BootScriptSave Protocol not exist.
|
||||||
|
|
||||||
|
EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
mBootScriptSave->Write (
|
||||||
|
mBootScriptSave,
|
||||||
|
TableName,
|
||||||
|
EFI_BOOT_SCRIPT_MEM_POLL_OPCODE,
|
||||||
|
Width,
|
||||||
|
Address,
|
||||||
|
BitMask,
|
||||||
|
BitValue,
|
||||||
|
Duration,
|
||||||
|
LoopTimes
|
||||||
|
);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
BootScriptSaveInformation (
|
BootScriptSaveInformation (
|
||||||
|
@ -100,7 +100,7 @@ Returns:
|
|||||||
{
|
{
|
||||||
return GetImageEx (
|
return GetImageEx (
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
&gEfiDefaultBmpLogoGuid,
|
FileNameGuid,
|
||||||
EFI_SECTION_RAW,
|
EFI_SECTION_RAW,
|
||||||
Image,
|
Image,
|
||||||
ImageSize,
|
ImageSize,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2004 - 2006, Intel Corporation
|
Copyright (c) 2004 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -59,7 +59,11 @@ Abstract:
|
|||||||
#include "PrintWidth.h"
|
#include "PrintWidth.h"
|
||||||
#include "EfiPrintLib.h"
|
#include "EfiPrintLib.h"
|
||||||
#include "Print.h"
|
#include "Print.h"
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
|
#include EFI_PROTOCOL_DEFINITION (HiiFont)
|
||||||
|
#else
|
||||||
#include EFI_PROTOCOL_DEFINITION (Hii)
|
#include EFI_PROTOCOL_DEFINITION (Hii)
|
||||||
|
#endif
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
CHAR_W *
|
CHAR_W *
|
||||||
@ -161,22 +165,26 @@ Returns:
|
|||||||
{
|
{
|
||||||
VOID *Buffer;
|
VOID *Buffer;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT16 GlyphWidth;
|
|
||||||
UINT32 GlyphStatus;
|
|
||||||
UINT16 StringIndex;
|
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
CHAR16 *UnicodeWeight;
|
CHAR16 *UnicodeWeight;
|
||||||
EFI_NARROW_GLYPH *Glyph;
|
|
||||||
EFI_HII_PROTOCOL *Hii;
|
|
||||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
|
|
||||||
UINT32 HorizontalResolution;
|
UINT32 HorizontalResolution;
|
||||||
UINT32 VerticalResolution;
|
UINT32 VerticalResolution;
|
||||||
UINT32 ColorDepth;
|
UINT32 ColorDepth;
|
||||||
UINT32 RefreshRate;
|
UINT32 RefreshRate;
|
||||||
UINTN BufferLen;
|
UINTN BufferLen;
|
||||||
UINTN LineBufferLen;
|
UINTN LineBufferLen;
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
GlyphStatus = 0;
|
EFI_HII_FONT_PROTOCOL *HiiFont;
|
||||||
|
EFI_IMAGE_OUTPUT *Blt;
|
||||||
|
EFI_FONT_DISPLAY_INFO *FontInfo;
|
||||||
|
#else
|
||||||
|
EFI_HII_PROTOCOL *Hii;
|
||||||
|
UINT16 GlyphWidth;
|
||||||
|
UINT32 GlyphStatus;
|
||||||
|
UINT16 StringIndex;
|
||||||
|
EFI_NARROW_GLYPH *Glyph;
|
||||||
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// For now, allocate an arbitrarily long buffer
|
// For now, allocate an arbitrarily long buffer
|
||||||
@ -192,19 +200,29 @@ Returns:
|
|||||||
} else {
|
} else {
|
||||||
UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
|
UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
|
||||||
}
|
}
|
||||||
ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
|
ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
|
||||||
|
|
||||||
LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * GLYPH_HEIGHT;
|
|
||||||
LineBuffer = EfiLibAllocatePool (LineBufferLen);
|
|
||||||
if (LineBuffer == NULL) {
|
|
||||||
gBS->FreePool (Buffer);
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
|
Blt = NULL;
|
||||||
|
FontInfo = NULL;
|
||||||
|
ASSERT (GraphicsOutput != NULL);
|
||||||
|
Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
LineBuffer = NULL;
|
||||||
Status = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, (VOID**)&Hii);
|
Status = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, (VOID**)&Hii);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * GLYPH_HEIGHT;
|
||||||
|
LineBuffer = EfiLibAllocatePool (LineBufferLen);
|
||||||
|
if (LineBuffer == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
VSPrint (Buffer, 0x10000, fmt, args);
|
VSPrint (Buffer, 0x10000, fmt, args);
|
||||||
|
|
||||||
@ -219,7 +237,65 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
BufferLen = EfiStrLen (Buffer);
|
BufferLen = EfiStrLen (Buffer);
|
||||||
|
|
||||||
|
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
|
LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * EFI_GLYPH_HEIGHT;
|
||||||
|
if (EFI_GLYPH_WIDTH * EFI_GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * BufferLen > LineBufferLen) {
|
||||||
|
Status = EFI_INVALID_PARAMETER;
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
Blt = (EFI_IMAGE_OUTPUT *) EfiLibAllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
|
||||||
|
if (Blt == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
Blt->Width = (UINT16) (HorizontalResolution);
|
||||||
|
Blt->Height = (UINT16) (VerticalResolution);
|
||||||
|
Blt->Image.Screen = GraphicsOutput;
|
||||||
|
|
||||||
|
FontInfo = (EFI_FONT_DISPLAY_INFO *) EfiLibAllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO));
|
||||||
|
if (FontInfo == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
if (Foreground != NULL) {
|
||||||
|
EfiCopyMem (&FontInfo->ForegroundColor, Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||||
|
} else {
|
||||||
|
EfiCopyMem (
|
||||||
|
&FontInfo->ForegroundColor,
|
||||||
|
&mEfiColors[Sto->Mode->Attribute & 0x0f],
|
||||||
|
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (Background != NULL) {
|
||||||
|
EfiCopyMem (&FontInfo->BackgroundColor, Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||||
|
} else {
|
||||||
|
EfiCopyMem (
|
||||||
|
&FontInfo->BackgroundColor,
|
||||||
|
&mEfiColors[Sto->Mode->Attribute >> 4],
|
||||||
|
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = HiiFont->StringToImage (
|
||||||
|
HiiFont,
|
||||||
|
EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_DIRECT_TO_SCREEN,
|
||||||
|
Buffer,
|
||||||
|
FontInfo,
|
||||||
|
&Blt,
|
||||||
|
X,
|
||||||
|
Y,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
#else
|
||||||
|
GlyphStatus = 0;
|
||||||
|
|
||||||
if (GLYPH_WIDTH * GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * BufferLen > LineBufferLen) {
|
if (GLYPH_WIDTH * GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * BufferLen > LineBufferLen) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
goto Error;
|
goto Error;
|
||||||
@ -288,8 +364,15 @@ Returns:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
Error:
|
Error:
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
|
EfiLibSafeFreePool (Blt);
|
||||||
|
EfiLibSafeFreePool (FontInfo);
|
||||||
|
#else
|
||||||
gBS->FreePool (LineBuffer);
|
gBS->FreePool (LineBuffer);
|
||||||
|
#endif
|
||||||
gBS->FreePool (Buffer);
|
gBS->FreePool (Buffer);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -417,6 +500,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
|
EFIAPI
|
||||||
VSPrint (
|
VSPrint (
|
||||||
OUT CHAR_W *StartOfBuffer,
|
OUT CHAR_W *StartOfBuffer,
|
||||||
IN UINTN BufferSize,
|
IN UINTN BufferSize,
|
||||||
|
@ -101,7 +101,7 @@ Returns:
|
|||||||
{
|
{
|
||||||
return GetImageEx (
|
return GetImageEx (
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
&gEfiDefaultBmpLogoGuid,
|
FileNameGuid,
|
||||||
EFI_SECTION_RAW,
|
EFI_SECTION_RAW,
|
||||||
Image,
|
Image,
|
||||||
ImageSize,
|
ImageSize,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2004 - 2006, Intel Corporation
|
Copyright (c) 2004 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -59,7 +59,11 @@ Abstract:
|
|||||||
#include "PrintWidth.h"
|
#include "PrintWidth.h"
|
||||||
#include "EfiPrintLib.h"
|
#include "EfiPrintLib.h"
|
||||||
#include "Print.h"
|
#include "Print.h"
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
|
#include EFI_PROTOCOL_DEFINITION (HiiFont)
|
||||||
|
#else
|
||||||
#include EFI_PROTOCOL_DEFINITION (Hii)
|
#include EFI_PROTOCOL_DEFINITION (Hii)
|
||||||
|
#endif
|
||||||
|
|
||||||
static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
|
static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
|
||||||
0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00,
|
||||||
@ -128,22 +132,26 @@ Returns:
|
|||||||
{
|
{
|
||||||
VOID *Buffer;
|
VOID *Buffer;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT16 GlyphWidth;
|
|
||||||
UINT32 GlyphStatus;
|
|
||||||
UINT16 StringIndex;
|
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
CHAR16 *UnicodeWeight;
|
CHAR16 *UnicodeWeight;
|
||||||
EFI_NARROW_GLYPH *Glyph;
|
|
||||||
EFI_HII_PROTOCOL *Hii;
|
|
||||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
|
|
||||||
UINT32 HorizontalResolution;
|
UINT32 HorizontalResolution;
|
||||||
UINT32 VerticalResolution;
|
UINT32 VerticalResolution;
|
||||||
UINT32 ColorDepth;
|
UINT32 ColorDepth;
|
||||||
UINT32 RefreshRate;
|
UINT32 RefreshRate;
|
||||||
UINTN BufferLen;
|
UINTN BufferLen;
|
||||||
UINTN LineBufferLen;
|
UINTN LineBufferLen;
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
GlyphStatus = 0;
|
EFI_HII_FONT_PROTOCOL *HiiFont;
|
||||||
|
EFI_IMAGE_OUTPUT *Blt;
|
||||||
|
EFI_FONT_DISPLAY_INFO *FontInfo;
|
||||||
|
#else
|
||||||
|
EFI_HII_PROTOCOL *Hii;
|
||||||
|
UINT16 GlyphWidth;
|
||||||
|
UINT32 GlyphStatus;
|
||||||
|
UINT16 StringIndex;
|
||||||
|
EFI_NARROW_GLYPH *Glyph;
|
||||||
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// For now, allocate an arbitrarily long buffer
|
// For now, allocate an arbitrarily long buffer
|
||||||
@ -161,17 +169,27 @@ Returns:
|
|||||||
}
|
}
|
||||||
ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
|
ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
|
||||||
|
|
||||||
LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * GLYPH_HEIGHT;
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
LineBuffer = EfiLibAllocatePool (LineBufferLen);
|
Blt = NULL;
|
||||||
if (LineBuffer == NULL) {
|
FontInfo = NULL;
|
||||||
gBS->FreePool (Buffer);
|
ASSERT (GraphicsOutput != NULL);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont);
|
||||||
}
|
if (EFI_ERROR (Status)) {
|
||||||
|
goto Error;
|
||||||
Status = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, &Hii);
|
}
|
||||||
|
#else
|
||||||
|
LineBuffer = NULL;
|
||||||
|
Status = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, (VOID**)&Hii);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * GLYPH_HEIGHT;
|
||||||
|
LineBuffer = EfiLibAllocatePool (LineBufferLen);
|
||||||
|
if (LineBuffer == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
VSPrint (Buffer, 0x10000, fmt, args);
|
VSPrint (Buffer, 0x10000, fmt, args);
|
||||||
|
|
||||||
@ -187,6 +205,63 @@ Returns:
|
|||||||
|
|
||||||
BufferLen = EfiStrLen (Buffer);
|
BufferLen = EfiStrLen (Buffer);
|
||||||
|
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
|
LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * EFI_GLYPH_HEIGHT;
|
||||||
|
if (EFI_GLYPH_WIDTH * EFI_GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * BufferLen > LineBufferLen) {
|
||||||
|
Status = EFI_INVALID_PARAMETER;
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
Blt = (EFI_IMAGE_OUTPUT *) EfiLibAllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
|
||||||
|
if (Blt == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
Blt->Width = (UINT16) (HorizontalResolution);
|
||||||
|
Blt->Height = (UINT16) (VerticalResolution);
|
||||||
|
Blt->Image.Screen = GraphicsOutput;
|
||||||
|
|
||||||
|
FontInfo = (EFI_FONT_DISPLAY_INFO *) EfiLibAllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO));
|
||||||
|
if (FontInfo == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
|
if (Foreground != NULL) {
|
||||||
|
EfiCopyMem (&FontInfo->ForegroundColor, Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||||
|
} else {
|
||||||
|
EfiCopyMem (
|
||||||
|
&FontInfo->ForegroundColor,
|
||||||
|
&mEfiColors[Sto->Mode->Attribute & 0x0f],
|
||||||
|
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (Background != NULL) {
|
||||||
|
EfiCopyMem (&FontInfo->BackgroundColor, Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||||
|
} else {
|
||||||
|
EfiCopyMem (
|
||||||
|
&FontInfo->BackgroundColor,
|
||||||
|
&mEfiColors[Sto->Mode->Attribute >> 4],
|
||||||
|
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = HiiFont->StringToImage (
|
||||||
|
HiiFont,
|
||||||
|
EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_DIRECT_TO_SCREEN,
|
||||||
|
Buffer,
|
||||||
|
FontInfo,
|
||||||
|
&Blt,
|
||||||
|
X,
|
||||||
|
Y,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
#else
|
||||||
|
GlyphStatus = 0;
|
||||||
|
|
||||||
if (GLYPH_WIDTH * GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * BufferLen > LineBufferLen) {
|
if (GLYPH_WIDTH * GLYPH_HEIGHT * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * BufferLen > LineBufferLen) {
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
goto Error;
|
goto Error;
|
||||||
@ -255,8 +330,15 @@ Returns:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
Error:
|
Error:
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
|
EfiLibSafeFreePool (Blt);
|
||||||
|
EfiLibSafeFreePool (FontInfo);
|
||||||
|
#else
|
||||||
gBS->FreePool (LineBuffer);
|
gBS->FreePool (LineBuffer);
|
||||||
|
#endif
|
||||||
gBS->FreePool (Buffer);
|
gBS->FreePool (Buffer);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
@ -384,6 +466,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
|
EFIAPI
|
||||||
VSPrint (
|
VSPrint (
|
||||||
OUT CHAR_W *StartOfBuffer,
|
OUT CHAR_W *StartOfBuffer,
|
||||||
IN UINTN BufferSize,
|
IN UINTN BufferSize,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2004 - 2006, Intel Corporation
|
Copyright (c) 2004 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -190,6 +190,7 @@ Returns:
|
|||||||
;
|
;
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
|
EFIAPI
|
||||||
VSPrint (
|
VSPrint (
|
||||||
OUT CHAR16 *StartOfBuffer,
|
OUT CHAR16 *StartOfBuffer,
|
||||||
IN UINTN StrLen,
|
IN UINTN StrLen,
|
||||||
|
@ -1513,15 +1513,13 @@ EfiFvbSetVolumeAttributes (
|
|||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
Modifies the current settings of the firmware volume according to the
|
Modifies the current settings of the firmware volume according to the
|
||||||
input parameter, and returns the new setting of the volume
|
input parameter.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
Instance - The FV instance whose attributes is going to be
|
Instance - The FV instance whose attributes is going to be
|
||||||
modified
|
modified
|
||||||
Attributes - On input, it is a pointer to EFI_FVB_ATTRIBUTES
|
Attributes - It is a pointer to EFI_FVB_ATTRIBUTES
|
||||||
containing the desired firmware volume settings.
|
containing the desired firmware volume settings.
|
||||||
On successful return, it contains the new settings
|
|
||||||
of the firmware volume
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Status code
|
Status code
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2004, Intel Corporation
|
Copyright (c) 2004 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -28,6 +28,7 @@ Abstract:
|
|||||||
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveInitialize (
|
BootScriptSaveInitialize (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
@ -52,6 +53,7 @@ Returns:
|
|||||||
;
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveIoWrite (
|
BootScriptSaveIoWrite (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
@ -87,6 +89,7 @@ Returns:
|
|||||||
;
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveIoReadWrite (
|
BootScriptSaveIoReadWrite (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
@ -122,6 +125,7 @@ Returns:
|
|||||||
;
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveMemWrite (
|
BootScriptSaveMemWrite (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
@ -157,6 +161,7 @@ Returns:
|
|||||||
;
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveMemReadWrite (
|
BootScriptSaveMemReadWrite (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
@ -192,6 +197,7 @@ Returns:
|
|||||||
;
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSavePciCfgWrite (
|
BootScriptSavePciCfgWrite (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
@ -228,6 +234,7 @@ Returns:
|
|||||||
;
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSavePciCfgReadWrite (
|
BootScriptSavePciCfgReadWrite (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
@ -265,6 +272,7 @@ Returns:
|
|||||||
;
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveSmbusExecute (
|
BootScriptSaveSmbusExecute (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
|
IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
|
||||||
@ -303,6 +311,7 @@ Returns:
|
|||||||
;
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveStall (
|
BootScriptSaveStall (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN UINTN Duration
|
IN UINTN Duration
|
||||||
@ -330,6 +339,7 @@ Returns:
|
|||||||
;
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
BootScriptSaveDispatch (
|
BootScriptSaveDispatch (
|
||||||
IN UINT16 TableName,
|
IN UINT16 TableName,
|
||||||
IN EFI_PHYSICAL_ADDRESS EntryPoint
|
IN EFI_PHYSICAL_ADDRESS EntryPoint
|
||||||
@ -355,7 +365,45 @@ Returns:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
;
|
;
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
BootScriptMemPoll (
|
||||||
|
IN UINT16 TableName,
|
||||||
|
IN EFI_BOOT_SCRIPT_WIDTH Width,
|
||||||
|
IN UINT64 Address,
|
||||||
|
IN VOID *BitMask,
|
||||||
|
IN VOID *BitValue,
|
||||||
|
IN UINTN Duration,
|
||||||
|
IN UINTN LoopTimes
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Polling one memory mapping register
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
TableName - Desired boot script table
|
||||||
|
|
||||||
|
Width - The width of the memory operations.
|
||||||
|
|
||||||
|
Address - The base address of the memory operations.
|
||||||
|
|
||||||
|
BitMask - A pointer to the bit mask to be AND-ed with the data read from the register.
|
||||||
|
|
||||||
|
BitValue - A pointer to the data value after to be Masked.
|
||||||
|
|
||||||
|
Duration - Duration in microseconds of the stall.
|
||||||
|
|
||||||
|
LoopTimes - The times of the register polling.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
EFI_SUCCESS - The operation was executed successfully
|
||||||
|
|
||||||
|
--*/
|
||||||
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
BootScriptSaveInformation (
|
BootScriptSaveInformation (
|
||||||
@ -473,6 +521,21 @@ Returns:
|
|||||||
#define SCRIPT_DISPATCH(TableName, EntryPoint) \
|
#define SCRIPT_DISPATCH(TableName, EntryPoint) \
|
||||||
BootScriptSaveDispatch(TableName, EntryPoint)
|
BootScriptSaveDispatch(TableName, EntryPoint)
|
||||||
|
|
||||||
|
#define SCRIPT_MEM_POLL(TableName, Width, Address, BitMask, BitValue, Duration, LoopTimes) \
|
||||||
|
BootScriptMemPoll(TableName, Width, Address, BitMask, BitValue, Duration, LoopTimes)
|
||||||
|
|
||||||
|
#define SCRIPT_INFORMATION(TableName, Length, Buffer) \
|
||||||
|
BootScriptSaveInformation(TableName, Length, Buffer)
|
||||||
|
|
||||||
|
#define SCRIPT_INFORMATION_UNICODE_STRING(TableName, String) \
|
||||||
|
BootScriptSaveInformationUnicodeString(TableName, String)
|
||||||
|
|
||||||
|
#define SCRIPT_INFORMATION_ASCII_STRING(TableName, String) \
|
||||||
|
BootScriptSaveInformationAsciiString(TableName, String)
|
||||||
|
|
||||||
|
//
|
||||||
|
// For backward compatibility
|
||||||
|
//
|
||||||
#define SCRIPT_INOFRMATION(TableName, Length, Buffer) \
|
#define SCRIPT_INOFRMATION(TableName, Length, Buffer) \
|
||||||
BootScriptSaveInformation(TableName, Length, Buffer)
|
BootScriptSaveInformation(TableName, Length, Buffer)
|
||||||
|
|
||||||
@ -506,6 +569,17 @@ Returns:
|
|||||||
|
|
||||||
#define SCRIPT_DISPATCH(TableName, EntryPoint)
|
#define SCRIPT_DISPATCH(TableName, EntryPoint)
|
||||||
|
|
||||||
|
#define SCRIPT_MEM_POLL(TableName, Width, Address, BitMask, BitValue, Duration, LoopTimes)
|
||||||
|
|
||||||
|
#define SCRIPT_INFORMATION(TableName, Length, Buffer)
|
||||||
|
|
||||||
|
#define SCRIPT_INFORMATION_UNICODE_STRING(TableName, String)
|
||||||
|
|
||||||
|
#define SCRIPT_INFORMATION_ASCII_STRING(TableName, String)
|
||||||
|
|
||||||
|
//
|
||||||
|
// For backward compatibility
|
||||||
|
//
|
||||||
#define SCRIPT_INOFRMATION(TableName, Length, Buffer)
|
#define SCRIPT_INOFRMATION(TableName, Length, Buffer)
|
||||||
|
|
||||||
#define SCRIPT_INOFRMATION_UNICODE_STRING(TableName, String)
|
#define SCRIPT_INOFRMATION_UNICODE_STRING(TableName, String)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2004, Intel Corporation
|
Copyright (c) 2004 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -134,6 +134,7 @@ Returns:
|
|||||||
|
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
|
EFIAPI
|
||||||
VSPrint (
|
VSPrint (
|
||||||
OUT CHAR_W *StartOfBuffer,
|
OUT CHAR_W *StartOfBuffer,
|
||||||
IN UINTN BufferSize,
|
IN UINTN BufferSize,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2004, Intel Corporation
|
Copyright (c) 2004 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -101,6 +101,7 @@ Returns:
|
|||||||
}
|
}
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
|
EFIAPI
|
||||||
VSPrint (
|
VSPrint (
|
||||||
OUT CHAR_W *StartOfBuffer,
|
OUT CHAR_W *StartOfBuffer,
|
||||||
IN UINTN BufferSize,
|
IN UINTN BufferSize,
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
#/*++
|
||||||
|
#
|
||||||
|
# Copyright (c) 2007, Intel Corporation
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
|
#
|
||||||
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
#
|
||||||
|
# Module Name:
|
||||||
|
#
|
||||||
|
# UfiIfrSupportLib.inf
|
||||||
|
#
|
||||||
|
# Abstract:
|
||||||
|
#
|
||||||
|
# Component description file.
|
||||||
|
#
|
||||||
|
#--*/
|
||||||
|
|
||||||
|
[defines]
|
||||||
|
BASE_NAME = UefiEfiIfrSupportLib
|
||||||
|
COMPONENT_TYPE = LIBRARY
|
||||||
|
|
||||||
|
[sources.common]
|
||||||
|
UefiIfrCommon.c
|
||||||
|
UefiIfrForm.c
|
||||||
|
UefiIfrString.c
|
||||||
|
UefiIfrOpCodeCreation.c
|
||||||
|
UefiIfrLibrary.h
|
||||||
|
|
||||||
|
[includes.common]
|
||||||
|
$(EDK_SOURCE)\Foundation\Efi
|
||||||
|
$(EDK_SOURCE)\Foundation\Framework
|
||||||
|
$(EDK_SOURCE)\Foundation
|
||||||
|
.
|
||||||
|
$(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\Library\Dxe\EfiDriverLib
|
||||||
|
|
||||||
|
[libraries.common]
|
||||||
|
EfiGuidLib
|
||||||
|
EdkFrameworkProtocolLib
|
||||||
|
|
||||||
|
[nmake.common]
|
@ -0,0 +1,618 @@
|
|||||||
|
/*++
|
||||||
|
|
||||||
|
Copyright (c) 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
UefiIfrCommon.c
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Common Library Routines to assist handle HII elements.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#include "UefiIfrLibrary.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hii vendor device path template
|
||||||
|
//
|
||||||
|
HII_VENDOR_DEVICE_PATH mHiiVendorDevicePathTemplate = {
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
HARDWARE_DEVICE_PATH,
|
||||||
|
HW_VENDOR_DP,
|
||||||
|
(UINT8) (sizeof (HII_VENDOR_DEVICE_PATH_NODE)),
|
||||||
|
(UINT8) ((sizeof (HII_VENDOR_DEVICE_PATH_NODE)) >> 8)
|
||||||
|
},
|
||||||
|
EFI_IFR_TIANO_GUID,
|
||||||
|
},
|
||||||
|
0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
END_DEVICE_PATH_TYPE,
|
||||||
|
END_ENTIRE_DEVICE_PATH_SUBTYPE,
|
||||||
|
END_DEVICE_PATH_LENGTH,
|
||||||
|
0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hii relative protocols
|
||||||
|
//
|
||||||
|
BOOLEAN mHiiProtocolsInitialized = FALSE;
|
||||||
|
|
||||||
|
EFI_HII_DATABASE_PROTOCOL *gIfrLibHiiDatabase;
|
||||||
|
EFI_HII_STRING_PROTOCOL *gIfrLibHiiString;
|
||||||
|
|
||||||
|
VOID
|
||||||
|
LocateHiiProtocols (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
This function locate Hii relative protocols for later usage.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
None.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
None.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
if (mHiiProtocolsInitialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, &gIfrLibHiiDatabase);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, &gIfrLibHiiString);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
mHiiProtocolsInitialized = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_HII_PACKAGE_LIST_HEADER *
|
||||||
|
PreparePackageList (
|
||||||
|
IN UINTN NumberOfPackages,
|
||||||
|
IN EFI_GUID *GuidId,
|
||||||
|
...
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Assemble EFI_HII_PACKAGE_LIST according to the passed in packages.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
NumberOfPackages - Number of packages.
|
||||||
|
GuidId - Package GUID.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Pointer of EFI_HII_PACKAGE_LIST_HEADER.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
VA_LIST Marker;
|
||||||
|
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
|
||||||
|
UINT8 *PackageListData;
|
||||||
|
UINT32 PackageListLength;
|
||||||
|
UINT32 PackageLength;
|
||||||
|
EFI_HII_PACKAGE_HEADER PackageHeader;
|
||||||
|
UINT8 *PackageArray;
|
||||||
|
UINTN Index;
|
||||||
|
|
||||||
|
PackageListLength = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
|
||||||
|
|
||||||
|
VA_START (Marker, GuidId);
|
||||||
|
for (Index = 0; Index < NumberOfPackages; Index++) {
|
||||||
|
EfiCopyMem (&PackageLength, VA_ARG (Marker, VOID *), sizeof (UINT32));
|
||||||
|
PackageListLength += (PackageLength - sizeof (UINT32));
|
||||||
|
}
|
||||||
|
VA_END (Marker);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Include the lenght of EFI_HII_PACKAGE_END
|
||||||
|
//
|
||||||
|
PackageListLength += sizeof (EFI_HII_PACKAGE_HEADER);
|
||||||
|
PackageListHeader = EfiLibAllocateZeroPool (PackageListLength);
|
||||||
|
ASSERT (PackageListHeader != NULL);
|
||||||
|
EfiCopyMem (&PackageListHeader->PackageListGuid, GuidId, sizeof (EFI_GUID));
|
||||||
|
PackageListHeader->PackageLength = PackageListLength;
|
||||||
|
|
||||||
|
PackageListData = ((UINT8 *) PackageListHeader) + sizeof (EFI_HII_PACKAGE_LIST_HEADER);
|
||||||
|
|
||||||
|
VA_START (Marker, GuidId);
|
||||||
|
for (Index = 0; Index < NumberOfPackages; Index++) {
|
||||||
|
PackageArray = (UINT8 *) VA_ARG (Marker, VOID *);
|
||||||
|
EfiCopyMem (&PackageLength, PackageArray, sizeof (UINT32));
|
||||||
|
PackageLength -= sizeof (UINT32);
|
||||||
|
PackageArray += sizeof (UINT32);
|
||||||
|
EfiCopyMem (PackageListData, PackageArray, PackageLength);
|
||||||
|
PackageListData += PackageLength;
|
||||||
|
}
|
||||||
|
VA_END (Marker);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Append EFI_HII_PACKAGE_END
|
||||||
|
//
|
||||||
|
PackageHeader.Type = EFI_HII_PACKAGE_END;
|
||||||
|
PackageHeader.Length = sizeof (EFI_HII_PACKAGE_HEADER);
|
||||||
|
EfiCopyMem (PackageListData, &PackageHeader, PackageHeader.Length);
|
||||||
|
|
||||||
|
return PackageListHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateHiiDriverHandle (
|
||||||
|
OUT EFI_HANDLE *DriverHandle
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
The HII driver handle passed in for HiiDatabase.NewPackageList() requires
|
||||||
|
that there should be DevicePath Protocol installed on it.
|
||||||
|
This routine create a virtual Driver Handle by installing a vendor device
|
||||||
|
path on it, so as to use it to invoke HiiDatabase.NewPackageList().
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
DriverHandle - Handle to be returned
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
EFI_SUCCESS - Handle destroy success.
|
||||||
|
EFI_OUT_OF_RESOURCES - Not enough memory.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
HII_VENDOR_DEVICE_PATH_NODE *VendorDevicePath;
|
||||||
|
UINT64 MonotonicCount;
|
||||||
|
|
||||||
|
VendorDevicePath = EfiLibAllocateCopyPool (sizeof (HII_VENDOR_DEVICE_PATH), &mHiiVendorDevicePathTemplate);
|
||||||
|
if (VendorDevicePath == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
gBS->GetNextMonotonicCount (&MonotonicCount);
|
||||||
|
VendorDevicePath->MonotonicCount = (UINT32) MonotonicCount;
|
||||||
|
|
||||||
|
*DriverHandle = NULL;
|
||||||
|
Status = gBS->InstallProtocolInterface (
|
||||||
|
DriverHandle,
|
||||||
|
&gEfiDevicePathProtocolGuid,
|
||||||
|
EFI_NATIVE_INTERFACE,
|
||||||
|
VendorDevicePath
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
DestroyHiiDriverHandle (
|
||||||
|
IN EFI_HANDLE DriverHandle
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Destroy the Driver Handle created by CreateHiiDriverHandle().
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
DriverHandle - Handle returned by CreateHiiDriverHandle()
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
EFI_SUCCESS - Handle destroy success.
|
||||||
|
other - Handle destroy fail.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
|
|
||||||
|
Status = gBS->HandleProtocol (
|
||||||
|
DriverHandle,
|
||||||
|
&gEfiDevicePathProtocolGuid,
|
||||||
|
&DevicePath
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = gBS->UninstallProtocolInterface (
|
||||||
|
DriverHandle,
|
||||||
|
&gEfiDevicePathProtocolGuid,
|
||||||
|
DevicePath
|
||||||
|
);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_HII_HANDLE
|
||||||
|
DevicePathToHiiHandle (
|
||||||
|
IN EFI_HII_DATABASE_PROTOCOL *HiiDatabase,
|
||||||
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Find HII Handle associated with given Device Path.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
HiiDatabase - Point to EFI_HII_DATABASE_PROTOCOL instance.
|
||||||
|
DevicePath - Device Path associated with the HII package list handle.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Handle - HII package list Handle associated with the Device Path.
|
||||||
|
NULL - Hii Package list handle is not found.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath;
|
||||||
|
UINTN BufferSize;
|
||||||
|
UINTN HandleCount;
|
||||||
|
UINTN Index;
|
||||||
|
EFI_HANDLE *Handles;
|
||||||
|
EFI_HANDLE Handle;
|
||||||
|
UINTN Size;
|
||||||
|
EFI_HANDLE DriverHandle;
|
||||||
|
EFI_HII_HANDLE *HiiHandles;
|
||||||
|
EFI_HII_HANDLE HiiHandle;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Locate Device Path Protocol handle buffer
|
||||||
|
//
|
||||||
|
Status = gBS->LocateHandleBuffer (
|
||||||
|
ByProtocol,
|
||||||
|
&gEfiDevicePathProtocolGuid,
|
||||||
|
NULL,
|
||||||
|
&HandleCount,
|
||||||
|
&Handles
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Search Driver Handle by Device Path
|
||||||
|
//
|
||||||
|
DriverHandle = NULL;
|
||||||
|
BufferSize = EfiDevicePathSize (DevicePath);
|
||||||
|
for(Index = 0; Index < HandleCount; Index++) {
|
||||||
|
Handle = Handles[Index];
|
||||||
|
gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, &TmpDevicePath);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check whether DevicePath match
|
||||||
|
//
|
||||||
|
Size = EfiDevicePathSize (TmpDevicePath);
|
||||||
|
if ((Size == BufferSize) && EfiCompareMem (DevicePath, TmpDevicePath, Size) == 0) {
|
||||||
|
DriverHandle = Handle;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gBS->FreePool (Handles);
|
||||||
|
|
||||||
|
if (DriverHandle == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve all Hii Handles from HII database
|
||||||
|
//
|
||||||
|
BufferSize = 0x1000;
|
||||||
|
HiiHandles = EfiLibAllocatePool (BufferSize);
|
||||||
|
ASSERT (HiiHandles != NULL);
|
||||||
|
Status = HiiDatabase->ListPackageLists (
|
||||||
|
HiiDatabase,
|
||||||
|
EFI_HII_PACKAGE_TYPE_ALL,
|
||||||
|
NULL,
|
||||||
|
&BufferSize,
|
||||||
|
HiiHandles
|
||||||
|
);
|
||||||
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
|
gBS->FreePool (HiiHandles);
|
||||||
|
HiiHandles = EfiLibAllocatePool (BufferSize);
|
||||||
|
ASSERT (HiiHandles != NULL);
|
||||||
|
|
||||||
|
Status = HiiDatabase->ListPackageLists (
|
||||||
|
HiiDatabase,
|
||||||
|
EFI_HII_PACKAGE_TYPE_ALL,
|
||||||
|
NULL,
|
||||||
|
&BufferSize,
|
||||||
|
HiiHandles
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
gBS->FreePool (HiiHandles);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Search Hii Handle by Driver Handle
|
||||||
|
//
|
||||||
|
HiiHandle = NULL;
|
||||||
|
HandleCount = BufferSize / sizeof (EFI_HII_HANDLE);
|
||||||
|
for (Index = 0; Index < HandleCount; Index++) {
|
||||||
|
Status = HiiDatabase->GetPackageListHandle (
|
||||||
|
HiiDatabase,
|
||||||
|
HiiHandles[Index],
|
||||||
|
&Handle
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR (Status) && (Handle == DriverHandle)) {
|
||||||
|
HiiHandle = HiiHandles[Index];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gBS->FreePool (HiiHandles);
|
||||||
|
return HiiHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
GetHiiHandles (
|
||||||
|
IN OUT UINTN *HandleBufferLength,
|
||||||
|
OUT EFI_HII_HANDLE **HiiHandleBuffer
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Determines the handles that are currently active in the database.
|
||||||
|
It's the caller's responsibility to free handle buffer.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
HiiDatabase - A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
|
||||||
|
HandleBufferLength - On input, a pointer to the length of the handle buffer. On output,
|
||||||
|
the length of the handle buffer that is required for the handles found.
|
||||||
|
HiiHandleBuffer - Pointer to an array of Hii Handles returned.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
EFI_SUCCESS - Get an array of Hii Handles successfully.
|
||||||
|
EFI_INVALID_PARAMETER - Hii is NULL.
|
||||||
|
EFI_NOT_FOUND - Database not found.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
UINTN BufferLength;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
BufferLength = 0;
|
||||||
|
|
||||||
|
LocateHiiProtocols ();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Try to find the actual buffer size for HiiHandle Buffer.
|
||||||
|
//
|
||||||
|
Status = gIfrLibHiiDatabase->ListPackageLists (
|
||||||
|
gIfrLibHiiDatabase,
|
||||||
|
EFI_HII_PACKAGE_TYPE_ALL,
|
||||||
|
NULL,
|
||||||
|
&BufferLength,
|
||||||
|
*HiiHandleBuffer
|
||||||
|
);
|
||||||
|
|
||||||
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
|
*HiiHandleBuffer = EfiLibAllocateZeroPool (BufferLength);
|
||||||
|
Status = gIfrLibHiiDatabase->ListPackageLists (
|
||||||
|
gIfrLibHiiDatabase,
|
||||||
|
EFI_HII_PACKAGE_TYPE_ALL,
|
||||||
|
NULL,
|
||||||
|
&BufferLength,
|
||||||
|
*HiiHandleBuffer
|
||||||
|
);
|
||||||
|
//
|
||||||
|
// we should not fail here.
|
||||||
|
//
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
*HandleBufferLength = BufferLength;
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
ExtractGuidFromHiiHandle (
|
||||||
|
IN EFI_HII_HANDLE Handle,
|
||||||
|
OUT EFI_GUID *Guid
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Extract Hii package list GUID for given HII handle.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
HiiHandle - Hii handle
|
||||||
|
Guid - Package list GUID
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
EFI_SUCCESS - Successfully extract GUID from Hii database.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN BufferSize;
|
||||||
|
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
||||||
|
EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Locate HII Database protocol
|
||||||
|
//
|
||||||
|
Status = gBS->LocateProtocol (
|
||||||
|
&gEfiHiiDatabaseProtocolGuid,
|
||||||
|
NULL,
|
||||||
|
&HiiDatabase
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get HII PackageList
|
||||||
|
//
|
||||||
|
BufferSize = 0;
|
||||||
|
HiiPackageList = NULL;
|
||||||
|
Status = HiiDatabase->ExportPackageLists (HiiDatabase, Handle, &BufferSize, HiiPackageList);
|
||||||
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
|
HiiPackageList = EfiLibAllocatePool (BufferSize);
|
||||||
|
ASSERT (HiiPackageList != NULL);
|
||||||
|
|
||||||
|
Status = HiiDatabase->ExportPackageLists (HiiDatabase, Handle, &BufferSize, HiiPackageList);
|
||||||
|
}
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract GUID
|
||||||
|
//
|
||||||
|
EfiCopyMem (Guid, &HiiPackageList->PackageListGuid, sizeof (EFI_GUID));
|
||||||
|
|
||||||
|
gBS->FreePool (HiiPackageList);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
ExtractClassFromHiiHandle (
|
||||||
|
IN EFI_HII_HANDLE Handle,
|
||||||
|
OUT UINT16 *Class,
|
||||||
|
OUT EFI_STRING_ID *FormSetTitle,
|
||||||
|
OUT EFI_STRING_ID *FormSetHelp
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Extract formset class for given HII handle.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
HiiHandle - Hii handle
|
||||||
|
Class - Class of the formset
|
||||||
|
FormSetTitle - Formset title string
|
||||||
|
FormSetHelp - Formset help string
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
EFI_SUCCESS - Successfully extract Class for specified Hii handle.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN BufferSize;
|
||||||
|
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
||||||
|
EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
|
||||||
|
UINT8 *Package;
|
||||||
|
UINT8 *FormSet;
|
||||||
|
UINT8 *OpCodeData;
|
||||||
|
UINT32 Offset;
|
||||||
|
UINT32 Offset2;
|
||||||
|
UINT32 PackageListLength;
|
||||||
|
EFI_HII_PACKAGE_HEADER PackageHeader;
|
||||||
|
|
||||||
|
*Class = EFI_NON_DEVICE_CLASS;
|
||||||
|
*FormSetTitle = 0;
|
||||||
|
*FormSetHelp = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Locate HII Database protocol
|
||||||
|
//
|
||||||
|
Status = gBS->LocateProtocol (
|
||||||
|
&gEfiHiiDatabaseProtocolGuid,
|
||||||
|
NULL,
|
||||||
|
&HiiDatabase
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get HII PackageList
|
||||||
|
//
|
||||||
|
BufferSize = 0;
|
||||||
|
HiiPackageList = NULL;
|
||||||
|
Status = HiiDatabase->ExportPackageLists (HiiDatabase, Handle, &BufferSize, HiiPackageList);
|
||||||
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
|
HiiPackageList = EfiLibAllocatePool (BufferSize);
|
||||||
|
ASSERT (HiiPackageList != NULL);
|
||||||
|
|
||||||
|
Status = HiiDatabase->ExportPackageLists (HiiDatabase, Handle, &BufferSize, HiiPackageList);
|
||||||
|
}
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get Form package from this HII package List
|
||||||
|
//
|
||||||
|
Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
|
||||||
|
Offset2 = 0;
|
||||||
|
FormSet = NULL;
|
||||||
|
EfiCopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32));
|
||||||
|
|
||||||
|
while (Offset < PackageListLength) {
|
||||||
|
Package = ((UINT8 *) HiiPackageList) + Offset;
|
||||||
|
EfiCopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
|
||||||
|
|
||||||
|
if (PackageHeader.Type == EFI_HII_PACKAGE_FORM) {
|
||||||
|
//
|
||||||
|
// Search Class Opcode in this Form Package
|
||||||
|
//
|
||||||
|
Offset2 = sizeof (EFI_HII_PACKAGE_HEADER);
|
||||||
|
while (Offset2 < PackageHeader.Length) {
|
||||||
|
OpCodeData = Package + Offset2;
|
||||||
|
|
||||||
|
if (((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_FORM_SET_OP) {
|
||||||
|
//
|
||||||
|
// Find FormSet OpCode
|
||||||
|
//
|
||||||
|
EfiCopyMem (FormSetTitle, &((EFI_IFR_FORM_SET *) OpCodeData)->FormSetTitle, sizeof (EFI_STRING_ID));
|
||||||
|
EfiCopyMem (FormSetHelp, &((EFI_IFR_FORM_SET *) OpCodeData)->Help, sizeof (EFI_STRING_ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_GUID_OP) &&
|
||||||
|
(EfiCompareGuid (&mIfrVendorGuid, &((EFI_IFR_GUID *) OpCodeData)->Guid)) &&
|
||||||
|
(((EFI_IFR_GUID_CLASS *) OpCodeData)->ExtendOpCode == EFI_IFR_EXTEND_OP_CLASS)
|
||||||
|
) {
|
||||||
|
//
|
||||||
|
// Find GUIDed Class OpCode
|
||||||
|
//
|
||||||
|
EfiCopyMem (Class, &((EFI_IFR_GUID_CLASS *) OpCodeData)->Class, sizeof (UINT16));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Till now, we ought to have found the formset Opcode
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Offset2 += ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Offset2 < PackageHeader.Length) {
|
||||||
|
//
|
||||||
|
// Target formset found
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Offset += PackageHeader.Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
gBS->FreePool (HiiPackageList);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,640 @@
|
|||||||
|
/*++
|
||||||
|
|
||||||
|
Copyright (c) 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
UefiIfrOpCodeCreation.c
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Library Routines to create IFR independent of string data - assume tokens already exist
|
||||||
|
Primarily to be used for exporting op-codes at a label in pre-defined forms.
|
||||||
|
|
||||||
|
Revision History:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#include "UefiIfrLibrary.h"
|
||||||
|
|
||||||
|
EFI_GUID mIfrVendorGuid = EFI_IFR_TIANO_GUID;
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
BOOLEAN
|
||||||
|
IsValidQuestionFlags (
|
||||||
|
IN UINT8 Flags
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return (Flags & (~QUESTION_FLAGS)) ? FALSE : TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
BOOLEAN
|
||||||
|
IsValidValueType (
|
||||||
|
IN UINT8 Type
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return (Type <= EFI_IFR_TYPE_OTHER) ? TRUE : FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
BOOLEAN
|
||||||
|
IsValidNumricFlags (
|
||||||
|
IN UINT8 Flags
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (Flags & ~(EFI_IFR_NUMERIC_SIZE | EFI_IFR_DISPLAY)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((Flags & EFI_IFR_DISPLAY) > EFI_IFR_DISPLAY_UINT_HEX) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
BOOLEAN
|
||||||
|
IsValidCheckboxFlags (
|
||||||
|
IN UINT8 Flags
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return (Flags <= EFI_IFR_CHECKBOX_DEFAULT_MFG) ? TRUE : FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateEndOpCode (
|
||||||
|
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_IFR_END End;
|
||||||
|
UINT8 *LocalBuffer;
|
||||||
|
|
||||||
|
ASSERT (Data != NULL && Data->Data != NULL);
|
||||||
|
|
||||||
|
if (Data->Offset + sizeof (EFI_IFR_END) > Data->BufferSize) {
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
End.Header.Length = sizeof (EFI_IFR_END);
|
||||||
|
End.Header.OpCode = EFI_IFR_END_OP;
|
||||||
|
End.Header.Scope = 0;
|
||||||
|
|
||||||
|
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||||
|
EfiCopyMem (LocalBuffer, &End, sizeof (EFI_IFR_END));
|
||||||
|
Data->Offset += sizeof (EFI_IFR_END);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateDefaultOpCode (
|
||||||
|
IN EFI_IFR_TYPE_VALUE *Value,
|
||||||
|
IN UINT8 Type,
|
||||||
|
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_IFR_DEFAULT Default;
|
||||||
|
UINT8 *LocalBuffer;
|
||||||
|
|
||||||
|
ASSERT (Data != NULL && Data->Data != NULL);
|
||||||
|
|
||||||
|
if ((Value == NULL) || !IsValidValueType (Type)) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Data->Offset + sizeof (EFI_IFR_DEFAULT) > Data->BufferSize) {
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Default.Header.OpCode = EFI_IFR_DEFAULT_OP;
|
||||||
|
Default.Header.Length = sizeof (EFI_IFR_DEFAULT);
|
||||||
|
Default.Header.Scope = 0;
|
||||||
|
Default.Type = Type;
|
||||||
|
Default.DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
|
||||||
|
EfiCopyMem (&Default.Value, Value, sizeof(EFI_IFR_TYPE_VALUE));
|
||||||
|
|
||||||
|
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||||
|
EfiCopyMem (LocalBuffer, &Default, sizeof (EFI_IFR_DEFAULT));
|
||||||
|
Data->Offset += sizeof (EFI_IFR_DEFAULT);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateActionOpCode (
|
||||||
|
IN EFI_QUESTION_ID QuestionId,
|
||||||
|
IN EFI_STRING_ID Prompt,
|
||||||
|
IN EFI_STRING_ID Help,
|
||||||
|
IN UINT8 QuestionFlags,
|
||||||
|
IN EFI_STRING_ID QuestionConfig,
|
||||||
|
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_IFR_ACTION Action;
|
||||||
|
UINT8 *LocalBuffer;
|
||||||
|
|
||||||
|
ASSERT (Data != NULL && Data->Data != NULL);
|
||||||
|
|
||||||
|
if (!IsValidQuestionFlags (QuestionFlags)) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Data->Offset + sizeof (EFI_IFR_ACTION) > Data->BufferSize) {
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action.Header.OpCode = EFI_IFR_ACTION_OP;
|
||||||
|
Action.Header.Length = sizeof (EFI_IFR_ACTION);
|
||||||
|
Action.Header.Scope = 0;
|
||||||
|
Action.Question.QuestionId = QuestionId;
|
||||||
|
Action.Question.Header.Prompt = Prompt;
|
||||||
|
Action.Question.Header.Help = Help;
|
||||||
|
Action.Question.VarStoreId = INVALID_VARSTORE_ID;
|
||||||
|
Action.Question.Flags = QuestionFlags;
|
||||||
|
Action.QuestionConfig = QuestionConfig;
|
||||||
|
|
||||||
|
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||||
|
EfiCopyMem (LocalBuffer, &Action, sizeof (EFI_IFR_ACTION));
|
||||||
|
Data->Offset += sizeof (EFI_IFR_ACTION);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateSubTitleOpCode (
|
||||||
|
IN EFI_STRING_ID Prompt,
|
||||||
|
IN EFI_STRING_ID Help,
|
||||||
|
IN UINT8 Flags,
|
||||||
|
IN UINT8 Scope,
|
||||||
|
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_IFR_SUBTITLE Subtitle;
|
||||||
|
UINT8 *LocalBuffer;
|
||||||
|
|
||||||
|
ASSERT (Data != NULL && Data->Data != NULL);
|
||||||
|
|
||||||
|
if (Data->Offset + sizeof (EFI_IFR_SUBTITLE) > Data->BufferSize) {
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Subtitle.Header.OpCode = EFI_IFR_SUBTITLE_OP;
|
||||||
|
Subtitle.Header.Length = sizeof (EFI_IFR_SUBTITLE);
|
||||||
|
Subtitle.Header.Scope = Scope;
|
||||||
|
Subtitle.Statement.Prompt = Prompt;
|
||||||
|
Subtitle.Statement.Help = Help;
|
||||||
|
Subtitle.Flags = Flags;
|
||||||
|
|
||||||
|
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||||
|
EfiCopyMem (LocalBuffer, &Subtitle, sizeof (EFI_IFR_SUBTITLE));
|
||||||
|
Data->Offset += sizeof (EFI_IFR_SUBTITLE);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateTextOpCode (
|
||||||
|
IN EFI_STRING_ID Prompt,
|
||||||
|
IN EFI_STRING_ID Help,
|
||||||
|
IN EFI_STRING_ID TextTwo,
|
||||||
|
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_IFR_TEXT Text;
|
||||||
|
UINT8 *LocalBuffer;
|
||||||
|
|
||||||
|
ASSERT (Data != NULL && Data->Data != NULL);
|
||||||
|
|
||||||
|
if (Data->Offset + sizeof (EFI_IFR_TEXT) > Data->BufferSize) {
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Text.Header.OpCode = EFI_IFR_TEXT_OP;
|
||||||
|
Text.Header.Length = sizeof (EFI_IFR_TEXT);
|
||||||
|
Text.Header.Scope = 0;
|
||||||
|
Text.Statement.Prompt = Prompt;
|
||||||
|
Text.Statement.Help = Help;
|
||||||
|
Text.TextTwo = TextTwo;
|
||||||
|
|
||||||
|
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||||
|
EfiCopyMem (LocalBuffer, &Text, sizeof (EFI_IFR_TEXT));
|
||||||
|
Data->Offset += sizeof (EFI_IFR_TEXT);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateGotoOpCode (
|
||||||
|
IN EFI_FORM_ID FormId,
|
||||||
|
IN EFI_STRING_ID Prompt,
|
||||||
|
IN EFI_STRING_ID Help,
|
||||||
|
IN UINT8 QuestionFlags,
|
||||||
|
IN EFI_QUESTION_ID QuestionId,
|
||||||
|
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_IFR_REF Goto;
|
||||||
|
UINT8 *LocalBuffer;
|
||||||
|
|
||||||
|
ASSERT (Data != NULL && Data->Data != NULL);
|
||||||
|
|
||||||
|
if (!IsValidQuestionFlags (QuestionFlags)) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Data->Offset + sizeof (EFI_IFR_REF) > Data->BufferSize) {
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Goto.Header.OpCode = EFI_IFR_REF_OP;
|
||||||
|
Goto.Header.Length = sizeof (EFI_IFR_REF);
|
||||||
|
Goto.Header.Scope = 0;
|
||||||
|
Goto.Question.Header.Prompt = Prompt;
|
||||||
|
Goto.Question.Header.Help = Help;
|
||||||
|
Goto.Question.VarStoreId = INVALID_VARSTORE_ID;
|
||||||
|
Goto.Question.QuestionId = QuestionId;
|
||||||
|
Goto.Question.Flags = QuestionFlags;
|
||||||
|
Goto.FormId = FormId;
|
||||||
|
|
||||||
|
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||||
|
EfiCopyMem (LocalBuffer, &Goto, sizeof (EFI_IFR_REF));
|
||||||
|
Data->Offset += sizeof (EFI_IFR_REF);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateOneOfOptionOpCode (
|
||||||
|
IN UINTN OptionCount,
|
||||||
|
IN IFR_OPTION *OptionsList,
|
||||||
|
IN UINT8 Type,
|
||||||
|
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Index;
|
||||||
|
UINT8 *LocalBuffer;
|
||||||
|
EFI_IFR_ONE_OF_OPTION OneOfOption;
|
||||||
|
|
||||||
|
ASSERT (Data != NULL && Data->Data != NULL);
|
||||||
|
|
||||||
|
if ((OptionCount != 0) && (OptionsList == NULL)) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Data->Offset + OptionCount * sizeof (EFI_IFR_ONE_OF_OPTION) > Data->BufferSize) {
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Index = 0; Index < OptionCount; Index++) {
|
||||||
|
OneOfOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
|
||||||
|
OneOfOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);
|
||||||
|
OneOfOption.Header.Scope = 0;
|
||||||
|
|
||||||
|
OneOfOption.Option = OptionsList[Index].StringToken;
|
||||||
|
OneOfOption.Value = OptionsList[Index].Value;
|
||||||
|
OneOfOption.Flags = OptionsList[Index].Flags & (EFI_IFR_OPTION_DEFAULT | EFI_IFR_OPTION_DEFAULT_MFG);
|
||||||
|
OneOfOption.Type = Type;
|
||||||
|
|
||||||
|
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||||
|
EfiCopyMem (LocalBuffer, &OneOfOption, sizeof (EFI_IFR_ONE_OF_OPTION));
|
||||||
|
Data->Offset += sizeof (EFI_IFR_ONE_OF_OPTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateOneOfOpCode (
|
||||||
|
IN EFI_QUESTION_ID QuestionId,
|
||||||
|
IN EFI_VARSTORE_ID VarStoreId,
|
||||||
|
IN UINT16 VarOffset,
|
||||||
|
IN EFI_STRING_ID Prompt,
|
||||||
|
IN EFI_STRING_ID Help,
|
||||||
|
IN UINT8 QuestionFlags,
|
||||||
|
IN UINT8 OneOfFlags,
|
||||||
|
IN IFR_OPTION *OptionsList,
|
||||||
|
IN UINTN OptionCount,
|
||||||
|
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Length;
|
||||||
|
EFI_IFR_ONE_OF OneOf;
|
||||||
|
UINT8 *LocalBuffer;
|
||||||
|
|
||||||
|
ASSERT (Data != NULL && Data->Data != NULL);
|
||||||
|
|
||||||
|
if (!IsValidNumricFlags (OneOfFlags) ||
|
||||||
|
!IsValidQuestionFlags (QuestionFlags) ||
|
||||||
|
((OptionCount != 0) && (OptionsList == NULL))) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
Length = sizeof (EFI_IFR_ONE_OF) + OptionCount * sizeof (EFI_IFR_ONE_OF_OPTION) + sizeof (EFI_IFR_END);
|
||||||
|
if (Data->Offset + Length > Data->BufferSize) {
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
OneOf.Header.OpCode = EFI_IFR_ONE_OF_OP;
|
||||||
|
OneOf.Header.Length = sizeof (EFI_IFR_ONE_OF);
|
||||||
|
OneOf.Header.Scope = 1;
|
||||||
|
OneOf.Question.Header.Prompt = Prompt;
|
||||||
|
OneOf.Question.Header.Help = Help;
|
||||||
|
OneOf.Question.QuestionId = QuestionId;
|
||||||
|
OneOf.Question.VarStoreId = VarStoreId;
|
||||||
|
OneOf.Question.VarStoreInfo.VarOffset = VarOffset;
|
||||||
|
OneOf.Question.Flags = QuestionFlags;
|
||||||
|
OneOf.Flags = OneOfFlags;
|
||||||
|
EfiZeroMem ((VOID *) &OneOf.data, sizeof (MINMAXSTEP_DATA));
|
||||||
|
|
||||||
|
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||||
|
EfiCopyMem (LocalBuffer, &OneOf, sizeof (EFI_IFR_ONE_OF));
|
||||||
|
Data->Offset += sizeof (EFI_IFR_ONE_OF);
|
||||||
|
|
||||||
|
CreateOneOfOptionOpCode (OptionCount, OptionsList, (OneOfFlags & EFI_IFR_NUMERIC_SIZE), Data);
|
||||||
|
|
||||||
|
CreateEndOpCode (Data);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateOrderedListOpCode (
|
||||||
|
IN EFI_QUESTION_ID QuestionId,
|
||||||
|
IN EFI_VARSTORE_ID VarStoreId,
|
||||||
|
IN UINT16 VarOffset,
|
||||||
|
IN EFI_STRING_ID Prompt,
|
||||||
|
IN EFI_STRING_ID Help,
|
||||||
|
IN UINT8 QuestionFlags,
|
||||||
|
IN UINT8 OrderedListFlags,
|
||||||
|
IN UINT8 DataType,
|
||||||
|
IN UINT8 MaxContainers,
|
||||||
|
IN IFR_OPTION *OptionsList,
|
||||||
|
IN UINTN OptionCount,
|
||||||
|
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Length;
|
||||||
|
EFI_IFR_ORDERED_LIST OrderedList;
|
||||||
|
UINT8 *LocalBuffer;
|
||||||
|
|
||||||
|
ASSERT (Data != NULL && Data->Data != NULL);
|
||||||
|
|
||||||
|
if (!IsValidQuestionFlags (QuestionFlags) ||
|
||||||
|
((OptionCount != 0) && (OptionsList == NULL))) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((OrderedListFlags != 0) &&
|
||||||
|
(OrderedListFlags != EFI_IFR_UNIQUE_SET) &&
|
||||||
|
(OrderedListFlags != EFI_IFR_NO_EMPTY_SET)) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
Length = sizeof (EFI_IFR_ORDERED_LIST) + OptionCount * sizeof (EFI_IFR_ONE_OF_OPTION) + sizeof (EFI_IFR_END);
|
||||||
|
if (Data->Offset + Length > Data->BufferSize) {
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
OrderedList.Header.OpCode = EFI_IFR_ORDERED_LIST_OP;
|
||||||
|
OrderedList.Header.Length = sizeof (EFI_IFR_ORDERED_LIST);
|
||||||
|
OrderedList.Header.Scope = 1;
|
||||||
|
OrderedList.Question.Header.Prompt = Prompt;
|
||||||
|
OrderedList.Question.Header.Help = Help;
|
||||||
|
OrderedList.Question.QuestionId = QuestionId;
|
||||||
|
OrderedList.Question.VarStoreId = VarStoreId;
|
||||||
|
OrderedList.Question.VarStoreInfo.VarOffset = VarOffset;
|
||||||
|
OrderedList.Question.Flags = QuestionFlags;
|
||||||
|
OrderedList.MaxContainers = MaxContainers;
|
||||||
|
OrderedList.Flags = OrderedListFlags;
|
||||||
|
|
||||||
|
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||||
|
EfiCopyMem (LocalBuffer, &OrderedList, sizeof (EFI_IFR_ORDERED_LIST));
|
||||||
|
Data->Offset += sizeof (EFI_IFR_ORDERED_LIST);
|
||||||
|
|
||||||
|
CreateOneOfOptionOpCode (OptionCount, OptionsList, DataType, Data);
|
||||||
|
|
||||||
|
CreateEndOpCode (Data);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateCheckBoxOpCode (
|
||||||
|
IN EFI_QUESTION_ID QuestionId,
|
||||||
|
IN EFI_VARSTORE_ID VarStoreId,
|
||||||
|
IN UINT16 VarOffset,
|
||||||
|
IN EFI_STRING_ID Prompt,
|
||||||
|
IN EFI_STRING_ID Help,
|
||||||
|
IN UINT8 QuestionFlags,
|
||||||
|
IN UINT8 CheckBoxFlags,
|
||||||
|
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_IFR_CHECKBOX CheckBox;
|
||||||
|
UINT8 *LocalBuffer;
|
||||||
|
|
||||||
|
ASSERT (Data != NULL && Data->Data != NULL);
|
||||||
|
|
||||||
|
if (!IsValidQuestionFlags (QuestionFlags) || !IsValidCheckboxFlags (CheckBoxFlags)) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Data->Offset + sizeof (EFI_IFR_CHECKBOX) > Data->BufferSize) {
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckBox.Header.OpCode = EFI_IFR_CHECKBOX_OP;
|
||||||
|
CheckBox.Header.Length = sizeof (EFI_IFR_CHECKBOX);
|
||||||
|
CheckBox.Header.Scope = 0;
|
||||||
|
CheckBox.Question.QuestionId = QuestionId;
|
||||||
|
CheckBox.Question.VarStoreId = VarStoreId;
|
||||||
|
CheckBox.Question.VarStoreInfo.VarOffset = VarOffset;
|
||||||
|
CheckBox.Question.Header.Prompt = Prompt;
|
||||||
|
CheckBox.Question.Header.Help = Help;
|
||||||
|
CheckBox.Question.Flags = QuestionFlags;
|
||||||
|
CheckBox.Flags = CheckBoxFlags;
|
||||||
|
|
||||||
|
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||||
|
EfiCopyMem (LocalBuffer, &CheckBox, sizeof (EFI_IFR_CHECKBOX));
|
||||||
|
Data->Offset += sizeof (EFI_IFR_CHECKBOX);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateNumericOpCode (
|
||||||
|
IN EFI_QUESTION_ID QuestionId,
|
||||||
|
IN EFI_VARSTORE_ID VarStoreId,
|
||||||
|
IN UINT16 VarOffset,
|
||||||
|
IN EFI_STRING_ID Prompt,
|
||||||
|
IN EFI_STRING_ID Help,
|
||||||
|
IN UINT8 QuestionFlags,
|
||||||
|
IN UINT8 NumericFlags,
|
||||||
|
IN UINT64 Minimum,
|
||||||
|
IN UINT64 Maximum,
|
||||||
|
IN UINT64 Step,
|
||||||
|
IN UINT64 Default,
|
||||||
|
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINTN Length;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_IFR_NUMERIC Numeric;
|
||||||
|
MINMAXSTEP_DATA MinMaxStep;
|
||||||
|
EFI_IFR_TYPE_VALUE DefaultValue;
|
||||||
|
UINT8 *LocalBuffer;
|
||||||
|
|
||||||
|
ASSERT (Data != NULL && Data->Data != NULL);
|
||||||
|
|
||||||
|
if (!IsValidQuestionFlags (QuestionFlags) || !IsValidNumricFlags (NumericFlags)) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
Length = sizeof (EFI_IFR_NUMERIC) + sizeof (EFI_IFR_DEFAULT) + sizeof (EFI_IFR_END);
|
||||||
|
if (Data->Offset + sizeof (EFI_IFR_CHECKBOX) > Data->BufferSize) {
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Numeric.Header.OpCode = EFI_IFR_NUMERIC_OP;
|
||||||
|
Numeric.Header.Length = sizeof (EFI_IFR_NUMERIC);
|
||||||
|
Numeric.Header.Scope = 1;
|
||||||
|
Numeric.Question.QuestionId = QuestionId;
|
||||||
|
Numeric.Question.VarStoreId = VarStoreId;
|
||||||
|
Numeric.Question.VarStoreInfo.VarOffset = VarOffset;
|
||||||
|
Numeric.Question.Header.Prompt = Prompt;
|
||||||
|
Numeric.Question.Header.Help = Help;
|
||||||
|
Numeric.Question.Flags = QuestionFlags;
|
||||||
|
Numeric.Flags = NumericFlags;
|
||||||
|
|
||||||
|
switch (NumericFlags & EFI_IFR_NUMERIC_SIZE) {
|
||||||
|
case EFI_IFR_NUMERIC_SIZE_1:
|
||||||
|
MinMaxStep.u8.MinValue = (UINT8) Minimum;
|
||||||
|
MinMaxStep.u8.MaxValue = (UINT8) Maximum;
|
||||||
|
MinMaxStep.u8.Step = (UINT8) Step;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFI_IFR_NUMERIC_SIZE_2:
|
||||||
|
MinMaxStep.u16.MinValue = (UINT16) Minimum;
|
||||||
|
MinMaxStep.u16.MaxValue = (UINT16) Maximum;
|
||||||
|
MinMaxStep.u16.Step = (UINT16) Step;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFI_IFR_NUMERIC_SIZE_4:
|
||||||
|
MinMaxStep.u32.MinValue = (UINT32) Minimum;
|
||||||
|
MinMaxStep.u32.MaxValue = (UINT32) Maximum;
|
||||||
|
MinMaxStep.u32.Step = (UINT32) Step;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFI_IFR_NUMERIC_SIZE_8:
|
||||||
|
MinMaxStep.u64.MinValue = Minimum;
|
||||||
|
MinMaxStep.u64.MaxValue = Maximum;
|
||||||
|
MinMaxStep.u64.Step = Step;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
EfiCopyMem (&Numeric.data, &MinMaxStep, sizeof (MINMAXSTEP_DATA));
|
||||||
|
|
||||||
|
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||||
|
EfiCopyMem (LocalBuffer, &Numeric, sizeof (EFI_IFR_NUMERIC));
|
||||||
|
Data->Offset += sizeof (EFI_IFR_NUMERIC);
|
||||||
|
|
||||||
|
DefaultValue.u64 = Default;
|
||||||
|
Status = CreateDefaultOpCode (&DefaultValue, (NumericFlags & EFI_IFR_NUMERIC_SIZE), Data);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateEndOpCode (Data);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateStringOpCode (
|
||||||
|
IN EFI_QUESTION_ID QuestionId,
|
||||||
|
IN EFI_VARSTORE_ID VarStoreId,
|
||||||
|
IN UINT16 VarOffset,
|
||||||
|
IN EFI_STRING_ID Prompt,
|
||||||
|
IN EFI_STRING_ID Help,
|
||||||
|
IN UINT8 QuestionFlags,
|
||||||
|
IN UINT8 StringFlags,
|
||||||
|
IN UINT8 MinSize,
|
||||||
|
IN UINT8 MaxSize,
|
||||||
|
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_IFR_STRING String;
|
||||||
|
UINT8 *LocalBuffer;
|
||||||
|
|
||||||
|
ASSERT (Data != NULL && Data->Data != NULL);
|
||||||
|
|
||||||
|
if (!IsValidQuestionFlags (QuestionFlags) || (StringFlags & (~EFI_IFR_STRING_MULTI_LINE))) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Data->Offset + sizeof (EFI_IFR_STRING) > Data->BufferSize) {
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
String.Header.OpCode = EFI_IFR_STRING_OP;
|
||||||
|
String.Header.Length = sizeof (EFI_IFR_STRING);
|
||||||
|
String.Header.Scope = 0;
|
||||||
|
String.Question.Header.Prompt = Prompt;
|
||||||
|
String.Question.Header.Help = Help;
|
||||||
|
String.Question.QuestionId = QuestionId;
|
||||||
|
String.Question.VarStoreId = VarStoreId;
|
||||||
|
String.Question.VarStoreInfo.VarOffset = VarOffset;
|
||||||
|
String.Question.Flags = QuestionFlags;
|
||||||
|
String.MinSize = MinSize;
|
||||||
|
String.MaxSize = MaxSize;
|
||||||
|
String.Flags = StringFlags;
|
||||||
|
|
||||||
|
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||||
|
EfiCopyMem (LocalBuffer, &String, sizeof (EFI_IFR_STRING));
|
||||||
|
Data->Offset += sizeof (EFI_IFR_STRING);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
CreateBannerOpCode (
|
||||||
|
IN EFI_STRING_ID Title,
|
||||||
|
IN UINT16 LineNumber,
|
||||||
|
IN UINT8 Alignment,
|
||||||
|
IN OUT EFI_HII_UPDATE_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_IFR_GUID_BANNER Banner;
|
||||||
|
UINT8 *LocalBuffer;
|
||||||
|
|
||||||
|
ASSERT (Data != NULL && Data->Data != NULL);
|
||||||
|
|
||||||
|
if (Data->Offset + sizeof (EFI_IFR_GUID_BANNER) > Data->BufferSize) {
|
||||||
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Banner.Header.OpCode = EFI_IFR_GUID_OP;
|
||||||
|
Banner.Header.Length = sizeof (EFI_IFR_GUID_BANNER);
|
||||||
|
Banner.Header.Scope = 0;
|
||||||
|
EfiCopyMem (&Banner.Guid, &mIfrVendorGuid, sizeof (EFI_IFR_GUID));
|
||||||
|
Banner.ExtendOpCode = EFI_IFR_EXTEND_OP_BANNER;
|
||||||
|
Banner.Title = Title;
|
||||||
|
Banner.LineNumber = LineNumber;
|
||||||
|
Banner.Alignment = Alignment;
|
||||||
|
|
||||||
|
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
|
||||||
|
EfiCopyMem (LocalBuffer, &Banner, sizeof (EFI_IFR_GUID_BANNER));
|
||||||
|
Data->Offset += sizeof (EFI_IFR_GUID_BANNER);
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
@ -0,0 +1,702 @@
|
|||||||
|
/*++
|
||||||
|
|
||||||
|
Copyright (c) 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
UefiIfrString.c
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Common Library Routines to assist to handle String and Language.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#include "UefiIfrLibrary.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Lookup table of ISO639-2 3 character language codes to ISO 639-1 2 character language codes
|
||||||
|
// Each entry is 5 CHAR8 values long. The first 3 CHAR8 values are the ISO 639-2 code.
|
||||||
|
// The last 2 CHAR8 values are the ISO 639-1 code.
|
||||||
|
//
|
||||||
|
CHAR8 Iso639ToRfc3066ConversionTable[] =
|
||||||
|
"\
|
||||||
|
aaraa\
|
||||||
|
abkab\
|
||||||
|
afraf\
|
||||||
|
amham\
|
||||||
|
araar\
|
||||||
|
asmas\
|
||||||
|
aymay\
|
||||||
|
azeaz\
|
||||||
|
bakba\
|
||||||
|
belbe\
|
||||||
|
benbn\
|
||||||
|
bihbh\
|
||||||
|
bisbi\
|
||||||
|
bodbo\
|
||||||
|
brebr\
|
||||||
|
bulbg\
|
||||||
|
catca\
|
||||||
|
cescs\
|
||||||
|
corkw\
|
||||||
|
cosco\
|
||||||
|
cymcy\
|
||||||
|
danda\
|
||||||
|
deude\
|
||||||
|
dzodz\
|
||||||
|
ellel\
|
||||||
|
engen\
|
||||||
|
epoeo\
|
||||||
|
estet\
|
||||||
|
euseu\
|
||||||
|
faofo\
|
||||||
|
fasfa\
|
||||||
|
fijfj\
|
||||||
|
finfi\
|
||||||
|
frafr\
|
||||||
|
fryfy\
|
||||||
|
gaiga\
|
||||||
|
gdhgd\
|
||||||
|
glggl\
|
||||||
|
grngn\
|
||||||
|
gujgu\
|
||||||
|
hauha\
|
||||||
|
hebhe\
|
||||||
|
hinhi\
|
||||||
|
hrvhr\
|
||||||
|
hunhu\
|
||||||
|
hyehy\
|
||||||
|
ikuiu\
|
||||||
|
ileie\
|
||||||
|
inaia\
|
||||||
|
indid\
|
||||||
|
ipkik\
|
||||||
|
islis\
|
||||||
|
itait\
|
||||||
|
jawjw\
|
||||||
|
jpnja\
|
||||||
|
kalkl\
|
||||||
|
kankn\
|
||||||
|
kasks\
|
||||||
|
katka\
|
||||||
|
kazkk\
|
||||||
|
khmkm\
|
||||||
|
kinrw\
|
||||||
|
kirky\
|
||||||
|
korko\
|
||||||
|
kurku\
|
||||||
|
laolo\
|
||||||
|
latla\
|
||||||
|
lavlv\
|
||||||
|
linln\
|
||||||
|
litlt\
|
||||||
|
ltzlb\
|
||||||
|
malml\
|
||||||
|
marmr\
|
||||||
|
mkdmk\
|
||||||
|
mlgmg\
|
||||||
|
mltmt\
|
||||||
|
molmo\
|
||||||
|
monmn\
|
||||||
|
mrimi\
|
||||||
|
msams\
|
||||||
|
myamy\
|
||||||
|
nauna\
|
||||||
|
nepne\
|
||||||
|
nldnl\
|
||||||
|
norno\
|
||||||
|
ocioc\
|
||||||
|
ormom\
|
||||||
|
panpa\
|
||||||
|
polpl\
|
||||||
|
porpt\
|
||||||
|
pusps\
|
||||||
|
quequ\
|
||||||
|
rohrm\
|
||||||
|
ronro\
|
||||||
|
runrn\
|
||||||
|
rusru\
|
||||||
|
sagsg\
|
||||||
|
sansa\
|
||||||
|
sinsi\
|
||||||
|
slksk\
|
||||||
|
slvsl\
|
||||||
|
smise\
|
||||||
|
smosm\
|
||||||
|
snasn\
|
||||||
|
sndsd\
|
||||||
|
somso\
|
||||||
|
sotst\
|
||||||
|
spaes\
|
||||||
|
sqisq\
|
||||||
|
srpsr\
|
||||||
|
sswss\
|
||||||
|
sunsu\
|
||||||
|
swasw\
|
||||||
|
swesv\
|
||||||
|
tamta\
|
||||||
|
tattt\
|
||||||
|
telte\
|
||||||
|
tgktg\
|
||||||
|
tgltl\
|
||||||
|
thath\
|
||||||
|
tsnts\
|
||||||
|
tuktk\
|
||||||
|
twitw\
|
||||||
|
uigug\
|
||||||
|
ukruk\
|
||||||
|
urdur\
|
||||||
|
uzbuz\
|
||||||
|
vievi\
|
||||||
|
volvo\
|
||||||
|
wolwo\
|
||||||
|
xhoxh\
|
||||||
|
yidyi\
|
||||||
|
zhaza\
|
||||||
|
zhozh\
|
||||||
|
zulzu\
|
||||||
|
";
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
ConvertRfc3066LanguageToIso639Language (
|
||||||
|
CHAR8 *LanguageRfc3066,
|
||||||
|
CHAR8 *LanguageIso639
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Convert language code from RFC3066 to ISO639-2.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
LanguageRfc3066 - RFC3066 language code.
|
||||||
|
LanguageIso639 - ISO639-2 language code.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
EFI_SUCCESS - Language code converted.
|
||||||
|
EFI_NOT_FOUND - Language code not found.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
UINTN Index;
|
||||||
|
|
||||||
|
if ((LanguageRfc3066[2] != '-') && (LanguageRfc3066[2] != 0)) {
|
||||||
|
EfiCopyMem (LanguageIso639, LanguageRfc3066, 3);
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Index = 0; Iso639ToRfc3066ConversionTable[Index] != 0; Index += 5) {
|
||||||
|
if (EfiCompareMem (LanguageRfc3066, &Iso639ToRfc3066ConversionTable[Index + 3], 2) == 0) {
|
||||||
|
EfiCopyMem (LanguageIso639, &Iso639ToRfc3066ConversionTable[Index], 3);
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
CHAR8 *
|
||||||
|
Rfc3066ToIso639 (
|
||||||
|
CHAR8 *SupportedLanguages
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Convert language code list from RFC3066 to ISO639-2, e.g. "en-US;fr-FR" will
|
||||||
|
be converted to "engfra".
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
SupportedLanguages - The RFC3066 language list.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The ISO639-2 language list.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
CHAR8 *Languages;
|
||||||
|
CHAR8 *ReturnValue;
|
||||||
|
CHAR8 *LangCodes;
|
||||||
|
CHAR8 LangRfc3066[RFC_3066_ENTRY_SIZE];
|
||||||
|
CHAR8 LangIso639[ISO_639_2_ENTRY_SIZE];
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
ReturnValue = EfiLibAllocateZeroPool (EfiAsciiStrSize (SupportedLanguages));
|
||||||
|
if (ReturnValue == NULL) {
|
||||||
|
return ReturnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Languages = ReturnValue;
|
||||||
|
LangCodes = SupportedLanguages;
|
||||||
|
while (*LangCodes != 0) {
|
||||||
|
GetNextLanguage (&LangCodes, LangRfc3066);
|
||||||
|
|
||||||
|
Status = ConvertRfc3066LanguageToIso639Language (LangRfc3066, LangIso639);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
EfiCopyMem (Languages, LangIso639, 3);
|
||||||
|
Languages = Languages + 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ReturnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
GetCurrentLanguage (
|
||||||
|
OUT CHAR8 *Lang
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Determine what is the current language setting
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
Lang - Pointer of system language
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Status code
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN Size;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get current language setting
|
||||||
|
//
|
||||||
|
Size = RFC_3066_ENTRY_SIZE;
|
||||||
|
Status = gRT->GetVariable (
|
||||||
|
L"PlatformLang",
|
||||||
|
&gEfiGlobalVariableGuid,
|
||||||
|
NULL,
|
||||||
|
&Size,
|
||||||
|
Lang
|
||||||
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
EfiAsciiStrCpy (Lang, "en-US");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
GetNextLanguage (
|
||||||
|
IN OUT CHAR8 **LangCode,
|
||||||
|
OUT CHAR8 *Lang
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Get next language from language code list (with separator ';').
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
LangCode - On input: point to first language in the list. On output: point to
|
||||||
|
next language in the list, or NULL if no more language in the list.
|
||||||
|
Lang - The first language in the list.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
None.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
UINTN Index;
|
||||||
|
CHAR8 *StringPtr;
|
||||||
|
|
||||||
|
if (LangCode == NULL || *LangCode == NULL) {
|
||||||
|
*Lang = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Index = 0;
|
||||||
|
StringPtr = *LangCode;
|
||||||
|
while (StringPtr[Index] != 0 && StringPtr[Index] != ';') {
|
||||||
|
Index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
EfiCopyMem (Lang, StringPtr, Index);
|
||||||
|
Lang[Index] = 0;
|
||||||
|
|
||||||
|
if (StringPtr[Index] == ';') {
|
||||||
|
Index++;
|
||||||
|
}
|
||||||
|
*LangCode = StringPtr + Index;
|
||||||
|
}
|
||||||
|
|
||||||
|
CHAR8 *
|
||||||
|
GetSupportedLanguages (
|
||||||
|
IN EFI_HII_HANDLE HiiHandle
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
This function returns the list of supported languages, in the format specified
|
||||||
|
in UEFI specification Appendix<69>M.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
HiiHandle - The HII package list handle.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The supported languages.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN BufferSize;
|
||||||
|
CHAR8 *LanguageString;
|
||||||
|
|
||||||
|
LocateHiiProtocols ();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Collect current supported Languages for given HII handle
|
||||||
|
//
|
||||||
|
BufferSize = 0x1000;
|
||||||
|
LanguageString = EfiLibAllocatePool (BufferSize);
|
||||||
|
Status = gIfrLibHiiString->GetLanguages (gIfrLibHiiString, HiiHandle, LanguageString, &BufferSize);
|
||||||
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
|
gBS->FreePool (LanguageString);
|
||||||
|
LanguageString = EfiLibAllocatePool (BufferSize);
|
||||||
|
Status = gIfrLibHiiString->GetLanguages (gIfrLibHiiString, HiiHandle, LanguageString, &BufferSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
LanguageString = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return LanguageString;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT16
|
||||||
|
GetSupportedLanguageNumber (
|
||||||
|
IN EFI_HII_HANDLE HiiHandle
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
This function returns the number of supported languages
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
HiiHandle - The HII package list handle.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The number of supported languages.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
CHAR8 *Languages;
|
||||||
|
CHAR8 *LanguageString;
|
||||||
|
UINT16 LangNumber;
|
||||||
|
CHAR8 Lang[RFC_3066_ENTRY_SIZE];
|
||||||
|
|
||||||
|
Languages = GetSupportedLanguages (HiiHandle);
|
||||||
|
if (Languages == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LangNumber = 0;
|
||||||
|
LanguageString = Languages;
|
||||||
|
while (*LanguageString != 0) {
|
||||||
|
GetNextLanguage (&LanguageString, Lang);
|
||||||
|
LangNumber++;
|
||||||
|
}
|
||||||
|
gBS->FreePool (Languages);
|
||||||
|
|
||||||
|
return LangNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
GetStringFromHandle (
|
||||||
|
IN EFI_HII_HANDLE HiiHandle,
|
||||||
|
IN EFI_STRING_ID StringId,
|
||||||
|
OUT EFI_STRING *String
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Get string specified by StringId form the HiiHandle.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
HiiHandle - The HII handle of package list.
|
||||||
|
StringId - The String ID.
|
||||||
|
String - The output string.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
EFI_NOT_FOUND - String is not found.
|
||||||
|
EFI_SUCCESS - Operation is successful.
|
||||||
|
EFI_OUT_OF_RESOURCES - There is not enought memory in the system.
|
||||||
|
EFI_INVALID_PARAMETER - The String is NULL.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN StringSize;
|
||||||
|
|
||||||
|
if (String == NULL) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringSize = IFR_LIB_DEFAULT_STRING_SIZE;
|
||||||
|
*String = EfiLibAllocateZeroPool (StringSize);
|
||||||
|
if (*String == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = IfrLibGetString (HiiHandle, StringId, *String, &StringSize);
|
||||||
|
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||||
|
gBS->FreePool (*String);
|
||||||
|
*String = EfiLibAllocateZeroPool (StringSize);
|
||||||
|
if (*String == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
Status = IfrLibGetString (HiiHandle, StringId, *String, &StringSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
GetStringFromToken (
|
||||||
|
IN EFI_GUID *ProducerGuid,
|
||||||
|
IN EFI_STRING_ID StringId,
|
||||||
|
OUT EFI_STRING *String
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Get the string given the StringId and String package Producer's Guid.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
ProducerGuid - The Guid of String package list.
|
||||||
|
StringId - The String ID.
|
||||||
|
String - The output string.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
EFI_NOT_FOUND - String is not found.
|
||||||
|
EFI_SUCCESS - Operation is successful.
|
||||||
|
EFI_OUT_OF_RESOURCES - There is not enought memory in the system.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN Index;
|
||||||
|
UINTN HandleBufferLen;
|
||||||
|
EFI_HII_HANDLE *HiiHandleBuffer;
|
||||||
|
EFI_GUID Guid;
|
||||||
|
|
||||||
|
Status = GetHiiHandles (&HandleBufferLen, &HiiHandleBuffer);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
for (Index = 0; Index < (HandleBufferLen / sizeof (EFI_HII_HANDLE)); Index++) {
|
||||||
|
Status = ExtractGuidFromHiiHandle (HiiHandleBuffer[Index], &Guid);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
if (EfiCompareGuid (&Guid, ProducerGuid) == TRUE) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Index >= (HandleBufferLen / sizeof (EFI_HII_HANDLE))) {
|
||||||
|
Status = EFI_NOT_FOUND;
|
||||||
|
goto Out;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = GetStringFromHandle (HiiHandleBuffer[Index], StringId, String);
|
||||||
|
|
||||||
|
Out:
|
||||||
|
if (HiiHandleBuffer != NULL) {
|
||||||
|
gBS->FreePool (HiiHandleBuffer);
|
||||||
|
}
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
IfrLibNewString (
|
||||||
|
IN EFI_HII_HANDLE PackageList,
|
||||||
|
OUT EFI_STRING_ID *StringId,
|
||||||
|
IN CONST EFI_STRING String
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
This function adds the string into String Package of each language.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
PackageList - Handle of the package list where this string will be added.
|
||||||
|
StringId - On return, contains the new strings id, which is unique within PackageList.
|
||||||
|
String - Points to the new null-terminated string.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
EFI_SUCCESS - The new string was added successfully.
|
||||||
|
EFI_NOT_FOUND - The specified PackageList could not be found in database.
|
||||||
|
EFI_OUT_OF_RESOURCES - Could not add the string due to lack of resources.
|
||||||
|
EFI_INVALID_PARAMETER - String is NULL or StringId is NULL is NULL.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
CHAR8 *Languages;
|
||||||
|
CHAR8 *LangStrings;
|
||||||
|
CHAR8 Lang[RFC_3066_ENTRY_SIZE];
|
||||||
|
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
|
LocateHiiProtocols ();
|
||||||
|
|
||||||
|
Languages = GetSupportedLanguages (PackageList);
|
||||||
|
|
||||||
|
LangStrings = Languages;
|
||||||
|
while (*LangStrings != 0) {
|
||||||
|
GetNextLanguage (&LangStrings, Lang);
|
||||||
|
|
||||||
|
Status = gIfrLibHiiString->NewString (
|
||||||
|
gIfrLibHiiString,
|
||||||
|
PackageList,
|
||||||
|
StringId,
|
||||||
|
Lang,
|
||||||
|
NULL,
|
||||||
|
String,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gBS->FreePool (Languages);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
IfrLibGetString (
|
||||||
|
IN EFI_HII_HANDLE PackageList,
|
||||||
|
IN EFI_STRING_ID StringId,
|
||||||
|
OUT EFI_STRING String,
|
||||||
|
IN OUT UINTN *StringSize
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
This function try to retrieve string from String package of current language.
|
||||||
|
If fail, it try to retrieve string from String package of first language it support.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
PackageList - The package list in the HII database to search for the specified string.
|
||||||
|
StringId - The string's id, which is unique within PackageList.
|
||||||
|
String - Points to the new null-terminated string.
|
||||||
|
StringSize - On entry, points to the size of the buffer pointed to by String, in bytes. On return,
|
||||||
|
points to the length of the string, in bytes.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
EFI_SUCCESS - The string was returned successfully.
|
||||||
|
EFI_NOT_FOUND - The string specified by StringId is not available.
|
||||||
|
EFI_BUFFER_TOO_SMALL - The buffer specified by StringLength is too small to hold the string.
|
||||||
|
EFI_INVALID_PARAMETER - The String or StringSize was NULL.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
CHAR8 *Languages;
|
||||||
|
CHAR8 *LangStrings;
|
||||||
|
CHAR8 Lang[RFC_3066_ENTRY_SIZE];
|
||||||
|
CHAR8 CurrentLang[RFC_3066_ENTRY_SIZE];
|
||||||
|
|
||||||
|
LocateHiiProtocols ();
|
||||||
|
|
||||||
|
GetCurrentLanguage (CurrentLang);
|
||||||
|
|
||||||
|
Status = gIfrLibHiiString->GetString (
|
||||||
|
gIfrLibHiiString,
|
||||||
|
CurrentLang,
|
||||||
|
PackageList,
|
||||||
|
StringId,
|
||||||
|
String,
|
||||||
|
StringSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
|
||||||
|
Languages = GetSupportedLanguages (PackageList);
|
||||||
|
LangStrings = Languages;
|
||||||
|
GetNextLanguage (&LangStrings, Lang);
|
||||||
|
gBS->FreePool (Languages);
|
||||||
|
|
||||||
|
Status = gIfrLibHiiString->GetString (
|
||||||
|
gIfrLibHiiString,
|
||||||
|
Lang,
|
||||||
|
PackageList,
|
||||||
|
StringId,
|
||||||
|
String,
|
||||||
|
StringSize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
IfrLibSetString (
|
||||||
|
IN EFI_HII_HANDLE PackageList,
|
||||||
|
IN EFI_STRING_ID StringId,
|
||||||
|
IN CONST EFI_STRING String
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
This function updates the string in String package of each language.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
PackageList - The package list containing the strings.
|
||||||
|
StringId - The string's id, which is unique within PackageList.
|
||||||
|
String - Points to the new null-terminated string.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
EFI_SUCCESS - The string was updated successfully.
|
||||||
|
EFI_NOT_FOUND - The string specified by StringId is not in the database.
|
||||||
|
EFI_INVALID_PARAMETER - The String was NULL.
|
||||||
|
EFI_OUT_OF_RESOURCES - The system is out of resources to accomplish the task.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
CHAR8 *Languages;
|
||||||
|
CHAR8 *LangStrings;
|
||||||
|
CHAR8 Lang[RFC_3066_ENTRY_SIZE];
|
||||||
|
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
|
LocateHiiProtocols ();
|
||||||
|
|
||||||
|
Languages = GetSupportedLanguages (PackageList);
|
||||||
|
|
||||||
|
LangStrings = Languages;
|
||||||
|
while (*LangStrings != 0) {
|
||||||
|
GetNextLanguage (&LangStrings, Lang);
|
||||||
|
|
||||||
|
Status = gIfrLibHiiString->SetString (
|
||||||
|
gIfrLibHiiString,
|
||||||
|
PackageList,
|
||||||
|
StringId,
|
||||||
|
Lang,
|
||||||
|
String,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gBS->FreePool (Languages);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
@ -84,21 +84,63 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverMode
|
|||||||
// NOTE: Limitation:
|
// NOTE: Limitation:
|
||||||
// Only one handler for SetVirtualAddressMap Event and ExitBootServices Event each
|
// Only one handler for SetVirtualAddressMap Event and ExitBootServices Event each
|
||||||
//
|
//
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the WRONG macro and it's kept only for backward compatibility.
|
||||||
|
*/
|
||||||
|
#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT__HANDLER__
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT__HANDLER__ (
|
||||||
|
IN EFI_EVENT Event,
|
||||||
|
IN VOID *Context
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the CORRECT macro users should use.
|
||||||
|
*/
|
||||||
#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__
|
#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__
|
||||||
VOID
|
VOID
|
||||||
|
EFIAPI
|
||||||
__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__ (
|
__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__ (
|
||||||
IN EFI_EVENT Event,
|
IN EFI_EVENT Event,
|
||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Both __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT__HANDLER__ and
|
||||||
|
* __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__ are kept here although
|
||||||
|
* the former is a WRONG macro. It's kept only for backward compatibility.
|
||||||
|
* For a single module, it's not likely that both macros are defined.
|
||||||
|
*/
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {
|
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
|
||||||
|
|
||||||
#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__
|
#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__
|
||||||
__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__,
|
__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the WRONG macro and it's kept only for backward compatibility.
|
||||||
|
*/
|
||||||
|
#ifdef __EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__
|
||||||
|
VOID
|
||||||
|
__EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__ (
|
||||||
|
IN EFI_EVENT Event,
|
||||||
|
IN VOID *Context
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the CORRECT macro users should use.
|
||||||
|
*/
|
||||||
#ifdef __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__
|
#ifdef __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__
|
||||||
VOID
|
VOID
|
||||||
__EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__ (
|
__EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__ (
|
||||||
@ -120,6 +162,13 @@ RuntimeDriverExitBootServices (
|
|||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Both __EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__ and
|
||||||
|
* __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__ are kept here although
|
||||||
|
* the former is a WRONG macro. It's kept only for backward compatibility.
|
||||||
|
* For a single module, it's not likely that both macros are defined.
|
||||||
|
*/
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {
|
||||||
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
|
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
|
||||||
//
|
//
|
||||||
@ -127,9 +176,15 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEve
|
|||||||
//
|
//
|
||||||
RuntimeDriverExitBootServices,
|
RuntimeDriverExitBootServices,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__
|
||||||
|
__EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__,
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__
|
#ifdef __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__
|
||||||
__EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__,
|
__EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -167,6 +222,7 @@ ProcessModuleUnloadList (
|
|||||||
// Library constructors
|
// Library constructors
|
||||||
//
|
//
|
||||||
VOID
|
VOID
|
||||||
|
EFIAPI
|
||||||
ProcessLibraryConstructorList (
|
ProcessLibraryConstructorList (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
@ -253,6 +309,7 @@ ProcessLibraryConstructorList (
|
|||||||
// Library Destructors
|
// Library Destructors
|
||||||
//
|
//
|
||||||
VOID
|
VOID
|
||||||
|
EFIAPI
|
||||||
ProcessLibraryDestructorList (
|
ProcessLibraryDestructorList (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
@ -309,16 +366,15 @@ _DriverUnloadHandler (
|
|||||||
//
|
//
|
||||||
// Close our ExitBootServices () notify function
|
// Close our ExitBootServices () notify function
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
|
||||||
if (_gDriverExitBootServicesEvent[0] != NULL) {
|
if (_gDriverExitBootServicesEvent[0] != NULL) {
|
||||||
ASSERT (gBS != NULL);
|
ASSERT (gBS != NULL);
|
||||||
Status = gBS->CloseEvent (_mDriverExitBootServicesNotifyEvent);
|
Status = gBS->CloseEvent (_mDriverExitBootServicesNotifyEvent);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
|
||||||
// NOTE: To allow passing in gST here, any library instance having a destructor
|
|
||||||
// must depend on EfiDriverLib
|
|
||||||
//
|
|
||||||
ProcessLibraryDestructorList (ImageHandle, gST);
|
ProcessLibraryDestructorList (ImageHandle, gST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,6 +408,7 @@ Returns:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
|
#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
|
||||||
EFI_EVENT_NOTIFY ChildNotifyEventHandler;
|
EFI_EVENT_NOTIFY ChildNotifyEventHandler;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
@ -359,6 +416,7 @@ Returns:
|
|||||||
ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index];
|
ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index];
|
||||||
ChildNotifyEventHandler (Event, NULL);
|
ChildNotifyEventHandler (Event, NULL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_DRIVER_ENTRY_POINT (_ModuleEntryPoint);
|
EFI_DRIVER_ENTRY_POINT (_ModuleEntryPoint);
|
||||||
@ -393,7 +451,6 @@ _ModuleEntryPoint (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
|
||||||
|
|
||||||
// if (_gUefiDriverRevision != 0) {
|
// if (_gUefiDriverRevision != 0) {
|
||||||
// //
|
// //
|
||||||
@ -414,6 +471,7 @@ _ModuleEntryPoint (
|
|||||||
//
|
//
|
||||||
// Register our ExitBootServices () notify function
|
// Register our ExitBootServices () notify function
|
||||||
//
|
//
|
||||||
|
#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
|
||||||
if (_gDriverExitBootServicesEvent[0] != NULL) {
|
if (_gDriverExitBootServicesEvent[0] != NULL) {
|
||||||
Status = SystemTable->BootServices->CreateEvent (
|
Status = SystemTable->BootServices->CreateEvent (
|
||||||
EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,
|
EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,
|
||||||
@ -425,17 +483,34 @@ _ModuleEntryPoint (
|
|||||||
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install unload handler...
|
// Install unload handler...
|
||||||
//
|
//
|
||||||
Status = SystemTable->BootServices->HandleProtocol (
|
//
|
||||||
ImageHandle,
|
// Add conditional macro to save size. The 4 macros check against
|
||||||
&gEfiLoadedImageProtocolGuid,
|
// potential functions which may be invoked, if there is no function
|
||||||
(VOID **)&LoadedImage
|
// to be called, we don't register Unload callback.
|
||||||
);
|
//
|
||||||
ASSERT_EFI_ERROR (Status);
|
#if ( defined(__EDKII_GLUE_MODULE_UNLOAD_HANDLER__) \
|
||||||
LoadedImage->Unload = _DriverUnloadHandler;
|
|| defined(__EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__) \
|
||||||
|
|| defined(__EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__) ) \
|
||||||
|
|| __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
|
||||||
|
|
||||||
|
do {
|
||||||
|
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||||
|
|
||||||
|
Status = SystemTable->BootServices->HandleProtocol (
|
||||||
|
ImageHandle,
|
||||||
|
&gEfiLoadedImageProtocolGuid,
|
||||||
|
(VOID **)&LoadedImage
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
LoadedImage->Unload = _DriverUnloadHandler;
|
||||||
|
} while(0);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Call the driver entry point
|
// Call the driver entry point
|
||||||
@ -453,11 +528,13 @@ _ModuleEntryPoint (
|
|||||||
//
|
//
|
||||||
// Close our ExitBootServices () notify function
|
// Close our ExitBootServices () notify function
|
||||||
//
|
//
|
||||||
|
#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
|
||||||
if (_gDriverExitBootServicesEvent[0] != NULL) {
|
if (_gDriverExitBootServicesEvent[0] != NULL) {
|
||||||
EFI_STATUS CloseEventStatus;
|
EFI_STATUS CloseEventStatus;
|
||||||
CloseEventStatus = SystemTable->BootServices->CloseEvent (_mDriverExitBootServicesNotifyEvent);
|
CloseEventStatus = SystemTable->BootServices->CloseEvent (_mDriverExitBootServicesNotifyEvent);
|
||||||
ASSERT_EFI_ERROR (CloseEventStatus);
|
ASSERT_EFI_ERROR (CloseEventStatus);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ProcessLibraryDestructorList (ImageHandle, SystemTable);
|
ProcessLibraryDestructorList (ImageHandle, SystemTable);
|
||||||
}
|
}
|
||||||
|
@ -32,20 +32,12 @@ Abstract:
|
|||||||
// Library constructors
|
// Library constructors
|
||||||
//
|
//
|
||||||
VOID
|
VOID
|
||||||
|
EFIAPI
|
||||||
ProcessLibraryConstructorList (
|
ProcessLibraryConstructorList (
|
||||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||||
IN EFI_PEI_SERVICES **PeiServices
|
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:
|
// EdkII Glue Library Constructors:
|
||||||
// PeiServicesTablePointerLib PeiServicesTablePointerLibConstructor()
|
// PeiServicesTablePointerLib PeiServicesTablePointerLibConstructor()
|
||||||
@ -56,6 +48,8 @@ ProcessLibraryConstructorList (
|
|||||||
#if defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__) \
|
#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_KR1__) \
|
||||||
|| defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__)
|
|| defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__)
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Status = PeiServicesTablePointerLibConstructor (FfsHeader, PeiServices);
|
Status = PeiServicesTablePointerLibConstructor (FfsHeader, PeiServices);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,6 +56,7 @@ ProcessModuleUnloadList (
|
|||||||
// Library constructors
|
// Library constructors
|
||||||
//
|
//
|
||||||
VOID
|
VOID
|
||||||
|
EFIAPI
|
||||||
ProcessLibraryConstructorList (
|
ProcessLibraryConstructorList (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
@ -133,6 +134,7 @@ ProcessLibraryConstructorList (
|
|||||||
// Library destructors
|
// Library destructors
|
||||||
//
|
//
|
||||||
VOID
|
VOID
|
||||||
|
EFIAPI
|
||||||
ProcessLibraryDestructorList (
|
ProcessLibraryDestructorList (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2004 - 2006, Intel Corporation
|
Copyright (c) 2004 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -23,7 +23,11 @@ Abstract:
|
|||||||
#ifndef __EDKII_GLUE_DEFINITION_CHANGES_BASE_H__
|
#ifndef __EDKII_GLUE_DEFINITION_CHANGES_BASE_H__
|
||||||
#define __EDKII_GLUE_DEFINITION_CHANGES_BASE_H__
|
#define __EDKII_GLUE_DEFINITION_CHANGES_BASE_H__
|
||||||
|
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
|
#include "TianoHii.h"
|
||||||
|
#else
|
||||||
#include "EfiInternalFormRepresentation.h"
|
#include "EfiInternalFormRepresentation.h"
|
||||||
|
#endif
|
||||||
#include "EfiPxe.h"
|
#include "EfiPxe.h"
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +51,7 @@ Abstract:
|
|||||||
// ----------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------
|
||||||
// InternalFormRepresentation.h:
|
// InternalFormRepresentation.h:
|
||||||
// ----------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------
|
||||||
|
#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_IFR_OP_HEADER Header;
|
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
|
UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
|
||||||
@ -66,6 +70,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_IFR_OP_HEADER Header;
|
EFI_IFR_OP_HEADER Header;
|
||||||
} EFI_IFR_END_EXPR;
|
} EFI_IFR_END_EXPR;
|
||||||
|
#endif
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// define GUID as EFI_GUID
|
// define GUID as EFI_GUID
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2004 - 2006, Intel Corporation
|
Copyright (c) 2004 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -23,7 +23,11 @@ Abstract:
|
|||||||
#ifndef __EDKII_GLUE_DEFINITION_CHANGES_DXE_H__
|
#ifndef __EDKII_GLUE_DEFINITION_CHANGES_DXE_H__
|
||||||
#define __EDKII_GLUE_DEFINITION_CHANGES_DXE_H__
|
#define __EDKII_GLUE_DEFINITION_CHANGES_DXE_H__
|
||||||
|
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
|
#include "TianoHii.h"
|
||||||
|
#else
|
||||||
#include "EfiInternalFormRepresentation.h"
|
#include "EfiInternalFormRepresentation.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "EdkIIGlueDefinitionChangesBase.h"
|
#include "EdkIIGlueDefinitionChangesBase.h"
|
||||||
|
|
||||||
@ -59,8 +63,10 @@ typedef EFI_MISC_SMBIOS_STRUCT_ENCAPSULATION EFI_MISC_SMBIOS_STRUCT_ENCA
|
|||||||
// -------------------
|
// -------------------
|
||||||
#define gEfiAcpiSupportProtocolGuid gEfiAcpiSupportGuid
|
#define gEfiAcpiSupportProtocolGuid gEfiAcpiSupportGuid
|
||||||
#define gEfiLoadPeImageProtocolGuid gEfiLoadPeImageGuid
|
#define gEfiLoadPeImageProtocolGuid gEfiLoadPeImageGuid
|
||||||
|
#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
|
||||||
#define EFI_GLYPH_NON_SPACING GLYPH_NON_SPACING
|
#define EFI_GLYPH_NON_SPACING GLYPH_NON_SPACING
|
||||||
#define EFI_GLYPH_WIDE GLYPH_NON_BREAKING
|
#define EFI_GLYPH_WIDE GLYPH_NON_BREAKING
|
||||||
|
#endif
|
||||||
#define BOOT_OBJECT_AUTHORIZATION_PARMSET_GUID BOOT_OBJECT_AUTHORIZATION_PARMSET_GUIDVALUE
|
#define BOOT_OBJECT_AUTHORIZATION_PARMSET_GUID BOOT_OBJECT_AUTHORIZATION_PARMSET_GUIDVALUE
|
||||||
#define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID
|
#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_FILE_SYSTEM_VOLUME_LABEL_ID EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID_GUID
|
||||||
@ -78,7 +84,9 @@ typedef EFI_MISC_SMBIOS_STRUCT_ENCAPSULATION EFI_MISC_SMBIOS_STRUCT_ENCA
|
|||||||
//
|
//
|
||||||
typedef EFI_VOLUME_OPEN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME;
|
typedef EFI_VOLUME_OPEN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME;
|
||||||
typedef EFI_TEXT_OUTPUT_STRING EFI_TEXT_STRING;
|
typedef EFI_TEXT_OUTPUT_STRING EFI_TEXT_STRING;
|
||||||
|
#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
|
||||||
typedef SCREEN_DESCRIPTOR EFI_SCREEN_DESCRIPTOR;
|
typedef SCREEN_DESCRIPTOR EFI_SCREEN_DESCRIPTOR;
|
||||||
|
#endif
|
||||||
typedef EFI_SIMPLE_TEXT_IN_PROTOCOL EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
|
typedef EFI_SIMPLE_TEXT_IN_PROTOCOL EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
|
||||||
typedef EFI_SIMPLE_TEXT_OUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
|
typedef EFI_SIMPLE_TEXT_OUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
|
||||||
//typedef EFI_TO_LEGACY16_INIT_TABLE EFI_TO_COMPATIBILITY16_INIT_TABLE;
|
//typedef EFI_TO_LEGACY16_INIT_TABLE EFI_TO_COMPATIBILITY16_INIT_TABLE;
|
||||||
|
@ -23,9 +23,14 @@ Abstract:
|
|||||||
#ifndef __EDKII_GLUE_DEFINITION_CHANGES_PEIM_H__
|
#ifndef __EDKII_GLUE_DEFINITION_CHANGES_PEIM_H__
|
||||||
#define __EDKII_GLUE_DEFINITION_CHANGES_PEIM_H__
|
#define __EDKII_GLUE_DEFINITION_CHANGES_PEIM_H__
|
||||||
|
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
|
#include "TianoHii.h"
|
||||||
|
#else
|
||||||
#include "EfiInternalFormRepresentation.h"
|
#include "EfiInternalFormRepresentation.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "EdkIIGlueDefinitionChangesBase.h"
|
#include "EdkIIGlueDefinitionChangesBase.h"
|
||||||
|
|
||||||
#include "EfiPciCfg.h"
|
#include "EfiPciCfg.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -61,6 +61,45 @@ Abstract:
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// DxePerformanceLib
|
||||||
|
//
|
||||||
|
#ifdef __EDKII_GLUE_DXE_PERFORMANCE_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_DXE_MEMORY_ALLOCATION_LIB__
|
||||||
|
#define __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
|
||||||
|
#endif
|
||||||
|
#ifndef __EDKII_GLUE_DXE_HOB_LIB__
|
||||||
|
#define __EDKII_GLUE_DXE_HOB_LIB__
|
||||||
|
#endif
|
||||||
|
#ifndef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
|
||||||
|
#define __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
|
||||||
|
#endif
|
||||||
|
#ifndef __EDKII_GLUE_UEFI_LIB__
|
||||||
|
#define __EDKII_GLUE_UEFI_LIB__
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// PeiPerformanceLib
|
||||||
|
//
|
||||||
|
#ifdef __EDKII_GLUE_PEI_PERFORMANCE_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_PEI_SERVICES_LIB__
|
||||||
|
#define __EDKII_GLUE_PEI_SERVICES_LIB__
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// EdkDxeRuntimeDriverLib
|
// EdkDxeRuntimeDriverLib
|
||||||
//
|
//
|
||||||
@ -554,6 +593,14 @@ Abstract:
|
|||||||
//
|
//
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Whether _gDriverExitBootServicesEvent[] contains effective handler
|
||||||
|
//
|
||||||
|
#if defined(__EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__) || defined(__EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__)
|
||||||
|
#define __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__ 1
|
||||||
|
#else
|
||||||
|
#define __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__ 0
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check against multiple instances of same library class being used
|
// Check against multiple instances of same library class being used
|
||||||
@ -654,6 +701,7 @@ Abstract:
|
|||||||
|
|
||||||
#ifdef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
|
#ifdef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
UefiBootServicesTableLibConstructor (
|
UefiBootServicesTableLibConstructor (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
@ -671,6 +719,7 @@ IoLibConstructor (
|
|||||||
|
|
||||||
#ifdef __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
|
#ifdef __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
UefiRuntimeServicesTableLibConstructor (
|
UefiRuntimeServicesTableLibConstructor (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
@ -679,6 +728,7 @@ UefiRuntimeServicesTableLibConstructor (
|
|||||||
|
|
||||||
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
|
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
RuntimeDriverLibConstruct (
|
RuntimeDriverLibConstruct (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
@ -687,6 +737,7 @@ RuntimeDriverLibConstruct (
|
|||||||
|
|
||||||
#ifdef __EDKII_GLUE_DXE_HOB_LIB__
|
#ifdef __EDKII_GLUE_DXE_HOB_LIB__
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
HobLibConstructor (
|
HobLibConstructor (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
@ -695,6 +746,7 @@ HobLibConstructor (
|
|||||||
|
|
||||||
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
|
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
UefiDriverModelLibConstructor (
|
UefiDriverModelLibConstructor (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
@ -703,6 +755,7 @@ UefiDriverModelLibConstructor (
|
|||||||
|
|
||||||
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__
|
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
PeiServicesTablePointerLibConstructor (
|
PeiServicesTablePointerLibConstructor (
|
||||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||||
IN EFI_PEI_SERVICES **PeiServices
|
IN EFI_PEI_SERVICES **PeiServices
|
||||||
@ -711,6 +764,7 @@ PeiServicesTablePointerLibConstructor (
|
|||||||
|
|
||||||
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
|
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
PeiServicesTablePointerLibConstructor (
|
PeiServicesTablePointerLibConstructor (
|
||||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||||
IN EFI_PEI_SERVICES **PeiServices
|
IN EFI_PEI_SERVICES **PeiServices
|
||||||
@ -719,6 +773,7 @@ PeiServicesTablePointerLibConstructor (
|
|||||||
|
|
||||||
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
|
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
PeiServicesTablePointerLibConstructor (
|
PeiServicesTablePointerLibConstructor (
|
||||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||||
IN EFI_PEI_SERVICES **PeiServices
|
IN EFI_PEI_SERVICES **PeiServices
|
||||||
@ -736,6 +791,7 @@ SmbusLibConstructor (
|
|||||||
|
|
||||||
#ifdef __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__
|
#ifdef __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
DxeServicesTableLibConstructor (
|
DxeServicesTableLibConstructor (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
@ -760,6 +816,7 @@ DxeSalLibConstructor (
|
|||||||
//
|
//
|
||||||
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
|
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
UefiDriverModelLibDestructor (
|
UefiDriverModelLibDestructor (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
@ -768,6 +825,7 @@ UefiDriverModelLibDestructor (
|
|||||||
|
|
||||||
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
|
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
RuntimeDriverLibDeconstruct (
|
RuntimeDriverLibDeconstruct (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
|
@ -30,6 +30,10 @@ Abstract:
|
|||||||
#define BUILD_WITH_EDKII_GLUE_LIB
|
#define BUILD_WITH_EDKII_GLUE_LIB
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef BUILD_WITH_GLUELIB
|
||||||
|
#define BUILD_WITH_GLUELIB
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// General Type & API definitions
|
// General Type & API definitions
|
||||||
//
|
//
|
||||||
|
@ -31,10 +31,12 @@ Abstract:
|
|||||||
// 0x3000 - the 3rd release
|
// 0x3000 - the 3rd release
|
||||||
// 0x5000 - support IPF. Jan, 2007
|
// 0x5000 - support IPF. Jan, 2007
|
||||||
// 0x6000 - support EBC. Feb, 2007
|
// 0x6000 - support EBC. Feb, 2007
|
||||||
|
// 0x7000 - size reduction, Jun, 2007
|
||||||
|
// 0x7100 - backward compatibility supported, Jun, 2007
|
||||||
//
|
//
|
||||||
// For reference only, don't change the value
|
// For reference only, don't change the value
|
||||||
//
|
//
|
||||||
#define EDKII_GLUE_LIBRARY_VERSION 0x6000
|
#define EDKII_GLUE_LIBRARY_VERSION 0x7100
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -84,21 +86,19 @@ Abstract:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// debug print level
|
// debug print level
|
||||||
// only when EFI_DEBUG is defined, the mask is effective
|
|
||||||
//
|
//
|
||||||
#define EDKII_GLUE_DebugPrintErrorLevel EFI_D_ERROR
|
#define EDKII_GLUE_DebugPrintErrorLevel EFI_D_ERROR
|
||||||
|
|
||||||
//
|
//
|
||||||
// debug propery mask
|
// debug propery mask
|
||||||
// only when EFI_DEBUG is defined, the mask is effective
|
|
||||||
//
|
//
|
||||||
#define EDKII_GLUE_DebugPropertyMask ( DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED \
|
#define EDKII_GLUE_DebugPropertyMask ( DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED \
|
||||||
| DEBUG_PROPERTY_DEBUG_PRINT_ENABLED \
|
| DEBUG_PROPERTY_DEBUG_PRINT_ENABLED \
|
||||||
| DEBUG_PROPERTY_DEBUG_CODE_ENABLED \
|
| DEBUG_PROPERTY_DEBUG_CODE_ENABLED \
|
||||||
| DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED \
|
| DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED \
|
||||||
| DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED \
|
| DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED \
|
||||||
| DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED \
|
| DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED \
|
||||||
)
|
)
|
||||||
|
|
||||||
//
|
//
|
||||||
// clear memory value
|
// clear memory value
|
||||||
@ -115,23 +115,22 @@ Abstract:
|
|||||||
// This value is FSB Clock frequency. Its unit is Hz and its
|
// This value is FSB Clock frequency. Its unit is Hz and its
|
||||||
// default value is 200000000, that means FSB frequency is 200Mhz.
|
// default value is 200000000, that means FSB frequency is 200Mhz.
|
||||||
//
|
//
|
||||||
#define EDKII_GLUE_FSBClock 200000000
|
#define EDKII_GLUE_FSBClock 200000000
|
||||||
|
|
||||||
//
|
//
|
||||||
// post code property mask
|
// post code property mask
|
||||||
//
|
//
|
||||||
#define EDKII_GLUE_PostCodePropertyMask ( POST_CODE_PROPERTY_POST_CODE_ENABLED \
|
#define EDKII_GLUE_PostCodePropertyMask ( POST_CODE_PROPERTY_POST_CODE_ENABLED \
|
||||||
| POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED \
|
| POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED \
|
||||||
)
|
)
|
||||||
|
|
||||||
//
|
//
|
||||||
// status code property mask
|
// status code property mask
|
||||||
//
|
//
|
||||||
#define EDKII_GLUE_ReportStatusCodePropertyMask ( REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED \
|
#define EDKII_GLUE_ReportStatusCodePropertyMask ( REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED \
|
||||||
| REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED \
|
| REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED \
|
||||||
| REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED \
|
| REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// for IPF only
|
// for IPF only
|
||||||
|
@ -39,8 +39,13 @@ Abstract:
|
|||||||
#include "EfiFirmwareVolumeHeader.h"
|
#include "EfiFirmwareVolumeHeader.h"
|
||||||
#include "EfiFirmwareFileSystem.h"
|
#include "EfiFirmwareFileSystem.h"
|
||||||
#include "PeiHob.h"
|
#include "PeiHob.h"
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
|
#include "TianoHii.h"
|
||||||
|
#else
|
||||||
#include "EfiInternalFormRepresentation.h"
|
#include "EfiInternalFormRepresentation.h"
|
||||||
|
#endif
|
||||||
#include "EfiStatusCode.h"
|
#include "EfiStatusCode.h"
|
||||||
|
#include "EfiPerf.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// IPF only
|
// IPF only
|
||||||
@ -90,10 +95,20 @@ Abstract:
|
|||||||
// resolved when porting a module to real EDK II
|
// resolved when porting a module to real EDK II
|
||||||
//
|
//
|
||||||
#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
|
#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
|
||||||
|
#include EFI_GUID_DEFINITION (PeiPerformanceHob)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Protocol definitions
|
// Protocol definitions
|
||||||
//
|
//
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
|
||||||
|
#include EFI_PROTOCOL_DEFINITION (FormBrowser2)
|
||||||
|
#include EFI_PROTOCOL_DEFINITION (HiiConfigAccess)
|
||||||
|
#include EFI_PROTOCOL_DEFINITION (HiiConfigRouting)
|
||||||
|
#include EFI_PROTOCOL_DEFINITION (HiiDatabase)
|
||||||
|
#include EFI_PROTOCOL_DEFINITION (HiiFont)
|
||||||
|
#include EFI_PROTOCOL_DEFINITION (HiiImage)
|
||||||
|
#include EFI_PROTOCOL_DEFINITION (HiiString)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||||
#include EFI_PROTOCOL_DEFINITION (DevicePathFromText)
|
#include EFI_PROTOCOL_DEFINITION (DevicePathFromText)
|
||||||
@ -120,7 +135,9 @@ Abstract:
|
|||||||
#include EFI_PROTOCOL_DEFINITION (BootScriptSave)
|
#include EFI_PROTOCOL_DEFINITION (BootScriptSave)
|
||||||
#include EFI_PROTOCOL_DEFINITION (BusSpecificDriverOverride)
|
#include EFI_PROTOCOL_DEFINITION (BusSpecificDriverOverride)
|
||||||
#include EFI_PROTOCOL_DEFINITION (ComponentName)
|
#include EFI_PROTOCOL_DEFINITION (ComponentName)
|
||||||
|
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||||
#include EFI_PROTOCOL_DEFINITION (ComponentName2)
|
#include EFI_PROTOCOL_DEFINITION (ComponentName2)
|
||||||
|
#endif
|
||||||
#include EFI_PROTOCOL_DEFINITION (CpuIo)
|
#include EFI_PROTOCOL_DEFINITION (CpuIo)
|
||||||
#include EFI_PROTOCOL_DEFINITION (DataHub)
|
#include EFI_PROTOCOL_DEFINITION (DataHub)
|
||||||
#include EFI_PROTOCOL_DEFINITION (DebugPort)
|
#include EFI_PROTOCOL_DEFINITION (DebugPort)
|
||||||
@ -140,10 +157,14 @@ Abstract:
|
|||||||
#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
|
#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
|
||||||
#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeBlock)
|
#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeBlock)
|
||||||
#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeDispatch)
|
#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeDispatch)
|
||||||
|
#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
|
||||||
#include EFI_PROTOCOL_DEFINITION (FormBrowser)
|
#include EFI_PROTOCOL_DEFINITION (FormBrowser)
|
||||||
#include EFI_PROTOCOL_DEFINITION (FormCallback)
|
#include EFI_PROTOCOL_DEFINITION (FormCallback)
|
||||||
|
#endif
|
||||||
#include EFI_PROTOCOL_DEFINITION (GuidedSectionExtraction)
|
#include EFI_PROTOCOL_DEFINITION (GuidedSectionExtraction)
|
||||||
|
#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
|
||||||
#include EFI_PROTOCOL_DEFINITION (Hii)
|
#include EFI_PROTOCOL_DEFINITION (Hii)
|
||||||
|
#endif
|
||||||
#include EFI_PROTOCOL_DEFINITION (IdeControllerInit)
|
#include EFI_PROTOCOL_DEFINITION (IdeControllerInit)
|
||||||
#include EFI_PROTOCOL_DEFINITION (IncompatiblePciDeviceSupport)
|
#include EFI_PROTOCOL_DEFINITION (IncompatiblePciDeviceSupport)
|
||||||
#include EFI_PROTOCOL_DEFINITION (Legacy8259)
|
#include EFI_PROTOCOL_DEFINITION (Legacy8259)
|
||||||
|
@ -45,6 +45,7 @@ Abstract:
|
|||||||
#include "EfiCapsule.h"
|
#include "EfiCapsule.h"
|
||||||
#include EFI_PROTOCOL_DEFINITION (DevicePath)
|
#include EFI_PROTOCOL_DEFINITION (DevicePath)
|
||||||
#include "TianoDevicePath.h"
|
#include "TianoDevicePath.h"
|
||||||
|
#include "PeiPerf.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// GUID definitions
|
// GUID definitions
|
||||||
@ -58,6 +59,8 @@ Abstract:
|
|||||||
#include EFI_GUID_DEFINITION (FirmwareFileSystem)
|
#include EFI_GUID_DEFINITION (FirmwareFileSystem)
|
||||||
#include EFI_GUID_DEFINITION (SmramMemoryReserve)
|
#include EFI_GUID_DEFINITION (SmramMemoryReserve)
|
||||||
#include EFI_GUID_DEFINITION (DataHubRecords)
|
#include EFI_GUID_DEFINITION (DataHubRecords)
|
||||||
|
#include EFI_GUID_DEFINITION (PeiPerformanceHob)
|
||||||
|
|
||||||
//
|
//
|
||||||
// *** NOTE ***: StatusCodeDataTypeId definition differences need to be
|
// *** NOTE ***: StatusCodeDataTypeId definition differences need to be
|
||||||
// resolved when porting a module to real EDK II
|
// resolved when porting a module to real EDK II
|
||||||
|
@ -73,7 +73,9 @@ Abstract:
|
|||||||
#include EFI_PROTOCOL_DEFINITION(Bis)
|
#include EFI_PROTOCOL_DEFINITION(Bis)
|
||||||
#include EFI_PROTOCOL_DEFINITION(BusSpecificDriverOverride)
|
#include EFI_PROTOCOL_DEFINITION(BusSpecificDriverOverride)
|
||||||
#include EFI_PROTOCOL_DEFINITION(ComponentName)
|
#include EFI_PROTOCOL_DEFINITION(ComponentName)
|
||||||
#include EFI_PROTOCOL_DEFINITION(ComponentName2)
|
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
|
||||||
|
#include EFI_PROTOCOL_DEFINITION (ComponentName2)
|
||||||
|
#endif
|
||||||
#include EFI_PROTOCOL_DEFINITION(DebugPort)
|
#include EFI_PROTOCOL_DEFINITION(DebugPort)
|
||||||
#include EFI_PROTOCOL_DEFINITION(DebugSupport)
|
#include EFI_PROTOCOL_DEFINITION(DebugSupport)
|
||||||
#include EFI_PROTOCOL_DEFINITION(Decompress)
|
#include EFI_PROTOCOL_DEFINITION(Decompress)
|
||||||
|
@ -37,5 +37,32 @@ Abstract:
|
|||||||
#ifndef MDE_CPU_IPF
|
#ifndef MDE_CPU_IPF
|
||||||
#define MDE_CPU_IPF
|
#define MDE_CPU_IPF
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// IPF Specific Functions
|
||||||
|
//
|
||||||
|
typedef struct {
|
||||||
|
UINT64 Status;
|
||||||
|
UINT64 r9;
|
||||||
|
UINT64 r10;
|
||||||
|
UINT64 r11;
|
||||||
|
} PAL_CALL_RETURN;
|
||||||
|
|
||||||
|
|
||||||
|
#define EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO 0x4871260ec1a74056
|
||||||
|
#define EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI 0x116e5ba645e631a0
|
||||||
|
|
||||||
|
#define EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO 0x4d02efdb7e97a470
|
||||||
|
#define EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI 0x96a27bd29061ce8f
|
||||||
|
|
||||||
|
#define EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO 0x4370c6414ecb6c53
|
||||||
|
#define EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI 0x78836e490e3bb28c
|
||||||
|
|
||||||
|
#define EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_LO 0x408b75e8899afd18
|
||||||
|
#define EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_HI 0x54f4cd7e2e6e1aa4
|
||||||
|
|
||||||
|
#define EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_LO 0x46f58ce17d019990
|
||||||
|
#define EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_HI 0xa06a6798513c76a7
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -97,6 +97,19 @@ Abstract:
|
|||||||
#define EFI_D_EVENT DEBUG_EVENT
|
#define EFI_D_EVENT DEBUG_EVENT
|
||||||
#define EFI_D_ERROR DEBUG_ERROR
|
#define EFI_D_ERROR DEBUG_ERROR
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Use the following 4 macros to save size
|
||||||
|
//
|
||||||
|
#define DebugAssertEnabled() ((BOOLEAN)((__EDKII_GLUE_PCD_PcdDebugPropertyMask__ & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0))
|
||||||
|
|
||||||
|
#define DebugPrintEnabled() ((BOOLEAN)((__EDKII_GLUE_PCD_PcdDebugPropertyMask__ & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0))
|
||||||
|
|
||||||
|
#define DebugCodeEnabled() ((BOOLEAN)((__EDKII_GLUE_PCD_PcdDebugPropertyMask__ & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0))
|
||||||
|
|
||||||
|
#define DebugClearMemoryEnabled() ((BOOLEAN)((__EDKII_GLUE_PCD_PcdDebugPropertyMask__ & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Prints a debug message to the debug output device if the specified error level is enabled.
|
Prints a debug message to the debug output device if the specified error level is enabled.
|
||||||
@ -177,78 +190,6 @@ DebugClearMemory (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
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().
|
Internal worker macro that calls DebugAssert().
|
||||||
@ -259,8 +200,12 @@ DebugClearMemoryEnabled (
|
|||||||
@param Expression Boolean expression that evailated to FALSE
|
@param Expression Boolean expression that evailated to FALSE
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
#ifdef EFI_DEBUG
|
||||||
#define _ASSERT(Expression) DebugAssert (__FILE__, __LINE__, #Expression)
|
#define _ASSERT(Expression) DebugAssert (__FILE__, __LINE__, #Expression)
|
||||||
|
#else
|
||||||
|
#define _ASSERT(Expression)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -273,8 +218,12 @@ DebugClearMemoryEnabled (
|
|||||||
and a variable argument list based on the format string.
|
and a variable argument list based on the format string.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
#ifdef EFI_DEBUG
|
||||||
#define _DEBUG(Expression) DebugPrint Expression
|
#define _DEBUG(Expression) DebugPrint Expression
|
||||||
|
#else
|
||||||
|
#define _DEBUG(Expression)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -443,6 +392,7 @@ DebugClearMemoryEnabled (
|
|||||||
@param Guid Pointer to a protocol GUID.
|
@param Guid Pointer to a protocol GUID.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
#ifdef EFI_DEBUG
|
||||||
#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) \
|
#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) \
|
||||||
do { \
|
do { \
|
||||||
if (DebugAssertEnabled ()) { \
|
if (DebugAssertEnabled ()) { \
|
||||||
@ -459,6 +409,10 @@ DebugClearMemoryEnabled (
|
|||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} while (FALSE)
|
} while (FALSE)
|
||||||
|
#else
|
||||||
|
#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) \
|
||||||
|
do {} while(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -563,9 +517,15 @@ DebugClearMemoryEnabled (
|
|||||||
@param TestSignature The 32-bit signature value to match.
|
@param TestSignature The 32-bit signature value to match.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define CR(Record, TYPE, Field, TestSignature) \
|
#ifdef EFI_DEBUG
|
||||||
(DebugAssertEnabled () && (_CR (Record, TYPE, Field)->Signature != TestSignature)) ? \
|
#define CR(Record, TYPE, Field, TestSignature) \
|
||||||
(TYPE *) (_ASSERT (CR has Bad Signature), Record) : \
|
(DebugAssertEnabled () && (_CR (Record, TYPE, Field)->Signature != TestSignature)) ? \
|
||||||
_CR (Record, TYPE, Field)
|
(TYPE *) (_ASSERT (CR has Bad Signature), Record) : \
|
||||||
|
_CR (Record, TYPE, Field)
|
||||||
|
#else
|
||||||
|
#define CR(Record, TYPE, Field, TestSignature) \
|
||||||
|
_CR (Record, TYPE, Field)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -250,6 +250,7 @@ EfiGetNextHighMonotonicCount (
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
|
EFIAPI
|
||||||
EfiResetSystem (
|
EfiResetSystem (
|
||||||
IN EFI_RESET_TYPE ResetType,
|
IN EFI_RESET_TYPE ResetType,
|
||||||
IN EFI_STATUS ResetStatus,
|
IN EFI_STATUS ResetStatus,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*++
|
/*++
|
||||||
|
|
||||||
Copyright (c) 2004 - 2006, Intel Corporation
|
Copyright (c) 2004 - 2007, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -23,6 +23,7 @@ Abstract:
|
|||||||
#ifndef __EDKII_GLUE_HII_LIB_H__
|
#ifndef __EDKII_GLUE_HII_LIB_H__
|
||||||
#define __EDKII_GLUE_HII_LIB_H__
|
#define __EDKII_GLUE_HII_LIB_H__
|
||||||
|
|
||||||
|
#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
|
||||||
|
|
||||||
#define PreparePackages GluePreparePackages
|
#define PreparePackages GluePreparePackages
|
||||||
|
|
||||||
@ -49,6 +50,6 @@ GluePreparePackages (
|
|||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,7 +63,7 @@ COMPONENT_TYPE = LIBRARY
|
|||||||
|
|
||||||
[nmake.common]
|
[nmake.common]
|
||||||
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
||||||
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006
|
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
|
||||||
|
|
||||||
[nmake.ia32]
|
[nmake.ia32]
|
||||||
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
|
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
|
||||||
@ -76,6 +76,6 @@ COMPONENT_TYPE = LIBRARY
|
|||||||
|
|
||||||
[nmake.ebc]
|
[nmake.ebc]
|
||||||
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
||||||
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
|
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
|
||||||
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
|
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
|
||||||
|
|
@ -62,7 +62,7 @@ COMPONENT_TYPE = LIBRARY
|
|||||||
|
|
||||||
[nmake.common]
|
[nmake.common]
|
||||||
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
||||||
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006
|
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
|
||||||
|
|
||||||
[nmake.ia32]
|
[nmake.ia32]
|
||||||
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
|
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
|
||||||
@ -75,5 +75,5 @@ COMPONENT_TYPE = LIBRARY
|
|||||||
|
|
||||||
[nmake.ebc]
|
[nmake.ebc]
|
||||||
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
||||||
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
|
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
|
||||||
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
|
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
|
||||||
|
@ -108,86 +108,3 @@ DebugClearMemory (
|
|||||||
return Buffer;
|
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;
|
|
||||||
}
|
|
||||||
|
@ -68,7 +68,7 @@ COMPONENT_TYPE = LIBRARY
|
|||||||
|
|
||||||
[nmake.common]
|
[nmake.common]
|
||||||
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
||||||
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006
|
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
|
||||||
|
|
||||||
[nmake.ia32]
|
[nmake.ia32]
|
||||||
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
|
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
|
||||||
@ -81,5 +81,5 @@ COMPONENT_TYPE = LIBRARY
|
|||||||
|
|
||||||
[nmake.ebc]
|
[nmake.ebc]
|
||||||
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
||||||
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
|
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
|
||||||
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
|
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
|
||||||
|
@ -20,7 +20,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Shifts a 64-bit integer right between 0 and 63 bits. The high bits are filled
|
Shifts a 64-bit integer right between 0 and 63 bits. The high bits are filled
|
||||||
|
@ -26,7 +26,6 @@ COMPONENT_TYPE = LIBRARY
|
|||||||
[sources.common]
|
[sources.common]
|
||||||
String.c
|
String.c
|
||||||
LinkedList.c
|
LinkedList.c
|
||||||
Synchronization.c
|
|
||||||
Cpu.c
|
Cpu.c
|
||||||
CpuDeadLoop.c
|
CpuDeadLoop.c
|
||||||
BitField.c
|
BitField.c
|
||||||
@ -57,8 +56,10 @@ COMPONENT_TYPE = LIBRARY
|
|||||||
SwapBytes32.c
|
SwapBytes32.c
|
||||||
SwapBytes64.c
|
SwapBytes64.c
|
||||||
SwitchStack.c
|
SwitchStack.c
|
||||||
|
CheckSum.c
|
||||||
|
|
||||||
[sources.ia32]
|
[sources.ia32]
|
||||||
|
SynchronizationMsc.c
|
||||||
x86DisablePaging32.c
|
x86DisablePaging32.c
|
||||||
x86DisablePaging64.c
|
x86DisablePaging64.c
|
||||||
x86EnablePaging32.c
|
x86EnablePaging32.c
|
||||||
@ -74,107 +75,109 @@ COMPONENT_TYPE = LIBRARY
|
|||||||
x86WriteGdtr.c
|
x86WriteGdtr.c
|
||||||
x86WriteIdtr.c
|
x86WriteIdtr.c
|
||||||
Unaligned.c
|
Unaligned.c
|
||||||
Ia32\Non-existing.c
|
Ia32/Non-existing.c
|
||||||
Ia32\InternalSwitchStack.c
|
Ia32/InternalSwitchStack.c
|
||||||
Ia32\DivS64x64Remainder.c
|
Ia32/DivS64x64Remainder.c
|
||||||
Ia32\ARShiftU64.asm
|
Ia32/ARShiftU64.c
|
||||||
Ia32\CpuBreakpoint.asm
|
Ia32/CpuBreakpoint.c
|
||||||
Ia32\CpuFlushTlb.asm
|
Ia32/CpuFlushTlb.c
|
||||||
Ia32\CpuSleep.asm
|
Ia32/CpuSleep.c
|
||||||
Ia32\CpuId.asm
|
Ia32/CpuId.c
|
||||||
Ia32\CpuIdEx.asm
|
Ia32/CpuIdEx.c
|
||||||
Ia32\CpuPause.asm
|
Ia32/CpuPause.c
|
||||||
Ia32\DisableInterrupts.asm
|
Ia32/DisableInterrupts.c
|
||||||
Ia32\DisablePaging32.asm
|
Ia32/DisablePaging32.c
|
||||||
Ia32\DivU64x32.asm
|
Ia32/DivU64x32.c
|
||||||
Ia32\DivU64x32Remainder.asm
|
Ia32/DivU64x32Remainder.c
|
||||||
Ia32\DivU64x64Remainder.asm
|
Ia32/DivU64x64Remainder.c
|
||||||
Ia32\EnableDisableInterrupts.asm
|
Ia32/EnableDisableInterrupts.c
|
||||||
Ia32\EnableInterrupts.asm
|
Ia32/EnableInterrupts.c
|
||||||
Ia32\EnablePaging32.asm
|
Ia32/EnablePaging32.c
|
||||||
Ia32\EnablePaging64.asm
|
Ia32/EnablePaging64.asm
|
||||||
Ia32\FlushCacheLine.asm
|
Ia32/FlushCacheLine.c
|
||||||
Ia32\FxSave.asm
|
Ia32/FxSave.c
|
||||||
Ia32\FxRestore.asm
|
Ia32/FxRestore.c
|
||||||
Ia32\InterlockedIncrement.asm
|
Ia32/InterlockedIncrement.c
|
||||||
Ia32\InterlockedDecrement.asm
|
Ia32/InterlockedDecrement.c
|
||||||
Ia32\InterlockedCompareExchange32.asm
|
Ia32/InterlockedCompareExchange32.c
|
||||||
Ia32\InterlockedCompareExchange64.asm
|
Ia32/InterlockedCompareExchange64.c
|
||||||
Ia32\Invd.asm
|
Ia32/Invd.c
|
||||||
Ia32\LongJump.asm
|
Ia32/LongJump.c
|
||||||
Ia32\LRotU64.asm
|
Ia32/LRotU64.c
|
||||||
Ia32\LShiftU64.asm
|
Ia32/LShiftU64.c
|
||||||
Ia32\MultU64x32.asm
|
Ia32/MultU64x32.c
|
||||||
Ia32\MultU64x64.asm
|
Ia32/MultU64x64.c
|
||||||
Ia32\ModU64x32.asm
|
Ia32/ModU64x32.c
|
||||||
Ia32\Monitor.asm
|
Ia32/Monitor.c
|
||||||
Ia32\Mwait.asm
|
Ia32/Mwait.c
|
||||||
Ia32\ReadCr0.asm
|
Ia32/ReadCr0.c
|
||||||
Ia32\ReadCr2.asm
|
Ia32/ReadCr2.c
|
||||||
Ia32\ReadCr3.asm
|
Ia32/ReadCr3.c
|
||||||
Ia32\ReadCr4.asm
|
Ia32/ReadCr4.c
|
||||||
Ia32\ReadDr0.asm
|
Ia32/ReadDr0.c
|
||||||
Ia32\ReadDr1.asm
|
Ia32/ReadDr1.c
|
||||||
Ia32\ReadDr2.asm
|
Ia32/ReadDr2.c
|
||||||
Ia32\ReadDr3.asm
|
Ia32/ReadDr3.c
|
||||||
Ia32\ReadDr4.asm
|
Ia32/ReadDr4.c
|
||||||
Ia32\ReadDr5.asm
|
Ia32/ReadDr5.c
|
||||||
Ia32\ReadDr6.asm
|
Ia32/ReadDr6.c
|
||||||
Ia32\ReadDr7.asm
|
Ia32/ReadDr7.c
|
||||||
Ia32\ReadEflags.asm
|
Ia32/ReadEflags.c
|
||||||
Ia32\ReadMm0.asm
|
Ia32/ReadMm0.c
|
||||||
Ia32\ReadMm1.asm
|
Ia32/ReadMm1.c
|
||||||
Ia32\ReadMm2.asm
|
Ia32/ReadMm2.c
|
||||||
Ia32\ReadMm3.asm
|
Ia32/ReadMm3.c
|
||||||
Ia32\ReadMm4.asm
|
Ia32/ReadMm4.c
|
||||||
Ia32\ReadMm5.asm
|
Ia32/ReadMm5.c
|
||||||
Ia32\ReadMm6.asm
|
Ia32/ReadMm6.c
|
||||||
Ia32\ReadMm7.asm
|
Ia32/ReadMm7.c
|
||||||
Ia32\ReadMsr64.asm
|
Ia32/ReadMsr64.c
|
||||||
Ia32\ReadCs.asm
|
Ia32/ReadCs.c
|
||||||
Ia32\ReadDs.asm
|
Ia32/ReadDs.c
|
||||||
Ia32\ReadEs.asm
|
Ia32/ReadEs.c
|
||||||
Ia32\ReadFs.asm
|
Ia32/ReadFs.c
|
||||||
Ia32\ReadGs.asm
|
Ia32/ReadGs.c
|
||||||
Ia32\ReadSs.asm
|
Ia32/ReadSs.c
|
||||||
Ia32\ReadTr.asm
|
Ia32/ReadTr.c
|
||||||
Ia32\ReadGdtr.asm
|
Ia32/ReadGdtr.c
|
||||||
Ia32\ReadIdtr.asm
|
Ia32/ReadIdtr.c
|
||||||
Ia32\ReadLdtr.asm
|
Ia32/ReadLdtr.c
|
||||||
Ia32\ReadTsc.asm
|
Ia32/ReadTsc.c
|
||||||
Ia32\ReadPmc.asm
|
Ia32/ReadPmc.c
|
||||||
Ia32\RShiftU64.asm
|
Ia32/RShiftU64.c
|
||||||
Ia32\RRotU64.asm
|
Ia32/RRotU64.c
|
||||||
Ia32\SetJump.asm
|
Ia32/SetJump.c
|
||||||
Ia32\SwapBytes64.asm
|
Ia32/SwapBytes64.c
|
||||||
Ia32\Thunk16.asm
|
Ia32/Thunk16.asm
|
||||||
Ia32\WriteMsr64.asm
|
Ia32/WriteMsr64.c
|
||||||
Ia32\WriteCr0.asm
|
Ia32/WriteCr0.c
|
||||||
Ia32\WriteCr2.asm
|
Ia32/WriteCr2.c
|
||||||
Ia32\WriteCr3.asm
|
Ia32/WriteCr3.c
|
||||||
Ia32\WriteCr4.asm
|
Ia32/WriteCr4.c
|
||||||
Ia32\WriteDr0.asm
|
Ia32/WriteDr0.c
|
||||||
Ia32\WriteDr1.asm
|
Ia32/WriteDr1.c
|
||||||
Ia32\WriteDr2.asm
|
Ia32/WriteDr2.c
|
||||||
Ia32\WriteDr3.asm
|
Ia32/WriteDr3.c
|
||||||
Ia32\WriteDr4.asm
|
Ia32/WriteDr4.c
|
||||||
Ia32\WriteDr5.asm
|
Ia32/WriteDr5.c
|
||||||
Ia32\WriteDr6.asm
|
Ia32/WriteDr6.c
|
||||||
Ia32\WriteDr7.asm
|
Ia32/WriteDr7.c
|
||||||
Ia32\WriteGdtr.asm
|
Ia32/WriteGdtr.c
|
||||||
Ia32\WriteIdtr.asm
|
Ia32/WriteIdtr.c
|
||||||
Ia32\WriteLdtr.asm
|
Ia32/WriteLdtr.c
|
||||||
Ia32\WriteMm0.asm
|
Ia32/WriteMm0.c
|
||||||
Ia32\WriteMm1.asm
|
Ia32/WriteMm1.c
|
||||||
Ia32\WriteMm2.asm
|
Ia32/WriteMm2.c
|
||||||
Ia32\WriteMm3.asm
|
Ia32/WriteMm3.c
|
||||||
Ia32\WriteMm4.asm
|
Ia32/WriteMm4.c
|
||||||
Ia32\WriteMm5.asm
|
Ia32/WriteMm5.c
|
||||||
Ia32\WriteMm6.asm
|
Ia32/WriteMm6.c
|
||||||
Ia32\WriteMm7.asm
|
Ia32/WriteMm7.c
|
||||||
Ia32\Wbinvd.asm
|
Ia32/Wbinvd.c
|
||||||
|
|
||||||
|
|
||||||
[sources.x64]
|
[sources.x64]
|
||||||
|
SynchronizationMsc.c
|
||||||
x86DisablePaging32.c
|
x86DisablePaging32.c
|
||||||
x86DisablePaging64.c
|
x86DisablePaging64.c
|
||||||
x86EnablePaging32.c
|
x86EnablePaging32.c
|
||||||
@ -191,119 +194,130 @@ COMPONENT_TYPE = LIBRARY
|
|||||||
x86WriteIdtr.c
|
x86WriteIdtr.c
|
||||||
Unaligned.c
|
Unaligned.c
|
||||||
Math64.c
|
Math64.c
|
||||||
X64\Non-existing.c
|
X64/Non-existing.c
|
||||||
X64\SwitchStack.asm
|
X64/SwitchStack.asm
|
||||||
X64\SetJump.asm
|
X64/SetJump.asm
|
||||||
X64\LongJump.asm
|
X64/LongJump.asm
|
||||||
X64\CpuId.asm
|
X64/CpuId.asm
|
||||||
X64\CpuIdEx.asm
|
X64/CpuIdEx.asm
|
||||||
X64\ReadEflags.asm
|
X64/ReadEflags.asm
|
||||||
X64\ReadMsr64.asm
|
X64/ReadMsr64.c
|
||||||
X64\WriteMsr64.asm
|
X64/WriteMsr64.c
|
||||||
X64\ReadCr0.asm
|
X64/ReadCr0.asm
|
||||||
X64\ReadCr2.asm
|
X64/ReadCr2.asm
|
||||||
X64\ReadCr3.asm
|
X64/ReadCr3.asm
|
||||||
X64\ReadCr4.asm
|
X64/ReadCr4.asm
|
||||||
X64\WriteCr0.asm
|
X64/WriteCr0.asm
|
||||||
X64\WriteCr2.asm
|
X64/WriteCr2.asm
|
||||||
X64\WriteCr3.asm
|
X64/WriteCr3.asm
|
||||||
X64\WriteCr4.asm
|
X64/WriteCr4.asm
|
||||||
X64\ReadDr0.asm
|
X64/ReadDr0.asm
|
||||||
X64\ReadDr1.asm
|
X64/ReadDr1.asm
|
||||||
X64\ReadDr2.asm
|
X64/ReadDr2.asm
|
||||||
X64\ReadDr3.asm
|
X64/ReadDr3.asm
|
||||||
X64\ReadDr4.asm
|
X64/ReadDr4.asm
|
||||||
X64\ReadDr5.asm
|
X64/ReadDr5.asm
|
||||||
X64\ReadDr6.asm
|
X64/ReadDr6.asm
|
||||||
X64\ReadDr7.asm
|
X64/ReadDr7.asm
|
||||||
X64\WriteDr0.asm
|
X64/WriteDr0.asm
|
||||||
X64\WriteDr1.asm
|
X64/WriteDr1.asm
|
||||||
X64\WriteDr2.asm
|
X64/WriteDr2.asm
|
||||||
X64\WriteDr3.asm
|
X64/WriteDr3.asm
|
||||||
X64\WriteDr4.asm
|
X64/WriteDr4.asm
|
||||||
X64\WriteDr5.asm
|
X64/WriteDr5.asm
|
||||||
X64\WriteDr6.asm
|
X64/WriteDr6.asm
|
||||||
X64\WriteDr7.asm
|
X64/WriteDr7.asm
|
||||||
X64\ReadCs.asm
|
X64/ReadCs.asm
|
||||||
X64\ReadDs.asm
|
X64/ReadDs.asm
|
||||||
X64\ReadEs.asm
|
X64/ReadEs.asm
|
||||||
X64\ReadFs.asm
|
X64/ReadFs.asm
|
||||||
X64\ReadGs.asm
|
X64/ReadGs.asm
|
||||||
X64\ReadSs.asm
|
X64/ReadSs.asm
|
||||||
X64\ReadTr.asm
|
X64/ReadTr.asm
|
||||||
X64\ReadGdtr.asm
|
X64/ReadGdtr.asm
|
||||||
X64\WriteGdtr.asm
|
X64/WriteGdtr.asm
|
||||||
X64\ReadIdtr.asm
|
X64/ReadIdtr.asm
|
||||||
X64\WriteIdtr.asm
|
X64/WriteIdtr.asm
|
||||||
X64\ReadLdtr.asm
|
X64/ReadLdtr.asm
|
||||||
X64\WriteLdtr.asm
|
X64/WriteLdtr.asm
|
||||||
X64\FxSave.asm
|
X64/FxSave.asm
|
||||||
X64\FxRestore.asm
|
X64/FxRestore.asm
|
||||||
X64\ReadMm0.asm
|
X64/ReadMm0.asm
|
||||||
X64\ReadMm1.asm
|
X64/ReadMm1.asm
|
||||||
X64\ReadMm2.asm
|
X64/ReadMm2.asm
|
||||||
X64\ReadMm3.asm
|
X64/ReadMm3.asm
|
||||||
X64\ReadMm4.asm
|
X64/ReadMm4.asm
|
||||||
X64\ReadMm5.asm
|
X64/ReadMm5.asm
|
||||||
X64\ReadMm6.asm
|
X64/ReadMm6.asm
|
||||||
X64\ReadMm7.asm
|
X64/ReadMm7.asm
|
||||||
X64\WriteMm0.asm
|
X64/WriteMm0.asm
|
||||||
X64\WriteMm1.asm
|
X64/WriteMm1.asm
|
||||||
X64\WriteMm2.asm
|
X64/WriteMm2.asm
|
||||||
X64\WriteMm3.asm
|
X64/WriteMm3.asm
|
||||||
X64\WriteMm4.asm
|
X64/WriteMm4.asm
|
||||||
X64\WriteMm5.asm
|
X64/WriteMm5.asm
|
||||||
X64\WriteMm6.asm
|
X64/WriteMm6.asm
|
||||||
X64\WriteMm7.asm
|
X64/WriteMm7.asm
|
||||||
X64\ReadTsc.asm
|
X64/ReadTsc.asm
|
||||||
X64\ReadPmc.asm
|
X64/ReadPmc.asm
|
||||||
X64\Monitor.asm
|
X64/Monitor.asm
|
||||||
X64\Mwait.asm
|
X64/Mwait.asm
|
||||||
X64\EnablePaging64.asm
|
X64/EnablePaging64.asm
|
||||||
X64\DisablePaging64.asm
|
X64/DisablePaging64.asm
|
||||||
X64\Wbinvd.asm
|
X64/Wbinvd.asm
|
||||||
X64\Invd.asm
|
X64/Invd.asm
|
||||||
X64\FlushCacheLine.asm
|
X64/FlushCacheLine.asm
|
||||||
X64\InterlockedIncrement.asm
|
X64/InterlockedIncrement.c
|
||||||
X64\InterlockedDecrement.asm
|
X64/InterlockedDecrement.c
|
||||||
X64\InterlockedCompareExchange32.asm
|
X64/InterlockedCompareExchange32.asm
|
||||||
X64\InterlockedCompareExchange64.asm
|
X64/InterlockedCompareExchange64.asm
|
||||||
X64\EnableInterrupts.asm
|
X64/EnableInterrupts.asm
|
||||||
X64\DisableInterrupts.asm
|
X64/DisableInterrupts.asm
|
||||||
X64\EnableDisableInterrupts.asm
|
X64/EnableDisableInterrupts.asm
|
||||||
X64\CpuSleep.asm
|
X64/CpuSleep.asm
|
||||||
X64\CpuPause.asm
|
X64/CpuPause.asm
|
||||||
X64\CpuBreakpoint.asm
|
X64/CpuBreakpoint.c
|
||||||
X64\CpuFlushTlb.asm
|
X64/CpuFlushTlb.asm
|
||||||
X64\Thunk16.asm
|
X64/Thunk16.asm
|
||||||
|
|
||||||
[sources.ipf]
|
[sources.ipf]
|
||||||
|
SynchronizationMsc.c
|
||||||
Math64.c
|
Math64.c
|
||||||
Ipf\asm.h
|
Ipf/asm.h
|
||||||
Ipf\ia_64gen.h
|
Ipf/ia_64gen.h
|
||||||
Ipf\PalCallStatic.s
|
Ipf/PalCallStatic.s
|
||||||
Ipf\setjmp.s
|
Ipf/setjmp.s
|
||||||
Ipf\longjmp.s
|
Ipf/longjmp.s
|
||||||
Ipf\SwitchStack.s
|
Ipf/SwitchStack.s
|
||||||
Ipf\Unaligned.c
|
Ipf/Unaligned.c
|
||||||
Ipf\CpuBreakpoint.c
|
Ipf/CpuBreakpoint.c
|
||||||
Ipf\InterlockedCompareExchange32.s
|
Ipf/InterlockedCompareExchange32.s
|
||||||
Ipf\InterlockedCompareExchange64.s
|
Ipf/InterlockedCompareExchange64.s
|
||||||
Ipf\Synchronization.c
|
Ipf/Synchronization.c
|
||||||
Ipf\CpuPause.s
|
Ipf/CpuPause.s
|
||||||
Ipf\CpuFlushTlb.s
|
Ipf/CpuFlushTlb.s
|
||||||
Ipf\GetInterruptState.s
|
Ipf/GetInterruptState.s
|
||||||
Ipf\Non-existing.c
|
Ipf/InternalSwitchStack.c
|
||||||
Ipf\FlushCacheRange.s
|
Ipf/FlushCacheRange.s
|
||||||
Ipf\ReadItc.s
|
Ipf/AccessDbr.s
|
||||||
|
Ipf/AccessEicr.s
|
||||||
|
Ipf/AccessGcr.s
|
||||||
|
Ipf/AccessKr.s
|
||||||
|
Ipf/AccessPmr.s
|
||||||
|
Ipf/AccessPsr.s
|
||||||
|
Ipf/AsmPalCall.s
|
||||||
|
Ipf/ExecFc.s
|
||||||
|
Ipf/ReadCpuid.s
|
||||||
|
Ipf/AccessGp.s
|
||||||
|
|
||||||
[sources.ebc]
|
[sources.ebc]
|
||||||
Math64.c
|
Math64.c
|
||||||
Unaligned.c
|
Unaligned.c
|
||||||
Ebc\SwitchStack.c
|
Ebc/SwitchStack.c
|
||||||
Ebc\SetJumpLongJump.c
|
Ebc/SetJumpLongJump.c
|
||||||
Ebc\CpuBreakpoint.c
|
Ebc/CpuBreakpoint.c
|
||||||
Ebc\Synchronization.c
|
Ebc/Synchronization.c
|
||||||
|
Synchronization.c
|
||||||
|
|
||||||
[includes.common]
|
[includes.common]
|
||||||
.
|
.
|
||||||
@ -343,7 +357,7 @@ COMPONENT_TYPE = LIBRARY
|
|||||||
|
|
||||||
[nmake.common]
|
[nmake.common]
|
||||||
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
||||||
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006
|
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
|
||||||
|
|
||||||
[nmake.ia32]
|
[nmake.ia32]
|
||||||
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
|
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
|
||||||
@ -356,6 +370,6 @@ COMPONENT_TYPE = LIBRARY
|
|||||||
|
|
||||||
[nmake.ebc]
|
[nmake.ebc]
|
||||||
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
|
||||||
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
|
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
|
||||||
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
|
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
|
||||||
|
|
@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
Module Name:
|
Module Name:
|
||||||
|
|
||||||
BaseLibInternal.h
|
BaseLibInternals.h
|
||||||
|
|
||||||
Abstract:
|
Abstract:
|
||||||
|
|
||||||
@ -20,8 +20,8 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#ifndef __BASE_LIB_INTERNAL_H__
|
#ifndef __BASE_LIB_INTERNALS_H__
|
||||||
#define __BASE_LIB_INTERNAL_H__
|
#define __BASE_LIB_INTERNALS_H__
|
||||||
|
|
||||||
#include "EdkIIGlueBase.h"
|
#include "EdkIIGlueBase.h"
|
||||||
|
|
||||||
@ -322,10 +322,16 @@ InternalMathDivRemS64x64 (
|
|||||||
/**
|
/**
|
||||||
Transfers control to a function starting with a new stack.
|
Transfers control to a function starting with a new stack.
|
||||||
|
|
||||||
Transfers control to the function specified by EntryPoint using the new stack
|
Transfers control to the function specified by EntryPoint using the
|
||||||
specified by NewStack and passing in the parameters specified by Context1 and
|
new stack specified by NewStack and passing in the parameters specified
|
||||||
Context2. Context1 and Context2 are optional and may be NULL. The function
|
by Context1 and Context2. Context1 and Context2 are optional and may
|
||||||
EntryPoint must never return.
|
be NULL. The function EntryPoint must never return.
|
||||||
|
Marker will be ignored on IA-32, x64, and EBC.
|
||||||
|
IPF CPUs expect one additional parameter of type VOID * that specifies
|
||||||
|
the new backing store pointer.
|
||||||
|
|
||||||
|
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 EntryPoint A pointer to function to call with the new stack.
|
||||||
@param Context1 A pointer to the context to pass into the EntryPoint
|
@param Context1 A pointer to the context to pass into the EntryPoint
|
||||||
@ -334,20 +340,250 @@ InternalMathDivRemS64x64 (
|
|||||||
function.
|
function.
|
||||||
@param NewStack A pointer to the new stack to use for the EntryPoint
|
@param NewStack A pointer to the new stack to use for the EntryPoint
|
||||||
function.
|
function.
|
||||||
|
@param Marker VA_LIST marker for the variable argument list.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSwitchStack (
|
InternalSwitchStack (
|
||||||
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
IN VOID *Context1,
|
IN VOID *Context1, OPTIONAL
|
||||||
IN VOID *Context2,
|
IN VOID *Context2, OPTIONAL
|
||||||
IN VOID *NewStack
|
IN VOID *NewStack,
|
||||||
|
IN VA_LIST Marker
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
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
|
||||||
|
EFIAPI
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ia32 and x64 specific functions
|
// Ia32 and x64 specific functions
|
||||||
//
|
//
|
||||||
|
#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads the current Global Descriptor Table Register(GDTR) descriptor.
|
Reads the current Global Descriptor Table Register(GDTR) descriptor.
|
||||||
@ -595,219 +831,46 @@ InternalX86DisablePaging64 (
|
|||||||
IN UINT32 NewStack
|
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,
|
#elif defined (MDE_CPU_IPF)
|
||||||
verifies the validity of this list.
|
//
|
||||||
|
//
|
||||||
If List is NULL, then ASSERT().
|
// IPF specific functions
|
||||||
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.
|
Transfers control to a function starting with a new stack.
|
||||||
|
|
||||||
Performs an atomic increment of the 32-bit unsigned integer specified by
|
Transfers control to the function specified by EntryPoint using the new stack
|
||||||
Value and returns the incremented value. The increment operation must be
|
specified by NewStack and passing in the parameters specified by Context1 and
|
||||||
performed using MP safe mechanisms. The state of the return value is not
|
Context2. Context1 and Context2 are optional and may be NULL. The function
|
||||||
guaranteed to be MP safe.
|
EntryPoint must never return.
|
||||||
|
|
||||||
@param Value A pointer to the 32-bit value to increment.
|
If EntryPoint is NULL, then ASSERT().
|
||||||
|
If NewStack is NULL, then ASSERT().
|
||||||
|
|
||||||
@return The incremented value.
|
@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.
|
||||||
UINT32
|
@param Context2 A pointer to the context to pass into the EntryPoint
|
||||||
EFIAPI
|
function.
|
||||||
InternalSyncIncrement (
|
@param NewStack A pointer to the new stack to use for the EntryPoint
|
||||||
IN volatile UINT32 *Value
|
function.
|
||||||
);
|
@param NewBsp A pointer to the new memory location for RSE backing
|
||||||
|
store.
|
||||||
/**
|
|
||||||
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
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalLongJump (
|
AsmSwitchStackAndBackingStore (
|
||||||
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
|
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
IN UINTN Value
|
IN VOID *Context1, OPTIONAL
|
||||||
|
IN VOID *Context2, OPTIONAL
|
||||||
|
IN VOID *NewStack,
|
||||||
|
IN VOID *NewBsp
|
||||||
);
|
);
|
||||||
|
#else
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -20,7 +20,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Worker function that returns a bit field from Operand
|
Worker function that returns a bit field from Operand
|
||||||
|
@ -0,0 +1,336 @@
|
|||||||
|
/**
|
||||||
|
Utility functions to generate checksum based on 2's complement
|
||||||
|
algorithm.
|
||||||
|
|
||||||
|
Copyright (c) 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
Module Name: CheckSum.c
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Calculate the sum of all elements in a buffer in unit of UINT8.
|
||||||
|
During calculation, the carry bits are dropped.
|
||||||
|
|
||||||
|
This function calculates the sum of all elements in a buffer
|
||||||
|
in unit of UINT8. The carry bits in result of addition are dropped.
|
||||||
|
The result is returned as UINT8. If Length is Zero, then Zero is
|
||||||
|
returned.
|
||||||
|
|
||||||
|
If Buffer is NULL, then ASSERT().
|
||||||
|
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
|
||||||
|
|
||||||
|
@param Buffer Pointer to the buffer to carry out the sum operation.
|
||||||
|
@param Length The size, in bytes, of Buffer .
|
||||||
|
|
||||||
|
@return Sum The sum of Buffer with carry bits dropped during additions.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT8
|
||||||
|
EFIAPI
|
||||||
|
CalculateSum8 (
|
||||||
|
IN CONST UINT8 *Buffer,
|
||||||
|
IN UINTN Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT8 Sum;
|
||||||
|
UINTN Count;
|
||||||
|
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
|
||||||
|
|
||||||
|
for (Sum = 0, Count = 0; Count < Length; Count++) {
|
||||||
|
Sum = (UINT8) (Sum + *(Buffer + Count));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the two's complement checksum of all elements in a buffer
|
||||||
|
of 8-bit values.
|
||||||
|
|
||||||
|
This function first calculates the sum of the 8-bit values in the
|
||||||
|
buffer specified by Buffer and Length. The carry bits in the result
|
||||||
|
of addition are dropped. Then, the two's complement of the sum is
|
||||||
|
returned. If Length is 0, then 0 is returned.
|
||||||
|
|
||||||
|
If Buffer is NULL, then ASSERT().
|
||||||
|
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
|
||||||
|
|
||||||
|
|
||||||
|
@param Buffer Pointer to the buffer to carry out the checksum operation.
|
||||||
|
@param Length The size, in bytes, of Buffer.
|
||||||
|
|
||||||
|
@return Checksum The 2's complement checksum of Buffer.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT8
|
||||||
|
EFIAPI
|
||||||
|
CalculateCheckSum8 (
|
||||||
|
IN CONST UINT8 *Buffer,
|
||||||
|
IN UINTN Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT8 CheckSum;
|
||||||
|
|
||||||
|
CheckSum = CalculateSum8 (Buffer, Length);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the checksum based on 2's complement.
|
||||||
|
//
|
||||||
|
return (UINT8) (0x100 - CheckSum);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the sum of all elements in a buffer of 16-bit values. During
|
||||||
|
calculation, the carry bits are dropped.
|
||||||
|
|
||||||
|
This function calculates the sum of the 16-bit values in the buffer
|
||||||
|
specified by Buffer and Length. The carry bits in result of addition are dropped.
|
||||||
|
The 16-bit result is returned. If Length is 0, then 0 is returned.
|
||||||
|
|
||||||
|
If 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 buffer to carry out the sum operation.
|
||||||
|
@param Length The size, in bytes, of Buffer.
|
||||||
|
|
||||||
|
@return Sum The sum of Buffer with carry bits dropped during additions.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT16
|
||||||
|
EFIAPI
|
||||||
|
CalculateSum16 (
|
||||||
|
IN CONST UINT16 *Buffer,
|
||||||
|
IN UINTN Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT16 Sum;
|
||||||
|
UINTN Count;
|
||||||
|
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
ASSERT (((UINTN) Buffer & 0x1) == 0);
|
||||||
|
ASSERT ((Length & 0x1) == 0);
|
||||||
|
ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
|
||||||
|
|
||||||
|
|
||||||
|
for (Sum = 0, Count = 0; Count < Length; Count++) {
|
||||||
|
Sum = (UINT16) (Sum + *(Buffer + Count));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the two's complement checksum of all elements in a buffer of
|
||||||
|
16-bit values.
|
||||||
|
|
||||||
|
This function first calculates the sum of the 16-bit values in the buffer
|
||||||
|
specified by Buffer and Length. The carry bits in the result of addition
|
||||||
|
are dropped. Then, the two's complement of the sum is returned. If Length
|
||||||
|
is 0, then 0 is returned.
|
||||||
|
|
||||||
|
If 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 buffer to carry out the checksum operation.
|
||||||
|
@param Length The size, in bytes, of Buffer.
|
||||||
|
|
||||||
|
@return Checksum The 2's complement checksum of Buffer.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT16
|
||||||
|
EFIAPI
|
||||||
|
CalculateCheckSum16 (
|
||||||
|
IN CONST UINT16 *Buffer,
|
||||||
|
IN UINTN Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT16 CheckSum;
|
||||||
|
|
||||||
|
CheckSum = CalculateSum16 (Buffer, Length);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the checksum based on 2's complement.
|
||||||
|
//
|
||||||
|
return (UINT16) (0x10000 - CheckSum);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the sum of all elements in a buffer of 32-bit values. During
|
||||||
|
calculation, the carry bits are dropped.
|
||||||
|
|
||||||
|
This function calculates the sum of the 32-bit values in the buffer
|
||||||
|
specified by Buffer and Length. The carry bits in result of addition are dropped.
|
||||||
|
The 32-bit result is returned. If Length is 0, then 0 is returned.
|
||||||
|
|
||||||
|
If 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 buffer to carry out the sum operation.
|
||||||
|
@param Length The size, in bytes, of Buffer.
|
||||||
|
|
||||||
|
@return Sum The sum of Buffer with carry bits dropped during additions.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT32
|
||||||
|
EFIAPI
|
||||||
|
CalculateSum32 (
|
||||||
|
IN CONST UINT32 *Buffer,
|
||||||
|
IN UINTN Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT32 Sum;
|
||||||
|
UINTN Count;
|
||||||
|
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
ASSERT (((UINTN) Buffer & 0x3) == 0);
|
||||||
|
ASSERT ((Length & 0x3) == 0);
|
||||||
|
ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
|
||||||
|
|
||||||
|
|
||||||
|
for (Sum = 0, Count = 0; Count < Length; Count++) {
|
||||||
|
Sum = Sum + *(Buffer + Count);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the two's complement checksum of all elements in a buffer of
|
||||||
|
32-bit values.
|
||||||
|
|
||||||
|
This function first calculates the sum of the 32-bit values in the buffer
|
||||||
|
specified by Buffer and Length. The carry bits in the result of addition
|
||||||
|
are dropped. Then, the two's complement of the sum is returned. If Length
|
||||||
|
is 0, then 0 is returned.
|
||||||
|
|
||||||
|
If 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 buffer to carry out the checksum operation.
|
||||||
|
@param Length The size, in bytes, of Buffer.
|
||||||
|
|
||||||
|
@return Checksum The 2's complement checksum of Buffer.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT32
|
||||||
|
EFIAPI
|
||||||
|
CalculateCheckSum32 (
|
||||||
|
IN CONST UINT32 *Buffer,
|
||||||
|
IN UINTN Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT32 CheckSum;
|
||||||
|
|
||||||
|
CheckSum = CalculateSum32 (Buffer, Length);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the checksum based on 2's complement.
|
||||||
|
//
|
||||||
|
return (UINT32) ((UINT32)(-1) - CheckSum + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the sum of all elements in a buffer of 64-bit values. During
|
||||||
|
calculation, the carry bits are dropped.
|
||||||
|
|
||||||
|
This function calculates the sum of the 64-bit values in the buffer
|
||||||
|
specified by Buffer and Length. The carry bits in result of addition are dropped.
|
||||||
|
The 64-bit result is returned. If Length is 0, then 0 is returned.
|
||||||
|
|
||||||
|
If 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 buffer to carry out the sum operation.
|
||||||
|
@param Length The size, in bytes, of Buffer.
|
||||||
|
|
||||||
|
@return Sum The sum of Buffer with carry bits dropped during additions.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT64
|
||||||
|
EFIAPI
|
||||||
|
CalculateSum64 (
|
||||||
|
IN CONST UINT64 *Buffer,
|
||||||
|
IN UINTN Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT64 Sum;
|
||||||
|
UINTN Count;
|
||||||
|
|
||||||
|
ASSERT (Buffer != NULL);
|
||||||
|
ASSERT (((UINTN) Buffer & 0x7) == 0);
|
||||||
|
ASSERT ((Length & 0x7) == 0);
|
||||||
|
ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
|
||||||
|
|
||||||
|
for (Sum = 0, Count = 0; Count < Length; Count++) {
|
||||||
|
Sum = Sum + *(Buffer + Count);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the two's complement checksum of all elements in a buffer of
|
||||||
|
64-bit values.
|
||||||
|
|
||||||
|
This function first calculates the sum of the 64-bit values in the buffer
|
||||||
|
specified by Buffer and Length. The carry bits in the result of addition
|
||||||
|
are dropped. Then, the two's complement of the sum is returned. If Length
|
||||||
|
is 0, then 0 is returned.
|
||||||
|
|
||||||
|
If 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 buffer to carry out the checksum operation.
|
||||||
|
@param Length The size, in bytes, of Buffer.
|
||||||
|
|
||||||
|
@return Checksum The 2's complement checksum of Buffer.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT64
|
||||||
|
EFIAPI
|
||||||
|
CalculateCheckSum64 (
|
||||||
|
IN CONST UINT64 *Buffer,
|
||||||
|
IN UINTN Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT64 CheckSum;
|
||||||
|
|
||||||
|
CheckSum = CalculateSum64 (Buffer, Length);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return the checksum based on 2's complement.
|
||||||
|
//
|
||||||
|
return (UINT64) ((UINT64)(-1) - CheckSum + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Disables CPU interrupts and returns the interrupt state prior to the disable
|
Disables CPU interrupts and returns the interrupt state prior to the disable
|
||||||
|
@ -19,7 +19,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Executes an infinite loop.
|
Executes an infinite loop.
|
||||||
|
@ -20,7 +20,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Divides a 64-bit signed integer by a 64-bit signed integer and generates a
|
Divides a 64-bit signed integer by a 64-bit signed integer and generates a
|
||||||
|
@ -20,7 +20,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
|
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
|
||||||
|
@ -20,7 +20,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
|
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
|
||||||
|
@ -19,7 +19,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Divides a 64-bit unsigned integer by a 64-bit unsigned integer and generates
|
Divides a 64-bit unsigned integer by a 64-bit unsigned integer and generates
|
||||||
|
@ -19,7 +19,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "..\BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
extern
|
extern
|
||||||
UINT64
|
UINT64
|
||||||
|
@ -19,7 +19,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "..\BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Worker function that checks ASSERT condition for JumpBuffer
|
Worker function that checks ASSERT condition for JumpBuffer
|
||||||
@ -33,6 +33,7 @@ Abstract:
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
|
EFIAPI
|
||||||
InternalAssertJumpBuffer (
|
InternalAssertJumpBuffer (
|
||||||
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
|
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
|
||||||
);
|
);
|
||||||
|
@ -19,15 +19,18 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "..\BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Transfers control to a function starting with a new stack.
|
Transfers control to a function starting with a new stack.
|
||||||
|
|
||||||
Transfers control to the function specified by EntryPoint using the 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
|
specified by NewStack and passing in the parameters specified by Context1 and
|
||||||
Context2. Context1 and Context2 are optional and may be NULL. The function
|
by Context1 and Context2. Context1 and Context2 are optional and may
|
||||||
EntryPoint must never return.
|
be NULL. The function EntryPoint must never return.
|
||||||
|
Marker will be ignored on IA-32, x64, and EBC.
|
||||||
|
IPF CPUs expect one additional parameter of type VOID * that specifies
|
||||||
|
the new backing store pointer.
|
||||||
|
|
||||||
If EntryPoint is NULL, then ASSERT().
|
If EntryPoint is NULL, then ASSERT().
|
||||||
If NewStack is NULL, then ASSERT().
|
If NewStack is NULL, then ASSERT().
|
||||||
@ -39,21 +42,30 @@ Abstract:
|
|||||||
function.
|
function.
|
||||||
@param NewStack A pointer to the new stack to use for the EntryPoint
|
@param NewStack A pointer to the new stack to use for the EntryPoint
|
||||||
function.
|
function.
|
||||||
|
@param Marker VA_LIST marker for the variable argument list.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSwitchStack (
|
InternalSwitchStack (
|
||||||
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
IN VOID *Context1, OPTIONAL
|
IN VOID *Context1, OPTIONAL
|
||||||
IN VOID *Context2, OPTIONAL
|
IN VOID *Context2, OPTIONAL
|
||||||
IN VOID *NewStack
|
IN VOID *NewStack,
|
||||||
|
IN VA_LIST Marker
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// This version of this function does not actually change the stack pointer
|
// 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
|
// This is to support compilation of CPU types that do not support assemblers
|
||||||
// such as EBC
|
// such as EBC
|
||||||
//
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Stack should be aligned with CPU_STACK_ALIGNMENT
|
||||||
|
//
|
||||||
|
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
|
||||||
|
|
||||||
EntryPoint (Context1, Context2);
|
EntryPoint (Context1, Context2);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "..\BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@ -19,7 +19,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the value of the highest bit set in a 32-bit value. Equivalent to
|
Returns the value of the highest bit set in a 32-bit value. Equivalent to
|
||||||
|
@ -20,7 +20,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the value of the highest bit set in a 64-bit value. Equivalent to
|
Returns the value of the highest bit set in a 64-bit value. Equivalent to
|
||||||
|
@ -20,7 +20,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the bit position of the highest bit set in a 32-bit value. Equivalent
|
Returns the bit position of the highest bit set in a 32-bit value. Equivalent
|
||||||
|
@ -20,7 +20,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the bit position of the highest bit set in a 64-bit value. Equivalent
|
Returns the bit position of the highest bit set in a 64-bit value. Equivalent
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
; 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
|
|
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
64-bit arithmetic right shift function for IA-32.
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
|
UINT64
|
||||||
|
EFIAPI
|
||||||
|
InternalMathARShiftU64 (
|
||||||
|
IN UINT64 Operand,
|
||||||
|
IN UINTN Count
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_asm {
|
||||||
|
mov cl, byte ptr [Count]
|
||||||
|
mov eax, dword ptr [Operand + 4]
|
||||||
|
cdq
|
||||||
|
test cl, 32
|
||||||
|
cmovz edx, eax
|
||||||
|
cmovz eax, dword ptr [Operand + 0]
|
||||||
|
shrd eax, edx, cl
|
||||||
|
sar edx, cl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,39 +0,0 @@
|
|||||||
; 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
|
|
@ -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:
|
||||||
|
|
||||||
|
CpuBreakpoint.c
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics
|
||||||
|
//
|
||||||
|
void __debugbreak ();
|
||||||
|
|
||||||
|
#pragma intrinsic(__debugbreak)
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
CpuBreakpoint (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
__debugbreak ();
|
||||||
|
}
|
||||||
|
|
@ -1,39 +0,0 @@
|
|||||||
; 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
|
|
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
CpuFlushTlb function.
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
CpuFlushTlb (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_asm {
|
||||||
|
mov eax, cr3
|
||||||
|
mov cr3, eax
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,64 +0,0 @@
|
|||||||
; 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
|
|
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
AsmCpuid function.
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
|
UINT32
|
||||||
|
EFIAPI
|
||||||
|
AsmCpuid (
|
||||||
|
IN UINT32 Index,
|
||||||
|
OUT UINT32 *RegisterEax, OPTIONAL
|
||||||
|
OUT UINT32 *RegisterEbx, OPTIONAL
|
||||||
|
OUT UINT32 *RegisterEcx, OPTIONAL
|
||||||
|
OUT UINT32 *RegisterEdx OPTIONAL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_asm {
|
||||||
|
mov eax, Index
|
||||||
|
cpuid
|
||||||
|
push ecx
|
||||||
|
mov ecx, RegisterEax
|
||||||
|
jecxz SkipEax
|
||||||
|
mov [ecx], eax
|
||||||
|
SkipEax:
|
||||||
|
mov ecx, RegisterEbx
|
||||||
|
jecxz SkipEbx
|
||||||
|
mov [ecx], ebx
|
||||||
|
SkipEbx:
|
||||||
|
pop eax
|
||||||
|
mov ecx, RegisterEcx
|
||||||
|
jecxz SkipEcx
|
||||||
|
mov [ecx], eax
|
||||||
|
SkipEcx:
|
||||||
|
mov ecx, RegisterEdx
|
||||||
|
jecxz SkipEdx
|
||||||
|
mov [ecx], edx
|
||||||
|
SkipEdx:
|
||||||
|
mov eax, Index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,66 +0,0 @@
|
|||||||
; 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
|
|
@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
AsmCpuidEx function.
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
|
UINT32
|
||||||
|
EFIAPI
|
||||||
|
AsmCpuidEx (
|
||||||
|
IN UINT32 Index,
|
||||||
|
IN UINT32 SubIndex,
|
||||||
|
OUT UINT32 *RegisterEax, OPTIONAL
|
||||||
|
OUT UINT32 *RegisterEbx, OPTIONAL
|
||||||
|
OUT UINT32 *RegisterEcx, OPTIONAL
|
||||||
|
OUT UINT32 *RegisterEdx OPTIONAL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_asm {
|
||||||
|
mov eax, Index
|
||||||
|
mov ecx, SubIndex
|
||||||
|
cpuid
|
||||||
|
push ecx
|
||||||
|
mov ecx, RegisterEax
|
||||||
|
jecxz SkipEax
|
||||||
|
mov [ecx], eax
|
||||||
|
SkipEax:
|
||||||
|
mov ecx, RegisterEbx
|
||||||
|
jecxz SkipEbx
|
||||||
|
mov [ecx], ebx
|
||||||
|
SkipEbx:
|
||||||
|
pop eax
|
||||||
|
mov ecx, RegisterEcx
|
||||||
|
jecxz SkipEcx
|
||||||
|
mov [ecx], eax
|
||||||
|
SkipEcx:
|
||||||
|
mov ecx, RegisterEdx
|
||||||
|
jecxz SkipEdx
|
||||||
|
mov [ecx], edx
|
||||||
|
SkipEdx:
|
||||||
|
mov eax, Index
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
CpuPause function.
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
CpuPause (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_asm {
|
||||||
|
pause
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
CpuSleep function.
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
CpuSleep (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_asm {
|
||||||
|
hlt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
; 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
|
|
@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
DisableInterrupts function.
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
DisableInterrupts (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_asm {
|
||||||
|
cli
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,55 +0,0 @@
|
|||||||
; 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
|
|
@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
AsmDisablePaging32 function.
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
|
__declspec (naked)
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
InternalX86DisablePaging32 (
|
||||||
|
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
|
IN VOID *Context1, OPTIONAL
|
||||||
|
IN VOID *Context2, OPTIONAL
|
||||||
|
IN VOID *NewStack
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_asm {
|
||||||
|
push ebp
|
||||||
|
mov ebp, esp
|
||||||
|
mov ebx, EntryPoint
|
||||||
|
mov ecx, Context1
|
||||||
|
mov edx, Context2
|
||||||
|
pushfd
|
||||||
|
pop edi // save EFLAGS to edi
|
||||||
|
cli
|
||||||
|
mov eax, cr0
|
||||||
|
btr eax, 31
|
||||||
|
mov esp, NewStack
|
||||||
|
mov cr0, eax
|
||||||
|
push edi
|
||||||
|
popfd // restore EFLAGS from edi
|
||||||
|
push edx
|
||||||
|
push ecx
|
||||||
|
call ebx
|
||||||
|
jmp $ // EntryPoint() should not return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -20,7 +20,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "..\BaseLibInternal.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Worker function that Divides a 64-bit signed integer by a 64-bit signed integer and
|
Worker function that Divides a 64-bit signed integer by a 64-bit signed integer and
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
; 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:
|
|
||||||
;
|
|
||||||
; DivU64x32.asm
|
|
||||||
;
|
|
||||||
; Abstract:
|
|
||||||
;
|
|
||||||
; Calculate the quotient of a 64-bit integer by a 32-bit integer
|
|
||||||
;
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
.386
|
|
||||||
.model flat,C
|
|
||||||
.code
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
; UINT64
|
|
||||||
; EFIAPI
|
|
||||||
; InternalMathDivU64x32 (
|
|
||||||
; IN UINT64 Dividend,
|
|
||||||
; IN UINT32 Divisor
|
|
||||||
; );
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
InternalMathDivU64x32 PROC
|
|
||||||
mov eax, [esp + 8]
|
|
||||||
mov ecx, [esp + 12]
|
|
||||||
xor edx, edx
|
|
||||||
div ecx
|
|
||||||
push eax ; save quotient on stack
|
|
||||||
mov eax, [esp + 8]
|
|
||||||
div ecx
|
|
||||||
pop edx ; restore high-order dword of the quotient
|
|
||||||
ret
|
|
||||||
InternalMathDivU64x32 ENDP
|
|
||||||
|
|
||||||
END
|
|
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
Calculate the quotient of a 64-bit integer by a 32-bit integer
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
|
UINT64
|
||||||
|
EFIAPI
|
||||||
|
InternalMathDivU64x32 (
|
||||||
|
IN UINT64 Dividend,
|
||||||
|
IN UINT32 Divisor
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_asm {
|
||||||
|
mov eax, dword ptr [Dividend + 4]
|
||||||
|
mov ecx, Divisor
|
||||||
|
xor edx, edx
|
||||||
|
div ecx
|
||||||
|
push eax ; save quotient on stack
|
||||||
|
mov eax, dword ptr [Dividend]
|
||||||
|
div ecx
|
||||||
|
pop edx ; restore high-order dword of the quotient
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,49 +0,0 @@
|
|||||||
; 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:
|
|
||||||
;
|
|
||||||
; DivError.asm
|
|
||||||
;
|
|
||||||
; Abstract:
|
|
||||||
;
|
|
||||||
; Set error flag for all division functions
|
|
||||||
;
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
.386
|
|
||||||
.model flat,C
|
|
||||||
.code
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
; UINT64
|
|
||||||
; EFIAPI
|
|
||||||
; InternalMathDivRemU64x32 (
|
|
||||||
; IN UINT64 Dividend,
|
|
||||||
; IN UINT32 Divisor,
|
|
||||||
; OUT UINT32 *Remainder
|
|
||||||
; );
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
InternalMathDivRemU64x32 PROC
|
|
||||||
mov ecx, [esp + 12] ; ecx <- divisor
|
|
||||||
mov eax, [esp + 8] ; eax <- dividend[32..63]
|
|
||||||
xor edx, edx
|
|
||||||
div ecx ; eax <- quotient[32..63], edx <- remainder
|
|
||||||
push eax
|
|
||||||
mov eax, [esp + 8] ; eax <- dividend[0..31]
|
|
||||||
div ecx ; eax <- quotient[0..31]
|
|
||||||
mov ecx, [esp + 20] ; ecx <- Remainder
|
|
||||||
jecxz @F ; abandon remainder if Remainder == NULL
|
|
||||||
mov [ecx], edx
|
|
||||||
@@:
|
|
||||||
pop edx ; edx <- quotient[32..63]
|
|
||||||
ret
|
|
||||||
InternalMathDivRemU64x32 ENDP
|
|
||||||
|
|
||||||
END
|
|
@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
Set error flag for all division functions
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
|
UINT64
|
||||||
|
EFIAPI
|
||||||
|
InternalMathDivRemU64x32 (
|
||||||
|
IN UINT64 Dividend,
|
||||||
|
IN UINT32 Divisor,
|
||||||
|
OUT UINT32 *Remainder
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_asm {
|
||||||
|
mov ecx, Divisor
|
||||||
|
mov eax, dword ptr [Dividend + 4]
|
||||||
|
xor edx, edx
|
||||||
|
div ecx
|
||||||
|
push eax
|
||||||
|
mov eax, dword ptr [Dividend + 0]
|
||||||
|
div ecx
|
||||||
|
mov ecx, Remainder
|
||||||
|
jecxz RemainderNull // abandon remainder if Remainder == NULL
|
||||||
|
mov [ecx], edx
|
||||||
|
RemainderNull:
|
||||||
|
pop edx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,90 +0,0 @@
|
|||||||
; 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:
|
|
||||||
;
|
|
||||||
; DivU64x64Remainder.asm
|
|
||||||
;
|
|
||||||
; Abstract:
|
|
||||||
;
|
|
||||||
; Calculate the quotient of a 64-bit integer by a 64-bit integer and returns
|
|
||||||
; both the quotient and the remainder
|
|
||||||
;
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
.386
|
|
||||||
.model flat,C
|
|
||||||
.code
|
|
||||||
|
|
||||||
EXTERN InternalMathDivRemU64x32:PROC
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
; UINT64
|
|
||||||
; EFIAPI
|
|
||||||
; InternalMathDivRemU64x64 (
|
|
||||||
; IN UINT64 Dividend,
|
|
||||||
; IN UINT64 Divisor,
|
|
||||||
; OUT UINT64 *Remainder OPTIONAL
|
|
||||||
; );
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
InternalMathDivRemU64x64 PROC
|
|
||||||
mov ecx, [esp + 16] ; ecx <- divisor[32..63]
|
|
||||||
test ecx, ecx
|
|
||||||
jnz _@DivRemU64x64 ; call _@DivRemU64x64 if Divisor > 2^32
|
|
||||||
mov ecx, [esp + 20]
|
|
||||||
jecxz @F
|
|
||||||
and dword ptr [ecx + 4], 0 ; zero high dword of remainder
|
|
||||||
mov [esp + 16], ecx ; set up stack frame to match DivRemU64x32
|
|
||||||
@@:
|
|
||||||
jmp InternalMathDivRemU64x32
|
|
||||||
InternalMathDivRemU64x64 ENDP
|
|
||||||
|
|
||||||
_@DivRemU64x64 PROC USES ebx esi edi
|
|
||||||
mov edx, dword ptr [esp + 20]
|
|
||||||
mov eax, dword ptr [esp + 16] ; edx:eax <- dividend
|
|
||||||
mov edi, edx
|
|
||||||
mov esi, eax ; edi:esi <- dividend
|
|
||||||
mov ebx, dword ptr [esp + 24] ; ecx:ebx <- divisor
|
|
||||||
@@:
|
|
||||||
shr edx, 1
|
|
||||||
rcr eax, 1
|
|
||||||
shrd ebx, ecx, 1
|
|
||||||
shr ecx, 1
|
|
||||||
jnz @B
|
|
||||||
div ebx
|
|
||||||
mov ebx, eax ; ebx <- quotient
|
|
||||||
mov ecx, [esp + 28] ; ecx <- high dword of divisor
|
|
||||||
mul dword ptr [esp + 24] ; edx:eax <- quotient * divisor[0..31]
|
|
||||||
imul ecx, ebx ; ecx <- quotient * divisor[32..63]
|
|
||||||
add edx, ecx ; edx <- (quotient * divisor)[32..63]
|
|
||||||
mov ecx, dword ptr [esp + 32] ; ecx <- addr for Remainder
|
|
||||||
jc @TooLarge ; product > 2^64
|
|
||||||
cmp edi, edx ; compare high 32 bits
|
|
||||||
ja @Correct
|
|
||||||
jb @TooLarge ; product > dividend
|
|
||||||
cmp esi, eax
|
|
||||||
jae @Correct ; product <= dividend
|
|
||||||
@TooLarge:
|
|
||||||
dec ebx ; adjust quotient by -1
|
|
||||||
jecxz @Return ; return if Remainder == NULL
|
|
||||||
sub eax, dword ptr [esp + 24]
|
|
||||||
sbb edx, dword ptr [esp + 28] ; edx:eax <- (quotient - 1) * divisor
|
|
||||||
@Correct:
|
|
||||||
jecxz @Return
|
|
||||||
sub esi, eax
|
|
||||||
sbb edi, edx ; edi:esi <- remainder
|
|
||||||
mov [ecx], esi
|
|
||||||
mov [ecx + 4], edi
|
|
||||||
@Return:
|
|
||||||
mov eax, ebx ; eax <- quotient
|
|
||||||
xor edx, edx ; quotient is 32 bits long
|
|
||||||
ret
|
|
||||||
_@DivRemU64x64 ENDP
|
|
||||||
|
|
||||||
END
|
|
@ -0,0 +1,68 @@
|
|||||||
|
/**
|
||||||
|
Calculate the quotient of a 64-bit integer by a 64-bit integer and returns
|
||||||
|
both the quotient and the remainderSet error flag for all division functions
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2007, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
|
UINT64
|
||||||
|
EFIAPI
|
||||||
|
InternalMathDivRemU64x64 (
|
||||||
|
IN UINT64 Dividend,
|
||||||
|
IN UINT64 Divisor,
|
||||||
|
OUT UINT64 *Remainder OPTIONAL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_asm {
|
||||||
|
mov edx, dword ptr [Dividend + 4]
|
||||||
|
mov eax, dword ptr [Dividend + 0] // edx:eax <- dividend
|
||||||
|
mov edi, edx
|
||||||
|
mov esi, eax // edi:esi <- dividend
|
||||||
|
mov ecx, dword ptr [Divisor + 4]
|
||||||
|
mov ebx, dword ptr [Divisor + 0] // ecx:ebx <- divisor
|
||||||
|
BitLoop:
|
||||||
|
shr edx, 1
|
||||||
|
rcr eax, 1
|
||||||
|
shrd ebx, ecx, 1
|
||||||
|
shr ecx, 1
|
||||||
|
jnz BitLoop
|
||||||
|
div ebx
|
||||||
|
mov ebx, eax // ebx <- quotient
|
||||||
|
mov ecx, dword ptr [Divisor + 4]
|
||||||
|
mul dword ptr [Divisor]
|
||||||
|
imul ecx, ebx
|
||||||
|
add edx, ecx
|
||||||
|
mov ecx, Remainder
|
||||||
|
jc TooLarge // product > 2^64
|
||||||
|
cmp edi, edx // compare high 32 bits
|
||||||
|
ja Correct
|
||||||
|
jb TooLarge // product > dividend
|
||||||
|
cmp esi, eax
|
||||||
|
jae Correct // product <= dividend
|
||||||
|
TooLarge:
|
||||||
|
dec ebx // adjust quotient by -1
|
||||||
|
jecxz Return // return if Remainder == NULL
|
||||||
|
sub eax, dword ptr [Divisor + 0]
|
||||||
|
sbb edx, dword ptr [Divisor + 4]
|
||||||
|
Correct:
|
||||||
|
jecxz Return
|
||||||
|
sub esi, eax
|
||||||
|
sbb edi, edx // edi:esi <- remainder
|
||||||
|
mov [ecx], esi
|
||||||
|
mov [ecx + 4], edi
|
||||||
|
Return:
|
||||||
|
mov eax, ebx // eax <- quotient
|
||||||
|
xor edx, edx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,39 +0,0 @@
|
|||||||
; 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:
|
|
||||||
;
|
|
||||||
; EnableDisableInterrupts.Asm
|
|
||||||
;
|
|
||||||
; Abstract:
|
|
||||||
;
|
|
||||||
; EnableDisableInterrupts function
|
|
||||||
;
|
|
||||||
; Notes:
|
|
||||||
;
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
.386p
|
|
||||||
.model flat
|
|
||||||
.code
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
; VOID
|
|
||||||
; EFIAPI
|
|
||||||
; EnableDisableInterrupts (
|
|
||||||
; VOID
|
|
||||||
; );
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
_EnableDisableInterrupts PROC
|
|
||||||
sti
|
|
||||||
cli
|
|
||||||
ret
|
|
||||||
_EnableDisableInterrupts ENDP
|
|
||||||
|
|
||||||
END
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user