diff options
Diffstat (limited to 'EdkCompatibilityPkg/Foundation')
448 files changed, 18656 insertions, 5615 deletions
diff --git a/EdkCompatibilityPkg/Foundation/Include/EfiCompNameSupport.h b/EdkCompatibilityPkg/Foundation/Include/EfiCompNameSupport.h new file mode 100644 index 0000000000..7159588ee1 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Include/EfiCompNameSupport.h @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Include/EfiTpm.h b/EdkCompatibilityPkg/Foundation/Include/EfiTpm.h index 67379aa42d..ea89f5658b 100644 --- a/EdkCompatibilityPkg/Foundation/Include/EfiTpm.h +++ b/EdkCompatibilityPkg/Foundation/Include/EfiTpm.h @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2006, Intel Corporation
+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
@@ -24,13 +24,13 @@ Abstract: #ifndef _EFI_TPM_H_
#define _EFI_TPM_H_
-#include <Tiano.h>
+#include "Tiano.h"
//
// The start of TPM return codes
//
#define TPM_BASE (EFI_MAX_BIT + (EFI_MAX_BIT >> 1))
-#include <IndustryStandard/Tpm12.h>
+#include "IndustryStandard/Tpm12.h"
//
// Standard event types
@@ -117,7 +117,7 @@ typedef struct tdEFI_IMAGE_LOAD_EVENT { // the measurement of given configuration tables.
//
typedef struct tdEFI_HANDOFF_TABLE_POINTERS {
- UINTN NumberOfTables;
+ UINTN NumberOfTables;
EFI_CONFIGURATION_TABLE TableEntry[1];
} EFI_HANDOFF_TABLE_POINTERS;
diff --git a/EdkCompatibilityPkg/Foundation/Include/Ia32/EfiBind.h b/EdkCompatibilityPkg/Foundation/Include/Ia32/EfiBind.h index ae60a28e27..12d40de737 100644 --- a/EdkCompatibilityPkg/Foundation/Include/Ia32/EfiBind.h +++ b/EdkCompatibilityPkg/Foundation/Include/Ia32/EfiBind.h @@ -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
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
@@ -49,12 +49,12 @@ Abstract: return 1; \
} \
\
- EFI_STATUS \
+ EFI_STATUS \
__declspec( dllexport ) \
__cdecl \
InitializeDriver ( \
- VOID *ImageHandle, \
- VOID *SystemTable \
+ EFI_HANDLE ImageHandle, \
+ EFI_SYSTEM_TABLE *SystemTable \
) \
{ \
return InitFunction(ImageHandle, SystemTable); \
diff --git a/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/Acpi3_0.h b/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/Acpi3_0.h index be4483ac68..cd359b6c1a 100644 --- a/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/Acpi3_0.h +++ b/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/Acpi3_0.h @@ -676,6 +676,16 @@ typedef struct { //
#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()
#endif
diff --git a/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/IScsiBootFirmwareTable.h b/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/IScsiBootFirmwareTable.h new file mode 100644 index 0000000000..8696e9c490 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/IScsiBootFirmwareTable.h @@ -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
+
diff --git a/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/Smbios.h b/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/Smbios.h index 10ef37ddf7..9c6564ca37 100644 --- a/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/Smbios.h +++ b/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/Smbios.h @@ -136,6 +136,17 @@ typedef struct { SMBIOS_TABLE_STRING SerialNumber;
SMBIOS_TABLE_STRING AssetTag;
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;
typedef struct {
@@ -197,6 +208,12 @@ typedef struct { UINT16 SlotID;
UINT8 SlotCharacteristics1;
UINT8 SlotCharacteristics2;
+ //
+ // Add for smbios 2.6
+ //
+ UINT16 SegmentGroupNum;
+ UINT8 BusNum;
+ UINT8 DevFuncNum;
} SMBIOS_TABLE_TYPE9;
typedef struct {
@@ -286,6 +303,10 @@ typedef struct { SMBIOS_TABLE_STRING SerialNumber;
SMBIOS_TABLE_STRING AssetTag;
SMBIOS_TABLE_STRING PartNumber;
+ //
+ // Add for smbios 2.6
+ //
+ UINT8 Attributes;
} SMBIOS_TABLE_TYPE17;
typedef struct {
@@ -516,6 +537,33 @@ typedef struct { UINT16 InputCurrentProbeHandle;
} 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 {
SMBIOS_TABLE_HEADER Hdr;
} SMBIOS_TABLE_TYPE126;
@@ -566,6 +614,8 @@ typedef union { SMBIOS_TABLE_TYPE37 *Type37;
SMBIOS_TABLE_TYPE38 *Type38;
SMBIOS_TABLE_TYPE39 *Type39;
+ SMBIOS_TABLE_TYPE40 *Type40;
+ SMBIOS_TABLE_TYPE41 *Type41;
SMBIOS_TABLE_TYPE126 *Type126;
SMBIOS_TABLE_TYPE127 *Type127;
UINT8 *Raw;
diff --git a/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/usb.h b/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/usb.h index 8ccfd11ea8..f3858ed390 100644 --- a/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/usb.h +++ b/EdkCompatibilityPkg/Foundation/Include/IndustryStandard/usb.h @@ -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
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
@@ -14,7 +14,7 @@ Module Name: usb.h
Abstract:
- Support for USB 1.1 standard.
+ Support for USB standard.
@@ -23,8 +23,237 @@ Revision History --*/
-#ifndef _USB_H
-#define _USB_H
+#ifndef _USB_INDUSTRY_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
//
@@ -61,161 +290,35 @@ Revision History #define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
#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 {
EfiUsbEndpointHalt,
EfiUsbDeviceRemoteWakeup
} 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
//
#define USB_DEV_GET_STATUS 0x00
-
#define USB_DEV_CLEAR_FEATURE 0x01
-
#define USB_DEV_SET_FEATURE 0x03
-
#define USB_DEV_SET_ADDRESS 0x05
#define USB_DEV_SET_ADDRESS_REQ_TYPE 0x00
-
#define USB_DEV_GET_DESCRIPTOR 0x06
#define USB_DEV_GET_DESCRIPTOR_REQ_TYPE 0x80
-
#define USB_DEV_SET_DESCRIPTOR 0x07
#define USB_DEV_SET_DESCRIPTOR_REQ_TYPE 0x00
-
#define USB_DEV_GET_CONFIGURATION 0x08
#define USB_DEV_GET_CONFIGURATION_REQ_TYPE 0x80
-
#define USB_DEV_SET_CONFIGURATION 0x09
#define USB_DEV_SET_CONFIGURATION_REQ_TYPE 0x00
-
#define USB_DEV_GET_INTERFACE 0x0A
#define USB_DEV_GET_INTERFACE_REQ_TYPE 0x81
-
#define USB_DEV_SET_INTERFACE 0x0B
#define USB_DEV_SET_INTERFACE_REQ_TYPE 0x01
-
#define USB_DEV_SYNCH_FRAME 0x0C
#define USB_DEV_SYNCH_FRAME_REQ_TYPE 0x82
-//
-// 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;
-
+#pragma pack(1)
//
// Supported String Languages
//
@@ -226,68 +329,16 @@ typedef struct { } EFI_USB_SUPPORTED_LANGUAGES;
//
-// String descriptor
-//
-typedef struct {
- UINT8 Length;
- UINT8 DescriptorType;
- CHAR16 String[1];
-} EFI_USB_STRING_DESCRIPTOR;
-
-//
-// Hub descriptor
+// USB alternate setting
//
-#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;
+ EFI_USB_INTERFACE_DESCRIPTOR *Interface;
+} USB_ALT_SETTING;
#pragma pack()
+///////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////
+
#endif
diff --git a/EdkCompatibilityPkg/Foundation/Include/Pei/PeiPerf.h b/EdkCompatibilityPkg/Foundation/Include/Pei/PeiPerf.h new file mode 100644 index 0000000000..5b86d838d4 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Include/Pei/PeiPerf.h @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Include/TianoHii.h b/EdkCompatibilityPkg/Foundation/Include/TianoHii.h new file mode 100644 index 0000000000..edce81ee03 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Include/TianoHii.h @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/CompilerStub/CompilerStubLib.inf b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/CompilerStubLib.inf index b80e6faca3..aeb80b8e7e 100644 --- a/EdkCompatibilityPkg/Foundation/Library/CompilerStub/CompilerStubLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/CompilerStubLib.inf @@ -22,16 +22,20 @@ [defines]
BASE_NAME = CompilerStub
COMPONENT_TYPE = LIBRARY
-
+
[sources.common]
[sources.ia32]
- Ia32\memcpy.asm
- Ia32\memset.asm
+ Ia32\memcpyRep1.asm
+ Ia32\memsetRep4.asm
+# Ia32\memcpy.asm
+# Ia32\memset.asm
[sources.x64]
- x64\memcpy.asm
- x64\memset.asm
+ x64\memcpyRep1.asm
+ x64\memsetRep4.asm
+# x64\memcpy.asm
+# x64\memset.asm
[sources.Ipf]
memcpy.c
diff --git a/EdkCompatibilityPkg/Foundation/Library/CompilerStub/Ia32/memcpyRep1.asm b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/Ia32/memcpyRep1.asm new file mode 100644 index 0000000000..aeebcfd09b --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/Ia32/memcpyRep1.asm @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/CompilerStub/Ia32/memcpyRep4.asm b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/Ia32/memcpyRep4.asm new file mode 100644 index 0000000000..d4cef09d7c --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/Ia32/memcpyRep4.asm @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuPause.asm b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/Ia32/memsetRep1.asm index 95e1307f8d..905c1f765e 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuPause.asm +++ b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/Ia32/memsetRep1.asm @@ -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
-; 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.
+;------------------------------------------------------------------------------
+;
+; 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:
;
-; CpuPause.Asm
+; SetMem.asm
;
; Abstract:
;
-; CpuPause function
+; memset function
;
; Notes:
;
@@ -21,19 +23,26 @@ .686
.model flat,C
- .xmm
.code
;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; CpuPause (
-; VOID
-; );
+; VOID *
+; memset (
+; OUT VOID *Buffer,
+; IN UINT8 Value,
+; IN UINTN Count
+; )
;------------------------------------------------------------------------------
-CpuPause PROC
- pause
+memset PROC USES edi
+ mov ecx, [esp + 16]
+ test ecx, ecx
+ je @F
+ mov al, [esp + 12]
+ mov edi, [esp + 8]
+ rep stosb
+@@:
+ mov eax, [esp + 8]
ret
-CpuPause ENDP
+memset ENDP
END
diff --git a/EdkCompatibilityPkg/Foundation/Library/CompilerStub/Ia32/memsetRep4.asm b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/Ia32/memsetRep4.asm new file mode 100644 index 0000000000..fadee231cb --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/Ia32/memsetRep4.asm @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memcpyRep1.asm b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memcpyRep1.asm new file mode 100644 index 0000000000..72b8de3c26 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memcpyRep1.asm @@ -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
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memcpyRep4.asm b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memcpyRep4.asm new file mode 100644 index 0000000000..2cca1c3380 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memcpyRep4.asm @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memcpyRep8.asm b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memcpyRep8.asm new file mode 100644 index 0000000000..27b3ca5364 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memcpyRep8.asm @@ -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
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memsetRep1.asm b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memsetRep1.asm new file mode 100644 index 0000000000..9a4d67330c --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memsetRep1.asm @@ -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
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memsetRep4.asm b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memsetRep4.asm new file mode 100644 index 0000000000..6ef0036578 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memsetRep4.asm @@ -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
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memsetRep8.asm b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memsetRep8.asm new file mode 100644 index 0000000000..16cb026df1 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/CompilerStub/x64/memsetRep8.asm @@ -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
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiScriptLib/EfiScriptLib.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiScriptLib/EfiScriptLib.c index 49720ecbf1..e31546f28e 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiScriptLib/EfiScriptLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiScriptLib/EfiScriptLib.c @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2006, Intel Corporation
+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
@@ -24,6 +24,7 @@ Abstract: EFI_BOOT_SCRIPT_SAVE_PROTOCOL *mBootScriptSave;
EFI_STATUS
+EFIAPI
BootScriptSaveInitialize (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -60,6 +61,7 @@ Returns: }
EFI_STATUS
+EFIAPI
BootScriptSaveIoWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
@@ -109,6 +111,7 @@ Returns: }
EFI_STATUS
+EFIAPI
BootScriptSaveIoReadWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
@@ -158,6 +161,7 @@ Returns: }
EFI_STATUS
+EFIAPI
BootScriptSaveMemWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
@@ -207,6 +211,7 @@ Returns: }
EFI_STATUS
+EFIAPI
BootScriptSaveMemReadWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
@@ -256,6 +261,7 @@ Returns: }
EFI_STATUS
+EFIAPI
BootScriptSavePciCfgWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
@@ -305,6 +311,7 @@ Returns: }
EFI_STATUS
+EFIAPI
BootScriptSavePciCfgReadWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
@@ -354,6 +361,7 @@ Returns: }
EFI_STATUS
+EFIAPI
BootScriptSaveSmbusExecute (
IN UINT16 TableName,
IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
@@ -409,6 +417,7 @@ Returns: }
EFI_STATUS
+EFIAPI
BootScriptSaveStall (
IN UINT16 TableName,
IN UINTN Duration
@@ -449,6 +458,7 @@ Returns: }
EFI_STATUS
+EFIAPI
BootScriptSaveDispatch (
IN UINT16 TableName,
IN EFI_PHYSICAL_ADDRESS EntryPoint
@@ -488,6 +498,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
+EFIAPI
BootScriptSaveInformation (
IN UINT16 TableName,
IN UINT32 Length,
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Graphics.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Graphics.c index 80d9b72835..2a42302c76 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Graphics.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Graphics.c @@ -100,7 +100,7 @@ Returns: {
return GetImageEx (
ImageHandle,
- &gEfiDefaultBmpLogoGuid,
+ FileNameGuid,
EFI_SECTION_RAW,
Image,
ImageSize,
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c index 5cbcb53c22..3b63433e0a 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c @@ -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
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
@@ -59,7 +59,11 @@ Abstract: #include "PrintWidth.h"
#include "EfiPrintLib.h"
#include "Print.h"
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+#include EFI_PROTOCOL_DEFINITION (HiiFont)
+#else
#include EFI_PROTOCOL_DEFINITION (Hii)
+#endif
STATIC
CHAR_W *
@@ -161,22 +165,26 @@ Returns: {
VOID *Buffer;
EFI_STATUS Status;
- UINT16 GlyphWidth;
- UINT32 GlyphStatus;
- UINT16 StringIndex;
UINTN Index;
CHAR16 *UnicodeWeight;
- EFI_NARROW_GLYPH *Glyph;
- EFI_HII_PROTOCOL *Hii;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
UINT32 HorizontalResolution;
UINT32 VerticalResolution;
UINT32 ColorDepth;
UINT32 RefreshRate;
UINTN BufferLen;
UINTN LineBufferLen;
-
- GlyphStatus = 0;
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ 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
@@ -192,19 +200,29 @@ Returns: } else {
UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
}
- 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;
- }
+ ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
+#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);
if (EFI_ERROR (Status)) {
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);
@@ -219,7 +237,65 @@ Returns: }
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) {
Status = EFI_INVALID_PARAMETER;
goto Error;
@@ -288,8 +364,15 @@ Returns: );
}
+#endif
+
Error:
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ EfiLibSafeFreePool (Blt);
+ EfiLibSafeFreePool (FontInfo);
+#else
gBS->FreePool (LineBuffer);
+#endif
gBS->FreePool (Buffer);
return Status;
}
@@ -417,6 +500,7 @@ Returns: }
UINTN
+EFIAPI
VSPrint (
OUT CHAR_W *StartOfBuffer,
IN UINTN BufferSize,
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Graphics.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Graphics.c index 0cae8e9ca4..82933a521d 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Graphics.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Graphics.c @@ -101,7 +101,7 @@ Returns: {
return GetImageEx (
ImageHandle,
- &gEfiDefaultBmpLogoGuid,
+ FileNameGuid,
EFI_SECTION_RAW,
Image,
ImageSize,
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Print.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Print.c index 94a1adb81c..2f29293b42 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Print.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Print.c @@ -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
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
@@ -59,7 +59,11 @@ Abstract: #include "PrintWidth.h"
#include "EfiPrintLib.h"
#include "Print.h"
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+#include EFI_PROTOCOL_DEFINITION (HiiFont)
+#else
#include EFI_PROTOCOL_DEFINITION (Hii)
+#endif
static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
0x00, 0x00, 0x00, 0x00,
@@ -128,22 +132,26 @@ Returns: {
VOID *Buffer;
EFI_STATUS Status;
- UINT16 GlyphWidth;
- UINT32 GlyphStatus;
- UINT16 StringIndex;
UINTN Index;
CHAR16 *UnicodeWeight;
- EFI_NARROW_GLYPH *Glyph;
- EFI_HII_PROTOCOL *Hii;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
UINT32 HorizontalResolution;
UINT32 VerticalResolution;
UINT32 ColorDepth;
UINT32 RefreshRate;
UINTN BufferLen;
UINTN LineBufferLen;
-
- GlyphStatus = 0;
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ 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
@@ -161,17 +169,27 @@ Returns: }
ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
+#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);
+ if (EFI_ERROR (Status)) {
+ goto Error;
+ }
LineBufferLen = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * GLYPH_HEIGHT;
LineBuffer = EfiLibAllocatePool (LineBufferLen);
if (LineBuffer == NULL) {
- gBS->FreePool (Buffer);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, &Hii);
- if (EFI_ERROR (Status)) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Error;
- }
+ }
+#endif
VSPrint (Buffer, 0x10000, fmt, args);
@@ -187,6 +205,63 @@ Returns: 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) {
Status = EFI_INVALID_PARAMETER;
goto Error;
@@ -255,8 +330,15 @@ Returns: );
}
+#endif
+
Error:
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ EfiLibSafeFreePool (Blt);
+ EfiLibSafeFreePool (FontInfo);
+#else
gBS->FreePool (LineBuffer);
+#endif
gBS->FreePool (Buffer);
return Status;
}
@@ -384,6 +466,7 @@ Returns: }
UINTN
+EFIAPI
VSPrint (
OUT CHAR_W *StartOfBuffer,
IN UINTN BufferSize,
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiPrintLib.h b/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiPrintLib.h index 42a6ec8c8a..c28955bea5 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiPrintLib.h +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiPrintLib.h @@ -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
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
@@ -190,6 +190,7 @@ Returns: ;
UINTN
+EFIAPI
VSPrint (
OUT CHAR16 *StartOfBuffer,
IN UINTN StrLen,
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiRuntimeLib.h b/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiRuntimeLib.h index 25b0d6e6c9..1231cff703 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiRuntimeLib.h +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiRuntimeLib.h @@ -1513,15 +1513,13 @@ EfiFvbSetVolumeAttributes ( Routine Description:
Modifies the current settings of the firmware volume according to the
- input parameter, and returns the new setting of the volume
+ input parameter.
Arguments:
Instance - The FV instance whose attributes is going to be
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.
- On successful return, it contains the new settings
- of the firmware volume
Returns:
Status code
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiScriptLib.h b/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiScriptLib.h index fbf9699a31..600cbb6a03 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiScriptLib.h +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiScriptLib.h @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2004, Intel Corporation
+Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -28,6 +28,7 @@ Abstract: EFI_STATUS
+EFIAPI
BootScriptSaveInitialize (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -52,6 +53,7 @@ Returns: ;
EFI_STATUS
+EFIAPI
BootScriptSaveIoWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
@@ -87,6 +89,7 @@ Returns: ;
EFI_STATUS
+EFIAPI
BootScriptSaveIoReadWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
@@ -122,6 +125,7 @@ Returns: ;
EFI_STATUS
+EFIAPI
BootScriptSaveMemWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
@@ -157,6 +161,7 @@ Returns: ;
EFI_STATUS
+EFIAPI
BootScriptSaveMemReadWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
@@ -192,6 +197,7 @@ Returns: ;
EFI_STATUS
+EFIAPI
BootScriptSavePciCfgWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
@@ -228,6 +234,7 @@ Returns: ;
EFI_STATUS
+EFIAPI
BootScriptSavePciCfgReadWrite (
IN UINT16 TableName,
IN EFI_BOOT_SCRIPT_WIDTH Width,
@@ -265,6 +272,7 @@ Returns: ;
EFI_STATUS
+EFIAPI
BootScriptSaveSmbusExecute (
IN UINT16 TableName,
IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,
@@ -303,6 +311,7 @@ Returns: ;
EFI_STATUS
+EFIAPI
BootScriptSaveStall (
IN UINT16 TableName,
IN UINTN Duration
@@ -330,6 +339,7 @@ Returns: ;
EFI_STATUS
+EFIAPI
BootScriptSaveDispatch (
IN UINT16 TableName,
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
EFIAPI
BootScriptSaveInformation (
@@ -473,6 +521,21 @@ Returns: #define SCRIPT_DISPATCH(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) \
BootScriptSaveInformation(TableName, Length, Buffer)
@@ -506,6 +569,17 @@ Returns: #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_UNICODE_STRING(TableName, String)
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c index d2bea32769..69242a15fb 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2004, Intel Corporation
+Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -134,6 +134,7 @@ Returns: UINTN
+EFIAPI
VSPrint (
OUT CHAR_W *StartOfBuffer,
IN UINTN BufferSize,
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/PrintLite/Print.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/PrintLite/Print.c index c648e25642..e093260d1b 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/PrintLite/Print.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/PrintLite/Print.c @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2004, Intel Corporation
+Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -101,6 +101,7 @@ Returns: }
UINTN
+EFIAPI
VSPrint (
OUT CHAR_W *StartOfBuffer,
IN UINTN BufferSize,
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiEfiIfrSupportLib.inf b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiEfiIfrSupportLib.inf new file mode 100644 index 0000000000..f5e66c1511 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiEfiIfrSupportLib.inf @@ -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]
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrCommon.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrCommon.c new file mode 100644 index 0000000000..7e9553ffe0 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrCommon.c @@ -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;
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c new file mode 100644 index 0000000000..381e9d21a5 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c @@ -0,0 +1,1141 @@ +/*++
+
+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:
+
+ UefiIfrForm.c
+
+Abstract:
+
+ Common Library Routines to assist handle HII elements.
+
+--*/
+
+#include "UefiIfrLibrary.h"
+
+//
+// Fake <ConfigHdr>
+//
+UINT16 mFakeConfigHdr[] = L"GUID=00000000000000000000000000000000&NAME=0000&PATH=0";
+
+STATIC
+EFI_STATUS
+GetPackageDataFromPackageList (
+ IN EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList,
+ IN UINT32 PackageIndex,
+ OUT UINT32 *BufferLen,
+ OUT EFI_HII_PACKAGE_HEADER **Buffer
+ )
+{
+ UINT32 Index;
+ EFI_HII_PACKAGE_HEADER *Package;
+ UINT32 Offset;
+ UINT32 PackageListLength;
+ EFI_HII_PACKAGE_HEADER PackageHeader = {0, 0};
+
+ ASSERT(HiiPackageList != NULL);
+
+ if ((BufferLen == NULL) || (Buffer == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Package = NULL;
+ Index = 0;
+ Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
+ EfiCopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32));
+ while (Offset < PackageListLength) {
+ Package = (EFI_HII_PACKAGE_HEADER *) (((UINT8 *) HiiPackageList) + Offset);
+ EfiCopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
+ if (Index == PackageIndex) {
+ break;
+ }
+ Offset += PackageHeader.Length;
+ Index++;
+ }
+ if (Offset >= PackageListLength) {
+ //
+ // no package found in this Package List
+ //
+ return EFI_NOT_FOUND;
+ }
+
+ *BufferLen = PackageHeader.Length;
+ *Buffer = Package;
+ return EFI_SUCCESS;
+}
+
+STATIC
+EFI_STATUS
+UpdateFormPackageData (
+ IN EFI_GUID *FormSetGuid,
+ IN EFI_FORM_ID FormId,
+ IN EFI_HII_PACKAGE_HEADER *Package,
+ IN UINT32 PackageLength,
+ IN UINT16 Label,
+ IN BOOLEAN Insert,
+ IN EFI_HII_UPDATE_DATA *Data,
+ OUT UINT8 **TempBuffer,
+ OUT UINT32 *TempBufferSize
+ )
+{
+ UINTN AddSize;
+ UINT8 *BufferPos;
+ EFI_HII_PACKAGE_HEADER PackageHeader;
+ UINTN Offset;
+ EFI_IFR_OP_HEADER *IfrOpHdr;
+ BOOLEAN GetFormSet;
+ BOOLEAN GetForm;
+ UINT8 ExtendOpCode;
+ UINT16 LabelNumber;
+ BOOLEAN Updated;
+ EFI_IFR_OP_HEADER *AddOpCode;
+
+ if ((TempBuffer == NULL) || (TempBufferSize == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *TempBufferSize = PackageLength;
+ if (Data != NULL) {
+ *TempBufferSize += Data->Offset;
+ }
+ *TempBuffer = EfiLibAllocateZeroPool (*TempBufferSize);
+ if (*TempBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ EfiCopyMem (*TempBuffer, Package, sizeof (EFI_HII_PACKAGE_HEADER));
+ *TempBufferSize = sizeof (EFI_HII_PACKAGE_HEADER);
+ BufferPos = *TempBuffer + sizeof (EFI_HII_PACKAGE_HEADER);
+
+ EfiCopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
+ IfrOpHdr = (EFI_IFR_OP_HEADER *)((UINT8 *) Package + sizeof (EFI_HII_PACKAGE_HEADER));
+ Offset = sizeof (EFI_HII_PACKAGE_HEADER);
+ GetFormSet = (FormSetGuid == NULL) ? TRUE : FALSE;
+ GetForm = FALSE;
+ Updated = FALSE;
+
+ while (Offset < PackageHeader.Length) {
+ EfiCopyMem (BufferPos, IfrOpHdr, IfrOpHdr->Length);
+ BufferPos += IfrOpHdr->Length;
+ *TempBufferSize += IfrOpHdr->Length;
+
+ switch (IfrOpHdr->OpCode) {
+ case EFI_IFR_FORM_SET_OP :
+ if (FormSetGuid != NULL) {
+ if (EfiCompareMem (&((EFI_IFR_FORM_SET *) IfrOpHdr)->Guid, FormSetGuid, sizeof (EFI_GUID)) == 0) {
+ GetFormSet = TRUE;
+ }
+ }
+ break;
+
+ case EFI_IFR_FORM_OP:
+ if (EfiCompareMem (&((EFI_IFR_FORM *) IfrOpHdr)->FormId, &FormId, sizeof (EFI_FORM_ID)) == 0) {
+ GetForm = TRUE;
+ }
+ break;
+
+ case EFI_IFR_GUID_OP :
+ if (!GetFormSet || !GetForm || Updated) {
+ //
+ // Go to the next Op-Code
+ //
+ Offset += IfrOpHdr->Length;
+ IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length);
+ continue;
+ }
+
+ ExtendOpCode = ((EFI_IFR_GUID_LABEL *) IfrOpHdr)->ExtendOpCode;
+ EfiCopyMem (&LabelNumber, &((EFI_IFR_GUID_LABEL *)IfrOpHdr)->Number, sizeof (UINT16));
+ if ((ExtendOpCode != EFI_IFR_EXTEND_OP_LABEL) || (LabelNumber != Label)) {
+ //
+ // Go to the next Op-Code
+ //
+ Offset += IfrOpHdr->Length;
+ IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length);
+ continue;
+ }
+
+ if (Insert && (Data != NULL)) {
+ //
+ // insert the DataCount amount of opcodes to TempBuffer if Data is NULL remove
+ // DataCount amount of opcodes unless runing into a label.
+ //
+ AddOpCode = (EFI_IFR_OP_HEADER *)Data->Data;
+ AddSize = 0;
+ while (AddSize < Data->Offset) {
+ EfiCopyMem (BufferPos, AddOpCode, AddOpCode->Length);
+ BufferPos += AddOpCode->Length;
+ *TempBufferSize += AddOpCode->Length;
+
+ AddSize += AddOpCode->Length;
+ AddOpCode = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (AddOpCode) + AddOpCode->Length);
+ }
+ } else {
+ //
+ // Search the next Label.
+ //
+ while (TRUE) {
+ Offset += IfrOpHdr->Length;
+ //
+ // Search the next label and Fail if not label found.
+ //
+ if (Offset >= PackageHeader.Length) {
+ goto Fail;
+ }
+ IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length);
+ if (IfrOpHdr->OpCode == EFI_IFR_GUID_OP) {
+ ExtendOpCode = ((EFI_IFR_GUID_LABEL *) IfrOpHdr)->ExtendOpCode;
+ if (ExtendOpCode == EFI_IFR_EXTEND_OP_LABEL) {
+ break;
+ }
+ }
+ }
+
+ if (Data != NULL) {
+ AddOpCode = (EFI_IFR_OP_HEADER *)Data->Data;
+ AddSize = 0;
+ while (AddSize < Data->Offset) {
+ EfiCopyMem (BufferPos, AddOpCode, AddOpCode->Length);
+ BufferPos += AddOpCode->Length;
+ *TempBufferSize += AddOpCode->Length;
+
+ AddSize += AddOpCode->Length;
+ AddOpCode = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (AddOpCode) + AddOpCode->Length);
+ }
+ }
+
+ //
+ // copy the next label
+ //
+ EfiCopyMem (BufferPos, IfrOpHdr, IfrOpHdr->Length);
+ BufferPos += IfrOpHdr->Length;
+ *TempBufferSize += IfrOpHdr->Length;
+ }
+
+ Updated = TRUE;
+ break;
+ default :
+ break;
+ }
+
+ //
+ // Go to the next Op-Code
+ //
+ Offset += IfrOpHdr->Length;
+ IfrOpHdr = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (IfrOpHdr) + IfrOpHdr->Length);
+ }
+
+ //
+ // Update the package length.
+ //
+ PackageHeader.Length = *TempBufferSize;
+ EfiCopyMem (*TempBuffer, &PackageHeader, sizeof (EFI_HII_PACKAGE_HEADER));
+
+Fail:
+ if (!Updated) {
+ gBS->FreePool (*TempBuffer);
+ *TempBufferSize = 0;
+ return EFI_NOT_FOUND;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS
+IfrLibUpdateForm (
+ IN EFI_HII_HANDLE Handle,
+ IN EFI_GUID *FormSetGuid, OPTIONAL
+ IN EFI_FORM_ID FormId,
+ IN UINT16 Label,
+ IN BOOLEAN Insert,
+ IN EFI_HII_UPDATE_DATA *Data
+ )
+/*++
+
+Routine Description:
+ This function allows the caller to update a form that has
+ previously been registered with the EFI HII database.
+
+Arguments:
+ Handle - Hii Handle
+ FormSetGuid - The formset should be updated.
+ FormId - The form should be updated.
+ Label - Update information starting immediately after this label in the IFR
+ Insert - If TRUE and Data is not NULL, insert data after Label.
+ If FALSE, replace opcodes between two labels with Data
+ Data - The adding data; If NULL, remove opcodes between two Label.
+
+Returns:
+ EFI_SUCCESS - Update success.
+ Other - Update fail.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
+ EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList;
+ UINT32 Index;
+ EFI_HII_PACKAGE_LIST_HEADER *UpdateBuffer;
+ UINTN BufferSize;
+ UINT8 *UpdateBufferPos;
+ EFI_HII_PACKAGE_HEADER PackageHeader;
+ EFI_HII_PACKAGE_HEADER *Package;
+ UINT32 PackageLength;
+ EFI_HII_PACKAGE_HEADER *TempBuffer;
+ UINT32 TempBufferSize;
+ BOOLEAN Updated;
+
+ if (Data == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ LocateHiiProtocols ();
+ HiiDatabase = gIfrLibHiiDatabase;
+
+ //
+ // Get the orginal package list
+ //
+ 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)) {
+ gBS->FreePool (HiiPackageList);
+ return Status;
+ }
+ }
+
+ //
+ // Calculate and allocate space for retrieval of IFR data
+ //
+ BufferSize += Data->Offset;
+ UpdateBuffer = EfiLibAllocateZeroPool (BufferSize);
+ if (UpdateBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ UpdateBufferPos = (UINT8 *) UpdateBuffer;
+
+ //
+ // copy the package list header
+ //
+ EfiCopyMem (UpdateBufferPos, HiiPackageList, sizeof (EFI_HII_PACKAGE_LIST_HEADER));
+ UpdateBufferPos += sizeof (EFI_HII_PACKAGE_LIST_HEADER);
+
+ Updated = FALSE;
+ for (Index = 0; ; Index++) {
+ Status = GetPackageDataFromPackageList (HiiPackageList, Index, &PackageLength, &Package);
+ if (Status == EFI_SUCCESS) {
+ EfiCopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
+ if ((PackageHeader.Type == EFI_HII_PACKAGE_FORM) && !Updated) {
+ Status = UpdateFormPackageData (FormSetGuid, FormId, Package, PackageLength, Label, Insert, Data, (UINT8 **)&TempBuffer, &TempBufferSize);
+ if (!EFI_ERROR(Status)) {
+ if (FormSetGuid == NULL) {
+ Updated = TRUE;
+ }
+ EfiCopyMem (UpdateBufferPos, TempBuffer, TempBufferSize);
+ UpdateBufferPos += TempBufferSize;
+ gBS->FreePool (TempBuffer);
+ continue;
+ }
+ }
+
+ EfiCopyMem (UpdateBufferPos, Package, PackageLength);
+ UpdateBufferPos += PackageLength;
+ } else if (Status == EFI_NOT_FOUND) {
+ break;
+ } else {
+ gBS->FreePool (HiiPackageList);
+ return Status;
+ }
+ }
+
+ //
+ // Update package list length
+ //
+ BufferSize = UpdateBufferPos - (UINT8 *) UpdateBuffer;
+ EfiCopyMem (&UpdateBuffer->PackageLength, &BufferSize, sizeof (UINT32));
+
+ gBS->FreePool (HiiPackageList);
+
+ return HiiDatabase->UpdatePackageList (HiiDatabase, Handle, UpdateBuffer);
+}
+
+EFI_STATUS
+IfrLibCreatePopUp (
+ IN UINTN NumberOfLines,
+ OUT EFI_INPUT_KEY *KeyValue,
+ IN CHAR16 *String,
+ ...
+ )
+/*++
+
+Routine Description:
+ Draw a dialog and return the selected key.
+
+Arguments:
+ NumberOfLines - The number of lines for the dialog box
+ KeyValue - The EFI_KEY value returned if HotKey is TRUE..
+ String - Pointer to the first string in the list
+ ... - A series of (quantity == NumberOfLines) text strings which
+ will be used to construct the dialog box
+
+Returns:
+ EFI_SUCCESS - Displayed dialog and received user interaction
+ EFI_INVALID_PARAMETER - One of the parameters was invalid.
+
+--*/
+{
+ UINTN Index;
+ UINTN Count;
+ UINTN Start;
+ UINTN End;
+ UINTN Top;
+ UINTN Bottom;
+ CHAR16 *StringPtr;
+ UINTN LeftColumn;
+ UINTN RightColumn;
+ UINTN TopRow;
+ UINTN BottomRow;
+ UINTN DimensionsWidth;
+ UINTN DimensionsHeight;
+ VA_LIST Marker;
+ EFI_INPUT_KEY Key;
+ UINTN LargestString;
+ CHAR16 *StackString;
+ EFI_STATUS Status;
+ UINTN StringLen;
+ CHAR16 *LineBuffer;
+ CHAR16 **StringArray;
+ EFI_EVENT TimerEvent;
+ EFI_EVENT WaitList[2];
+ UINTN CurrentAttribute;
+ EFI_SIMPLE_TEXT_OUT_PROTOCOL *ConOut;
+
+ if ((KeyValue == NULL) || (String == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ TopRow = 0;
+ BottomRow = 0;
+ LeftColumn = 0;
+ RightColumn = 0;
+
+ ConOut = gST->ConOut;
+ ConOut->QueryMode (ConOut, ConOut->Mode->Mode, &RightColumn, &BottomRow);
+
+ DimensionsWidth = RightColumn - LeftColumn;
+ DimensionsHeight = BottomRow - TopRow;
+
+ CurrentAttribute = ConOut->Mode->Attribute;
+
+ LineBuffer = EfiLibAllocateZeroPool (DimensionsWidth * sizeof (CHAR16));
+ ASSERT (LineBuffer != NULL);
+
+ //
+ // Determine the largest string in the dialog box
+ // Notice we are starting with 1 since String is the first string
+ //
+ StringArray = EfiLibAllocateZeroPool (NumberOfLines * sizeof (CHAR16 *));
+ LargestString = EfiStrLen (String);
+ StringArray[0] = String;
+
+ VA_START (Marker, String);
+ for (Index = 1; Index < NumberOfLines; Index++) {
+ StackString = VA_ARG (Marker, CHAR16 *);
+
+ if (StackString == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ StringArray[Index] = StackString;
+ StringLen = EfiStrLen (StackString);
+ if (StringLen > LargestString) {
+ LargestString = StringLen;
+ }
+ }
+
+ if ((LargestString + 2) > DimensionsWidth) {
+ LargestString = DimensionsWidth - 2;
+ }
+
+ //
+ // Subtract the PopUp width from total Columns, allow for one space extra on
+ // each end plus a border.
+ //
+ Start = (DimensionsWidth - LargestString - 2) / 2 + LeftColumn + 1;
+ End = Start + LargestString + 1;
+
+ Top = ((DimensionsHeight - NumberOfLines - 2) / 2) + TopRow - 1;
+ Bottom = Top + NumberOfLines + 2;
+
+ //
+ // Disable cursor
+ //
+ ConOut->EnableCursor (ConOut, FALSE);
+ ConOut->SetAttribute (ConOut, EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE);
+
+ StringPtr = &LineBuffer[0];
+ *StringPtr++ = BOXDRAW_DOWN_RIGHT;
+ for (Index = 0; Index < LargestString; Index++) {
+ *StringPtr++ = BOXDRAW_HORIZONTAL;
+ }
+ *StringPtr++ = BOXDRAW_DOWN_LEFT;
+ *StringPtr = L'\0';
+
+ ConOut->SetCursorPosition (ConOut, Start, Top);
+ ConOut->OutputString (ConOut, LineBuffer);
+
+ for (Index = 0; Index < NumberOfLines; Index++) {
+ StringPtr = &LineBuffer[0];
+ *StringPtr++ = BOXDRAW_VERTICAL;
+
+ for (Count = 0; Count < LargestString; Count++) {
+ StringPtr[Count] = L' ';
+ }
+
+ StringLen = EfiStrLen (StringArray[Index]);
+ if (StringLen > LargestString) {
+ StringLen = LargestString;
+ }
+ EfiCopyMem (
+ StringPtr + ((LargestString - StringLen) / 2),
+ StringArray[Index],
+ StringLen * sizeof (CHAR16)
+ );
+ StringPtr += LargestString;
+
+ *StringPtr++ = BOXDRAW_VERTICAL;
+ *StringPtr = L'\0';
+
+ ConOut->SetCursorPosition (ConOut, Start, Top + 1 + Index);
+ ConOut->OutputString (ConOut, LineBuffer);
+ }
+
+ StringPtr = &LineBuffer[0];
+ *StringPtr++ = BOXDRAW_UP_RIGHT;
+ for (Index = 0; Index < LargestString; Index++) {
+ *StringPtr++ = BOXDRAW_HORIZONTAL;
+ }
+ *StringPtr++ = BOXDRAW_UP_LEFT;
+ *StringPtr = L'\0';
+
+ ConOut->SetCursorPosition (ConOut, Start, Top + NumberOfLines + 1);
+ ConOut->OutputString (ConOut, LineBuffer);
+
+ do {
+ Status = gBS->CreateEvent (EFI_EVENT_TIMER, 0, NULL, NULL, &TimerEvent);
+
+ //
+ // Set a timer event of 1 second expiration
+ //
+ gBS->SetTimer (
+ TimerEvent,
+ TimerRelative,
+ 10000000
+ );
+
+ //
+ // Wait for the keystroke event or the timer
+ //
+ WaitList[0] = gST->ConIn->WaitForKey;
+ WaitList[1] = TimerEvent;
+ Status = gBS->WaitForEvent (2, WaitList, &Index);
+
+ //
+ // Check for the timer expiration
+ //
+ if (!EFI_ERROR (Status) && Index == 1) {
+ Status = EFI_TIMEOUT;
+ }
+
+ gBS->CloseEvent (TimerEvent);
+ } while (Status == EFI_TIMEOUT);
+
+ Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
+ EfiCopyMem (KeyValue, &Key, sizeof (EFI_INPUT_KEY));
+
+ ConOut->SetAttribute (ConOut, CurrentAttribute);
+ ConOut->EnableCursor (ConOut, TRUE);
+
+ return Status;
+}
+
+EFI_STATUS
+ExtractDefault(
+ IN VOID *Buffer,
+ IN UINTN *BufferSize,
+ UINTN Number,
+ ...
+ )
+/*++
+
+ Routine Description:
+
+ Configure the buffer accrording to ConfigBody strings.
+
+ Arguments:
+ DefaultId - the ID of default.
+ Buffer - the start address of buffer.
+ BufferSize - the size of buffer.
+ Number - the number of the strings.
+
+ Returns:
+ EFI_BUFFER_TOO_SMALL - the BufferSize is too small to operate.
+ EFI_INVALID_PARAMETER - Buffer is NULL or BufferSize is 0.
+ EFI_SUCCESS - Operation successful.
+
+--*/
+{
+ VA_LIST Args;
+ UINTN Index;
+ UINT32 TotalLen;
+ UINT8 *BufCfgArray;
+ UINT8 *BufferPos;
+ UINT16 Offset;
+ UINT16 Width;
+ UINT8 *Value;
+
+ if ((Buffer == NULL) || (BufferSize == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Offset = 0;
+ Width = 0;
+ Value = NULL;
+
+ VA_START (Args, Number);
+ for (Index = 0; Index < Number; Index++) {
+ BufCfgArray = (UINT8 *) VA_ARG (Args, VOID *);
+ EfiCopyMem (&TotalLen, BufCfgArray, sizeof (UINT32));
+ BufferPos = BufCfgArray + sizeof (UINT32);
+
+ while ((UINT32)(BufferPos - BufCfgArray) < TotalLen) {
+ EfiCopyMem (&Offset, BufferPos, sizeof (UINT16));
+ BufferPos += sizeof (UINT16);
+ EfiCopyMem (&Width, BufferPos, sizeof (UINT16));
+ BufferPos += sizeof (UINT16);
+ Value = BufferPos;
+ BufferPos += Width;
+
+ if ((UINTN)(Offset + Width) > *BufferSize) {
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ EfiCopyMem ((UINT8 *)Buffer + Offset, Value, Width);
+ }
+ }
+ VA_END (Args);
+
+ *BufferSize = (UINTN)Offset;
+
+ return EFI_SUCCESS;
+}
+
+STATIC
+VOID
+SwapBuffer (
+ IN OUT UINT8 *Buffer,
+ IN UINTN BufferSize
+ )
+/*++
+
+Routine Description:
+ Swap bytes in the buffer.
+
+Arguments:
+ Buffer - Binary buffer.
+ BufferSize - Size of the buffer in bytes.
+
+Returns:
+ None.
+
+--*/
+{
+ UINTN Index;
+ UINT8 Temp;
+ UINTN SwapCount;
+
+ SwapCount = (BufferSize - 1) / 2;
+ for (Index = 0; Index < SwapCount; Index++) {
+ Temp = Buffer[Index];
+ Buffer[Index] = Buffer[BufferSize - 1 - Index];
+ Buffer[BufferSize - 1 - Index] = Temp;
+ }
+}
+
+EFI_STATUS
+BufferToHexString (
+ IN OUT CHAR16 *Str,
+ IN UINT8 *Buffer,
+ IN UINTN BufferSize
+ )
+/*++
+
+Routine Description:
+ Converts binary buffer to Unicode string in reversed byte order from BufToHexString().
+
+Arguments:
+ Str - String for output
+ Buffer - Binary buffer.
+ BufferSize - Size of the buffer in bytes.
+
+Returns:
+ EFI_SUCCESS - The function completed successfully.
+
+--*/
+{
+ EFI_STATUS Status;
+ UINT8 *NewBuffer;
+ UINTN StrBufferLen;
+
+ NewBuffer = EfiLibAllocateCopyPool (BufferSize, Buffer);
+ SwapBuffer (NewBuffer, BufferSize);
+
+ StrBufferLen = (BufferSize + 1) * sizeof (CHAR16);
+ Status = BufToHexString (Str, &StrBufferLen, NewBuffer, BufferSize);
+
+ gBS->FreePool (NewBuffer);
+
+ return Status;
+}
+
+EFI_STATUS
+HexStringToBuffer (
+ IN OUT UINT8 *Buffer,
+ IN OUT UINTN *BufferSize,
+ IN CHAR16 *Str
+ )
+/*++
+
+Routine Description:
+ Converts Hex String to binary buffer in reversed byte order from HexStringToBuf().
+
+Arguments:
+ Buffer - Pointer to buffer that receives the data.
+ BufferSize - Length in bytes of the buffer to hold converted data.
+ If routine return with EFI_SUCCESS, containing length of converted data.
+ If routine return with EFI_BUFFER_TOO_SMALL, containg length of buffer desired.
+ Str - String to be converted from.
+
+Returns:
+ EFI_SUCCESS - The function completed successfully.
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN ConvertedStrLen;
+
+ ConvertedStrLen = 0;
+ Status = HexStringToBuf (Buffer, BufferSize, Str, &ConvertedStrLen);
+ if (!EFI_ERROR (Status)) {
+ SwapBuffer (Buffer, ConvertedStrLen);
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+ConstructConfigHdr (
+ IN OUT CHAR16 *ConfigHdr,
+ IN OUT UINTN *StrBufferLen,
+ IN EFI_GUID *Guid,
+ IN CHAR16 *Name, OPTIONAL
+ IN EFI_HANDLE *DriverHandle
+ )
+/*++
+
+Routine Description:
+ Construct <ConfigHdr> using routing information GUID/NAME/PATH.
+
+Arguments:
+ ConfigHdr - Pointer to the ConfigHdr string.
+ StrBufferLen - On input: Length in bytes of buffer to hold the ConfigHdr string.
+ Includes tailing '\0' character.
+ On output:
+ If return EFI_SUCCESS, containing length of ConfigHdr string buffer.
+ If return EFI_BUFFER_TOO_SMALL, containg length of string buffer desired.
+ Guid - Routing information: GUID.
+ Name - Routing information: NAME.
+ DriverHandle - Driver handle which contains the routing information: PATH.
+
+Returns:
+ EFI_SUCCESS - Routine success.
+ EFI_BUFFER_TOO_SMALL - The ConfigHdr string buffer is too small.
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN NameStrLen;
+ UINTN DevicePathSize;
+ UINTN BufferSize;
+ CHAR16 *StrPtr;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ if (Name == NULL) {
+ //
+ // There will be no "NAME" in <ConfigHdr> for Name/Value storage
+ //
+ NameStrLen = 0;
+ } else {
+ //
+ // For buffer storage
+ //
+ NameStrLen = EfiStrLen (Name);
+ }
+
+ //
+ // Retrieve DevicePath Protocol associated with this HiiPackageList
+ //
+ Status = gBS->HandleProtocol (
+ DriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &DevicePath
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ DevicePathSize = EfiDevicePathSize (DevicePath);
+
+ //
+ // GUID=<HexCh>32&NAME=<Alpha>NameStrLen&PATH=<HexChar>DevicePathStrLen <NULL>
+ // | 5 | 32 | 6 | NameStrLen | 6 | DevicePathStrLen |
+ //
+ BufferSize = (5 + 32 + 6 + NameStrLen + 6 + DevicePathSize * 2 + 1) * sizeof (CHAR16);
+ if (*StrBufferLen < BufferSize) {
+ *StrBufferLen = BufferSize;
+ return EFI_BUFFER_TOO_SMALL;
+ }
+
+ *StrBufferLen = BufferSize;
+
+ StrPtr = ConfigHdr;
+
+ EfiStrCpy (StrPtr, L"GUID=");
+ StrPtr += 5;
+ BufferToHexString (StrPtr, (UINT8 *) Guid, sizeof (EFI_GUID));
+ StrPtr += 32;
+
+ EfiStrCpy (StrPtr, L"&NAME=");
+ StrPtr += 6;
+ if (Name != NULL) {
+ EfiStrCpy (StrPtr, Name);
+ StrPtr += NameStrLen;
+ }
+
+ EfiStrCpy (StrPtr, L"&PATH=");
+ StrPtr += 6;
+ BufferToHexString (StrPtr, (UINT8 *) DevicePath, DevicePathSize);
+
+ return EFI_SUCCESS;
+}
+
+BOOLEAN
+FindBlockName (
+ IN OUT CHAR16 *String,
+ UINTN Offset,
+ UINTN Width
+ )
+/*++
+
+Routine Description:
+ Search BlockName "&OFFSET=Offset&WIDTH=Width" in a string.
+
+Arguments:
+ String - The string to be searched in.
+ Offset - Offset in BlockName.
+ Width - Width in BlockName.
+
+Returns:
+ TRUE - Block name found.
+ FALSE - Block name not found.
+
+--*/
+{
+ EFI_STATUS Status;
+ UINTN Data;
+ UINTN BufferSize;
+ UINTN ConvertedStrLen;
+
+ while ((String = EfiStrStr (String, L"&OFFSET=")) != NULL) {
+ //
+ // Skip '&OFFSET='
+ //
+ String = String + 8;
+
+ Data = 0;
+ BufferSize = sizeof (UINTN);
+ Status = HexStringToBuf ((UINT8 *) &Data, &BufferSize, String, &ConvertedStrLen);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+ String = String + ConvertedStrLen;
+
+ if (Data != Offset) {
+ continue;
+ }
+
+ if (EfiStrnCmp (String, L"&WIDTH=", 7) != 0) {
+ return FALSE;
+ }
+ String = String + 7;
+
+ Data = 0;
+ BufferSize = sizeof (UINTN);
+ Status = HexStringToBuf ((UINT8 *) &Data, &BufferSize, String, &ConvertedStrLen);
+ if (EFI_ERROR (Status)) {
+ return FALSE;
+ }
+ if (Data == Width) {
+ return TRUE;
+ }
+
+ String = String + ConvertedStrLen;
+ }
+
+ return FALSE;
+}
+
+EFI_STATUS
+GetBrowserData (
+ EFI_GUID *VariableGuid, OPTIONAL
+ CHAR16 *VariableName, OPTIONAL
+ UINTN *BufferSize,
+ UINT8 *Buffer
+ )
+/*++
+
+Routine Description:
+ This routine is invoked by ConfigAccess.Callback() to retrived uncommitted data from Form Browser.
+
+Arguments:
+ VariableGuid - An optional field to indicate the target variable GUID name to use.
+ VariableName - An optional field to indicate the target human-readable variable name.
+ BufferSize - On input: Length in bytes of buffer to hold retrived data.
+ On output:
+ If return EFI_BUFFER_TOO_SMALL, containg length of buffer desired.
+ Buffer - Buffer to hold retrived data.
+
+Returns:
+ EFI_SUCCESS - Routine success.
+ EFI_BUFFER_TOO_SMALL - The intput buffer is too small.
+
+--*/
+{
+ EFI_STATUS Status;
+ CHAR16 *ConfigHdr;
+ CHAR16 *ConfigResp;
+ CHAR16 *StringPtr;
+ UINTN HeaderLen;
+ UINTN BufferLen;
+ CHAR16 *Progress;
+ EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
+
+ //
+ // Locate protocols for use
+ //
+ Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, &FormBrowser2);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, &HiiConfigRouting);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Retrive formset storage data from Form Browser
+ //
+ ConfigHdr = mFakeConfigHdr;
+ HeaderLen = EfiStrLen (ConfigHdr);
+
+ BufferLen = 0x4000;
+ ConfigResp = EfiLibAllocateZeroPool (BufferLen + HeaderLen);
+
+ StringPtr = ConfigResp + HeaderLen;
+ *StringPtr = L'&';
+ StringPtr++;
+
+ Status = FormBrowser2->BrowserCallback (
+ FormBrowser2,
+ &BufferLen,
+ StringPtr,
+ TRUE,
+ VariableGuid,
+ VariableName
+ );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ gBS->FreePool (ConfigResp);
+ ConfigResp = EfiLibAllocateZeroPool (BufferLen + HeaderLen);
+
+ StringPtr = ConfigResp + HeaderLen;
+ *StringPtr = L'&';
+ StringPtr++;
+
+ Status = FormBrowser2->BrowserCallback (
+ FormBrowser2,
+ &BufferLen,
+ StringPtr,
+ TRUE,
+ VariableGuid,
+ VariableName
+ );
+ }
+ if (EFI_ERROR (Status)) {
+ gBS->FreePool (ConfigResp);
+ return Status;
+ }
+ EfiCopyMem (ConfigResp, ConfigHdr, HeaderLen * sizeof (UINT16));
+
+ //
+ // Convert <ConfigResp> to buffer data
+ //
+ Status = HiiConfigRouting->ConfigToBlock (
+ HiiConfigRouting,
+ ConfigResp,
+ Buffer,
+ BufferSize,
+ &Progress
+ );
+ gBS->FreePool (ConfigResp);
+
+ return Status;
+}
+
+EFI_STATUS
+SetBrowserData (
+ EFI_GUID *VariableGuid, OPTIONAL
+ CHAR16 *VariableName, OPTIONAL
+ UINTN BufferSize,
+ UINT8 *Buffer,
+ CHAR16 *RequestElement OPTIONAL
+ )
+/*++
+
+Routine Description:
+ This routine is invoked by ConfigAccess.Callback() to update uncommitted data of Form Browser.
+
+Arguments:
+ VariableGuid - An optional field to indicate the target variable GUID name to use.
+ VariableName - An optional field to indicate the target human-readable variable name.
+ BufferSize - Length in bytes of buffer to hold retrived data.
+ Buffer - Buffer to hold retrived data.
+ RequestElement - An optional field to specify which part of the buffer data
+ will be send back to Browser. If NULL, the whole buffer of
+ data will be committed to Browser.
+ <RequestElement> ::= &OFFSET=<Number>&WIDTH=<Number>*
+
+Returns:
+ EFI_SUCCESS - Routine success.
+ Other - Updating Browser uncommitted data failed.
+
+--*/
+{
+ EFI_STATUS Status;
+ CHAR16 *ConfigHdr;
+ CHAR16 *ConfigResp;
+ CHAR16 *StringPtr;
+ UINTN HeaderLen;
+ UINTN BufferLen;
+ CHAR16 *Progress;
+ EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
+ CHAR16 BlockName[33];
+ CHAR16 *ConfigRequest;
+ CHAR16 *Request;
+
+ //
+ // Locate protocols for use
+ //
+ Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, &FormBrowser2);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, &HiiConfigRouting);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Prepare <ConfigRequest>
+ //
+ ConfigHdr = mFakeConfigHdr;
+ HeaderLen = EfiStrLen (ConfigHdr);
+
+ if (RequestElement == NULL) {
+ //
+ // RequestElement not specified, use "&OFFSET=0&WIDTH=<BufferSize>" as <BlockName>
+ //
+ BlockName[0] = L'\0';
+ EfiStrCpy (BlockName, L"&OFFSET=0&WIDTH=");
+
+ //
+ // String lenghth of L"&OFFSET=0&WIDTH=" is 16
+ //
+ StringPtr = BlockName + 16;
+ BufferLen = sizeof (BlockName) - (16 * sizeof (CHAR16));
+ BufToHexString (StringPtr, &BufferLen, (UINT8 *) &BufferSize, sizeof (UINTN));
+
+ Request = BlockName;
+ } else {
+ Request = RequestElement;
+ }
+
+ BufferLen = HeaderLen * sizeof (CHAR16) + EfiStrSize (Request);
+ ConfigRequest = EfiLibAllocateZeroPool (BufferLen);
+
+ EfiCopyMem (ConfigRequest, ConfigHdr, HeaderLen * sizeof (CHAR16));
+ StringPtr = ConfigRequest + HeaderLen;
+ EfiStrCpy (StringPtr, Request);
+
+ //
+ // Convert buffer to <ConfigResp>
+ //
+ Status = HiiConfigRouting->BlockToConfig (
+ HiiConfigRouting,
+ ConfigRequest,
+ Buffer,
+ BufferSize,
+ &ConfigResp,
+ &Progress
+ );
+ if (EFI_ERROR (Status)) {
+ gBS->FreePool (ConfigResp);
+ return Status;
+ }
+
+ //
+ // Skip <ConfigHdr> and '&'
+ //
+ StringPtr = ConfigResp + HeaderLen + 1;
+
+ //
+ // Change uncommitted data in Browser
+ //
+ Status = FormBrowser2->BrowserCallback (
+ FormBrowser2,
+ &BufferSize,
+ StringPtr,
+ FALSE,
+ NULL,
+ NULL
+ );
+ gBS->FreePool (ConfigResp);
+ return Status;
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrLibrary.h b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrLibrary.h new file mode 100644 index 0000000000..9c65215724 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrLibrary.h @@ -0,0 +1,1127 @@ +/*++
+
+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:
+
+ UefiIfrLibrary.h
+
+Abstract:
+
+ The file contain all library function for Ifr Operations.
+
+--*/
+
+#ifndef _IFRLIBRARY_H
+#define _IFRLIBRARY_H
+
+#include "Tiano.h"
+#include "EfiDriverLib.h"
+#include "TianoHii.h"
+
+#include EFI_PROTOCOL_DEFINITION (HiiFont)
+#include EFI_PROTOCOL_DEFINITION (HiiImage)
+#include EFI_PROTOCOL_DEFINITION (HiiString)
+#include EFI_PROTOCOL_DEFINITION (HiiDatabase)
+#include EFI_PROTOCOL_DEFINITION (HiiConfigRouting)
+#include EFI_PROTOCOL_DEFINITION (HiiConfigAccess)
+#include EFI_PROTOCOL_DEFINITION (FormBrowser2)
+#include EFI_PROTOCOL_DEFINITION (SimpleTextOut)
+
+#include EFI_GUID_DEFINITION (GlobalVariable)
+
+#define IFR_LIB_DEFAULT_STRING_SIZE 0x200
+
+//
+// The architectural variable "Lang" and "LangCodes" are deprecated in UEFI
+// specification. While, UEFI specification also states that these deprecated
+// variables may be provided for backwards compatibility.
+// If "LANG_SUPPORT" is defined, "Lang" and "LangCodes" will be produced;
+// If "LANG_SUPPORT" is undefined, "Lang" and "LangCodes" will not be produced.
+//
+#define LANG_SUPPORT
+
+#define EFI_LANGUAGE_VARIABLE L"Lang"
+#define EFI_LANGUAGE_CODES_VARIABLE L"LangCodes"
+
+#define UEFI_LANGUAGE_VARIABLE L"PlatformLang"
+#define UEFI_LANGUAGE_CODES_VARIABLE L"PlatformLangCodes"
+
+//
+// Limited buffer size recommended by RFC4646 (4.3. Length Considerations)
+// (42 characters plus a NULL terminator)
+//
+#define RFC_3066_ENTRY_SIZE (42 + 1)
+#define ISO_639_2_ENTRY_SIZE 3
+
+#define INVALID_VARSTORE_ID 0
+
+#define QUESTION_FLAGS (EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_OPTIONS_ONLY)
+#define QUESTION_FLAGS_MASK (~QUESTION_FLAGS)
+
+extern EFI_GUID mIfrVendorGuid;
+extern EFI_HII_DATABASE_PROTOCOL *gIfrLibHiiDatabase;
+extern EFI_HII_STRING_PROTOCOL *gIfrLibHiiString;
+
+#pragma pack(1)
+typedef struct {
+ EFI_STRING_ID StringToken;
+ EFI_IFR_TYPE_VALUE Value;
+ UINT8 Flags;
+} IFR_OPTION;
+#pragma pack()
+
+typedef struct {
+ VENDOR_DEVICE_PATH VendorDevicePath;
+ UINT32 MonotonicCount;
+} HII_VENDOR_DEVICE_PATH_NODE;
+
+typedef struct {
+ HII_VENDOR_DEVICE_PATH_NODE Node;
+ EFI_DEVICE_PATH_PROTOCOL End;
+} HII_VENDOR_DEVICE_PATH;
+
+typedef struct {
+ //
+ // Buffer size allocated for Data.
+ //
+ UINT32 BufferSize;
+
+ //
+ // Offset in Data to append the newly created opcode binary.
+ // It will be adjusted automatically in Create***OpCode(), and should be
+ // initialized to 0 before invocation of a serial of Create***OpCode()
+ //
+ UINT32 Offset;
+
+ //
+ // The destination buffer for created op-codes
+ //
+ UINT8 *Data;
+} EFI_HII_UPDATE_DATA;
+
+VOID
+LocateHiiProtocols (
+ VOID
+ )
+/*++
+
+Routine Description:
+ This function locate Hii relative protocols for later usage.
+
+Arguments:
+ None.
+
+Returns:
+ None.
+
+--*/
+;
+
+//
+// Exported Library functions
+//
+EFI_STATUS
+CreateEndOpCode (
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+/*++
+
+Routine Description:
+ Create EFI_IFR_END_OP opcode.
+
+Arguments:
+ Data - Destination for the created opcode binary
+
+Returns:
+ EFI_SUCCESS - Opcode create success
+
+--*/
+;
+
+EFI_STATUS
+CreateDefaultOpCode (
+ IN EFI_IFR_TYPE_VALUE *Value,
+ IN UINT8 Type,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+/*++
+
+Routine Description:
+ Create EFI_IFR_DEFAULT_OP opcode.
+
+Arguments:
+ Value - Value for the default
+ Type - Type for the default
+ Data - Destination for the created opcode binary
+
+Returns:
+ EFI_SUCCESS - Opcode create 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
+ )
+/*++
+
+Routine Description:
+ Create EFI_IFR_ACTION_OP opcode.
+
+Arguments:
+ QuestionId - Question ID
+ Prompt - String ID for Prompt
+ Help - String ID for Help
+ QuestionFlags - Flags in Question Header
+ QuestionConfig - String ID for configuration
+ Data - Destination for the created opcode binary
+
+Returns:
+ EFI_SUCCESS - Opcode create 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
+ )
+/*++
+
+Routine Description:
+ Create EFI_IFR_SUBTITLE_OP opcode.
+
+Arguments:
+ Prompt - String ID for Prompt
+ Help - String ID for Help
+ Flags - Subtitle opcode flags
+ Scope - Subtitle Scope bit
+ Data - Destination for the created opcode binary
+
+Returns:
+ EFI_SUCCESS - Opcode create 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
+ )
+/*++
+
+Routine Description:
+ Create EFI_IFR_TEXT_OP opcode.
+
+Arguments:
+ Prompt - String ID for Prompt
+ Help - String ID for Help
+ TextTwo - String ID for text two
+ Data - Destination for the created opcode binary
+
+Returns:
+ EFI_SUCCESS - Opcode create 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
+ )
+/*++
+
+Routine Description:
+ Create EFI_IFR_REF_OP opcode.
+
+Arguments:
+ FormId - Destination Form ID
+ Prompt - String ID for Prompt
+ Help - String ID for Help
+ QuestionFlags - Flags in Question Header
+ QuestionId - Question ID
+ Data - Destination for the created opcode binary
+
+Returns:
+ EFI_SUCCESS - Opcode create success
+
+--*/
+;
+
+EFI_STATUS
+CreateOneOfOptionOpCode (
+ IN UINTN OptionCount,
+ IN IFR_OPTION *OptionsList,
+ IN UINT8 Type,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+;
+
+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
+ )
+/*++
+
+Routine Description:
+ Create EFI_IFR_ONE_OF_OP opcode.
+
+Arguments:
+ QuestionId - Question ID
+ VarStoreId - Storage ID
+ VarOffset - Offset in Storage
+ Prompt - String ID for Prompt
+ Help - String ID for Help
+ QuestionFlags - Flags in Question Header
+ OneOfFlags - Flags for oneof opcode
+ OptionsList - List of options
+ OptionCount - Number of options in option list
+ Data - Destination for the created opcode binary
+
+Returns:
+ EFI_SUCCESS - Opcode create 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 Flags,
+ IN UINT8 DataType,
+ IN UINT8 MaxContainers,
+ IN IFR_OPTION *OptionsList,
+ IN UINTN OptionCount,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+/*++
+
+Routine Description:
+ Create EFI_IFR_ORDERED_LIST_OP opcode.
+
+Arguments:
+ QuestionId - Question ID
+ VarStoreId - Storage ID
+ VarOffset - Offset in Storage
+ Prompt - String ID for Prompt
+ Help - String ID for Help
+ QuestionFlags - Flags in Question Header
+ Flags - Flags for ordered list opcode
+ DataType - Type for option value
+ MaxContainers - Maximum count for options in this ordered list
+ OptionsList - List of options
+ OptionCount - Number of options in option list
+ Data - Destination for the created opcode binary
+
+Returns:
+ EFI_SUCCESS - Opcode create 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
+ )
+/*++
+
+Routine Description:
+ Create EFI_IFR_CHECKBOX_OP opcode.
+
+Arguments:
+ QuestionId - Question ID
+ VarStoreId - Storage ID
+ VarOffset - Offset in Storage
+ Prompt - String ID for Prompt
+ Help - String ID for Help
+ QuestionFlags - Flags in Question Header
+ CheckBoxFlags - Flags for checkbox opcode
+ Data - Destination for the created opcode binary
+
+Returns:
+ EFI_SUCCESS - Opcode create 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
+ )
+/*++
+
+Routine Description:
+ Create EFI_IFR_NUMERIC_OP opcode.
+
+Arguments:
+ QuestionId - Question ID
+ VarStoreId - Storage ID
+ VarOffset - Offset in Storage
+ Prompt - String ID for Prompt
+ Help - String ID for Help
+ QuestionFlags - Flags in Question Header
+ NumericFlags - Flags for numeric opcode
+ Minimum - Numeric minimum value
+ Maximum - Numeric maximum value
+ Step - Numeric step for edit
+ Default - Numeric default value
+ Data - Destination for the created opcode binary
+
+Returns:
+ EFI_SUCCESS - Opcode create 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
+ )
+/*++
+
+Routine Description:
+ Create EFI_IFR_STRING_OP opcode.
+
+Arguments:
+ QuestionId - Question ID
+ VarStoreId - Storage ID
+ VarOffset - Offset in Storage
+ Prompt - String ID for Prompt
+ Help - String ID for Help
+ QuestionFlags - Flags in Question Header
+ StringFlags - Flags for string opcode
+ MinSize - String minimum length
+ MaxSize - String maximum length
+ Data - Destination for the created opcode binary
+
+Returns:
+ EFI_SUCCESS - Opcode create success
+
+--*/
+;
+
+EFI_STATUS
+CreateBannerOpCode (
+ IN EFI_STRING_ID Title,
+ IN UINT16 LineNumber,
+ IN UINT8 Alignment,
+ IN OUT EFI_HII_UPDATE_DATA *Data
+ )
+/*++
+
+Routine Description:
+ Create GUIDed opcode for banner.
+
+Arguments:
+ Title - String ID for title
+ LineNumber - Line number for this banner
+ Alignment - Alignment for this banner, left, center or right
+ Data - Destination for the created opcode binary
+
+Returns:
+ EFI_SUCCESS - Opcode create success
+
+--*/
+;
+
+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.
+
+--*/
+;
+
+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
+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_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
+ExtractDefault(
+ IN VOID *Buffer,
+ IN UINTN *BufferSize,
+ UINTN Number,
+ ...
+ )
+/*++
+
+ Routine Description:
+ Configure the buffer accrording to ConfigBody strings.
+
+ Arguments:
+ DefaultId - the ID of default.
+ Buffer - the start address of buffer.
+ BufferSize - the size of buffer.
+ Number - the number of the strings.
+
+ Returns:
+ EFI_BUFFER_TOO_SMALL - the BufferSize is too small to operate.
+ EFI_INVALID_PARAMETER - Buffer is NULL or BufferSize is 0.
+ EFI_SUCCESS - Operation successful.
+
+--*/
+;
+
+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
+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
+BufferToHexString (
+ IN OUT CHAR16 *Str,
+ IN UINT8 *Buffer,
+ IN UINTN BufferSize
+ )
+/*++
+
+Routine Description:
+ Converts binary buffer to Unicode string in reversed byte order to BufToHexString().
+
+Arguments:
+ Str - String for output
+ Buffer - Binary buffer.
+ BufferSize - Size of the buffer in bytes.
+
+Returns:
+ EFI_SUCCESS - The function completed successfully.
+
+--*/
+;
+
+EFI_STATUS
+HexStringToBuffer (
+ IN OUT UINT8 *Buffer,
+ IN OUT UINTN *BufferSize,
+ IN CHAR16 *Str
+ )
+/*++
+
+Routine Description:
+ Converts Hex String to binary buffer in reversed byte order to HexStringToBuf().
+
+Arguments:
+ Buffer - Pointer to buffer that receives the data.
+ BufferSize - Length in bytes of the buffer to hold converted data.
+ If routine return with EFI_SUCCESS, containing length of converted data.
+ If routine return with EFI_BUFFER_TOO_SMALL, containg length of buffer desired.
+ Str - String to be converted from.
+
+Returns:
+ EFI_SUCCESS - The function completed successfully.
+
+--*/
+;
+
+EFI_STATUS
+ConstructConfigHdr (
+ IN OUT CHAR16 *ConfigHdr,
+ IN OUT UINTN *StrBufferLen,
+ IN EFI_GUID *Guid,
+ IN CHAR16 *Name, OPTIONAL
+ IN EFI_HANDLE *DriverHandle
+ )
+/*++
+
+Routine Description:
+ Construct <ConfigHdr> using routing information GUID/NAME/PATH.
+
+Arguments:
+ ConfigHdr - Pointer to the ConfigHdr string.
+ StrBufferLen - On input: Length in bytes of buffer to hold the ConfigHdr string. Includes tailing '\0' character.
+ On output:
+ If return EFI_SUCCESS, containing length of ConfigHdr string buffer.
+ If return EFI_BUFFER_TOO_SMALL, containg length of string buffer desired.
+ Guid - Routing information: GUID.
+ Name - Routing information: NAME.
+ DriverHandle - Driver handle which contains the routing information: PATH.
+
+Returns:
+ EFI_SUCCESS - Routine success.
+ EFI_BUFFER_TOO_SMALL - The ConfigHdr string buffer is too small.
+
+--*/
+;
+
+BOOLEAN
+FindBlockName (
+ IN OUT CHAR16 *String,
+ UINTN Offset,
+ UINTN Width
+ )
+/*++
+
+Routine Description:
+ Search BlockName "&OFFSET=Offset&WIDTH=Width" in a string.
+
+Arguments:
+ String - The string to be searched in.
+ Offset - Offset in BlockName.
+ Width - Width in BlockName.
+
+Returns:
+ TRUE - Block name found.
+ FALSE - Block name not found.
+
+--*/
+;
+
+EFI_STATUS
+GetBrowserData (
+ EFI_GUID *VariableGuid, OPTIONAL
+ CHAR16 *VariableName, OPTIONAL
+ UINTN *BufferSize,
+ UINT8 *Buffer
+ )
+/*++
+
+Routine Description:
+ This routine is invoked by ConfigAccess.Callback() to retrived uncommitted data from Form Browser.
+
+Arguments:
+ VariableGuid - An optional field to indicate the target variable GUID name to use.
+ VariableName - An optional field to indicate the target human-readable variable name.
+ BufferSize - On input: Length in bytes of buffer to hold retrived data.
+ On output:
+ If return EFI_BUFFER_TOO_SMALL, containg length of buffer desired.
+ Buffer - Buffer to hold retrived data.
+
+Returns:
+ EFI_SUCCESS - Routine success.
+ EFI_BUFFER_TOO_SMALL - The intput buffer is too small.
+
+--*/
+;
+
+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.
+
+--*/
+;
+
+EFI_STATUS
+SetBrowserData (
+ EFI_GUID *VariableGuid, OPTIONAL
+ CHAR16 *VariableName, OPTIONAL
+ UINTN BufferSize,
+ UINT8 *Buffer,
+ CHAR16 *RequestElement OPTIONAL
+ )
+/*++
+
+Routine Description:
+ This routine is invoked by ConfigAccess.Callback() to update uncommitted data of Form Browser.
+
+Arguments:
+ VariableGuid - An optional field to indicate the target variable GUID name to use.
+ VariableName - An optional field to indicate the target human-readable variable name.
+ BufferSize - Length in bytes of buffer to hold retrived data.
+ Buffer - Buffer to hold retrived data.
+ RequestElement - An optional field to specify which part of the buffer data
+ will be send back to Browser. If NULL, the whole buffer of
+ data will be committed to Browser.
+ <RequestElement> ::= &OFFSET=<Number>&WIDTH=<Number>*
+
+Returns:
+ EFI_SUCCESS - Routine success.
+ Other - Updating Browser uncommitted data failed.
+
+--*/
+;
+
+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.
+
+--*/
+;
+
+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.
+
+--*/
+;
+
+EFI_STATUS
+GetCurrentLanguage (
+ OUT CHAR8 *Lang
+ )
+/*++
+
+Routine Description:
+ Determine what is the current language setting
+
+Arguments:
+ Lang - Pointer of system language
+
+Returns:
+ Status code
+
+--*/
+;
+
+VOID
+GetNextLanguage (
+ IN OUT CHAR8 **LangCode,
+ OUT CHAR8 *Lang
+ )
+/*++
+
+Routine Description:
+ Get next language from language code list.
+
+Arguments:
+ LangCode - The language code.
+ Lang - Returned language.
+
+Returns:
+ None.
+
+--*/
+;
+
+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 M.
+
+Arguments:
+ HiiHandle - The HII package list handle.
+
+Returns:
+ The supported languages.
+
+--*/
+;
+
+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.
+
+--*/
+;
+
+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
+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
+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
+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
+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 current 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
+IfrLibCreatePopUp (
+ IN UINTN NumberOfLines,
+ OUT EFI_INPUT_KEY *KeyValue,
+ IN CHAR16 *String,
+ ...
+ )
+/*++
+
+Routine Description:
+ Draw a dialog and return the selected key.
+
+Arguments:
+ NumberOfLines - The number of lines for the dialog box
+ KeyValue - The EFI_KEY value returned if HotKey is TRUE..
+ String - Pointer to the first string in the list
+ ... - A series of (quantity == NumberOfLines) text strings which
+ will be used to construct the dialog box
+
+Returns:
+ EFI_SUCCESS - Displayed dialog and received user interaction
+ EFI_INVALID_PARAMETER - One of the parameters was invalid.
+
+--*/
+;
+
+EFI_STATUS
+IfrLibUpdateForm (
+ IN EFI_HII_HANDLE Handle,
+ IN EFI_GUID *FormSetGuid, OPTIONAL
+ IN EFI_FORM_ID FormId,
+ IN UINT16 Label,
+ IN BOOLEAN Insert,
+ IN EFI_HII_UPDATE_DATA *Data
+ )
+/*++
+
+Routine Description:
+ This function allows the caller to update a form that has
+ previously been registered with the EFI HII database.
+
+Arguments:
+ Handle - Hii Handle
+ FormSetGuid - The formset should be updated.
+ FormId - The form should be updated.
+ Label - Update information starting immediately after this label in the IFR
+ Insert - If TRUE and Data is not NULL, insert data after Label.
+ If FALSE, replace opcodes between two labels with Data.
+ Data - The adding data; If NULL, remove opcodes between two Label.
+
+Returns:
+ EFI_SUCCESS - Update success.
+ Other - Update fail.
+
+--*/
+;
+#endif
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrOpCodeCreation.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrOpCodeCreation.c new file mode 100644 index 0000000000..3729fa216f --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrOpCodeCreation.c @@ -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;
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrString.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrString.c new file mode 100644 index 0000000000..c2e57dd16b --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrString.c @@ -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 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;
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGlueDxeDriverEntryPoint.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGlueDxeDriverEntryPoint.c index d3e30df00f..28b8b6e29d 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGlueDxeDriverEntryPoint.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGlueDxeDriverEntryPoint.c @@ -84,21 +84,63 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverMode // NOTE: Limitation:
// 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__
VOID
+EFIAPI
__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__ (
IN EFI_EVENT Event,
IN VOID *Context
);
#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[] = {
+#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__
__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__,
#endif
+
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__
VOID
__EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__ (
@@ -120,6 +162,13 @@ RuntimeDriverExitBootServices ( 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[] = {
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
//
@@ -127,9 +176,15 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEve //
RuntimeDriverExitBootServices,
#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__
__EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__,
#endif
+
NULL
};
@@ -167,6 +222,7 @@ ProcessModuleUnloadList ( // Library constructors
//
VOID
+EFIAPI
ProcessLibraryConstructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -253,6 +309,7 @@ ProcessLibraryConstructorList ( // Library Destructors
//
VOID
+EFIAPI
ProcessLibraryDestructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -309,16 +366,15 @@ _DriverUnloadHandler ( //
// Close our ExitBootServices () notify function
//
+
+#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
if (_gDriverExitBootServicesEvent[0] != NULL) {
ASSERT (gBS != NULL);
Status = gBS->CloseEvent (_mDriverExitBootServicesNotifyEvent);
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);
}
@@ -352,6 +408,7 @@ Returns: --*/
{
+#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
EFI_EVENT_NOTIFY ChildNotifyEventHandler;
UINTN Index;
@@ -359,6 +416,7 @@ Returns: ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index];
ChildNotifyEventHandler (Event, NULL);
}
+#endif
}
EFI_DRIVER_ENTRY_POINT (_ModuleEntryPoint);
@@ -393,7 +451,6 @@ _ModuleEntryPoint ( )
{
EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
// if (_gUefiDriverRevision != 0) {
// //
@@ -414,6 +471,7 @@ _ModuleEntryPoint ( //
// Register our ExitBootServices () notify function
//
+#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
if (_gDriverExitBootServicesEvent[0] != NULL) {
Status = SystemTable->BootServices->CreateEvent (
EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,
@@ -425,17 +483,34 @@ _ModuleEntryPoint ( ASSERT_EFI_ERROR (Status);
}
+#endif
//
// Install unload handler...
//
- Status = SystemTable->BootServices->HandleProtocol (
- ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID **)&LoadedImage
- );
- ASSERT_EFI_ERROR (Status);
- LoadedImage->Unload = _DriverUnloadHandler;
+ //
+ // Add conditional macro to save size. The 4 macros check against
+ // potential functions which may be invoked, if there is no function
+ // to be called, we don't register Unload callback.
+ //
+#if ( defined(__EDKII_GLUE_MODULE_UNLOAD_HANDLER__) \
+ || 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
@@ -453,11 +528,13 @@ _ModuleEntryPoint ( //
// Close our ExitBootServices () notify function
//
+#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
if (_gDriverExitBootServicesEvent[0] != NULL) {
EFI_STATUS CloseEventStatus;
CloseEventStatus = SystemTable->BootServices->CloseEvent (_mDriverExitBootServicesNotifyEvent);
ASSERT_EFI_ERROR (CloseEventStatus);
}
+#endif
ProcessLibraryDestructorList (ImageHandle, SystemTable);
}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGluePeimEntryPoint.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGluePeimEntryPoint.c index b84c883978..f46228c9c7 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGluePeimEntryPoint.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGluePeimEntryPoint.c @@ -32,21 +32,13 @@ Abstract: // Library constructors
//
VOID
+EFIAPI
ProcessLibraryConstructorList (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
)
{
//
-// Declare "Status" if any of the following libraries are used
-//
-#if defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__) \
- || defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__) \
- || defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__)
- EFI_STATUS Status;
-#endif
-
-//
// EdkII Glue Library Constructors:
// PeiServicesTablePointerLib PeiServicesTablePointerLibConstructor()
// PeiServicesTablePointerLibMm7 PeiServicesTablePointerLibConstructor()
@@ -56,6 +48,8 @@ ProcessLibraryConstructorList ( #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;
+
Status = PeiServicesTablePointerLibConstructor (FfsHeader, PeiServices);
ASSERT_EFI_ERROR (Status);
#endif
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGlueSmmDriverEntryPoint.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGlueSmmDriverEntryPoint.c index f8c8f9c4ec..9d5f467cfd 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGlueSmmDriverEntryPoint.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGlueSmmDriverEntryPoint.c @@ -56,6 +56,7 @@ ProcessModuleUnloadList ( // Library constructors
//
VOID
+EFIAPI
ProcessLibraryConstructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -133,6 +134,7 @@ ProcessLibraryConstructorList ( // Library destructors
//
VOID
+EFIAPI
ProcessLibraryDestructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDefinitionChangesBase.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDefinitionChangesBase.h index 3c3076954d..376d7f38ac 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDefinitionChangesBase.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDefinitionChangesBase.h @@ -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
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
@@ -23,7 +23,11 @@ Abstract: #ifndef __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"
+#endif
#include "EfiPxe.h"
@@ -47,7 +51,7 @@ Abstract: // ----------------------------------------------------------------------------------
// InternalFormRepresentation.h:
// ----------------------------------------------------------------------------------
-
+#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
@@ -66,6 +70,7 @@ typedef struct { typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_END_EXPR;
+#endif
// ------------------------
// define GUID as EFI_GUID
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDefinitionChangesDxe.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDefinitionChangesDxe.h index 0f2cadd3fc..4bcbf9ca62 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDefinitionChangesDxe.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDefinitionChangesDxe.h @@ -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
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
@@ -23,7 +23,11 @@ Abstract: #ifndef __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"
+#endif
#include "EdkIIGlueDefinitionChangesBase.h"
@@ -59,8 +63,10 @@ typedef EFI_MISC_SMBIOS_STRUCT_ENCAPSULATION EFI_MISC_SMBIOS_STRUCT_ENCA // -------------------
#define gEfiAcpiSupportProtocolGuid gEfiAcpiSupportGuid
#define gEfiLoadPeImageProtocolGuid gEfiLoadPeImageGuid
+#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
#define EFI_GLYPH_NON_SPACING GLYPH_NON_SPACING
#define EFI_GLYPH_WIDE GLYPH_NON_BREAKING
+#endif
#define BOOT_OBJECT_AUTHORIZATION_PARMSET_GUID BOOT_OBJECT_AUTHORIZATION_PARMSET_GUIDVALUE
#define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID
#define EFI_FILE_SYSTEM_VOLUME_LABEL_ID EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID_GUID
@@ -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_TEXT_OUTPUT_STRING EFI_TEXT_STRING;
+#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
typedef SCREEN_DESCRIPTOR EFI_SCREEN_DESCRIPTOR;
+#endif
typedef EFI_SIMPLE_TEXT_IN_PROTOCOL EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
typedef EFI_SIMPLE_TEXT_OUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
//typedef EFI_TO_LEGACY16_INIT_TABLE EFI_TO_COMPATIBILITY16_INIT_TABLE;
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDefinitionChangesPeim.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDefinitionChangesPeim.h index 353fe36709..635b0dc51a 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDefinitionChangesPeim.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDefinitionChangesPeim.h @@ -23,9 +23,14 @@ Abstract: #ifndef __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"
+#endif
#include "EdkIIGlueDefinitionChangesBase.h"
+
#include "EfiPciCfg.h"
//
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDependencies.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDependencies.h index 1f59b3552b..c28debd6f1 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDependencies.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Common/EdkIIGlueDependencies.h @@ -62,6 +62,45 @@ Abstract: #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
//
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
@@ -554,6 +593,14 @@ Abstract: //
#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
@@ -654,6 +701,7 @@ Abstract: #ifdef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
EFI_STATUS
+EFIAPI
UefiBootServicesTableLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -671,6 +719,7 @@ IoLibConstructor ( #ifdef __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
EFI_STATUS
+EFIAPI
UefiRuntimeServicesTableLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -679,6 +728,7 @@ UefiRuntimeServicesTableLibConstructor ( #ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
EFI_STATUS
+EFIAPI
RuntimeDriverLibConstruct (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -687,6 +737,7 @@ RuntimeDriverLibConstruct ( #ifdef __EDKII_GLUE_DXE_HOB_LIB__
EFI_STATUS
+EFIAPI
HobLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -695,6 +746,7 @@ HobLibConstructor ( #ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
EFI_STATUS
+EFIAPI
UefiDriverModelLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -703,6 +755,7 @@ UefiDriverModelLibConstructor ( #ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__
EFI_STATUS
+EFIAPI
PeiServicesTablePointerLibConstructor (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
@@ -711,6 +764,7 @@ PeiServicesTablePointerLibConstructor ( #ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
EFI_STATUS
+EFIAPI
PeiServicesTablePointerLibConstructor (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
@@ -719,6 +773,7 @@ PeiServicesTablePointerLibConstructor ( #ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
EFI_STATUS
+EFIAPI
PeiServicesTablePointerLibConstructor (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
@@ -736,6 +791,7 @@ SmbusLibConstructor ( #ifdef __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__
EFI_STATUS
+EFIAPI
DxeServicesTableLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -760,6 +816,7 @@ DxeSalLibConstructor ( //
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
EFI_STATUS
+EFIAPI
UefiDriverModelLibDestructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -768,6 +825,7 @@ UefiDriverModelLibDestructor ( #ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
EFI_STATUS
+EFIAPI
RuntimeDriverLibDeconstruct (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueBase.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueBase.h index 605c84547e..b62edef674 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueBase.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueBase.h @@ -30,6 +30,10 @@ Abstract: #define BUILD_WITH_EDKII_GLUE_LIB
#endif
+#ifndef BUILD_WITH_GLUELIB
+ #define BUILD_WITH_GLUELIB
+#endif
+
//
// General Type & API definitions
//
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueConfig.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueConfig.h index 6bbcfee1bc..8a1d018a97 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueConfig.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueConfig.h @@ -31,10 +31,12 @@ Abstract: // 0x3000 - the 3rd release
// 0x5000 - support IPF. Jan, 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
//
-#define EDKII_GLUE_LIBRARY_VERSION 0x6000
+#define EDKII_GLUE_LIBRARY_VERSION 0x7100
//
@@ -84,21 +86,19 @@ Abstract: //
// debug print level
-// only when EFI_DEBUG is defined, the mask is effective
//
#define EDKII_GLUE_DebugPrintErrorLevel EFI_D_ERROR
//
// debug propery mask
-// only when EFI_DEBUG is defined, the mask is effective
-//
-#define EDKII_GLUE_DebugPropertyMask ( DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED \
- | DEBUG_PROPERTY_DEBUG_PRINT_ENABLED \
- | DEBUG_PROPERTY_DEBUG_CODE_ENABLED \
- | DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED \
- | DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED \
- | DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED \
- )
+//
+#define EDKII_GLUE_DebugPropertyMask ( DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED \
+ | DEBUG_PROPERTY_DEBUG_PRINT_ENABLED \
+ | DEBUG_PROPERTY_DEBUG_CODE_ENABLED \
+ | DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED \
+ | DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED \
+ | DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED \
+ )
//
// clear memory value
@@ -115,23 +115,22 @@ Abstract: // This value is FSB Clock frequency. Its unit is Hz and its
// default value is 200000000, that means FSB frequency is 200Mhz.
//
-#define EDKII_GLUE_FSBClock 200000000
+#define EDKII_GLUE_FSBClock 200000000
//
// post code property mask
//
#define EDKII_GLUE_PostCodePropertyMask ( POST_CODE_PROPERTY_POST_CODE_ENABLED \
- | POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED \
+ | POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED \
)
//
// status code property mask
//
#define EDKII_GLUE_ReportStatusCodePropertyMask ( REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED \
- | REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED \
- | REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED \
- )
-
+ | REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED \
+ | REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED \
+ )
//
// for IPF only
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueDxe.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueDxe.h index 8aa355e127..c1d5102257 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueDxe.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueDxe.h @@ -39,8 +39,13 @@ Abstract: #include "EfiFirmwareVolumeHeader.h"
#include "EfiFirmwareFileSystem.h"
#include "PeiHob.h"
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+#include "TianoHii.h"
+#else
#include "EfiInternalFormRepresentation.h"
+#endif
#include "EfiStatusCode.h"
+#include "EfiPerf.h"
//
// IPF only
@@ -90,10 +95,20 @@ Abstract: // resolved when porting a module to real EDK II
//
#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
+#include EFI_GUID_DEFINITION (PeiPerformanceHob)
//
// 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)
#include EFI_PROTOCOL_DEFINITION (DevicePathFromText)
@@ -120,7 +135,9 @@ Abstract: #include EFI_PROTOCOL_DEFINITION (BootScriptSave)
#include EFI_PROTOCOL_DEFINITION (BusSpecificDriverOverride)
#include EFI_PROTOCOL_DEFINITION (ComponentName)
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
#include EFI_PROTOCOL_DEFINITION (ComponentName2)
+#endif
#include EFI_PROTOCOL_DEFINITION (CpuIo)
#include EFI_PROTOCOL_DEFINITION (DataHub)
#include EFI_PROTOCOL_DEFINITION (DebugPort)
@@ -140,10 +157,14 @@ Abstract: #include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeBlock)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeDispatch)
+#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
#include EFI_PROTOCOL_DEFINITION (FormBrowser)
#include EFI_PROTOCOL_DEFINITION (FormCallback)
+#endif
#include EFI_PROTOCOL_DEFINITION (GuidedSectionExtraction)
+#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
#include EFI_PROTOCOL_DEFINITION (Hii)
+#endif
#include EFI_PROTOCOL_DEFINITION (IdeControllerInit)
#include EFI_PROTOCOL_DEFINITION (IncompatiblePciDeviceSupport)
#include EFI_PROTOCOL_DEFINITION (Legacy8259)
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGluePeim.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGluePeim.h index 617364ffba..f2cda3365f 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGluePeim.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGluePeim.h @@ -45,6 +45,7 @@ Abstract: #include "EfiCapsule.h"
#include EFI_PROTOCOL_DEFINITION (DevicePath)
#include "TianoDevicePath.h"
+#include "PeiPerf.h"
//
// GUID definitions
@@ -58,6 +59,8 @@ Abstract: #include EFI_GUID_DEFINITION (FirmwareFileSystem)
#include EFI_GUID_DEFINITION (SmramMemoryReserve)
#include EFI_GUID_DEFINITION (DataHubRecords)
+#include EFI_GUID_DEFINITION (PeiPerformanceHob)
+
//
// *** NOTE ***: StatusCodeDataTypeId definition differences need to be
// resolved when porting a module to real EDK II
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueUefi.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueUefi.h index e71020e296..dbeeafd48f 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueUefi.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/EdkIIGlueUefi.h @@ -73,7 +73,9 @@ Abstract: #include EFI_PROTOCOL_DEFINITION(Bis)
#include EFI_PROTOCOL_DEFINITION(BusSpecificDriverOverride)
#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(DebugSupport)
#include EFI_PROTOCOL_DEFINITION(Decompress)
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Ipf/EdkIIGlueProcessorBind.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Ipf/EdkIIGlueProcessorBind.h index 8c6ef88b4f..a37be76663 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Ipf/EdkIIGlueProcessorBind.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Ipf/EdkIIGlueProcessorBind.h @@ -37,5 +37,32 @@ Abstract: #ifndef MDE_CPU_IPF
#define MDE_CPU_IPF
#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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueBaseLib.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueBaseLib.h index 4c95c85ce1..59cd672740 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueBaseLib.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueBaseLib.h @@ -72,7 +72,7 @@ Abstract: //
// SPIN_LOCK
//
-typedef UINTN SPIN_LOCK;
+typedef volatile UINTN SPIN_LOCK;
#if defined (MDE_CPU_IA32)
//
@@ -206,6 +206,8 @@ GlueStrCpy ( OUT CHAR16 *Destination,
IN CONST CHAR16 *Source
);
+
+
/**
Copies one Null-terminated Unicode string with a maximum length to another
Null-terminated Unicode string with a maximum length and returns the new
@@ -242,6 +244,8 @@ GlueStrnCpy ( IN CONST CHAR16 *Source,
IN UINTN Length
);
+
+
/**
Returns the length of a Null-terminated Unicode string.
@@ -264,6 +268,8 @@ EFIAPI GlueStrLen (
IN CONST CHAR16 *String
);
+
+
/**
Returns the size of a Null-terminated Unicode string in bytes, including the
Null terminator.
@@ -287,6 +293,8 @@ EFIAPI GlueStrSize (
IN CONST CHAR16 *String
);
+
+
/**
Compares two Null-terminated Unicode strings, and returns the difference
between the first mismatched Unicode characters.
@@ -321,6 +329,8 @@ GlueStrCmp ( IN CONST CHAR16 *FirstString,
IN CONST CHAR16 *SecondString
);
+
+
/**
Compares two Null-terminated Unicode strings with maximum lengths, and
returns the difference between the first mismatched Unicode characters.
@@ -358,6 +368,8 @@ GlueStrnCmp ( IN CONST CHAR16 *SecondString,
IN UINTN Length
);
+
+
/**
Concatenates one Null-terminated Unicode string to another Null-terminated
Unicode string, and returns the concatenated Unicode string.
@@ -396,6 +408,8 @@ GlueStrCat ( IN OUT CHAR16 *Destination,
IN CONST CHAR16 *Source
);
+
+
/**
Concatenates one Null-terminated Unicode string with a maximum length to the
end of another Null-terminated Unicode string, and returns the concatenated
@@ -442,22 +456,22 @@ GlueStrnCat ( );
/**
- Returns the first occurance of a Null-terminated Unicode sub-string
+ Returns the first occurance of a Null-terminated Unicode sub-string
in a Null-terminated Unicode string.
- This function scans the contents of the Null-terminated Unicode string
- specified by String and returns the first occurrence of SearchString.
- If SearchString is not found in String, then NULL is returned. If
- the length of SearchString is zero, then String is
+ This function scans the contents of the Null-terminated Unicode string
+ specified by String and returns the first occurrence of SearchString.
+ If SearchString is not found in String, then NULL is returned. If
+ the length of SearchString is zero, then String is
returned.
-
+
If String is NULL, then ASSERT().
If String is not aligned on a 16-bit boundary, then ASSERT().
If SearchString is NULL, then ASSERT().
If SearchString is not aligned on a 16-bit boundary, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and SearchString
- or String contains more than PcdMaximumUnicodeStringLength Unicode
+ If PcdMaximumUnicodeStringLength is not zero, and SearchString
+ or String contains more than PcdMaximumUnicodeStringLength Unicode
characters not including the Null-terminator, then ASSERT().
@param String Pointer to a Null-terminated Unicode string.
@@ -475,37 +489,37 @@ StrStr ( );
/**
- Convert a Null-terminated Unicode decimal string to a value of
+ Convert a Null-terminated Unicode decimal string to a value of
type UINTN.
- This function returns a value of type UINTN by interpreting the contents
- of the Unicode string specified by String as a decimal number. The format
+ This function returns a value of type UINTN by interpreting the contents
+ of the Unicode string specified by String as a decimal number. The format
of the input Unicode string String is:
-
+
[spaces] [decimal digits].
-
- The valid decimal digit character is in the range [0-9]. The
- function will ignore the pad space, which includes spaces or
- tab characters, before [decimal digits]. The running zero in the
- beginning of [decimal digits] will be ignored. Then, the function
- stops at the first character that is a not a valid decimal character
- or a Null-terminator, whichever one comes first.
-
+
+ The valid decimal digit character is in the range [0-9]. The
+ function will ignore the pad space, which includes spaces or
+ tab characters, before [decimal digits]. The running zero in the
+ beginning of [decimal digits] will be ignored. Then, the function
+ stops at the first character that is a not a valid decimal character
+ or a Null-terminator, whichever one comes first.
+
If String is NULL, then ASSERT().
- If String is not aligned in a 16-bit boundary, then ASSERT().
+ If String is not aligned in a 16-bit boundary, then ASSERT().
If String has only pad spaces, then 0 is returned.
- If String has no pad spaces or valid decimal digits,
+ If String has no pad spaces or valid decimal digits,
then 0 is returned.
- If the number represented by String overflows according
+ If the number represented by String overflows according
to the range defined by UINTN, then ASSERT().
-
- If PcdMaximumUnicodeStringLength is not zero, and String contains
- more than PcdMaximumUnicodeStringLength Unicode characters not including
+
+ If PcdMaximumUnicodeStringLength is not zero, and String contains
+ more than PcdMaximumUnicodeStringLength Unicode characters not including
the Null-terminator, then ASSERT().
@param String Pointer to a Null-terminated Unicode string.
- @retval UINTN
+ @retval UINTN
**/
UINTN
@@ -515,37 +529,37 @@ StrDecimalToUintn ( );
/**
- Convert a Null-terminated Unicode decimal string to a value of
+ Convert a Null-terminated Unicode decimal string to a value of
type UINT64.
- This function returns a value of type UINT64 by interpreting the contents
- of the Unicode string specified by String as a decimal number. The format
+ This function returns a value of type UINT64 by interpreting the contents
+ of the Unicode string specified by String as a decimal number. The format
of the input Unicode string String is:
-
+
[spaces] [decimal digits].
-
- The valid decimal digit character is in the range [0-9]. The
- function will ignore the pad space, which includes spaces or
- tab characters, before [decimal digits]. The running zero in the
- beginning of [decimal digits] will be ignored. Then, the function
- stops at the first character that is a not a valid decimal character
- or a Null-terminator, whichever one comes first.
-
+
+ The valid decimal digit character is in the range [0-9]. The
+ function will ignore the pad space, which includes spaces or
+ tab characters, before [decimal digits]. The running zero in the
+ beginning of [decimal digits] will be ignored. Then, the function
+ stops at the first character that is a not a valid decimal character
+ or a Null-terminator, whichever one comes first.
+
If String is NULL, then ASSERT().
- If String is not aligned in a 16-bit boundary, then ASSERT().
+ If String is not aligned in a 16-bit boundary, then ASSERT().
If String has only pad spaces, then 0 is returned.
- If String has no pad spaces or valid decimal digits,
+ If String has no pad spaces or valid decimal digits,
then 0 is returned.
- If the number represented by String overflows according
+ If the number represented by String overflows according
to the range defined by UINT64, then ASSERT().
-
- If PcdMaximumUnicodeStringLength is not zero, and String contains
- more than PcdMaximumUnicodeStringLength Unicode characters not including
+
+ If PcdMaximumUnicodeStringLength is not zero, and String contains
+ more than PcdMaximumUnicodeStringLength Unicode characters not including
the Null-terminator, then ASSERT().
@param String Pointer to a Null-terminated Unicode string.
- @retval UINT64
+ @retval UINT64
**/
UINT64
@@ -553,35 +567,36 @@ EFIAPI StrDecimalToUint64 (
IN CONST CHAR16 *String
);
+
/**
Convert a Null-terminated Unicode hexadecimal string to a value of type UINTN.
- This function returns a value of type UINTN by interpreting the contents
- of the Unicode string specified by String as a hexadecimal number.
+ This function returns a value of type UINTN by interpreting the contents
+ of the Unicode string specified by String as a hexadecimal number.
The format of the input Unicode string String is:
-
- [spaces][zeros][x][hexadecimal digits].
-
- The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
- The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.
- If "x" appears in the input string, it must be prefixed with at least one 0.
- The function will ignore the pad space, which includes spaces or tab characters,
- before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or
- [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the
- first valid hexadecimal digit. Then, the function stops at the first character that is
+
+ [spaces][zeros][x][hexadecimal digits].
+
+ The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
+ The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.
+ If "x" appears in the input string, it must be prefixed with at least one 0.
+ The function will ignore the pad space, which includes spaces or tab characters,
+ before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or
+ [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the
+ first valid hexadecimal digit. Then, the function stops at the first character that is
a not a valid hexadecimal character or NULL, whichever one comes first.
If String is NULL, then ASSERT().
If String is not aligned in a 16-bit boundary, then ASSERT().
If String has only pad spaces, then zero is returned.
- If String has no leading pad spaces, leading zeros or valid hexadecimal digits,
+ If String has no leading pad spaces, leading zeros or valid hexadecimal digits,
then zero is returned.
- If the number represented by String overflows according to the range defined by
+ If the number represented by String overflows according to the range defined by
UINTN, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and String contains more than
- PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,
+ If PcdMaximumUnicodeStringLength is not zero, and String contains more than
+ PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,
then ASSERT().
@param String Pointer to a Null-terminated Unicode string.
@@ -595,34 +610,35 @@ StrHexToUintn ( IN CONST CHAR16 *String
);
+
/**
Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64.
- This function returns a value of type UINT64 by interpreting the contents
- of the Unicode string specified by String as a hexadecimal number.
- The format of the input Unicode string String is
-
- [spaces][zeros][x][hexadecimal digits].
-
- The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
- The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.
- If "x" appears in the input string, it must be prefixed with at least one 0.
- The function will ignore the pad space, which includes spaces or tab characters,
- before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or
- [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the
- first valid hexadecimal digit. Then, the function stops at the first character that is
+ This function returns a value of type UINT64 by interpreting the contents
+ of the Unicode string specified by String as a hexadecimal number.
+ The format of the input Unicode string String is
+
+ [spaces][zeros][x][hexadecimal digits].
+
+ The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
+ The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.
+ If "x" appears in the input string, it must be prefixed with at least one 0.
+ The function will ignore the pad space, which includes spaces or tab characters,
+ before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or
+ [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the
+ first valid hexadecimal digit. Then, the function stops at the first character that is
a not a valid hexadecimal character or NULL, whichever one comes first.
If String is NULL, then ASSERT().
If String is not aligned in a 16-bit boundary, then ASSERT().
If String has only pad spaces, then zero is returned.
- If String has no leading pad spaces, leading zeros or valid hexadecimal digits,
+ If String has no leading pad spaces, leading zeros or valid hexadecimal digits,
then zero is returned.
- If the number represented by String overflows according to the range defined by
+ If the number represented by String overflows according to the range defined by
UINT64, then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and String contains more than
- PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,
+ If PcdMaximumUnicodeStringLength is not zero, and String contains more than
+ PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,
then ASSERT().
@param String Pointer to a Null-terminated Unicode string.
@@ -636,28 +652,29 @@ StrHexToUint64 ( IN CONST CHAR16 *String
);
+
/**
- Convert one Null-terminated Unicode string to a Null-terminated
+ Convert one Null-terminated Unicode string to a Null-terminated
ASCII string and returns the ASCII string.
-
- This function converts the content of the Unicode string Source
- to the ASCII string Destination by copying the lower 8 bits of
- each Unicode character. It returns Destination.
- If any Unicode characters in Source contain non-zero value in
+ This function converts the content of the Unicode string Source
+ to the ASCII string Destination by copying the lower 8 bits of
+ each Unicode character. It returns Destination.
+
+ If any Unicode characters in Source contain non-zero value in
the upper 8 bits, then ASSERT().
-
+
If Destination is NULL, then ASSERT().
If Source is NULL, then ASSERT().
If Source is not aligned on a 16-bit boundary, then ASSERT().
If Source and Destination overlap, then ASSERT().
-
- If PcdMaximumUnicodeStringLength is not zero, and Source contains
- more than PcdMaximumUnicodeStringLength Unicode characters not including
+
+ If PcdMaximumUnicodeStringLength is not zero, and Source contains
+ more than PcdMaximumUnicodeStringLength Unicode characters not including
the Null-terminator, then ASSERT().
-
- If PcdMaximumAsciiStringLength is not zero, and Source contains more
- than PcdMaximumAsciiStringLength Unicode characters not including the
+
+ If PcdMaximumAsciiStringLength is not zero, and Source contains more
+ than PcdMaximumAsciiStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param Source Pointer to a Null-terminated Unicode string.
@@ -673,6 +690,7 @@ UnicodeStrToAsciiStr ( OUT CHAR8 *Destination
);
+
/**
Copies one Null-terminated ASCII string to another Null-terminated ASCII
string and returns the new ASCII string.
@@ -700,6 +718,8 @@ AsciiStrCpy ( OUT CHAR8 *Destination,
IN CONST CHAR8 *Source
);
+
+
/**
Copies one Null-terminated ASCII string with a maximum length to another
Null-terminated ASCII string with a maximum length and returns the new ASCII
@@ -733,6 +753,8 @@ AsciiStrnCpy ( IN CONST CHAR8 *Source,
IN UINTN Length
);
+
+
/**
Returns the length of a Null-terminated ASCII string.
@@ -755,6 +777,8 @@ EFIAPI AsciiStrLen (
IN CONST CHAR8 *String
);
+
+
/**
Returns the size of a Null-terminated ASCII string in bytes, including the
Null terminator.
@@ -777,6 +801,8 @@ EFIAPI AsciiStrSize (
IN CONST CHAR8 *String
);
+
+
/**
Compares two Null-terminated ASCII strings, and returns the difference
between the first mismatched ASCII characters.
@@ -809,6 +835,8 @@ AsciiStrCmp ( IN CONST CHAR8 *FirstString,
IN CONST CHAR8 *SecondString
);
+
+
/**
Performs a case insensitive comparison of two Null-terminated ASCII strings,
and returns the difference between the first mismatched ASCII characters.
@@ -844,6 +872,8 @@ AsciiStriCmp ( IN CONST CHAR8 *FirstString,
IN CONST CHAR8 *SecondString
);
+
+
/**
Compares two Null-terminated ASCII strings with maximum lengths, and returns
the difference between the first mismatched ASCII characters.
@@ -878,6 +908,8 @@ AsciiStrnCmp ( IN CONST CHAR8 *SecondString,
IN UINTN Length
);
+
+
/**
Concatenates one Null-terminated ASCII string to another Null-terminated
ASCII string, and returns the concatenated ASCII string.
@@ -911,6 +943,8 @@ AsciiStrCat ( IN OUT CHAR8 *Destination,
IN CONST CHAR8 *Source
);
+
+
/**
Concatenates one Null-terminated ASCII string with a maximum length to the
end of another Null-terminated ASCII string, and returns the concatenated
@@ -953,20 +987,21 @@ AsciiStrnCat ( IN UINTN Length
);
+
/**
- Returns the first occurance of a Null-terminated ASCII sub-string
+ Returns the first occurance of a Null-terminated ASCII sub-string
in a Null-terminated ASCII string.
- This function scans the contents of the ASCII string specified by String
- and returns the first occurrence of SearchString. If SearchString is not
- found in String, then NULL is returned. If the length of SearchString is zero,
+ This function scans the contents of the ASCII string specified by String
+ and returns the first occurrence of SearchString. If SearchString is not
+ found in String, then NULL is returned. If the length of SearchString is zero,
then String is returned.
-
+
If String is NULL, then ASSERT().
If SearchString is NULL, then ASSERT().
- If PcdMaximumAsciiStringLength is not zero, and SearchString or
- String contains more than PcdMaximumAsciiStringLength Unicode characters
+ If PcdMaximumAsciiStringLength is not zero, and SearchString or
+ String contains more than PcdMaximumAsciiStringLength Unicode characters
not including the Null-terminator, then ASSERT().
@param String Pointer to a Null-terminated ASCII string.
@@ -983,34 +1018,35 @@ AsciiStrStr ( IN CONST CHAR8 *SearchString
);
+
/**
- Convert a Null-terminated ASCII decimal string to a value of type
+ Convert a Null-terminated ASCII decimal string to a value of type
UINTN.
- This function returns a value of type UINTN by interpreting the contents
- of the ASCII string String as a decimal number. The format of the input
+ This function returns a value of type UINTN by interpreting the contents
+ of the ASCII string String as a decimal number. The format of the input
ASCII string String is:
-
+
[spaces] [decimal digits].
-
- The valid decimal digit character is in the range [0-9]. The function will
- ignore the pad space, which includes spaces or tab characters, before the digits.
- The running zero in the beginning of [decimal digits] will be ignored. Then, the
- function stops at the first character that is a not a valid decimal character or
+
+ The valid decimal digit character is in the range [0-9]. The function will
+ ignore the pad space, which includes spaces or tab characters, before the digits.
+ The running zero in the beginning of [decimal digits] will be ignored. Then, the
+ function stops at the first character that is a not a valid decimal character or
Null-terminator, whichever on comes first.
-
+
If String has only pad spaces, then 0 is returned.
If String has no pad spaces or valid decimal digits, then 0 is returned.
- If the number represented by String overflows according to the range defined by
+ If the number represented by String overflows according to the range defined by
UINTN, then ASSERT().
If String is NULL, then ASSERT().
- If PcdMaximumAsciiStringLength is not zero, and String contains more than
- PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ If PcdMaximumAsciiStringLength is not zero, and String contains more than
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
then ASSERT().
@param String Pointer to a Null-terminated ASCII string.
- @retval UINTN
+ @retval UINTN
**/
UINTN
@@ -1019,34 +1055,35 @@ AsciiStrDecimalToUintn ( IN CONST CHAR8 *String
);
+
/**
- Convert a Null-terminated ASCII decimal string to a value of type
+ Convert a Null-terminated ASCII decimal string to a value of type
UINT64.
- This function returns a value of type UINT64 by interpreting the contents
- of the ASCII string String as a decimal number. The format of the input
+ This function returns a value of type UINT64 by interpreting the contents
+ of the ASCII string String as a decimal number. The format of the input
ASCII string String is:
-
+
[spaces] [decimal digits].
-
- The valid decimal digit character is in the range [0-9]. The function will
- ignore the pad space, which includes spaces or tab characters, before the digits.
- The running zero in the beginning of [decimal digits] will be ignored. Then, the
- function stops at the first character that is a not a valid decimal character or
+
+ The valid decimal digit character is in the range [0-9]. The function will
+ ignore the pad space, which includes spaces or tab characters, before the digits.
+ The running zero in the beginning of [decimal digits] will be ignored. Then, the
+ function stops at the first character that is a not a valid decimal character or
Null-terminator, whichever on comes first.
-
+
If String has only pad spaces, then 0 is returned.
If String has no pad spaces or valid decimal digits, then 0 is returned.
- If the number represented by String overflows according to the range defined by
+ If the number represented by String overflows according to the range defined by
UINT64, then ASSERT().
If String is NULL, then ASSERT().
- If PcdMaximumAsciiStringLength is not zero, and String contains more than
- PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ If PcdMaximumAsciiStringLength is not zero, and String contains more than
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
then ASSERT().
@param String Pointer to a Null-terminated ASCII string.
- @retval UINT64
+ @retval UINT64
**/
UINT64
@@ -1055,33 +1092,34 @@ AsciiStrDecimalToUint64 ( IN CONST CHAR8 *String
);
+
/**
Convert a Null-terminated ASCII hexadecimal string to a value of type UINTN.
- This function returns a value of type UINTN by interpreting the contents of
- the ASCII string String as a hexadecimal number. The format of the input ASCII
+ This function returns a value of type UINTN by interpreting the contents of
+ the ASCII string String as a hexadecimal number. The format of the input ASCII
string String is:
-
+
[spaces][zeros][x][hexadecimal digits].
-
- The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
- The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"
- appears in the input string, it must be prefixed with at least one 0. The function
- will ignore the pad space, which includes spaces or tab characters, before [zeros],
- [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]
- will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal
- digit. Then, the function stops at the first character that is a not a valid
+
+ The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
+ The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"
+ appears in the input string, it must be prefixed with at least one 0. The function
+ will ignore the pad space, which includes spaces or tab characters, before [zeros],
+ [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]
+ will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal
+ digit. Then, the function stops at the first character that is a not a valid
hexadecimal character or Null-terminator, whichever on comes first.
-
+
If String has only pad spaces, then 0 is returned.
If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then
0 is returned.
- If the number represented by String overflows according to the range defined by UINTN,
+ If the number represented by String overflows according to the range defined by UINTN,
then ASSERT().
If String is NULL, then ASSERT().
- If PcdMaximumAsciiStringLength is not zero,
- and String contains more than PcdMaximumAsciiStringLength ASCII characters not including
+ If PcdMaximumAsciiStringLength is not zero,
+ and String contains more than PcdMaximumAsciiStringLength ASCII characters not including
the Null-terminator, then ASSERT().
@param String Pointer to a Null-terminated ASCII string.
@@ -1095,33 +1133,34 @@ AsciiStrHexToUintn ( IN CONST CHAR8 *String
);
+
/**
Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64.
- This function returns a value of type UINT64 by interpreting the contents of
- the ASCII string String as a hexadecimal number. The format of the input ASCII
+ This function returns a value of type UINT64 by interpreting the contents of
+ the ASCII string String as a hexadecimal number. The format of the input ASCII
string String is:
-
+
[spaces][zeros][x][hexadecimal digits].
-
- The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
- The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"
- appears in the input string, it must be prefixed with at least one 0. The function
- will ignore the pad space, which includes spaces or tab characters, before [zeros],
- [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]
- will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal
- digit. Then, the function stops at the first character that is a not a valid
+
+ The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].
+ The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"
+ appears in the input string, it must be prefixed with at least one 0. The function
+ will ignore the pad space, which includes spaces or tab characters, before [zeros],
+ [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]
+ will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal
+ digit. Then, the function stops at the first character that is a not a valid
hexadecimal character or Null-terminator, whichever on comes first.
-
+
If String has only pad spaces, then 0 is returned.
If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then
0 is returned.
- If the number represented by String overflows according to the range defined by UINT64,
+ If the number represented by String overflows according to the range defined by UINT64,
then ASSERT().
If String is NULL, then ASSERT().
- If PcdMaximumAsciiStringLength is not zero,
- and String contains more than PcdMaximumAsciiStringLength ASCII characters not including
+ If PcdMaximumAsciiStringLength is not zero,
+ and String contains more than PcdMaximumAsciiStringLength ASCII characters not including
the Null-terminator, then ASSERT().
@param String Pointer to a Null-terminated ASCII string.
@@ -1135,25 +1174,26 @@ AsciiStrHexToUint64 ( IN CONST CHAR8 *String
);
+
/**
- Convert one Null-terminated ASCII string to a Null-terminated
+ Convert one Null-terminated ASCII string to a Null-terminated
Unicode string and returns the Unicode string.
- This function converts the contents of the ASCII string Source to the Unicode
- string Destination, and returns Destination. The function terminates the
- Unicode string Destination by appending a Null-terminator character at the end.
- The caller is responsible to make sure Destination points to a buffer with size
+ This function converts the contents of the ASCII string Source to the Unicode
+ string Destination, and returns Destination. The function terminates the
+ Unicode string Destination by appending a Null-terminator character at the end.
+ The caller is responsible to make sure Destination points to a buffer with size
equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.
-
+
If Destination is NULL, then ASSERT().
If Destination is not aligned on a 16-bit boundary, then ASSERT().
If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT().
- If PcdMaximumAsciiStringLength is not zero, and Source contains more than
- PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
+ If PcdMaximumAsciiStringLength is not zero, and Source contains more than
+ PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,
then ASSERT().
- If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
- PcdMaximumUnicodeStringLength ASCII characters not including the
+ If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
+ PcdMaximumUnicodeStringLength ASCII characters not including the
Null-terminator, then ASSERT().
@param Source Pointer to a Null-terminated ASCII string.
@@ -1169,6 +1209,7 @@ AsciiStrToUnicodeStr ( OUT CHAR16 *Destination
);
+
/**
Converts an 8-bit value to an 8-bit BCD value.
@@ -1188,6 +1229,7 @@ DecimalToBcd8 ( IN UINT8 Value
);
+
/**
Converts an 8-bit BCD value to an 8-bit value.
@@ -1238,6 +1280,7 @@ struct _LIST_ENTRY { **/
#define INITIALIZE_LIST_HEAD_VARIABLE(ListHead) {&ListHead, &ListHead}
+
/**
Initializes the head node of a doubly linked list, and returns the pointer to
the head node of the doubly linked list.
@@ -1260,6 +1303,7 @@ GlueInitializeListHead ( IN LIST_ENTRY *ListHead
);
+
/**
Adds a node to the beginning of a doubly linked list, and returns the pointer
to the head node of the doubly linked list.
@@ -1288,6 +1332,7 @@ GlueInsertHeadList ( IN LIST_ENTRY *Entry
);
+
/**
Adds a node to the end of a doubly linked list, and returns the pointer to
the head node of the doubly linked list.
@@ -1316,6 +1361,7 @@ GlueInsertTailList ( IN LIST_ENTRY *Entry
);
+
/**
Retrieves the first node of a doubly linked list.
@@ -1341,6 +1387,7 @@ GlueGetFirstNode ( IN CONST LIST_ENTRY *List
);
+
/**
Retrieves the next node of a doubly linked list.
@@ -1369,6 +1416,7 @@ GlueGetNextNode ( IN CONST LIST_ENTRY *Node
);
+
/**
Checks to see if a doubly linked list is empty or not.
@@ -1393,6 +1441,7 @@ GlueIsListEmpty ( IN CONST LIST_ENTRY *ListHead
);
+
/**
Determines if a node in a doubly linked list is null.
@@ -1422,6 +1471,7 @@ GlueIsNull ( IN CONST LIST_ENTRY *Node
);
+
/**
Determines if a node the last node in a doubly linked list.
@@ -1451,6 +1501,7 @@ GlueIsNodeAtEnd ( IN CONST LIST_ENTRY *Node
);
+
/**
Swaps the location of two nodes in a doubly linked list, and returns the
first node after the swap.
@@ -1481,6 +1532,7 @@ GlueSwapListEntries ( IN LIST_ENTRY *SecondEntry
);
+
/**
Removes a node from a doubly linked list, and returns the node that follows
the removed node.
@@ -1534,6 +1586,7 @@ GlueLShiftU64 ( IN UINTN Count
);
+
/**
Shifts a 64-bit integer right between 0 and 63 bits. This high bits are
filled with zeros. The shifted value is returned.
@@ -1556,6 +1609,7 @@ GlueRShiftU64 ( IN UINTN Count
);
+
/**
Shifts a 64-bit integer right between 0 and 63 bits. The high bits are filled
with original integer's bit 63. The shifted value is returned.
@@ -1578,6 +1632,7 @@ ARShiftU64 ( IN UINTN Count
);
+
/**
Rotates a 32-bit integer left between 0 and 31 bits, filling the low bits
with the high bits that were rotated.
@@ -1601,6 +1656,7 @@ LRotU32 ( IN UINTN Count
);
+
/**
Rotates a 32-bit integer right between 0 and 31 bits, filling the high bits
with the low bits that were rotated.
@@ -1624,6 +1680,7 @@ RRotU32 ( IN UINTN Count
);
+
/**
Rotates a 64-bit integer left between 0 and 63 bits, filling the low bits
with the high bits that were rotated.
@@ -1647,6 +1704,7 @@ LRotU64 ( IN UINTN Count
);
+
/**
Rotates a 64-bit integer right between 0 and 63 bits, filling the high bits
with the high low bits that were rotated.
@@ -1670,6 +1728,7 @@ RRotU64 ( IN UINTN Count
);
+
/**
Returns the bit position of the lowest bit set in a 32-bit value.
@@ -1689,6 +1748,7 @@ LowBitSet32 ( IN UINT32 Operand
);
+
/**
Returns the bit position of the lowest bit set in a 64-bit value.
@@ -1708,6 +1768,7 @@ LowBitSet64 ( IN UINT64 Operand
);
+
/**
Returns the bit position of the highest bit set in a 32-bit value. Equivalent
to log2(x).
@@ -1728,6 +1789,7 @@ HighBitSet32 ( IN UINT32 Operand
);
+
/**
Returns the bit position of the highest bit set in a 64-bit value. Equivalent
to log2(x).
@@ -1748,6 +1810,7 @@ HighBitSet64 ( IN UINT64 Operand
);
+
/**
Returns the value of the highest bit set in a 32-bit value. Equivalent to
1 << HighBitSet32(x).
@@ -1767,6 +1830,7 @@ GetPowerOfTwo32 ( IN UINT32 Operand
);
+
/**
Returns the value of the highest bit set in a 64-bit value. Equivalent to
1 << HighBitSet64(x).
@@ -1786,6 +1850,7 @@ GetPowerOfTwo64 ( IN UINT64 Operand
);
+
/**
Switches the endianess of a 16-bit integer.
@@ -1804,6 +1869,7 @@ SwapBytes16 ( IN UINT16 Value
);
+
/**
Switches the endianess of a 32-bit integer.
@@ -1822,6 +1888,7 @@ SwapBytes32 ( IN UINT32 Value
);
+
/**
Switches the endianess of a 64-bit integer.
@@ -1840,6 +1907,7 @@ SwapBytes64 ( IN UINT64 Value
);
+
/**
Multiples a 64-bit unsigned integer by a 32-bit unsigned integer and
generates a 64-bit unsigned result.
@@ -1863,6 +1931,7 @@ GlueMultU64x32 ( IN UINT32 Multiplier
);
+
/**
Multiples a 64-bit unsigned integer by a 64-bit unsigned integer and
generates a 64-bit unsigned result.
@@ -1886,6 +1955,7 @@ MultU64x64 ( IN UINT64 Multiplier
);
+
/**
Multiples a 64-bit signed integer by a 64-bit signed integer and generates a
64-bit signed result.
@@ -1909,6 +1979,7 @@ MultS64x64 ( IN INT64 Multiplier
);
+
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
a 64-bit unsigned result.
@@ -1932,6 +2003,7 @@ GlueDivU64x32 ( IN UINT32 Divisor
);
+
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
a 32-bit unsigned remainder.
@@ -1955,6 +2027,7 @@ ModU64x32 ( IN UINT32 Divisor
);
+
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates
a 64-bit unsigned result and an optional 32-bit unsigned remainder.
@@ -1982,6 +2055,7 @@ DivU64x32Remainder ( OUT UINT32 *Remainder OPTIONAL
);
+
/**
Divides a 64-bit unsigned integer by a 64-bit unsigned integer and generates
a 64-bit unsigned result and an optional 64-bit unsigned remainder.
@@ -2009,6 +2083,7 @@ DivU64x64Remainder ( OUT UINT64 *Remainder OPTIONAL
);
+
/**
Divides a 64-bit signed integer by a 64-bit signed integer and generates a
64-bit signed result and a optional 64-bit signed remainder.
@@ -2036,6 +2111,7 @@ DivS64x64Remainder ( OUT INT64 *Remainder OPTIONAL
);
+
/**
Reads a 16-bit value from memory that may be unaligned.
@@ -2055,6 +2131,7 @@ ReadUnaligned16 ( IN CONST UINT16 *Uint16
);
+
/**
Writes a 16-bit value to memory that may be unaligned.
@@ -2077,6 +2154,7 @@ WriteUnaligned16 ( IN UINT16 Value
);
+
/**
Reads a 24-bit value from memory that may be unaligned.
@@ -2096,6 +2174,7 @@ ReadUnaligned24 ( IN CONST UINT32 *Buffer
);
+
/**
Writes a 24-bit value to memory that may be unaligned.
@@ -2118,6 +2197,7 @@ WriteUnaligned24 ( IN UINT32 Value
);
+
/**
Reads a 32-bit value from memory that may be unaligned.
@@ -2137,6 +2217,7 @@ ReadUnaligned32 ( IN CONST UINT32 *Uint32
);
+
/**
Writes a 32-bit value to memory that may be unaligned.
@@ -2159,6 +2240,7 @@ WriteUnaligned32 ( IN UINT32 Value
);
+
/**
Reads a 64-bit value from memory that may be unaligned.
@@ -2178,6 +2260,7 @@ ReadUnaligned64 ( IN CONST UINT64 *Uint64
);
+
/**
Writes a 64-bit value to memory that may be unaligned.
@@ -2200,6 +2283,7 @@ WriteUnaligned64 ( IN UINT64 Value
);
+
//
// Bit Field Functions
//
@@ -2231,6 +2315,7 @@ BitFieldRead8 ( IN UINTN EndBit
);
+
/**
Writes a bit field to an 8-bit value, and returns the result.
@@ -2262,6 +2347,7 @@ BitFieldWrite8 ( IN UINT8 Value
);
+
/**
Reads a bit field from an 8-bit value, performs a bitwise OR, and returns the
result.
@@ -2294,6 +2380,7 @@ BitFieldOr8 ( IN UINT8 OrData
);
+
/**
Reads a bit field from an 8-bit value, performs a bitwise AND, and returns
the result.
@@ -2326,6 +2413,7 @@ BitFieldAnd8 ( IN UINT8 AndData
);
+
/**
Reads a bit field from an 8-bit value, performs a bitwise AND followed by a
bitwise OR, and returns the result.
@@ -2361,6 +2449,7 @@ BitFieldAndThenOr8 ( IN UINT8 OrData
);
+
/**
Returns a bit field from a 16-bit value.
@@ -2388,6 +2477,7 @@ BitFieldRead16 ( IN UINTN EndBit
);
+
/**
Writes a bit field to a 16-bit value, and returns the result.
@@ -2419,6 +2509,7 @@ BitFieldWrite16 ( IN UINT16 Value
);
+
/**
Reads a bit field from a 16-bit value, performs a bitwise OR, and returns the
result.
@@ -2451,6 +2542,7 @@ BitFieldOr16 ( IN UINT16 OrData
);
+
/**
Reads a bit field from a 16-bit value, performs a bitwise AND, and returns
the result.
@@ -2483,6 +2575,7 @@ BitFieldAnd16 ( IN UINT16 AndData
);
+
/**
Reads a bit field from a 16-bit value, performs a bitwise AND followed by a
bitwise OR, and returns the result.
@@ -2518,6 +2611,7 @@ BitFieldAndThenOr16 ( IN UINT16 OrData
);
+
/**
Returns a bit field from a 32-bit value.
@@ -2545,6 +2639,7 @@ BitFieldRead32 ( IN UINTN EndBit
);
+
/**
Writes a bit field to a 32-bit value, and returns the result.
@@ -2576,6 +2671,7 @@ BitFieldWrite32 ( IN UINT32 Value
);
+
/**
Reads a bit field from a 32-bit value, performs a bitwise OR, and returns the
result.
@@ -2608,6 +2704,7 @@ BitFieldOr32 ( IN UINT32 OrData
);
+
/**
Reads a bit field from a 32-bit value, performs a bitwise AND, and returns
the result.
@@ -2640,6 +2737,7 @@ BitFieldAnd32 ( IN UINT32 AndData
);
+
/**
Reads a bit field from a 32-bit value, performs a bitwise AND followed by a
bitwise OR, and returns the result.
@@ -2675,6 +2773,7 @@ BitFieldAndThenOr32 ( IN UINT32 OrData
);
+
/**
Returns a bit field from a 64-bit value.
@@ -2702,6 +2801,7 @@ BitFieldRead64 ( IN UINTN EndBit
);
+
/**
Writes a bit field to a 64-bit value, and returns the result.
@@ -2733,6 +2833,7 @@ BitFieldWrite64 ( IN UINT64 Value
);
+
/**
Reads a bit field from a 64-bit value, performs a bitwise OR, and returns the
result.
@@ -2765,6 +2866,7 @@ BitFieldOr64 ( IN UINT64 OrData
);
+
/**
Reads a bit field from a 64-bit value, performs a bitwise AND, and returns
the result.
@@ -2797,6 +2899,7 @@ BitFieldAnd64 ( IN UINT64 AndData
);
+
/**
Reads a bit field from a 64-bit value, performs a bitwise AND followed by a
bitwise OR, and returns the result.
@@ -2832,6 +2935,7 @@ BitFieldAndThenOr64 ( IN UINT64 OrData
);
+
//
// Base Library Synchronization Functions
//
@@ -2858,6 +2962,7 @@ GetSpinLockProperties ( VOID
);
+
/**
Initializes a spin lock to the released state and returns the spin lock.
@@ -2880,6 +2985,7 @@ InitializeSpinLock ( IN SPIN_LOCK *SpinLock
);
+
/**
Waits until a spin lock can be placed in the acquired state.
@@ -2906,6 +3012,7 @@ AcquireSpinLock ( IN SPIN_LOCK *SpinLock
);
+
/**
Attempts to place a spin lock in the acquired state.
@@ -2929,6 +3036,7 @@ AcquireSpinLockOrFail ( IN SPIN_LOCK *SpinLock
);
+
/**
Releases a spin lock.
@@ -2949,6 +3057,7 @@ ReleaseSpinLock ( IN SPIN_LOCK *SpinLock
);
+
/**
Performs an atomic increment of an 32-bit unsigned integer.
@@ -2970,6 +3079,7 @@ InterlockedIncrement ( IN UINT32 *Value
);
+
/**
Performs an atomic decrement of an 32-bit unsigned integer.
@@ -2991,6 +3101,7 @@ InterlockedDecrement ( IN UINT32 *Value
);
+
/**
Performs an atomic compare exchange operation on a 32-bit unsigned integer.
@@ -3018,6 +3129,7 @@ InterlockedCompareExchange32 ( IN UINT32 ExchangeValue
);
+
/**
Performs an atomic compare exchange operation on a 64-bit unsigned integer.
@@ -3044,6 +3156,7 @@ InterlockedCompareExchange64 ( IN UINT64 ExchangeValue
);
+
/**
Performs an atomic compare exchange operation on a pointer value.
@@ -3069,21 +3182,22 @@ InterlockedCompareExchangePointer ( IN VOID *ExchangeValue
);
+
//
// Base Library Checksum Functions
//
/**
- Calculate the sum of all elements in a buffer in unit of UINT8.
+ 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
+ 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().
+ 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 .
@@ -3100,14 +3214,14 @@ CalculateSum8 ( /**
- Returns the two's complement checksum of all elements in a buffer
+ 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
+ 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().
@@ -3125,14 +3239,15 @@ CalculateCheckSum8 ( IN UINTN Length
);
+
/**
- Returns the sum of all elements in a buffer of 16-bit values. During
+ 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.
-
+ 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().
@@ -3151,19 +3266,20 @@ CalculateSum16 ( IN UINTN Length
);
+
/**
- Returns the two's complement checksum of all elements in a buffer of
+ 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
+ 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().
+ 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.
@@ -3178,14 +3294,15 @@ CalculateCheckSum16 ( IN UINTN Length
);
+
/**
- Returns the sum of all elements in a buffer of 32-bit values. During
+ 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.
-
+ 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().
@@ -3204,19 +3321,20 @@ CalculateSum32 ( IN UINTN Length
);
+
/**
- Returns the two's complement checksum of all elements in a buffer of
+ 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
+ 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().
+ 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.
@@ -3231,14 +3349,15 @@ CalculateCheckSum32 ( IN UINTN Length
);
+
/**
- Returns the sum of all elements in a buffer of 64-bit values. During
+ 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.
-
+ 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().
@@ -3257,19 +3376,20 @@ CalculateSum64 ( IN UINTN Length
);
+
/**
- Returns the two's complement checksum of all elements in a buffer of
+ 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
+ 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().
+ 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.
@@ -3284,6 +3404,7 @@ CalculateCheckSum64 ( IN UINTN Length
);
+
//
// Base Library CPU Functions
//
@@ -3294,6 +3415,7 @@ VOID IN VOID *Context2 OPTIONAL
);
+
/**
Used to serialize load and store operations.
@@ -3307,6 +3429,7 @@ MemoryFence ( VOID
);
+
/**
Saves the current CPU context that can be restored with a call to LongJump()
and returns 0.
@@ -3329,6 +3452,7 @@ SetJump ( OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
);
+
/**
Restores the CPU context that was saved with SetJump().
@@ -3352,6 +3476,7 @@ LongJump ( IN UINTN Value
);
+
/**
Enables CPU interrupts.
@@ -3364,6 +3489,7 @@ EnableInterrupts ( VOID
);
+
/**
Disables CPU interrupts.
@@ -3376,6 +3502,7 @@ DisableInterrupts ( VOID
);
+
/**
Disables CPU interrupts and returns the interrupt state prior to the disable
operation.
@@ -3393,6 +3520,7 @@ SaveAndDisableInterrupts ( VOID
);
+
/**
Enables CPU interrupts for the smallest window required to capture any
pending interrupts.
@@ -3407,6 +3535,7 @@ EnableDisableInterrupts ( VOID
);
+
/**
Retrieves the current CPU interrupt state.
@@ -3423,6 +3552,7 @@ GlueGetInterruptState ( VOID
);
+
/**
Set the current CPU interrupt state.
@@ -3443,6 +3573,7 @@ SetInterruptState ( IN BOOLEAN InterruptState
);
+
/**
Places the CPU in a sleep state until an interrupt is received.
@@ -3457,6 +3588,7 @@ CpuSleep ( VOID
);
+
/**
Requests CPU to pause for a short period of time.
@@ -3470,6 +3602,7 @@ CpuPause ( VOID
);
+
/**
Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
@@ -3482,13 +3615,18 @@ CpuFlushTlb ( VOID
);
+
/**
Transfers control to a function starting with a new stack.
- Transfers control to the function specified by EntryPoint using the new stack
- specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
+ Transfers control to the function specified by EntryPoint using the
+ new stack specified by NewStack and passing in the parameters specified
+ by Context1 and Context2. Context1 and Context2 are optional and may
+ be NULL. The function EntryPoint must never return. This function
+ supports a variable number of arguments following the NewStack parameter.
+ These additional arguments are 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().
@@ -3508,9 +3646,11 @@ SwitchStack ( IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
- IN VOID *NewStack
+ IN VOID *NewStack,
+ ...
);
+
/**
Generates a breakpoint on the CPU.
@@ -3524,6 +3664,7 @@ CpuBreakpoint ( VOID
);
+
/**
Executes an infinite loop.
@@ -3539,6 +3680,1237 @@ CpuDeadLoop ( VOID
);
+
+#if defined (MDE_CPU_IPF)
+
+/**
+ Flush a range of cache lines in the cache coherency domain of the calling
+ CPU.
+
+ Invalidates the cache lines specified by Address and Length. If Address is
+ not aligned on a cache line boundary, then entire cache line containing
+ Address is invalidated. If Address + Length is not aligned on a cache line
+ boundary, then the entire instruction cache line containing Address + Length
+ -1 is invalidated. This function may choose to invalidate the entire
+ instruction cache if that is more efficient than invalidating the specified
+ range. If Length is 0, the no instruction cache lines are invalidated.
+ Address is returned.
+
+ If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
+
+ @param Address The base address of the instruction lines to invalidate. If
+ the CPU is in a physical addressing mode, then Address is a
+ physical address. If the CPU is in a virtual addressing mode,
+ then Address is a virtual address.
+
+ @param Length The number of bytes to invalidate from the instruction cache.
+
+ @return Address
+
+**/
+VOID *
+EFIAPI
+IpfFlushCacheRange (
+ IN VOID *Address,
+ IN UINTN Length
+ );
+
+
+/**
+ Executes a FC instruction
+ Executes a FC instruction on the cache line specified by Address.
+ The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary).
+ An implementation may flush a larger region. This function is only available on IPF.
+
+ @param Address The Address of cache line to be flushed.
+
+ @return The address of FC instruction executed.
+
+**/
+UINT64
+EFIAPI
+AsmFc (
+ IN UINT64 Address
+ );
+
+
+/**
+ Executes a FC.I instruction.
+ Executes a FC.I instruction on the cache line specified by Address.
+ The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary).
+ An implementation may flush a larger region. This function is only available on IPF.
+
+ @param Address The Address of cache line to be flushed.
+
+ @return The address of FC.I instruction executed.
+
+**/
+UINT64
+EFIAPI
+AsmFci (
+ IN UINT64 Address
+ );
+
+
+/**
+ Reads the current value of a Processor Identifier Register (CPUID).
+ The Index of largest implemented CPUID (One less than the number of implemented CPUID
+ registers) is determined by CPUID [3] bits {7:0}.
+ No parameter checking is performed on Index. If the Index value is beyond the
+ implemented CPUID register range, a Reserved Register/Field fault may occur. The caller
+ must either guarantee that Index is valid, or the caller must set up fault handlers to
+ catch the faults. This function is only available on IPF.
+
+ @param Index The 8-bit Processor Identifier Register index to read.
+
+ @return The current value of Processor Identifier Register specified by Index.
+
+**/
+UINT64
+EFIAPI
+AsmReadCpuid (
+ IN UINT8 Index
+ );
+
+
+/**
+ Reads the current value of 64-bit Processor Status Register (PSR).
+ This function is only available on IPF.
+
+ @return The current value of PSR.
+
+**/
+UINT64
+EFIAPI
+AsmReadPsr (
+ VOID
+ );
+
+
+/**
+ Writes the current value of 64-bit Processor Status Register (PSR).
+ No parameter checking is performed on Value. All bits of Value corresponding to
+ reserved fields of PSR must be 0 or a Reserved Register/Field fault may occur. The caller must either guarantee that Value is valid, or the caller must set up fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to PSR.
+
+ @return The 64-bit value written to the PSR.
+
+**/
+UINT64
+EFIAPI
+AsmWritePsr (
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #0 (KR0).
+ This function is only available on IPF.
+
+ @return The current value of KR0.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr0 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #1 (KR1).
+ This function is only available on IPF.
+
+ @return The current value of KR1.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr1 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #2 (KR2).
+ This function is only available on IPF.
+
+ @return The current value of KR2.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr2 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #3 (KR3).
+ This function is only available on IPF.
+
+ @return The current value of KR3.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr3 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #4 (KR4).
+ This function is only available on IPF.
+
+ @return The current value of KR4.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr4 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #5 (KR5).
+ This function is only available on IPF.
+
+ @return The current value of KR5.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr5 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #6 (KR6).
+ This function is only available on IPF.
+
+ @return The current value of KR6.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr6 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of 64-bit Kernel Register #7 (KR7).
+ This function is only available on IPF.
+
+ @return The current value of KR7.
+
+**/
+UINT64
+EFIAPI
+AsmReadKr7 (
+ VOID
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #0 (KR0).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR0.
+
+ @return The 64-bit value written to the KR0.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr0 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #1 (KR1).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR1.
+
+ @return The 64-bit value written to the KR1.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr1 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #2 (KR2).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR2.
+
+ @return The 64-bit value written to the KR2.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr2 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #3 (KR3).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR3.
+
+ @return The 64-bit value written to the KR3.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr3 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #4 (KR4).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR4.
+
+ @return The 64-bit value written to the KR4.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr4 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #5 (KR5).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR5.
+
+ @return The 64-bit value written to the KR5.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr5 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #6 (KR6).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR6.
+
+ @return The 64-bit value written to the KR6.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr6 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Write the current value of 64-bit Kernel Register #7 (KR7).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to KR7.
+
+ @return The 64-bit value written to the KR7.
+
+**/
+UINT64
+EFIAPI
+AsmWriteKr7 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of Interval Timer Counter Register (ITC).
+ This function is only available on IPF.
+
+ @return The current value of ITC.
+
+**/
+UINT64
+EFIAPI
+AsmReadItc (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Interval Timer Vector Register (ITV).
+ This function is only available on IPF.
+
+ @return The current value of ITV.
+
+**/
+UINT64
+EFIAPI
+AsmReadItv (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Interval Timer Match Register (ITM).
+ This function is only available on IPF.
+
+ @return The current value of ITM.
+**/
+UINT64
+EFIAPI
+AsmReadItm (
+ VOID
+ );
+
+
+/**
+ Writes the current value of 64-bit Interval Timer Counter Register (ITC).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to ITC.
+
+ @return The 64-bit value written to the ITC.
+
+**/
+UINT64
+EFIAPI
+AsmWriteItc (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Interval Timer Match Register (ITM).
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to ITM.
+
+ @return The 64-bit value written to the ITM.
+
+**/
+UINT64
+EFIAPI
+AsmWriteItm (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Interval Timer Vector Register (ITV).
+ No parameter checking is performed on Value. All bits of Value corresponding to
+ reserved fields of ITV must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to ITV.
+
+ @return The 64-bit value written to the ITV.
+
+**/
+UINT64
+EFIAPI
+AsmWriteItv (
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of Default Control Register (DCR).
+ This function is only available on IPF.
+
+ @return The current value of DCR.
+
+**/
+UINT64
+EFIAPI
+AsmReadDcr (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Interruption Vector Address Register (IVA).
+ This function is only available on IPF.
+
+ @return The current value of IVA.
+**/
+UINT64
+EFIAPI
+AsmReadIva (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Page Table Address Register (PTA).
+ This function is only available on IPF.
+
+ @return The current value of PTA.
+
+**/
+UINT64
+EFIAPI
+AsmReadPta (
+ VOID
+ );
+
+
+/**
+ Writes the current value of 64-bit Default Control Register (DCR).
+ No parameter checking is performed on Value. All bits of Value corresponding to
+ reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to DCR.
+
+ @return The 64-bit value written to the DCR.
+
+**/
+UINT64
+EFIAPI
+AsmWriteDcr (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Interruption Vector Address Register (IVA).
+ The size of vector table is 32 K bytes and is 32 K bytes aligned
+ the low 15 bits of Value is ignored when written.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to IVA.
+
+ @return The 64-bit value written to the IVA.
+
+**/
+UINT64
+EFIAPI
+AsmWriteIva (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Page Table Address Register (PTA).
+ No parameter checking is performed on Value. All bits of Value corresponding to
+ reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to PTA.
+
+ @return The 64-bit value written to the PTA.
+**/
+UINT64
+EFIAPI
+AsmWritePta (
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of Local Interrupt ID Register (LID).
+ This function is only available on IPF.
+
+ @return The current value of LID.
+
+**/
+UINT64
+EFIAPI
+AsmReadLid (
+ VOID
+ );
+
+
+/**
+ Reads the current value of External Interrupt Vector Register (IVR).
+ This function is only available on IPF.
+
+ @return The current value of IVR.
+
+**/
+UINT64
+EFIAPI
+AsmReadIvr (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Task Priority Register (TPR).
+ This function is only available on IPF.
+
+ @return The current value of TPR.
+
+**/
+UINT64
+EFIAPI
+AsmReadTpr (
+ VOID
+ );
+
+
+/**
+ Reads the current value of External Interrupt Request Register #0 (IRR0).
+ This function is only available on IPF.
+
+ @return The current value of IRR0.
+
+**/
+UINT64
+EFIAPI
+AsmReadIrr0 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of External Interrupt Request Register #1 (IRR1).
+ This function is only available on IPF.
+
+ @return The current value of IRR1.
+
+**/
+UINT64
+EFIAPI
+AsmReadIrr1 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of External Interrupt Request Register #2 (IRR2).
+ This function is only available on IPF.
+
+ @return The current value of IRR2.
+
+**/
+UINT64
+EFIAPI
+AsmReadIrr2 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of External Interrupt Request Register #3 (IRR3).
+ This function is only available on IPF.
+
+ @return The current value of IRR3.
+
+**/
+UINT64
+EFIAPI
+AsmReadIrr3 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Performance Monitor Vector Register (PMV).
+ This function is only available on IPF.
+
+ @return The current value of PMV.
+
+**/
+UINT64
+EFIAPI
+AsmReadPmv (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Corrected Machine Check Vector Register (CMCV).
+ This function is only available on IPF.
+
+ @return The current value of CMCV.
+
+**/
+UINT64
+EFIAPI
+AsmReadCmcv (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Local Redirection Register #0 (LRR0).
+ This function is only available on IPF.
+
+ @return The current value of LRR0.
+
+**/
+UINT64
+EFIAPI
+AsmReadLrr0 (
+ VOID
+ );
+
+
+/**
+ Reads the current value of Local Redirection Register #1 (LRR1).
+ This function is only available on IPF.
+
+ @return The current value of LRR1.
+
+**/
+UINT64
+EFIAPI
+AsmReadLrr1 (
+ VOID
+ );
+
+
+/**
+ Writes the current value of 64-bit Page Local Interrupt ID Register (LID).
+ No parameter checking is performed on Value. All bits of Value corresponding to
+ reserved fields of LID must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to LID.
+
+ @return The 64-bit value written to the LID.
+
+**/
+UINT64
+EFIAPI
+AsmWriteLid (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Task Priority Register (TPR).
+ No parameter checking is performed on Value. All bits of Value corresponding to
+ reserved fields of TPR must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to TPR.
+
+ @return The 64-bit value written to the TPR.
+
+**/
+UINT64
+EFIAPI
+AsmWriteTpr (
+ IN UINT64 Value
+ );
+
+
+/**
+ Performs a write operation on End OF External Interrupt Register (EOI).
+ Writes a value of 0 to the EOI Register. This function is only available on IPF.
+
+**/
+VOID
+EFIAPI
+AsmWriteEoi (
+ VOID
+ );
+
+
+/**
+ Writes the current value of 64-bit Performance Monitor Vector Register (PMV).
+ No parameter checking is performed on Value. All bits of Value corresponding
+ to reserved fields of PMV must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to PMV.
+
+ @return The 64-bit value written to the PMV.
+
+**/
+UINT64
+EFIAPI
+AsmWritePmv (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Corrected Machine Check Vector Register (CMCV).
+ No parameter checking is performed on Value. All bits of Value corresponding
+ to reserved fields of CMCV must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to CMCV.
+
+ @return The 64-bit value written to the CMCV.
+
+**/
+UINT64
+EFIAPI
+AsmWriteCmcv (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Local Redirection Register #0 (LRR0).
+ No parameter checking is performed on Value. All bits of Value corresponding
+ to reserved fields of LRR0 must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to LRR0.
+
+ @return The 64-bit value written to the LRR0.
+
+**/
+UINT64
+EFIAPI
+AsmWriteLrr0 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Local Redirection Register #1 (LRR1).
+ No parameter checking is performed on Value. All bits of Value corresponding
+ to reserved fields of LRR1 must be 0 or a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Value is valid, or the caller must
+ set up fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to LRR1.
+
+ @return The 64-bit value written to the LRR1.
+
+**/
+UINT64
+EFIAPI
+AsmWriteLrr1 (
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of Instruction Breakpoint Register (IBR).
+
+ The Instruction Breakpoint Registers are used in pairs. The even numbered
+ registers contain breakpoint addresses, and the odd numbered registers contain
+ breakpoint mask conditions. At least 4 instruction registers pairs are implemented
+ on all processor models. Implemented registers are contiguous starting with
+ register 0. No parameter checking is performed on Index, and if the Index value
+ is beyond the implemented IBR register range, a Reserved Register/Field fault may
+ occur. The caller must either guarantee that Index is valid, or the caller must
+ set up fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Instruction Breakpoint Register index to read.
+
+ @return The current value of Instruction Breakpoint Register specified by Index.
+
+**/
+UINT64
+EFIAPI
+AsmReadIbr (
+ IN UINT8 Index
+ );
+
+
+/**
+ Reads the current value of Data Breakpoint Register (DBR).
+
+ The Data Breakpoint Registers are used in pairs. The even numbered registers
+ contain breakpoint addresses, and odd numbered registers contain breakpoint
+ mask conditions. At least 4 data registers pairs are implemented on all processor
+ models. Implemented registers are contiguous starting with register 0.
+ No parameter checking is performed on Index. If the Index value is beyond
+ the implemented DBR register range, a Reserved Register/Field fault may occur.
+ The caller must either guarantee that Index is valid, or the caller must set up
+ fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Data Breakpoint Register index to read.
+
+ @return The current value of Data Breakpoint Register specified by Index.
+
+**/
+UINT64
+EFIAPI
+AsmReadDbr (
+ IN UINT8 Index
+ );
+
+
+/**
+ Reads the current value of Performance Monitor Configuration Register (PMC).
+
+ All processor implementations provide at least 4 performance counters
+ (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter overflow
+ status registers (PMC [0]¡ PMC [3]). Processor implementations may provide
+ additional implementation-dependent PMC and PMD to increase the number of
+ ¡®generic¡¯ performance counters (PMC/PMD pairs). The remainder of PMC and PMD
+ register set is implementation dependent. No parameter checking is performed
+ on Index. If the Index value is beyond the implemented PMC register range,
+ zero value will be returned.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Performance Monitor Configuration Register index to read.
+
+ @return The current value of Performance Monitor Configuration Register
+ specified by Index.
+
+**/
+UINT64
+EFIAPI
+AsmReadPmc (
+ IN UINT8 Index
+ );
+
+
+/**
+ Reads the current value of Performance Monitor Data Register (PMD).
+
+ All processor implementations provide at least 4 performance counters
+ (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter
+ overflow status registers (PMC [0]¡ PMC [3]). Processor implementations may
+ provide additional implementation-dependent PMC and PMD to increase the number
+ of ¡®generic¡¯ performance counters (PMC/PMD pairs). The remainder of PMC and PMD
+ register set is implementation dependent. No parameter checking is performed
+ on Index. If the Index value is beyond the implemented PMD register range,
+ zero value will be returned.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Performance Monitor Data Register index to read.
+
+ @return The current value of Performance Monitor Data Register specified by Index.
+
+**/
+UINT64
+EFIAPI
+AsmReadPmd (
+ IN UINT8 Index
+ );
+
+
+/**
+ Writes the current value of 64-bit Instruction Breakpoint Register (IBR).
+
+ Writes current value of Instruction Breakpoint Register specified by Index.
+ The Instruction Breakpoint Registers are used in pairs. The even numbered
+ registers contain breakpoint addresses, and odd numbered registers contain
+ breakpoint mask conditions. At least 4 instruction registers pairs are implemented
+ on all processor models. Implemented registers are contiguous starting with
+ register 0. No parameter checking is performed on Index. If the Index value
+ is beyond the implemented IBR register range, a Reserved Register/Field fault may
+ occur. The caller must either guarantee that Index is valid, or the caller must
+ set up fault handlers to catch the faults.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Instruction Breakpoint Register index to write.
+ @param Value The 64-bit value to write to IBR.
+
+ @return The 64-bit value written to the IBR.
+
+**/
+UINT64
+EFIAPI
+AsmWriteIbr (
+ IN UINT8 Index,
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Data Breakpoint Register (DBR).
+
+ Writes current value of Data Breakpoint Register specified by Index.
+ The Data Breakpoint Registers are used in pairs. The even numbered registers
+ contain breakpoint addresses, and odd numbered registers contain breakpoint
+ mask conditions. At least 4 data registers pairs are implemented on all processor
+ models. Implemented registers are contiguous starting with register 0. No parameter
+ checking is performed on Index. If the Index value is beyond the implemented
+ DBR register range, a Reserved Register/Field fault may occur. The caller must
+ either guarantee that Index is valid, or the caller must set up fault handlers to
+ catch the faults.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Data Breakpoint Register index to write.
+ @param Value The 64-bit value to write to DBR.
+
+ @return The 64-bit value written to the DBR.
+
+**/
+UINT64
+EFIAPI
+AsmWriteDbr (
+ IN UINT8 Index,
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Performance Monitor Configuration Register (PMC).
+
+ Writes current value of Performance Monitor Configuration Register specified by Index.
+ All processor implementations provide at least 4 performance counters
+ (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter overflow status
+ registers (PMC [0]¡ PMC [3]). Processor implementations may provide additional
+ implementation-dependent PMC and PMD to increase the number of ¡®generic¡¯ performance
+ counters (PMC/PMD pairs). The remainder of PMC and PMD register set is implementation
+ dependent. No parameter checking is performed on Index. If the Index value is
+ beyond the implemented PMC register range, the write is ignored.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Performance Monitor Configuration Register index to write.
+ @param Value The 64-bit value to write to PMC.
+
+ @return The 64-bit value written to the PMC.
+
+**/
+UINT64
+EFIAPI
+AsmWritePmc (
+ IN UINT8 Index,
+ IN UINT64 Value
+ );
+
+
+/**
+ Writes the current value of 64-bit Performance Monitor Data Register (PMD).
+
+ Writes current value of Performance Monitor Data Register specified by Index.
+ All processor implementations provide at least 4 performance counters
+ (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter overflow
+ status registers (PMC [0]¡ PMC [3]). Processor implementations may provide
+ additional implementation-dependent PMC and PMD to increase the number of ¡®generic¡¯
+ performance counters (PMC/PMD pairs). The remainder of PMC and PMD register set
+ is implementation dependent. No parameter checking is performed on Index. If the
+ Index value is beyond the implemented PMD register range, the write is ignored.
+ This function is only available on IPF.
+
+ @param Index The 8-bit Performance Monitor Data Register index to write.
+ @param Value The 64-bit value to write to PMD.
+
+ @return The 64-bit value written to the PMD.
+
+**/
+UINT64
+EFIAPI
+AsmWritePmd (
+ IN UINT8 Index,
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of 64-bit Global Pointer (GP).
+
+ Reads and returns the current value of GP.
+ This function is only available on IPF.
+
+ @return The current value of GP.
+
+**/
+UINT64
+EFIAPI
+AsmReadGp (
+ VOID
+ );
+
+
+/**
+ Write the current value of 64-bit Global Pointer (GP).
+
+ Writes the current value of GP. The 64-bit value written to the GP is returned.
+ No parameter checking is performed on Value.
+ This function is only available on IPF.
+
+ @param Value The 64-bit value to write to GP.
+
+ @return The 64-bit value written to the GP.
+
+**/
+UINT64
+EFIAPI
+AsmWriteGp (
+ IN UINT64 Value
+ );
+
+
+/**
+ Reads the current value of 64-bit Stack Pointer (SP).
+
+ Reads and returns the current value of SP.
+ This function is only available on IPF.
+
+ @return The current value of SP.
+
+**/
+UINT64
+EFIAPI
+AsmReadSp (
+ VOID
+ );
+
+
+/**
+ Determines if the CPU is currently executing in virtual, physical, or mixed mode.
+
+ Determines the current execution mode of the CPU.
+ If the CPU is in virtual mode(PSR.RT=1, PSR.DT=1, PSR.IT=1), then 1 is returned.
+ If the CPU is in physical mode(PSR.RT=0, PSR.DT=0, PSR.IT=0), then 0 is returned.
+ If the CPU is not in physical mode or virtual mode, then it is in mixed mode,
+ and -1 is returned.
+ This function is only available on IPF.
+
+ @return 1 The CPU is in virtual mode.
+ @return 0 The CPU is in physical mode.
+ @return -1 The CPU is in mixed mode.
+
+**/
+INT64
+EFIAPI
+AsmCpuVirtual (
+ VOID
+ );
+
+
+/**
+ Makes a PAL procedure call.
+
+ This is a wrapper function to make a PAL procedure call. Based on the Index
+ value this API will make static or stacked PAL call. The following table
+ describes the usage of PAL Procedure Index Assignment. Architected procedures
+ may be designated as required or optional. If a PAL procedure is specified
+ as optional, a unique return code of 0xFFFFFFFFFFFFFFFF is returned in the
+ Status field of the PAL_CALL_RETURN structure.
+ This indicates that the procedure is not present in this PAL implementation.
+ It is the caller¡¯s responsibility to check for this return code after calling
+ any optional PAL procedure.
+ No parameter checking is performed on the 5 input parameters, but there are
+ some common rules that the caller should follow when making a PAL call. Any
+ address passed to PAL as buffers for return parameters must be 8-byte aligned.
+ Unaligned addresses may cause undefined results. For those parameters defined
+ as reserved or some fields defined as reserved must be zero filled or the invalid
+ argument return value may be returned or undefined result may occur during the
+ execution of the procedure. If the PalEntryPoint does not point to a valid
+ PAL entry point then the system behavior is undefined. This function is only
+ available on IPF.
+
+ @param PalEntryPoint The PAL procedure calls entry point.
+ @param Index The PAL procedure Index number.
+ @param Arg2 The 2nd parameter for PAL procedure calls.
+ @param Arg3 The 3rd parameter for PAL procedure calls.
+ @param Arg4 The 4th parameter for PAL procedure calls.
+
+ @return structure returned from the PAL Call procedure, including the status and return value.
+
+**/
+PAL_CALL_RETURN
+EFIAPI
+AsmPalCall (
+ IN UINT64 PalEntryPoint,
+ IN UINT64 Index,
+ IN UINT64 Arg2,
+ IN UINT64 Arg3,
+ IN UINT64 Arg4
+ );
+
+
+/**
+ Transfers control to a function starting with a new stack.
+
+ Transfers control to the function specified by EntryPoint using the new stack
+ specified by NewStack and passing in the parameters specified by Context1 and
+ Context2. Context1 and Context2 are optional and may be NULL. The function
+ EntryPoint must never return.
+
+ If EntryPoint is NULL, then ASSERT().
+ If NewStack is NULL, then ASSERT().
+
+ @param EntryPoint A pointer to function to call with the new stack.
+ @param Context1 A pointer to the context to pass into the EntryPoint
+ function.
+ @param Context2 A pointer to the context to pass into the EntryPoint
+ function.
+ @param NewStack A pointer to the new stack to use for the EntryPoint
+ function.
+ @param NewBsp A pointer to the new memory location for RSE backing
+ store.
+
+**/
+VOID
+EFIAPI
+AsmSwitchStackAndBackingStore (
+ IN SWITCH_STACK_ENTRY_POINT EntryPoint,
+ IN VOID *Context1, OPTIONAL
+ IN VOID *Context2, OPTIONAL
+ IN VOID *NewStack,
+ IN VOID *NewBsp
+ );
+
+
+//
+// Bugbug: This call should be removed after
+// the PalCall Instance issue has been fixed.
+//
+/**
+ Performs a PAL call using static calling convention.
+
+ An internal function to perform a PAL call using static calling convention.
+
+ @param PalEntryPoint The entry point address of PAL. The address in ar.kr5
+ would be used if this parameter were NULL on input.
+ @param Arg1 The first argument of a PAL call.
+ @param Arg1 The second argument of a PAL call.
+ @param Arg1 The third argument of a PAL call.
+ @param Arg1 The fourth argument of a PAL call.
+
+ @return The values returned in r8, r9, r10 and r11.
+
+**/
+PAL_CALL_RETURN
+PalCallStatic (
+ IN CONST VOID *PalEntryPoint,
+ IN UINT64 Arg1,
+ IN UINT64 Arg2,
+ IN UINT64 Arg3,
+ IN UINT64 Arg4
+ );
+
+
+#elif defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
//
// IA32 and X64 Specific Functions
//
@@ -3806,6 +5178,7 @@ AsmCpuid ( OUT UINT32 *Edx OPTIONAL
);
+
/**
Retrieves CPUID information using an extended leaf identifier.
@@ -3849,6 +5222,7 @@ AsmCpuidEx ( OUT UINT32 *Edx OPTIONAL
);
+
/**
Returns the lower 32-bits of a Machine Specific Register(MSR).
@@ -3869,6 +5243,7 @@ AsmReadMsr32 ( IN UINT32 Index
);
+
/**
Zero-extend a 32-bit value and writes it to a Machine Specific Register(MSR).
@@ -3892,6 +5267,7 @@ AsmWriteMsr32 ( IN UINT32 Value
);
+
/**
Reads a 64-bit MSR, performs a bitwise inclusive OR on the lower 32-bits, and
writes the result back to the 64-bit MSR.
@@ -3918,6 +5294,7 @@ AsmMsrOr32 ( IN UINT32 OrData
);
+
/**
Reads a 64-bit MSR, performs a bitwise AND on the lower 32-bits, and writes
the result back to the 64-bit MSR.
@@ -3944,6 +5321,7 @@ AsmMsrAnd32 ( IN UINT32 AndData
);
+
/**
Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise inclusive OR
on the lower 32-bits, and writes the result back to the 64-bit MSR.
@@ -3974,6 +5352,7 @@ AsmMsrAndThenOr32 ( IN UINT32 OrData
);
+
/**
Reads a bit field of an MSR.
@@ -4004,6 +5383,7 @@ AsmMsrBitFieldRead32 ( IN UINTN EndBit
);
+
/**
Writes a bit field to an MSR.
@@ -4038,6 +5418,7 @@ AsmMsrBitFieldWrite32 ( IN UINT32 Value
);
+
/**
Reads a bit field in a 64-bit MSR, performs a bitwise OR, and writes the
result back to the bit field in the 64-bit MSR.
@@ -4073,6 +5454,7 @@ AsmMsrBitFieldOr32 ( IN UINT32 OrData
);
+
/**
Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the
result back to the bit field in the 64-bit MSR.
@@ -4108,6 +5490,7 @@ AsmMsrBitFieldAnd32 ( IN UINT32 AndData
);
+
/**
Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a
bitwise inclusive OR, and writes the result back to the bit field in the
@@ -4147,6 +5530,7 @@ AsmMsrBitFieldAndThenOr32 ( IN UINT32 OrData
);
+
/**
Returns a 64-bit Machine Specific Register(MSR).
@@ -4167,6 +5551,7 @@ AsmReadMsr64 ( IN UINT32 Index
);
+
/**
Writes a 64-bit value to a Machine Specific Register(MSR), and returns the
value.
@@ -4191,6 +5576,7 @@ AsmWriteMsr64 ( IN UINT64 Value
);
+
/**
Reads a 64-bit MSR, performs a bitwise inclusive OR, and writes the result
back to the 64-bit MSR.
@@ -4216,6 +5602,7 @@ AsmMsrOr64 ( IN UINT64 OrData
);
+
/**
Reads a 64-bit MSR, performs a bitwise AND, and writes the result back to the
64-bit MSR.
@@ -4241,6 +5628,7 @@ AsmMsrAnd64 ( IN UINT64 AndData
);
+
/**
Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise inclusive
OR, and writes the result back to the 64-bit MSR.
@@ -4270,6 +5658,7 @@ AsmMsrAndThenOr64 ( IN UINT64 OrData
);
+
/**
Reads a bit field of an MSR.
@@ -4300,6 +5689,7 @@ AsmMsrBitFieldRead64 ( IN UINTN EndBit
);
+
/**
Writes a bit field to an MSR.
@@ -4333,6 +5723,7 @@ AsmMsrBitFieldWrite64 ( IN UINT64 Value
);
+
/**
Reads a bit field in a 64-bit MSR, performs a bitwise inclusive OR, and
writes the result back to the bit field in the 64-bit MSR.
@@ -4368,6 +5759,7 @@ AsmMsrBitFieldOr64 ( IN UINT64 OrData
);
+
/**
Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the
result back to the bit field in the 64-bit MSR.
@@ -4403,6 +5795,7 @@ AsmMsrBitFieldAnd64 ( IN UINT64 AndData
);
+
/**
Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a
bitwise inclusive OR, and writes the result back to the bit field in the
@@ -4441,6 +5834,7 @@ AsmMsrBitFieldAndThenOr64 ( IN UINT64 OrData
);
+
/**
Reads the current value of the EFLAGS register.
@@ -4457,6 +5851,7 @@ AsmReadEflags ( VOID
);
+
/**
Reads the current value of the Control Register 0 (CR0).
@@ -4473,6 +5868,7 @@ AsmReadCr0 ( VOID
);
+
/**
Reads the current value of the Control Register 2 (CR2).
@@ -4489,6 +5885,7 @@ AsmReadCr2 ( VOID
);
+
/**
Reads the current value of the Control Register 3 (CR3).
@@ -4505,6 +5902,7 @@ AsmReadCr3 ( VOID
);
+
/**
Reads the current value of the Control Register 4 (CR4).
@@ -4521,6 +5919,7 @@ AsmReadCr4 ( VOID
);
+
/**
Writes a value to Control Register 0 (CR0).
@@ -4538,6 +5937,7 @@ AsmWriteCr0 ( UINTN Cr0
);
+
/**
Writes a value to Control Register 2 (CR2).
@@ -4555,6 +5955,7 @@ AsmWriteCr2 ( UINTN Cr2
);
+
/**
Writes a value to Control Register 3 (CR3).
@@ -4572,6 +5973,7 @@ AsmWriteCr3 ( UINTN Cr3
);
+
/**
Writes a value to Control Register 4 (CR4).
@@ -4589,6 +5991,7 @@ AsmWriteCr4 ( UINTN Cr4
);
+
/**
Reads the current value of Debug Register 0 (DR0).
@@ -4605,6 +6008,7 @@ AsmReadDr0 ( VOID
);
+
/**
Reads the current value of Debug Register 1 (DR1).
@@ -4621,6 +6025,7 @@ AsmReadDr1 ( VOID
);
+
/**
Reads the current value of Debug Register 2 (DR2).
@@ -4637,6 +6042,7 @@ AsmReadDr2 ( VOID
);
+
/**
Reads the current value of Debug Register 3 (DR3).
@@ -4653,6 +6059,7 @@ AsmReadDr3 ( VOID
);
+
/**
Reads the current value of Debug Register 4 (DR4).
@@ -4669,6 +6076,7 @@ AsmReadDr4 ( VOID
);
+
/**
Reads the current value of Debug Register 5 (DR5).
@@ -4685,6 +6093,7 @@ AsmReadDr5 ( VOID
);
+
/**
Reads the current value of Debug Register 6 (DR6).
@@ -4701,6 +6110,7 @@ AsmReadDr6 ( VOID
);
+
/**
Reads the current value of Debug Register 7 (DR7).
@@ -4717,6 +6127,7 @@ AsmReadDr7 ( VOID
);
+
/**
Writes a value to Debug Register 0 (DR0).
@@ -4734,6 +6145,7 @@ AsmWriteDr0 ( UINTN Dr0
);
+
/**
Writes a value to Debug Register 1 (DR1).
@@ -4751,6 +6163,7 @@ AsmWriteDr1 ( UINTN Dr1
);
+
/**
Writes a value to Debug Register 2 (DR2).
@@ -4768,6 +6181,7 @@ AsmWriteDr2 ( UINTN Dr2
);
+
/**
Writes a value to Debug Register 3 (DR3).
@@ -4785,6 +6199,7 @@ AsmWriteDr3 ( UINTN Dr3
);
+
/**
Writes a value to Debug Register 4 (DR4).
@@ -4802,6 +6217,7 @@ AsmWriteDr4 ( UINTN Dr4
);
+
/**
Writes a value to Debug Register 5 (DR5).
@@ -4819,6 +6235,7 @@ AsmWriteDr5 ( UINTN Dr5
);
+
/**
Writes a value to Debug Register 6 (DR6).
@@ -4836,6 +6253,7 @@ AsmWriteDr6 ( UINTN Dr6
);
+
/**
Writes a value to Debug Register 7 (DR7).
@@ -4853,6 +6271,7 @@ AsmWriteDr7 ( UINTN Dr7
);
+
/**
Reads the current value of Code Segment Register (CS).
@@ -4868,6 +6287,7 @@ AsmReadCs ( VOID
);
+
/**
Reads the current value of Data Segment Register (DS).
@@ -4883,6 +6303,7 @@ AsmReadDs ( VOID
);
+
/**
Reads the current value of Extra Segment Register (ES).
@@ -4898,6 +6319,7 @@ AsmReadEs ( VOID
);
+
/**
Reads the current value of FS Data Segment Register (FS).
@@ -4913,6 +6335,7 @@ AsmReadFs ( VOID
);
+
/**
Reads the current value of GS Data Segment Register (GS).
@@ -4928,6 +6351,7 @@ AsmReadGs ( VOID
);
+
/**
Reads the current value of Stack Segment Register (SS).
@@ -4943,6 +6367,7 @@ AsmReadSs ( VOID
);
+
/**
Reads the current value of Task Register (TR).
@@ -4958,6 +6383,7 @@ AsmReadTr ( VOID
);
+
/**
Reads the current Global Descriptor Table Register(GDTR) descriptor.
@@ -4975,6 +6401,7 @@ AsmReadGdtr ( OUT IA32_DESCRIPTOR *Gdtr
);
+
/**
Writes the current Global Descriptor Table Register (GDTR) descriptor.
@@ -4992,6 +6419,7 @@ AsmWriteGdtr ( IN CONST IA32_DESCRIPTOR *Gdtr
);
+
/**
Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
@@ -5009,6 +6437,7 @@ AsmReadIdtr ( OUT IA32_DESCRIPTOR *Idtr
);
+
/**
Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
@@ -5026,6 +6455,7 @@ AsmWriteIdtr ( IN CONST IA32_DESCRIPTOR *Idtr
);
+
/**
Reads the current Local Descriptor Table Register(LDTR) selector.
@@ -5041,6 +6471,7 @@ AsmReadLdtr ( VOID
);
+
/**
Writes the current Local Descriptor Table Register (GDTR) selector.
@@ -5056,6 +6487,7 @@ AsmWriteLdtr ( IN UINT16 Ldtr
);
+
/**
Save the current floating point/SSE/SSE2 context to a buffer.
@@ -5075,6 +6507,7 @@ AsmFxSave ( OUT IA32_FX_BUFFER *Buffer
);
+
/**
Restores the current floating point/SSE/SSE2 context from a buffer.
@@ -5095,6 +6528,7 @@ AsmFxRestore ( IN CONST IA32_FX_BUFFER *Buffer
);
+
/**
Reads the current value of 64-bit MMX Register #0 (MM0).
@@ -5110,6 +6544,7 @@ AsmReadMm0 ( VOID
);
+
/**
Reads the current value of 64-bit MMX Register #1 (MM1).
@@ -5125,6 +6560,7 @@ AsmReadMm1 ( VOID
);
+
/**
Reads the current value of 64-bit MMX Register #2 (MM2).
@@ -5140,6 +6576,7 @@ AsmReadMm2 ( VOID
);
+
/**
Reads the current value of 64-bit MMX Register #3 (MM3).
@@ -5155,6 +6592,7 @@ AsmReadMm3 ( VOID
);
+
/**
Reads the current value of 64-bit MMX Register #4 (MM4).
@@ -5170,6 +6608,7 @@ AsmReadMm4 ( VOID
);
+
/**
Reads the current value of 64-bit MMX Register #5 (MM5).
@@ -5185,6 +6624,7 @@ AsmReadMm5 ( VOID
);
+
/**
Reads the current value of 64-bit MMX Register #6 (MM6).
@@ -5200,6 +6640,7 @@ AsmReadMm6 ( VOID
);
+
/**
Reads the current value of 64-bit MMX Register #7 (MM7).
@@ -5215,6 +6656,7 @@ AsmReadMm7 ( VOID
);
+
/**
Writes the current value of 64-bit MMX Register #0 (MM0).
@@ -5230,6 +6672,7 @@ AsmWriteMm0 ( IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #1 (MM1).
@@ -5245,6 +6688,7 @@ AsmWriteMm1 ( IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #2 (MM2).
@@ -5260,6 +6704,7 @@ AsmWriteMm2 ( IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #3 (MM3).
@@ -5275,6 +6720,7 @@ AsmWriteMm3 ( IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #4 (MM4).
@@ -5290,6 +6736,7 @@ AsmWriteMm4 ( IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #5 (MM5).
@@ -5305,6 +6752,7 @@ AsmWriteMm5 ( IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #6 (MM6).
@@ -5320,6 +6768,7 @@ AsmWriteMm6 ( IN UINT64 Value
);
+
/**
Writes the current value of 64-bit MMX Register #7 (MM7).
@@ -5335,6 +6784,7 @@ AsmWriteMm7 ( IN UINT64 Value
);
+
/**
Reads the current value of Time Stamp Counter (TSC).
@@ -5350,6 +6800,7 @@ AsmReadTsc ( VOID
);
+
/**
Reads the current value of a Performance Counter (PMC).
@@ -5367,6 +6818,7 @@ AsmReadPmc ( IN UINT32 Index
);
+
/**
Sets up a monitor buffer that is used by AsmMwait().
@@ -5391,6 +6843,7 @@ AsmMonitor ( IN UINTN Edx
);
+
/**
Executes an MWAIT instruction.
@@ -5412,6 +6865,7 @@ AsmMwait ( IN UINTN Ecx
);
+
/**
Executes a WBINVD instruction.
@@ -5425,6 +6879,7 @@ AsmWbinvd ( VOID
);
+
/**
Executes a INVD instruction.
@@ -5438,6 +6893,7 @@ AsmInvd ( VOID
);
+
/**
Flushes a cache line from all the instruction and data caches within the
coherency domain of the CPU.
@@ -5459,6 +6915,7 @@ AsmFlushCacheLine ( IN VOID *LinearAddress
);
+
/**
Enables the 32-bit paging mode on the CPU.
@@ -5505,6 +6962,7 @@ AsmEnablePaging32 ( IN VOID *NewStack
);
+
/**
Disables the 32-bit paging mode on the CPU.
@@ -5548,6 +7006,7 @@ AsmDisablePaging32 ( IN VOID *NewStack
);
+
/**
Enables the 64-bit paging mode on the CPU.
@@ -5590,6 +7049,7 @@ AsmEnablePaging64 ( IN UINT64 NewStack
);
+
/**
Disables the 64-bit paging mode on the CPU.
@@ -5630,6 +7090,7 @@ AsmDisablePaging64 ( IN UINT32 NewStack
);
+
//
// 16-bit thunking services
//
@@ -5662,6 +7123,7 @@ AsmGetThunk16Properties ( OUT UINT32 *ExtraStackSize
);
+
/**
Prepares all structures a code required to use AsmThunk16().
@@ -5679,6 +7141,7 @@ AsmPrepareThunk16 ( OUT THUNK_CONTEXT *ThunkContext
);
+
/**
Transfers control to a 16-bit real mode entry point and returns the results.
@@ -5699,6 +7162,7 @@ AsmThunk16 ( IN OUT THUNK_CONTEXT *ThunkContext
);
+
/**
Prepares all structures and code for a 16-bit real mode thunk, transfers
control to a 16-bit real mode entry point, and returns the results.
@@ -5722,121 +7186,8 @@ AsmPrepareAndThunk16 ( IN OUT THUNK_CONTEXT *ThunkContext
);
-/**
- Transfers control to a function starting with a new stack.
-
- Transfers control to the function specified by EntryPoint using the new stack
- specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
-
- If EntryPoint is NULL, then ASSERT().
- If NewStack is NULL, then ASSERT().
-
- @param EntryPoint A pointer to function to call with the new stack.
- @param Context1 A pointer to the context to pass into the EntryPoint
- function.
- @param Context2 A pointer to the context to pass into the EntryPoint
- function.
- @param NewStack A pointer to the new stack to use for the EntryPoint
- function.
- @param NewBsp A pointer to the new memory location for RSE backing
- store.
-
-**/
-VOID
-EFIAPI
-AsmSwitchStackAndBackingStore (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *NewStack,
- IN VOID *NewBsp
- );
-
-typedef struct {
- UINT64 Status;
- UINT64 r9;
- UINT64 r10;
- UINT64 r11;
-} PAL_PROC_RETURN;
-
-//
-// IPF Specific functions
-//
-
-
-/**
- Performs a PAL call using static calling convention.
-
- An internal function to perform a PAL call using static calling convention.
-
- @param PalEntryPoint The entry point address of PAL. The address in ar.kr5
- would be used if this parameter were NULL on input.
- @param Arg1 The first argument of a PAL call.
- @param Arg1 The second argument of a PAL call.
- @param Arg1 The third argument of a PAL call.
- @param Arg1 The fourth argument of a PAL call.
-
- @return The values returned in r8, r9, r10 and r11.
-
-**/
-PAL_PROC_RETURN
-PalCallStatic (
- IN CONST VOID *PalEntryPoint,
- IN UINT64 Arg1,
- IN UINT64 Arg2,
- IN UINT64 Arg3,
- IN UINT64 Arg4
- );
-
-
-/**
- Returns the current value of ar.itc.
-
- An internal function to return the current value of ar.itc, which is the
- timer tick on IPF.
-
- @return The currect value of ar.itc
-
-**/
-INT64
-IpfReadItc (
- VOID
- );
-
-
-/**
- Flush a range of cache lines in the cache coherency domain of the calling
- CPU.
-
- Invalidates the cache lines specified by Address and Length. If Address is
- not aligned on a cache line boundary, then entire cache line containing
- Address is invalidated. If Address + Length is not aligned on a cache line
- boundary, then the entire instruction cache line containing Address + Length
- -1 is invalidated. This function may choose to invalidate the entire
- instruction cache if that is more efficient than invalidating the specified
- range. If Length is 0, the no instruction cache lines are invalidated.
- Address is returned.
-
- If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
-
- @param Address The base address of the instruction lines to invalidate. If
- the CPU is in a physical addressing mode, then Address is a
- physical address. If the CPU is in a virtual addressing mode,
- then Address is a virtual address.
-
- @param Length The number of bytes to invalidate from the instruction cache.
-
- @return Address
-
-**/
-VOID *
-EFIAPI
-IpfFlushCacheRange (
- IN VOID *Address,
- IN UINTN Length
- );
+#else
#endif
+#endif
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueDebugLib.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueDebugLib.h index 577b28d272..90ec02600d 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueDebugLib.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueDebugLib.h @@ -97,6 +97,19 @@ Abstract: #define EFI_D_EVENT DEBUG_EVENT
#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.
@@ -179,78 +192,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().
This macro calls DebugAssert() passing in the filename, line number, and
@@ -259,8 +200,12 @@ DebugClearMemoryEnabled ( @param Expression Boolean expression that evailated to FALSE
**/
+#ifdef EFI_DEBUG
#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.
**/
+#ifdef EFI_DEBUG
#define _DEBUG(Expression) DebugPrint Expression
+#else
+#define _DEBUG(Expression)
+#endif
/**
@@ -443,6 +392,7 @@ DebugClearMemoryEnabled ( @param Guid Pointer to a protocol GUID.
**/
+#ifdef EFI_DEBUG
#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) \
do { \
if (DebugAssertEnabled ()) { \
@@ -459,6 +409,10 @@ DebugClearMemoryEnabled ( } \
} \
} 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.
**/
-#define CR(Record, TYPE, Field, TestSignature) \
- (DebugAssertEnabled () && (_CR (Record, TYPE, Field)->Signature != TestSignature)) ? \
- (TYPE *) (_ASSERT (CR has Bad Signature), Record) : \
- _CR (Record, TYPE, Field)
-
+#ifdef EFI_DEBUG
+ #define CR(Record, TYPE, Field, TestSignature) \
+ (DebugAssertEnabled () && (_CR (Record, TYPE, Field)->Signature != TestSignature)) ? \
+ (TYPE *) (_ASSERT (CR has Bad Signature), Record) : \
+ _CR (Record, TYPE, Field)
+#else
+ #define CR(Record, TYPE, Field, TestSignature) \
+ _CR (Record, TYPE, Field)
+#endif
+
+
#endif
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueDxeRuntimeDriverLib.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueDxeRuntimeDriverLib.h index f5ee0bc5ed..0db9ee55f4 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueDxeRuntimeDriverLib.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueDxeRuntimeDriverLib.h @@ -250,6 +250,7 @@ EfiGetNextHighMonotonicCount ( **/
VOID
+EFIAPI
EfiResetSystem (
IN EFI_RESET_TYPE ResetType,
IN EFI_STATUS ResetStatus,
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueHiiLib.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueHiiLib.h index 601656923b..47444e2044 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueHiiLib.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueHiiLib.h @@ -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
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
@@ -23,6 +23,7 @@ Abstract: #ifndef __EDKII_GLUE_HII_LIB_H__
#define __EDKII_GLUE_HII_LIB_H__
+#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
#define PreparePackages GluePreparePackages
@@ -49,6 +50,6 @@ GluePreparePackages ( )
;
-
+#endif
#endif
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf index c24ff0cf02..a756a0c8ef 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf @@ -63,7 +63,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -76,6 +76,6 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
\ No newline at end of file diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseDebugLibNull/BaseDebugLibNull.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseDebugLibNull/BaseDebugLibNull.inf index 4b33115fc1..168c29ea23 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseDebugLibNull/BaseDebugLibNull.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseDebugLibNull/BaseDebugLibNull.inf @@ -62,7 +62,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -75,5 +75,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseDebugLibNull/DebugLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseDebugLibNull/DebugLib.c index 6ce2f49f34..fb902ceea7 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseDebugLibNull/DebugLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseDebugLibNull/DebugLib.c @@ -108,86 +108,3 @@ DebugClearMemory ( 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;
-}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf index 1feeb5c2d0..4081b2bec2 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf @@ -68,7 +68,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -81,5 +81,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/ARShiftU64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/ARShiftU64.c index 2dbf61d1da..d73b1a3a0b 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/ARShiftU64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/ARShiftU64.c @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/BaseLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/BaseLib.inf index 40b2824350..a1931699aa 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/BaseLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/BaseLib.inf @@ -26,7 +26,6 @@ COMPONENT_TYPE = LIBRARY [sources.common]
String.c
LinkedList.c
- Synchronization.c
Cpu.c
CpuDeadLoop.c
BitField.c
@@ -57,8 +56,10 @@ COMPONENT_TYPE = LIBRARY SwapBytes32.c
SwapBytes64.c
SwitchStack.c
+ CheckSum.c
[sources.ia32]
+ SynchronizationMsc.c
x86DisablePaging32.c
x86DisablePaging64.c
x86EnablePaging32.c
@@ -74,107 +75,109 @@ COMPONENT_TYPE = LIBRARY x86WriteGdtr.c
x86WriteIdtr.c
Unaligned.c
- Ia32\Non-existing.c
- Ia32\InternalSwitchStack.c
- Ia32\DivS64x64Remainder.c
- Ia32\ARShiftU64.asm
- Ia32\CpuBreakpoint.asm
- Ia32\CpuFlushTlb.asm
- Ia32\CpuSleep.asm
- Ia32\CpuId.asm
- Ia32\CpuIdEx.asm
- Ia32\CpuPause.asm
- Ia32\DisableInterrupts.asm
- Ia32\DisablePaging32.asm
- Ia32\DivU64x32.asm
- Ia32\DivU64x32Remainder.asm
- Ia32\DivU64x64Remainder.asm
- Ia32\EnableDisableInterrupts.asm
- Ia32\EnableInterrupts.asm
- Ia32\EnablePaging32.asm
- Ia32\EnablePaging64.asm
- Ia32\FlushCacheLine.asm
- Ia32\FxSave.asm
- Ia32\FxRestore.asm
- Ia32\InterlockedIncrement.asm
- Ia32\InterlockedDecrement.asm
- Ia32\InterlockedCompareExchange32.asm
- Ia32\InterlockedCompareExchange64.asm
- Ia32\Invd.asm
- Ia32\LongJump.asm
- Ia32\LRotU64.asm
- Ia32\LShiftU64.asm
- Ia32\MultU64x32.asm
- Ia32\MultU64x64.asm
- Ia32\ModU64x32.asm
- Ia32\Monitor.asm
- Ia32\Mwait.asm
- Ia32\ReadCr0.asm
- Ia32\ReadCr2.asm
- Ia32\ReadCr3.asm
- Ia32\ReadCr4.asm
- Ia32\ReadDr0.asm
- Ia32\ReadDr1.asm
- Ia32\ReadDr2.asm
- Ia32\ReadDr3.asm
- Ia32\ReadDr4.asm
- Ia32\ReadDr5.asm
- Ia32\ReadDr6.asm
- Ia32\ReadDr7.asm
- Ia32\ReadEflags.asm
- Ia32\ReadMm0.asm
- Ia32\ReadMm1.asm
- Ia32\ReadMm2.asm
- Ia32\ReadMm3.asm
- Ia32\ReadMm4.asm
- Ia32\ReadMm5.asm
- Ia32\ReadMm6.asm
- Ia32\ReadMm7.asm
- Ia32\ReadMsr64.asm
- Ia32\ReadCs.asm
- Ia32\ReadDs.asm
- Ia32\ReadEs.asm
- Ia32\ReadFs.asm
- Ia32\ReadGs.asm
- Ia32\ReadSs.asm
- Ia32\ReadTr.asm
- Ia32\ReadGdtr.asm
- Ia32\ReadIdtr.asm
- Ia32\ReadLdtr.asm
- Ia32\ReadTsc.asm
- Ia32\ReadPmc.asm
- Ia32\RShiftU64.asm
- Ia32\RRotU64.asm
- Ia32\SetJump.asm
- Ia32\SwapBytes64.asm
- Ia32\Thunk16.asm
- Ia32\WriteMsr64.asm
- Ia32\WriteCr0.asm
- Ia32\WriteCr2.asm
- Ia32\WriteCr3.asm
- Ia32\WriteCr4.asm
- Ia32\WriteDr0.asm
- Ia32\WriteDr1.asm
- Ia32\WriteDr2.asm
- Ia32\WriteDr3.asm
- Ia32\WriteDr4.asm
- Ia32\WriteDr5.asm
- Ia32\WriteDr6.asm
- Ia32\WriteDr7.asm
- Ia32\WriteGdtr.asm
- Ia32\WriteIdtr.asm
- Ia32\WriteLdtr.asm
- Ia32\WriteMm0.asm
- Ia32\WriteMm1.asm
- Ia32\WriteMm2.asm
- Ia32\WriteMm3.asm
- Ia32\WriteMm4.asm
- Ia32\WriteMm5.asm
- Ia32\WriteMm6.asm
- Ia32\WriteMm7.asm
- Ia32\Wbinvd.asm
+ Ia32/Non-existing.c
+ Ia32/InternalSwitchStack.c
+ Ia32/DivS64x64Remainder.c
+ Ia32/ARShiftU64.c
+ Ia32/CpuBreakpoint.c
+ Ia32/CpuFlushTlb.c
+ Ia32/CpuSleep.c
+ Ia32/CpuId.c
+ Ia32/CpuIdEx.c
+ Ia32/CpuPause.c
+ Ia32/DisableInterrupts.c
+ Ia32/DisablePaging32.c
+ Ia32/DivU64x32.c
+ Ia32/DivU64x32Remainder.c
+ Ia32/DivU64x64Remainder.c
+ Ia32/EnableDisableInterrupts.c
+ Ia32/EnableInterrupts.c
+ Ia32/EnablePaging32.c
+ Ia32/EnablePaging64.asm
+ Ia32/FlushCacheLine.c
+ Ia32/FxSave.c
+ Ia32/FxRestore.c
+ Ia32/InterlockedIncrement.c
+ Ia32/InterlockedDecrement.c
+ Ia32/InterlockedCompareExchange32.c
+ Ia32/InterlockedCompareExchange64.c
+ Ia32/Invd.c
+ Ia32/LongJump.c
+ Ia32/LRotU64.c
+ Ia32/LShiftU64.c
+ Ia32/MultU64x32.c
+ Ia32/MultU64x64.c
+ Ia32/ModU64x32.c
+ Ia32/Monitor.c
+ Ia32/Mwait.c
+ Ia32/ReadCr0.c
+ Ia32/ReadCr2.c
+ Ia32/ReadCr3.c
+ Ia32/ReadCr4.c
+ Ia32/ReadDr0.c
+ Ia32/ReadDr1.c
+ Ia32/ReadDr2.c
+ Ia32/ReadDr3.c
+ Ia32/ReadDr4.c
+ Ia32/ReadDr5.c
+ Ia32/ReadDr6.c
+ Ia32/ReadDr7.c
+ Ia32/ReadEflags.c
+ Ia32/ReadMm0.c
+ Ia32/ReadMm1.c
+ Ia32/ReadMm2.c
+ Ia32/ReadMm3.c
+ Ia32/ReadMm4.c
+ Ia32/ReadMm5.c
+ Ia32/ReadMm6.c
+ Ia32/ReadMm7.c
+ Ia32/ReadMsr64.c
+ Ia32/ReadCs.c
+ Ia32/ReadDs.c
+ Ia32/ReadEs.c
+ Ia32/ReadFs.c
+ Ia32/ReadGs.c
+ Ia32/ReadSs.c
+ Ia32/ReadTr.c
+ Ia32/ReadGdtr.c
+ Ia32/ReadIdtr.c
+ Ia32/ReadLdtr.c
+ Ia32/ReadTsc.c
+ Ia32/ReadPmc.c
+ Ia32/RShiftU64.c
+ Ia32/RRotU64.c
+ Ia32/SetJump.c
+ Ia32/SwapBytes64.c
+ Ia32/Thunk16.asm
+ Ia32/WriteMsr64.c
+ Ia32/WriteCr0.c
+ Ia32/WriteCr2.c
+ Ia32/WriteCr3.c
+ Ia32/WriteCr4.c
+ Ia32/WriteDr0.c
+ Ia32/WriteDr1.c
+ Ia32/WriteDr2.c
+ Ia32/WriteDr3.c
+ Ia32/WriteDr4.c
+ Ia32/WriteDr5.c
+ Ia32/WriteDr6.c
+ Ia32/WriteDr7.c
+ Ia32/WriteGdtr.c
+ Ia32/WriteIdtr.c
+ Ia32/WriteLdtr.c
+ Ia32/WriteMm0.c
+ Ia32/WriteMm1.c
+ Ia32/WriteMm2.c
+ Ia32/WriteMm3.c
+ Ia32/WriteMm4.c
+ Ia32/WriteMm5.c
+ Ia32/WriteMm6.c
+ Ia32/WriteMm7.c
+ Ia32/Wbinvd.c
+
[sources.x64]
+ SynchronizationMsc.c
x86DisablePaging32.c
x86DisablePaging64.c
x86EnablePaging32.c
@@ -191,119 +194,130 @@ COMPONENT_TYPE = LIBRARY x86WriteIdtr.c
Unaligned.c
Math64.c
- X64\Non-existing.c
- X64\SwitchStack.asm
- X64\SetJump.asm
- X64\LongJump.asm
- X64\CpuId.asm
- X64\CpuIdEx.asm
- X64\ReadEflags.asm
- X64\ReadMsr64.asm
- X64\WriteMsr64.asm
- X64\ReadCr0.asm
- X64\ReadCr2.asm
- X64\ReadCr3.asm
- X64\ReadCr4.asm
- X64\WriteCr0.asm
- X64\WriteCr2.asm
- X64\WriteCr3.asm
- X64\WriteCr4.asm
- X64\ReadDr0.asm
- X64\ReadDr1.asm
- X64\ReadDr2.asm
- X64\ReadDr3.asm
- X64\ReadDr4.asm
- X64\ReadDr5.asm
- X64\ReadDr6.asm
- X64\ReadDr7.asm
- X64\WriteDr0.asm
- X64\WriteDr1.asm
- X64\WriteDr2.asm
- X64\WriteDr3.asm
- X64\WriteDr4.asm
- X64\WriteDr5.asm
- X64\WriteDr6.asm
- X64\WriteDr7.asm
- X64\ReadCs.asm
- X64\ReadDs.asm
- X64\ReadEs.asm
- X64\ReadFs.asm
- X64\ReadGs.asm
- X64\ReadSs.asm
- X64\ReadTr.asm
- X64\ReadGdtr.asm
- X64\WriteGdtr.asm
- X64\ReadIdtr.asm
- X64\WriteIdtr.asm
- X64\ReadLdtr.asm
- X64\WriteLdtr.asm
- X64\FxSave.asm
- X64\FxRestore.asm
- X64\ReadMm0.asm
- X64\ReadMm1.asm
- X64\ReadMm2.asm
- X64\ReadMm3.asm
- X64\ReadMm4.asm
- X64\ReadMm5.asm
- X64\ReadMm6.asm
- X64\ReadMm7.asm
- X64\WriteMm0.asm
- X64\WriteMm1.asm
- X64\WriteMm2.asm
- X64\WriteMm3.asm
- X64\WriteMm4.asm
- X64\WriteMm5.asm
- X64\WriteMm6.asm
- X64\WriteMm7.asm
- X64\ReadTsc.asm
- X64\ReadPmc.asm
- X64\Monitor.asm
- X64\Mwait.asm
- X64\EnablePaging64.asm
- X64\DisablePaging64.asm
- X64\Wbinvd.asm
- X64\Invd.asm
- X64\FlushCacheLine.asm
- X64\InterlockedIncrement.asm
- X64\InterlockedDecrement.asm
- X64\InterlockedCompareExchange32.asm
- X64\InterlockedCompareExchange64.asm
- X64\EnableInterrupts.asm
- X64\DisableInterrupts.asm
- X64\EnableDisableInterrupts.asm
- X64\CpuSleep.asm
- X64\CpuPause.asm
- X64\CpuBreakpoint.asm
- X64\CpuFlushTlb.asm
- X64\Thunk16.asm
+ X64/Non-existing.c
+ X64/SwitchStack.asm
+ X64/SetJump.asm
+ X64/LongJump.asm
+ X64/CpuId.asm
+ X64/CpuIdEx.asm
+ X64/ReadEflags.asm
+ X64/ReadMsr64.c
+ X64/WriteMsr64.c
+ X64/ReadCr0.asm
+ X64/ReadCr2.asm
+ X64/ReadCr3.asm
+ X64/ReadCr4.asm
+ X64/WriteCr0.asm
+ X64/WriteCr2.asm
+ X64/WriteCr3.asm
+ X64/WriteCr4.asm
+ X64/ReadDr0.asm
+ X64/ReadDr1.asm
+ X64/ReadDr2.asm
+ X64/ReadDr3.asm
+ X64/ReadDr4.asm
+ X64/ReadDr5.asm
+ X64/ReadDr6.asm
+ X64/ReadDr7.asm
+ X64/WriteDr0.asm
+ X64/WriteDr1.asm
+ X64/WriteDr2.asm
+ X64/WriteDr3.asm
+ X64/WriteDr4.asm
+ X64/WriteDr5.asm
+ X64/WriteDr6.asm
+ X64/WriteDr7.asm
+ X64/ReadCs.asm
+ X64/ReadDs.asm
+ X64/ReadEs.asm
+ X64/ReadFs.asm
+ X64/ReadGs.asm
+ X64/ReadSs.asm
+ X64/ReadTr.asm
+ X64/ReadGdtr.asm
+ X64/WriteGdtr.asm
+ X64/ReadIdtr.asm
+ X64/WriteIdtr.asm
+ X64/ReadLdtr.asm
+ X64/WriteLdtr.asm
+ X64/FxSave.asm
+ X64/FxRestore.asm
+ X64/ReadMm0.asm
+ X64/ReadMm1.asm
+ X64/ReadMm2.asm
+ X64/ReadMm3.asm
+ X64/ReadMm4.asm
+ X64/ReadMm5.asm
+ X64/ReadMm6.asm
+ X64/ReadMm7.asm
+ X64/WriteMm0.asm
+ X64/WriteMm1.asm
+ X64/WriteMm2.asm
+ X64/WriteMm3.asm
+ X64/WriteMm4.asm
+ X64/WriteMm5.asm
+ X64/WriteMm6.asm
+ X64/WriteMm7.asm
+ X64/ReadTsc.asm
+ X64/ReadPmc.asm
+ X64/Monitor.asm
+ X64/Mwait.asm
+ X64/EnablePaging64.asm
+ X64/DisablePaging64.asm
+ X64/Wbinvd.asm
+ X64/Invd.asm
+ X64/FlushCacheLine.asm
+ X64/InterlockedIncrement.c
+ X64/InterlockedDecrement.c
+ X64/InterlockedCompareExchange32.asm
+ X64/InterlockedCompareExchange64.asm
+ X64/EnableInterrupts.asm
+ X64/DisableInterrupts.asm
+ X64/EnableDisableInterrupts.asm
+ X64/CpuSleep.asm
+ X64/CpuPause.asm
+ X64/CpuBreakpoint.c
+ X64/CpuFlushTlb.asm
+ X64/Thunk16.asm
[sources.ipf]
+ SynchronizationMsc.c
Math64.c
- Ipf\asm.h
- Ipf\ia_64gen.h
- Ipf\PalCallStatic.s
- Ipf\setjmp.s
- Ipf\longjmp.s
- Ipf\SwitchStack.s
- Ipf\Unaligned.c
- Ipf\CpuBreakpoint.c
- Ipf\InterlockedCompareExchange32.s
- Ipf\InterlockedCompareExchange64.s
- Ipf\Synchronization.c
- Ipf\CpuPause.s
- Ipf\CpuFlushTlb.s
- Ipf\GetInterruptState.s
- Ipf\Non-existing.c
- Ipf\FlushCacheRange.s
- Ipf\ReadItc.s
-
+ Ipf/asm.h
+ Ipf/ia_64gen.h
+ Ipf/PalCallStatic.s
+ Ipf/setjmp.s
+ Ipf/longjmp.s
+ Ipf/SwitchStack.s
+ Ipf/Unaligned.c
+ Ipf/CpuBreakpoint.c
+ Ipf/InterlockedCompareExchange32.s
+ Ipf/InterlockedCompareExchange64.s
+ Ipf/Synchronization.c
+ Ipf/CpuPause.s
+ Ipf/CpuFlushTlb.s
+ Ipf/GetInterruptState.s
+ Ipf/InternalSwitchStack.c
+ Ipf/FlushCacheRange.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]
Math64.c
Unaligned.c
- Ebc\SwitchStack.c
- Ebc\SetJumpLongJump.c
- Ebc\CpuBreakpoint.c
- Ebc\Synchronization.c
+ Ebc/SwitchStack.c
+ Ebc/SetJumpLongJump.c
+ Ebc/CpuBreakpoint.c
+ Ebc/Synchronization.c
+ Synchronization.c
[includes.common]
.
@@ -343,7 +357,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -356,6 +370,6 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
\ No newline at end of file diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/BaseLibInternal.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/BaseLibInternals.h index 1ed70853c4..1e9cde6c4f 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/BaseLibInternal.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/BaseLibInternals.h @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name:
- BaseLibInternal.h
+ BaseLibInternals.h
Abstract:
@@ -20,8 +20,8 @@ Abstract: --*/
-#ifndef __BASE_LIB_INTERNAL_H__
-#define __BASE_LIB_INTERNAL_H__
+#ifndef __BASE_LIB_INTERNALS_H__
+#define __BASE_LIB_INTERNALS_H__
#include "EdkIIGlueBase.h"
@@ -322,10 +322,16 @@ InternalMathDivRemS64x64 ( /**
Transfers control to a function starting with a new stack.
- Transfers control to the function specified by EntryPoint using the new stack
- specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
+ Transfers control to the function specified by EntryPoint using the
+ new stack specified by NewStack and passing in the parameters specified
+ by Context1 and Context2. Context1 and Context2 are optional and may
+ be NULL. The function EntryPoint must never return.
+ 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 Context1 A pointer to the context to pass into the EntryPoint
@@ -334,20 +340,250 @@ InternalMathDivRemS64x64 ( function.
@param NewStack A pointer to the new stack to use for the EntryPoint
function.
+ @param Marker VA_LIST marker for the variable argument list.
**/
VOID
EFIAPI
InternalSwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1,
- IN VOID *Context2,
- IN VOID *NewStack
+ IN VOID *Context1, OPTIONAL
+ IN VOID *Context2, OPTIONAL
+ 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
//
+#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
/**
Reads the current Global Descriptor Table Register(GDTR) descriptor.
@@ -595,219 +831,46 @@ InternalX86DisablePaging64 ( IN UINT32 NewStack
);
-/**
- Worker function that locates the Node in the List
-
- By searching the List, finds the location of the Node in List. At the same time,
- verifies the validity of this list.
-
- If List is NULL, then ASSERT().
- If List->ForwardLink is NULL, then ASSERT().
- If List->backLink is NULL, then ASSERT().
- If Node is NULL, then ASSERT();
- If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
- of nodes in ListHead, including the ListHead node, is greater than or
- equal to PcdMaximumLinkedListLength, then ASSERT().
-
- @param List A pointer to a node in a linked list.
- @param Node A pointer to one nod.
-
- @retval TRUE Node is in List
- @retval FALSE Node isn't in List, or List is invalid
-
-**/
-BOOLEAN
-IsNodeInList (
- IN CONST LIST_ENTRY *List,
- IN CONST LIST_ENTRY *Node
- );
-
-/**
- Performs an atomic increment of an 32-bit unsigned integer.
-
- Performs an atomic increment of the 32-bit unsigned integer specified by
- Value and returns the incremented value. The increment operation must be
- performed using MP safe mechanisms. The state of the return value is not
- guaranteed to be MP safe.
-
- @param Value A pointer to the 32-bit value to increment.
-
- @return The incremented value.
-
-**/
-UINT32
-EFIAPI
-InternalSyncIncrement (
- IN volatile UINT32 *Value
- );
-
-/**
- Performs an atomic decrement of an 32-bit unsigned integer.
- Performs an atomic decrement of the 32-bit unsigned integer specified by
- Value and returns the decrement value. The decrement operation must be
- performed using MP safe mechanisms. The state of the return value is not
- guaranteed to be MP safe.
-
- @param Value A pointer to the 32-bit value to decrement.
-
- @return The decrement value.
-
-**/
-UINT32
-EFIAPI
-InternalSyncDecrement (
- IN volatile UINT32 *Value
- );
-
-/**
- Performs an atomic compare exchange operation on a 32-bit unsigned integer.
-
- Performs an atomic compare exchange operation on the 32-bit unsigned integer
- specified by Value. If Value is equal to CompareValue, then Value is set to
- ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
- then Value is returned. The compare exchange operation must be performed using
- MP safe mechanisms.
-
- @param Value A pointer to the 32-bit value for the compare exchange
- operation.
- @param CompareValue 32-bit value used in compare operation.
- @param ExchangeValue 32-bit value used in exchange operation.
-
- @return The original *Value before exchange.
-
-**/
-UINT32
-EFIAPI
-InternalSyncCompareExchange32 (
- IN volatile UINT32 *Value,
- IN UINT32 CompareValue,
- IN UINT32 ExchangeValue
- );
-
-/**
- Performs an atomic compare exchange operation on a 64-bit unsigned integer.
-
- Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
- by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
- CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
- The compare exchange operation must be performed using MP safe mechanisms.
-
- @param Value A pointer to the 64-bit value for the compare exchange
- operation.
- @param CompareValue 64-bit value used in compare operation.
- @param ExchangeValue 64-bit value used in exchange operation.
-
- @return The original *Value before exchange.
-
-**/
-UINT64
-EFIAPI
-InternalSyncCompareExchange64 (
- IN volatile UINT64 *Value,
- IN UINT64 CompareValue,
- IN UINT64 ExchangeValue
- );
-
-/**
- Worker function that returns a bit field from Operand
-
- Returns the bitfield specified by the StartBit and the EndBit from Operand.
-
- @param Operand Operand on which to perform the bitfield operation.
- @param StartBit The ordinal of the least significant bit in the bit field.
- @param EndBit The ordinal of the most significant bit in the bit field.
-
- @return The bit field read.
-
-**/
-unsigned int
-BitFieldReadUint (
- IN unsigned int Operand,
- IN UINTN StartBit,
- IN UINTN EndBit
- );
-
-/**
- Worker function that reads a bit field from Operand, performs a bitwise OR,
- and returns the result.
-
- Performs a bitwise OR between the bit field specified by StartBit and EndBit
- in Operand and the value specified by AndData. All other bits in Operand are
- preserved. The new value is returned.
-
- @param Operand Operand on which to perform the bitfield operation.
- @param StartBit The ordinal of the least significant bit in the bit field.
- @param EndBit The ordinal of the most significant bit in the bit field.
- @param OrData The value to OR with the read value from the value
-
- @return The new value.
-
-**/
-unsigned int
-BitFieldOrUint (
- IN unsigned int Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN unsigned int OrData
- );
-
-/**
- Worker function that reads a bit field from Operand, performs a bitwise AND,
- and returns the result.
-
- Performs a bitwise AND between the bit field specified by StartBit and EndBit
- in Operand and the value specified by AndData. All other bits in Operand are
- preserved. The new value is returned.
-
- @param Operand Operand on which to perform the bitfield operation.
- @param StartBit The ordinal of the least significant bit in the bit field.
- @param EndBit The ordinal of the most significant bit in the bit field.
- @param AndData The value to And with the read value from the value
-
- @return The new value.
-
-**/
-unsigned int
-BitFieldAndUint (
- IN unsigned int Operand,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN unsigned int AndData
- );
+#elif defined (MDE_CPU_IPF)
+//
+//
+// IPF specific functions
+//
/**
- 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
- );
+ Transfers control to a function starting with a new stack.
-/**
- Restores the CPU context that was saved with SetJump().
+ Transfers control to the function specified by EntryPoint using the new stack
+ specified by NewStack and passing in the parameters specified by Context1 and
+ Context2. Context1 and Context2 are optional and may be NULL. The function
+ EntryPoint must never return.
- 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.
+ If EntryPoint is NULL, then ASSERT().
+ If NewStack is NULL, then ASSERT().
- @param JumpBuffer A pointer to CPU context buffer.
- @param Value The value to return when the SetJump() context is restored.
+ @param EntryPoint A pointer to function to call with the new stack.
+ @param Context1 A pointer to the context to pass into the EntryPoint
+ function.
+ @param Context2 A pointer to the context to pass into the EntryPoint
+ function.
+ @param NewStack A pointer to the new stack to use for the EntryPoint
+ function.
+ @param NewBsp A pointer to the new memory location for RSE backing
+ store.
**/
VOID
EFIAPI
-InternalLongJump (
- IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
- IN UINTN Value
+AsmSwitchStackAndBackingStore (
+ IN SWITCH_STACK_ENTRY_POINT EntryPoint,
+ IN VOID *Context1, OPTIONAL
+ IN VOID *Context2, OPTIONAL
+ IN VOID *NewStack,
+ IN VOID *NewBsp
);
+#else
+
+#endif
#endif
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/BitField.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/BitField.c index 6b332e5f82..65e34ebaab 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/BitField.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/BitField.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Worker function that returns a bit field from Operand
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/CheckSum.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/CheckSum.c new file mode 100644 index 0000000000..ad89076a30 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/CheckSum.c @@ -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);
+}
+
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Cpu.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Cpu.c index adabe6165c..50d9bf07fa 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Cpu.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Cpu.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Disables CPU interrupts and returns the interrupt state prior to the disable
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/CpuDeadLoop.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/CpuDeadLoop.c index 6eef0357d7..9c18c0c8d7 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/CpuDeadLoop.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/CpuDeadLoop.c @@ -19,7 +19,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Executes an infinite loop.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivS64x64Remainder.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivS64x64Remainder.c index 58d99de18a..0ccca1c5c0 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivS64x64Remainder.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivS64x64Remainder.c @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivU64x32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivU64x32.c index d45c4d465f..977dfdd115 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivU64x32.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivU64x32.c @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivU64x32Remainder.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivU64x32Remainder.c index fe065cdd57..e3cd7db8db 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivU64x32Remainder.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivU64x32Remainder.c @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivU64x64Remainder.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivU64x64Remainder.c index 6ea2f0a430..722e2b2eba 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivU64x64Remainder.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/DivU64x64Remainder.c @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/CpuBreakpoint.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/CpuBreakpoint.c index 438df67aec..f98d1073bb 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/CpuBreakpoint.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/CpuBreakpoint.c @@ -19,7 +19,7 @@ Abstract: --*/
-#include "..\BaseLibInternal.h"
+#include "BaseLibInternals.h"
extern
UINT64
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/SetJumpLongJump.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/SetJumpLongJump.c index c42fa5ca2a..9e66d62fb4 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/SetJumpLongJump.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/SetJumpLongJump.c @@ -19,7 +19,7 @@ Abstract: --*/
-#include "..\BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Worker function that checks ASSERT condition for JumpBuffer
@@ -33,6 +33,7 @@ Abstract: **/
VOID
+EFIAPI
InternalAssertJumpBuffer (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
);
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/SwitchStack.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/SwitchStack.c index c94a0863c2..4244ce4c2e 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/SwitchStack.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/SwitchStack.c @@ -19,15 +19,18 @@ Abstract: --*/
-#include "..\BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack
specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
+ by Context1 and Context2. Context1 and Context2 are optional and may
+ 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().
@@ -39,21 +42,30 @@ Abstract: function.
@param NewStack A pointer to the new stack to use for the EntryPoint
function.
+ @param Marker VA_LIST marker for the variable argument list.
**/
VOID
EFIAPI
InternalSwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *NewStack
+ IN VOID *Context1, OPTIONAL
+ IN VOID *Context2, OPTIONAL
+ IN VOID *NewStack,
+ IN VA_LIST Marker
)
+
{
//
// This version of this function does not actually change the stack pointer
// This is to support compilation of CPU types that do not support assemblers
// such as EBC
//
+
+ //
+ // Stack should be aligned with CPU_STACK_ALIGNMENT
+ //
+ ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
+
EntryPoint (Context1, Context2);
}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/Synchronization.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/Synchronization.c index 2c08ffac65..b1cbcf9d57 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/Synchronization.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ebc/Synchronization.c @@ -19,7 +19,7 @@ Abstract: --*/
-#include "..\BaseLibInternal.h"
+#include "BaseLibInternals.h"
UINT32
EFIAPI
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/GetPowerOfTwo32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/GetPowerOfTwo32.c index 1199bfd3f5..bf034a9a20 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/GetPowerOfTwo32.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/GetPowerOfTwo32.c @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/GetPowerOfTwo64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/GetPowerOfTwo64.c index bd702a27b9..bc10d87608 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/GetPowerOfTwo64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/GetPowerOfTwo64.c @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/HighBitSet32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/HighBitSet32.c index a7a1f56923..ae4367c23f 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/HighBitSet32.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/HighBitSet32.c @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/HighBitSet64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/HighBitSet64.c index e19928f651..8dc9ad4158 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/HighBitSet64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/HighBitSet64.c @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ARShiftU64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ARShiftU64.asm deleted file mode 100644 index 1e14e9e9ea..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ARShiftU64.asm +++ /dev/null @@ -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
\ No newline at end of file diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ARShiftU64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ARShiftU64.c new file mode 100644 index 0000000000..bd9a535060 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ARShiftU64.c @@ -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
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuBreakpoint.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuBreakpoint.asm deleted file mode 100644 index e1050afff8..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuBreakpoint.asm +++ /dev/null @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuBreakpoint.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuBreakpoint.c new file mode 100644 index 0000000000..37bc9053a0 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuBreakpoint.c @@ -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 ();
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuFlushTlb.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuFlushTlb.asm deleted file mode 100644 index ba4849f0af..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuFlushTlb.asm +++ /dev/null @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuFlushTlb.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuFlushTlb.c new file mode 100644 index 0000000000..64ede7beac --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuFlushTlb.c @@ -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
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuId.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuId.asm deleted file mode 100644 index 4b97570daa..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuId.asm +++ /dev/null @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuId.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuId.c new file mode 100644 index 0000000000..bcc3d039e5 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuId.c @@ -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
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuIdEx.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuIdEx.asm deleted file mode 100644 index ea57e60e97..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuIdEx.asm +++ /dev/null @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuIdEx.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuIdEx.c new file mode 100644 index 0000000000..69c285b47a --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuIdEx.c @@ -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
+ }
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuPause.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuPause.c new file mode 100644 index 0000000000..41721432e3 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuPause.c @@ -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
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuSleep.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuSleep.c new file mode 100644 index 0000000000..7b70ac9a5e --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuSleep.c @@ -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
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DisableInterrupts.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DisableInterrupts.asm deleted file mode 100644 index fabb3b8323..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DisableInterrupts.asm +++ /dev/null @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DisableInterrupts.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DisableInterrupts.c new file mode 100644 index 0000000000..98c709cbcb --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DisableInterrupts.c @@ -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
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DisablePaging32.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DisablePaging32.asm deleted file mode 100644 index 77eee7c094..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DisablePaging32.asm +++ /dev/null @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DisablePaging32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DisablePaging32.c new file mode 100644 index 0000000000..492d5da1a4 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DisablePaging32.c @@ -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
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivS64x64Remainder.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivS64x64Remainder.c index c53b8a0e9c..140e3b1145 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivS64x64Remainder.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivS64x64Remainder.c @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x32.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x32.asm deleted file mode 100644 index 28ae1f88d8..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x32.asm +++ /dev/null @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x32.c new file mode 100644 index 0000000000..c32b149100 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x32.c @@ -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
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x32Remainder.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x32Remainder.asm deleted file mode 100644 index 6a1b0eb608..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x32Remainder.asm +++ /dev/null @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x32Remainder.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x32Remainder.c new file mode 100644 index 0000000000..f02c1388e9 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x32Remainder.c @@ -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
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x64Remainder.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x64Remainder.asm deleted file mode 100644 index f0261c67a6..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x64Remainder.asm +++ /dev/null @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x64Remainder.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x64Remainder.c new file mode 100644 index 0000000000..2cc0a63311 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/DivU64x64Remainder.c @@ -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
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnableDisableInterrupts.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnableDisableInterrupts.asm deleted file mode 100644 index 7218d3027b..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnableDisableInterrupts.asm +++ /dev/null @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnableDisableInterrupts.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnableDisableInterrupts.c new file mode 100644 index 0000000000..84e08ed3c5 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnableDisableInterrupts.c @@ -0,0 +1,30 @@ +/**
+ EnableDisableInterrupts 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
+EnableDisableInterrupts (
+ VOID
+ )
+{
+ _asm {
+ sti
+ nop
+ nop
+ cli
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnableInterrupts.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnableInterrupts.asm deleted file mode 100644 index 26cc379308..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnableInterrupts.asm +++ /dev/null @@ -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:
-;
-; EnableInterrupts.Asm
-;
-; Abstract:
-;
-; EnableInterrupts function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386p
- .model flat
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; EnableInterrupts (
-; VOID
-; );
-;------------------------------------------------------------------------------
-_EnableInterrupts PROC
- sti
- ret
-_EnableInterrupts ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnableInterrupts.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnableInterrupts.c new file mode 100644 index 0000000000..d56818b135 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnableInterrupts.c @@ -0,0 +1,27 @@ +/**
+ EnableInterrupts 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
+EnableInterrupts (
+ VOID
+ )
+{
+ _asm {
+ sti
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnablePaging32.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnablePaging32.asm deleted file mode 100644 index 06188d7352..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnablePaging32.asm +++ /dev/null @@ -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:
-;
-; EnablePaging32.Asm
-;
-; Abstract:
-;
-; AsmEnablePaging32 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86EnablePaging32 (
-; IN SWITCH_STACK_ENTRY_POINT EntryPoint,
-; IN VOID *Context1, OPTIONAL
-; IN VOID *Context2, OPTIONAL
-; IN VOID *NewStack
-; );
-;------------------------------------------------------------------------------
-InternalX86EnablePaging32 PROC
- mov ebx, [esp + 4]
- mov ecx, [esp + 8]
- mov edx, [esp + 12]
- pushfd
- pop edi ; save flags in edi
- cli
- mov eax, cr0
- bts eax, 31
- mov esp, [esp + 16]
- mov cr0, eax
- push edi
- popfd ; restore flags
- push edx
- push ecx
- call ebx
- jmp $
-InternalX86EnablePaging32 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnablePaging32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnablePaging32.c new file mode 100644 index 0000000000..701da0a63e --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/EnablePaging32.c @@ -0,0 +1,48 @@ +/**
+ AsmEnablePaging32 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
+InternalX86EnablePaging32 (
+ 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
+ cli
+ mov eax, cr0
+ bts eax, 31
+ mov esp, NewStack
+ mov cr0, eax
+ push edi
+ popfd
+ push edx
+ push ecx
+ call ebx
+ jmp $
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FlushCacheLine.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FlushCacheLine.asm deleted file mode 100644 index e4d188034c..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FlushCacheLine.asm +++ /dev/null @@ -1,40 +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:
-;
-; FlushCacheLine.Asm
-;
-; Abstract:
-;
-; AsmFlushCacheLine function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586P
- .model flat,C
- .xmm
- .code
-
-;------------------------------------------------------------------------------
-; VOID *
-; EFIAPI
-; AsmFlushCacheLine (
-; IN VOID *LinearAddress
-; );
-;------------------------------------------------------------------------------
-AsmFlushCacheLine PROC
- mov eax, [esp + 4]
- clflush [eax]
- ret
-AsmFlushCacheLine ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FlushCacheLine.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FlushCacheLine.c new file mode 100644 index 0000000000..999e7d6fc5 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FlushCacheLine.c @@ -0,0 +1,28 @@ +/**
+ AsmFlushCacheLine 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
+AsmFlushCacheLine (
+ IN VOID *LinearAddress
+ )
+{
+ _asm {
+ mov eax, LinearAddress
+ clflush [eax]
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FxRestore.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FxRestore.asm deleted file mode 100644 index 520efe8cef..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FxRestore.asm +++ /dev/null @@ -1,40 +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:
-;
-; FxRestore.Asm
-;
-; Abstract:
-;
-; AsmFxRestore function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .xmm
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86FxRestore (
-; IN CONST IA32_FX_BUFFER *Buffer
-; );
-;------------------------------------------------------------------------------
-InternalX86FxRestore PROC
- mov eax, [esp + 4] ; Buffer must be 16-byte aligned
- fxrstor [eax]
- ret
-InternalX86FxRestore ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FxRestore.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FxRestore.c new file mode 100644 index 0000000000..12f4e37bbc --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FxRestore.c @@ -0,0 +1,28 @@ +/**
+ AsmFxRestore 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
+InternalX86FxRestore (
+ IN CONST IA32_FX_BUFFER *Buffer
+ )
+{
+ _asm {
+ mov eax, Buffer
+ fxrstor [eax]
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FxSave.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FxSave.asm deleted file mode 100644 index cd8a8017f0..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FxSave.asm +++ /dev/null @@ -1,40 +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:
-;
-; FxSave.Asm
-;
-; Abstract:
-;
-; AsmFxSave function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .xmm
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86FxSave (
-; OUT IA32_FX_BUFFER *Buffer
-; );
-;------------------------------------------------------------------------------
-InternalX86FxSave PROC
- mov eax, [esp + 4] ; Buffer must be 16-byte aligned
- fxsave [eax]
- ret
-InternalX86FxSave ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FxSave.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FxSave.c new file mode 100644 index 0000000000..1ed1b7819a --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/FxSave.c @@ -0,0 +1,28 @@ +/**
+ AsmFxSave 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
+InternalX86FxSave (
+ OUT IA32_FX_BUFFER *Buffer
+ )
+{
+ _asm {
+ mov eax, Buffer
+ fxsave [eax]
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedCompareExchange32.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedCompareExchange32.asm deleted file mode 100644 index 1937c86a80..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedCompareExchange32.asm +++ /dev/null @@ -1,43 +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:
-;
-; InterlockedCompareExchange32.Asm
-;
-; Abstract:
-;
-; InterlockedCompareExchange32 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .486
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT32
-; EFIAPI
-; InternalSyncCompareExchange32 (
-; IN UINT32 *Value,
-; IN UINT32 CompareValue,
-; IN UINT32 ExchangeValue
-; );
-;------------------------------------------------------------------------------
-InternalSyncCompareExchange32 PROC
- mov ecx, [esp + 4]
- mov eax, [esp + 8]
- mov edx, [esp + 12]
- lock cmpxchg [ecx], edx
- ret
-InternalSyncCompareExchange32 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedCompareExchange32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedCompareExchange32.c new file mode 100644 index 0000000000..a6458006bf --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedCompareExchange32.c @@ -0,0 +1,32 @@ +/**
+ InterlockedCompareExchange32 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
+InternalSyncCompareExchange32 (
+ IN volatile UINT32 *Value,
+ IN UINT32 CompareValue,
+ IN UINT32 ExchangeValue
+ )
+{
+ _asm {
+ mov ecx, Value
+ mov eax, CompareValue
+ mov edx, ExchangeValue
+ lock cmpxchg [ecx], edx
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedCompareExchange64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedCompareExchange64.asm deleted file mode 100644 index 8cea7dcd1f..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedCompareExchange64.asm +++ /dev/null @@ -1,45 +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:
-;
-; InterlockedCompareExchange64.Asm
-;
-; Abstract:
-;
-; InterlockedCompareExchange64 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586P
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; InternalSyncCompareExchange64 (
-; IN UINT64 *Value,
-; IN UINT64 CompareValue,
-; IN UINT64 ExchangeValue
-; );
-;------------------------------------------------------------------------------
-InternalSyncCompareExchange64 PROC USES esi ebx
- mov esi, [esp + 12]
- mov eax, [esp + 16]
- mov edx, [esp + 20]
- mov ebx, [esp + 24]
- mov ecx, [esp + 28]
- lock cmpxchg8b qword ptr [esi]
- ret
-InternalSyncCompareExchange64 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedCompareExchange64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedCompareExchange64.c new file mode 100644 index 0000000000..44deb0999d --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedCompareExchange64.c @@ -0,0 +1,33 @@ +/**
+ InterlockedCompareExchange64 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"
+
+UINT64
+EFIAPI
+InternalSyncCompareExchange64 (
+ IN volatile UINT64 *Value,
+ IN UINT64 CompareValue,
+ IN UINT64 ExchangeValue
+ )
+{
+ _asm {
+ mov esi, Value
+ mov eax, dword ptr [CompareValue + 0]
+ mov edx, dword ptr [CompareValue + 4]
+ mov ebx, dword ptr [ExchangeValue + 0]
+ mov ecx, dword ptr [ExchangeValue + 4]
+ lock cmpxchg8b qword ptr [esi]
+ }
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedDecrement.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedDecrement.asm deleted file mode 100644 index 269c5f2f15..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedDecrement.asm +++ /dev/null @@ -1,40 +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:
-;
-; InterlockedDecrement.Asm
-;
-; Abstract:
-;
-; InterlockedDecrement function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT32
-; EFIAPI
-; InternalSyncDecrement (
-; IN UINT32 *Value
-; );
-;------------------------------------------------------------------------------
-InternalSyncDecrement PROC
- mov eax, [esp + 4]
- lock dec dword ptr [eax]
- mov eax, [eax]
- ret
-InternalSyncDecrement ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedDecrement.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedDecrement.c new file mode 100644 index 0000000000..3f7403bb56 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedDecrement.c @@ -0,0 +1,28 @@ +/**
+ InterlockedDecrement 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
+InternalSyncDecrement (
+ IN volatile UINT32 *Value
+ )
+{
+ _asm {
+ mov eax, Value
+ lock dec dword ptr [eax]
+ mov eax, [eax]
+ }
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedIncrement.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedIncrement.asm deleted file mode 100644 index 4d989b564e..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedIncrement.asm +++ /dev/null @@ -1,40 +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:
-;
-; InterlockedIncrement.Asm
-;
-; Abstract:
-;
-; InterlockedIncrement function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT32
-; EFIAPI
-; InternalSyncIncrement (
-; IN UINT32 *Value
-; );
-;------------------------------------------------------------------------------
-InternalSyncIncrement PROC
- mov eax, [esp + 4]
- lock inc dword ptr [eax]
- mov eax, [eax]
- ret
-InternalSyncIncrement ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedIncrement.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedIncrement.c new file mode 100644 index 0000000000..0db18768ad --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InterlockedIncrement.c @@ -0,0 +1,29 @@ +/**
+ InterLockedIncrement 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
+InternalSyncIncrement (
+ IN volatile UINT32 *Value
+ )
+{
+ _asm {
+ mov eax, Value
+ lock inc dword ptr [eax]
+ mov eax, [eax]
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InternalSwitchStack.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InternalSwitchStack.c index 9d6443ab03..50a9d4f747 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InternalSwitchStack.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/InternalSwitchStack.c @@ -20,15 +20,21 @@ Abstract: --*/
-#include "..\BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack
specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
+ by Context1 and Context2. Context1 and Context2 are optional and may
+ 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 Context1 A pointer to the context to pass into the EntryPoint
@@ -37,19 +43,26 @@ Abstract: function.
@param NewStack A pointer to the new stack to use for the EntryPoint
function.
+ @param Marker VA_LIST marker for the variable argument list.
**/
VOID
EFIAPI
InternalSwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1,
- IN VOID *Context2,
- IN VOID *NewStack
+ IN VOID *Context1, OPTIONAL
+ IN VOID *Context2, OPTIONAL
+ IN VOID *NewStack,
+ IN VA_LIST Marker
)
{
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
+ //
+ // Stack should be aligned with CPU_STACK_ALIGNMENT
+ //
+ ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
+
JumpBuffer.Eip = (UINTN)EntryPoint;
JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*);
JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2);
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Invd.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Invd.c new file mode 100644 index 0000000000..197bd11a78 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Invd.c @@ -0,0 +1,27 @@ +/**
+ AsmInvd 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
+AsmInvd (
+ VOID
+ )
+{
+ _asm {
+ invd
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LRotU64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LRotU64.asm deleted file mode 100644 index f1bbd5886e..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LRotU64.asm +++ /dev/null @@ -1,47 +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:
-;
-; LRotU64.asm
-;
-; Abstract:
-;
-; 64-bit left rotation for Ia32
-;
-;------------------------------------------------------------------------------
-
- .686
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; InternalMathLRotU64 (
-; IN UINT64 Operand,
-; IN UINTN Count
-; );
-;------------------------------------------------------------------------------
-InternalMathLRotU64 PROC USES ebx
- mov cl, [esp + 16]
- mov edx, [esp + 12]
- mov eax, [esp + 8]
- shld ebx, edx, cl
- shld edx, eax, cl
- ror ebx, cl
- shld eax, ebx, cl
- test cl, 32 ; Count >= 32?
- cmovnz ecx, eax
- cmovnz eax, edx
- cmovnz edx, ecx
- ret
-InternalMathLRotU64 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LRotU64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LRotU64.c new file mode 100644 index 0000000000..6b9e3c0169 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LRotU64.c @@ -0,0 +1,46 @@ +/*++
+
+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:
+
+ LRotU64.c
+
+Abstract:
+
+
+
+--*/
+
+#include "BaseLibInternals.h"
+
+UINT64
+EFIAPI
+InternalMathLRotU64 (
+ IN UINT64 Operand,
+ IN UINTN Count
+ )
+{
+ _asm {
+ mov cl, byte ptr [Count]
+ mov edx, dword ptr [Operand + 4]
+ mov eax, dword ptr [Operand + 0]
+ shld ebx, edx, cl
+ shld edx, eax, cl
+ ror ebx, cl
+ shld eax, ebx, cl
+ test cl, 32 ; Count >= 32?
+ cmovnz ecx, eax
+ cmovnz eax, edx
+ cmovnz edx, ecx
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LShiftU64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LShiftU64.asm deleted file mode 100644 index 06a521dde6..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LShiftU64.asm +++ /dev/null @@ -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:
-;
-; LShiftU64.asm
-;
-; Abstract:
-;
-; 64-bit left shift function for IA-32
-;
-;------------------------------------------------------------------------------
-
- .686
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; InternalMathLShiftU64 (
-; IN UINT64 Operand,
-; IN UINTN Count
-; );
-;------------------------------------------------------------------------------
-InternalMathLShiftU64 PROC
- mov cl, [esp + 12]
- xor eax, eax
- mov edx, [esp + 4]
- test cl, 32 ; Count >= 32?
- cmovz eax, edx
- cmovz edx, [esp + 8]
- shld edx, eax, cl
- shl eax, cl
- ret
-InternalMathLShiftU64 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LShiftU64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LShiftU64.c new file mode 100644 index 0000000000..267fa3713e --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LShiftU64.c @@ -0,0 +1,43 @@ +/*++
+
+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:
+
+ LShiftU64.c
+
+Abstract:
+
+
+
+--*/
+
+#include "BaseLibInternals.h"
+
+UINT64
+EFIAPI
+InternalMathLShiftU64 (
+ IN UINT64 Operand,
+ IN UINTN Count
+ )
+{
+ _asm {
+ mov cl, byte ptr [Count]
+ xor eax, eax
+ mov edx, dword ptr [Operand + 0]
+ test cl, 32 // Count >= 32?
+ cmovz eax, edx
+ cmovz edx, dword ptr [Operand + 4]
+ shld edx, eax, cl
+ shl eax, cl
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LongJump.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LongJump.asm deleted file mode 100644 index 68e5b6b737..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LongJump.asm +++ /dev/null @@ -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:
-;
-; LongJump.Asm
-;
-; Abstract:
-;
-; Implementation of _LongJump() on IA-32.
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalLongJump (
-; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-InternalLongJump PROC
- pop eax ; skip return address
- pop edx ; edx <- JumpBuffer
- pop eax ; eax <- Value
- mov ebx, [edx]
- mov esi, [edx + 4]
- mov edi, [edx + 8]
- mov ebp, [edx + 12]
- mov esp, [edx + 16]
- jmp dword ptr [edx + 20] ; restore "eip"
-InternalLongJump ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LongJump.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LongJump.c new file mode 100644 index 0000000000..356a07cf66 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/LongJump.c @@ -0,0 +1,37 @@ +/**
+ Implementation of _LongJump() on 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"
+
+__declspec (naked)
+VOID
+EFIAPI
+InternalLongJump (
+ IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
+ IN UINTN Value
+ )
+{
+ _asm {
+ pop eax ; skip return address
+ pop edx ; edx <- JumpBuffer
+ pop eax ; eax <- Value
+ mov ebx, [edx]
+ mov esi, [edx + 4]
+ mov edi, [edx + 8]
+ mov ebp, [edx + 12]
+ mov esp, [edx + 16]
+ jmp dword ptr [edx + 20]
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ModU64x32.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ModU64x32.asm deleted file mode 100644 index 62e310a415..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ModU64x32.asm +++ /dev/null @@ -1,43 +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 remainder of a 64-bit integer by a 32-bit integer
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT32
-; EFIAPI
-; InternalMathModU64x32 (
-; IN UINT64 Dividend,
-; IN UINT32 Divisor
-; );
-;------------------------------------------------------------------------------
-InternalMathModU64x32 PROC
- mov eax, [esp + 8]
- mov ecx, [esp + 12]
- xor edx, edx
- div ecx
- mov eax, [esp + 4]
- div ecx
- mov eax, edx
- ret
-InternalMathModU64x32 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ModU64x32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ModU64x32.c new file mode 100644 index 0000000000..d04a29d3d7 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ModU64x32.c @@ -0,0 +1,41 @@ +/*++
+
+Copyright (c) 2004 - 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+
+Module Name:
+
+ ModU64x32.c
+
+Abstract:
+
+
+
+--*/
+
+#include "BaseLibInternals.h"
+
+UINT32
+EFIAPI
+InternalMathModU64x32 (
+ IN UINT64 Dividend,
+ IN UINT32 Divisor
+ )
+{
+ _asm {
+ mov eax, dword ptr [Dividend + 4]
+ mov ecx, Divisor
+ xor edx, edx
+ div ecx
+ mov eax, dword ptr [Dividend + 0]
+ div ecx
+ mov eax, edx
+ }
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Monitor.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Monitor.asm deleted file mode 100644 index cf298a9edf..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Monitor.asm +++ /dev/null @@ -1,43 +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:
-;
-; Monitor.Asm
-;
-; Abstract:
-;
-; AsmMonitor function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .686
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmMonitor (
-; IN UINTN Eax,
-; IN UINTN Ecx,
-; IN UINTN Edx
-; );
-;------------------------------------------------------------------------------
-AsmMonitor PROC
- mov eax, [esp + 4]
- mov ecx, [esp + 8]
- mov edx, [esp + 12]
- DB 0fh, 1, 0c8h ; monitor
- ret
-AsmMonitor ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Monitor.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Monitor.c new file mode 100644 index 0000000000..d521e19140 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Monitor.c @@ -0,0 +1,34 @@ +/**
+ AsmMonitor 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"
+
+UINTN
+EFIAPI
+AsmMonitor (
+ IN UINTN RegisterEax,
+ IN UINTN RegisterEcx,
+ IN UINTN RegisterEdx
+ )
+{
+ _asm {
+ mov eax, RegisterEax
+ mov ecx, RegisterEcx
+ mov edx, RegisterEdx
+ _emit 0x0f // monitor
+ _emit 0x01
+ _emit 0xc8
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/MultU64x32.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/MultU64x32.asm deleted file mode 100644 index f10c4a74bc..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/MultU64x32.asm +++ /dev/null @@ -1,41 +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:
-;
-; MultU64x32.asm
-;
-; Abstract:
-;
-; Calculate the product of a 64-bit integer and a 32-bit integer
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; InternalMathMultU64x32 (
-; IN UINT64 Multiplicand,
-; IN UINT32 Multiplier
-; );
-;------------------------------------------------------------------------------
-InternalMathMultU64x32 PROC
- mov ecx, [esp + 12]
- mov eax, ecx
- imul ecx, [esp + 8] ; overflow not detectable
- mul dword ptr [esp + 4]
- add edx, ecx
- ret
-InternalMathMultU64x32 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/MultU64x32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/MultU64x32.c new file mode 100644 index 0000000000..e92a6a2c1e --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/MultU64x32.c @@ -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:
+
+ MultU64x32.c
+
+Abstract:
+
+
+
+--*/
+
+#include "BaseLibInternals.h"
+
+UINT64
+EFIAPI
+InternalMathMultU64x32 (
+ IN UINT64 Multiplicand,
+ IN UINT32 Multiplier
+ )
+{
+ _asm {
+ mov ecx, Multiplier
+ mov eax, ecx
+ imul ecx, dword ptr [Multiplicand + 4] // overflow not detectable
+ mul dword ptr [Multiplicand + 0]
+ add edx, ecx
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/MultU64x64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/MultU64x64.asm deleted file mode 100644 index 39a66ebfdd..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/MultU64x64.asm +++ /dev/null @@ -1,45 +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:
-;
-; MultU64x64.asm
-;
-; Abstract:
-;
-; Calculate the product of a 64-bit integer and another 64-bit integer
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; InternalMathMultU64x64 (
-; IN UINT64 Multiplicand,
-; IN UINT64 Multiplier
-; );
-;------------------------------------------------------------------------------
-InternalMathMultU64x64 PROC USES ebx
- mov ebx, [esp + 8] ; ebx <- M1[0..31]
- mov edx, [esp + 16] ; edx <- M2[0..31]
- mov ecx, ebx
- mov eax, edx
- imul ebx, [esp + 20] ; ebx <- M1[0..31] * M2[32..63]
- imul edx, [esp + 12] ; edx <- M1[32..63] * M2[0..31]
- add ebx, edx ; carries are abandoned
- mul ecx ; edx:eax <- M1[0..31] * M2[0..31]
- add edx, ebx ; carries are abandoned
- ret
-InternalMathMultU64x64 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/MultU64x64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/MultU64x64.c new file mode 100644 index 0000000000..d77c9e10c0 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/MultU64x64.c @@ -0,0 +1,44 @@ +/*++
+
+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:
+
+ MultU64x64.c
+
+Abstract:
+
+
+
+--*/
+
+#include "BaseLibInternals.h"
+
+UINT64
+EFIAPI
+InternalMathMultU64x64 (
+ IN UINT64 Multiplicand,
+ IN UINT64 Multiplier
+ )
+{
+ _asm {
+ mov ebx, dword ptr [Multiplicand + 0]
+ mov edx, dword ptr [Multiplier + 0]
+ mov ecx, ebx
+ mov eax, edx
+ imul ebx, dword ptr [Multiplier + 4]
+ imul edx, dword ptr [Multiplicand + 4]
+ add ebx, edx
+ mul ecx
+ add edx, ebx
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Mwait.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Mwait.asm deleted file mode 100644 index bb2a07cc18..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Mwait.asm +++ /dev/null @@ -1,41 +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:
-;
-; Mwait.Asm
-;
-; Abstract:
-;
-; AsmMwait function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .686
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmMwait (
-; IN UINTN Eax,
-; IN UINTN Ecx
-; );
-;------------------------------------------------------------------------------
-AsmMwait PROC
- mov eax, [esp + 4]
- mov ecx, [esp + 8]
- DB 0fh, 1, 0c9h ; mwait
- ret
-AsmMwait ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Mwait.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Mwait.c new file mode 100644 index 0000000000..a0c65bcc62 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Mwait.c @@ -0,0 +1,32 @@ +/**
+ AsmMwait 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"
+
+UINTN
+EFIAPI
+AsmMwait (
+ IN UINTN RegisterEax,
+ IN UINTN RegisterEcx
+ )
+{
+ _asm {
+ mov eax, RegisterEax
+ mov ecx, RegisterEcx
+ _emit 0x0f // mwait
+ _emit 0x01
+ _emit 0xC9
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Non-existing.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Non-existing.c index 6ac40c718c..b163fbe371 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Non-existing.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Non-existing.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "..\BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/RRotU64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/RRotU64.asm deleted file mode 100644 index 413ae0c8e8..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/RRotU64.asm +++ /dev/null @@ -1,47 +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:
-;
-; RRotU64.asm
-;
-; Abstract:
-;
-; 64-bit right rotation for Ia32
-;
-;------------------------------------------------------------------------------
-
- .686
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; InternalMathRRotU64 (
-; IN UINT64 Operand,
-; IN UINTN Count
-; );
-;------------------------------------------------------------------------------
-InternalMathRRotU64 PROC USES ebx
- mov cl, [esp + 16]
- mov eax, [esp + 8]
- mov edx, [esp + 12]
- shrd ebx, eax, cl
- shrd eax, edx, cl
- rol ebx, cl
- shrd edx, ebx, cl
- test cl, 32 ; Count >= 32?
- cmovnz ecx, eax ; switch eax & edx if Count >= 32
- cmovnz eax, edx
- cmovnz edx, ecx
- ret
-InternalMathRRotU64 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/RRotU64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/RRotU64.c new file mode 100644 index 0000000000..d394ecad08 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/RRotU64.c @@ -0,0 +1,38 @@ +/**
+ 64-bit right rotation for Ia32
+
+ 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
+InternalMathRRotU64 (
+ IN UINT64 Operand,
+ IN UINTN Count
+ )
+{
+ _asm {
+ mov cl, byte ptr [Count]
+ mov eax, dword ptr [Operand + 0]
+ mov edx, dword ptr [Operand + 4]
+ shrd ebx, eax, cl
+ shrd eax, edx, cl
+ rol ebx, cl
+ shrd edx, ebx, cl
+ test cl, 32 // Count >= 32?
+ cmovnz ecx, eax
+ cmovnz eax, edx
+ cmovnz edx, ecx
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/RShiftU64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/RShiftU64.asm deleted file mode 100644 index 78b039f479..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/RShiftU64.asm +++ /dev/null @@ -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:
-;
-; RShiftU64.asm
-;
-; Abstract:
-;
-; 64-bit logical right shift function for IA-32
-;
-;------------------------------------------------------------------------------
-
- .686
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; InternalMathRShiftU64 (
-; IN UINT64 Operand,
-; IN UINTN Count
-; );
-;------------------------------------------------------------------------------
-InternalMathRShiftU64 PROC
- mov cl, [esp + 12] ; cl <- Count
- xor edx, edx
- mov eax, [esp + 8]
- test cl, 32 ; Count >= 32?
- cmovz edx, eax
- cmovz eax, [esp + 4]
- shrd eax, edx, cl
- shr edx, cl
- ret
-InternalMathRShiftU64 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/RShiftU64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/RShiftU64.c new file mode 100644 index 0000000000..e4fae45eb1 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/RShiftU64.c @@ -0,0 +1,43 @@ +/*++
+
+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:
+
+ RShiftU64.c
+
+Abstract:
+
+
+
+--*/
+
+#include "BaseLibInternals.h"
+
+UINT64
+EFIAPI
+InternalMathRShiftU64 (
+ IN UINT64 Operand,
+ IN UINTN Count
+ )
+{
+ _asm {
+ mov cl, byte ptr [Count]
+ xor edx, edx
+ mov eax, dword ptr [Operand + 4]
+ test cl, 32
+ cmovz edx, eax
+ cmovz eax, dword ptr [Operand + 0]
+ shrd eax, edx, cl
+ shr edx, cl
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr0.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr0.asm deleted file mode 100644 index 6d15ad5d43..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr0.asm +++ /dev/null @@ -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:
-;
-; ReadCr0.Asm
-;
-; Abstract:
-;
-; AsmReadCr0 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadCr0 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadCr0 PROC
- mov eax, cr0
- ret
-AsmReadCr0 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr0.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr0.c new file mode 100644 index 0000000000..aa83897b3d --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr0.c @@ -0,0 +1,26 @@ +/**
+ AsmReadCr0 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"
+
+UINTN
+EFIAPI
+AsmReadCr0 (
+ VOID
+ )
+{
+ __asm {
+ mov eax, cr0
+ }
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr2.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr2.asm deleted file mode 100644 index b7f75e4566..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr2.asm +++ /dev/null @@ -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:
-;
-; ReadCr2.Asm
-;
-; Abstract:
-;
-; AsmReadCr2 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadCr2 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadCr2 PROC
- mov eax, cr2
- ret
-AsmReadCr2 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr2.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr2.c new file mode 100644 index 0000000000..bd177ae033 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr2.c @@ -0,0 +1,27 @@ +/**
+ AsmReadCr2 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"
+
+UINTN
+EFIAPI
+AsmReadCr2 (
+ VOID
+ )
+{
+ __asm {
+ mov eax, cr2
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr3.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr3.asm deleted file mode 100644 index 2f3b54bfd0..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr3.asm +++ /dev/null @@ -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:
-;
-; ReadCr3.Asm
-;
-; Abstract:
-;
-; AsmReadCr3 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadCr3 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadCr3 PROC
- mov eax, cr3
- ret
-AsmReadCr3 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr3.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr3.c new file mode 100644 index 0000000000..7f41a4a3d8 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr3.c @@ -0,0 +1,27 @@ +/**
+ AsmReadCr3 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"
+
+UINTN
+EFIAPI
+AsmReadCr3 (
+ VOID
+ )
+{
+ __asm {
+ mov eax, cr3
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr4.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr4.asm deleted file mode 100644 index bf2aaee384..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr4.asm +++ /dev/null @@ -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:
-;
-; ReadCr4.Asm
-;
-; Abstract:
-;
-; AsmReadCr4 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadCr4 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadCr4 PROC
- mov eax, cr4
- ret
-AsmReadCr4 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr4.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr4.c new file mode 100644 index 0000000000..8f0b1444fd --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCr4.c @@ -0,0 +1,29 @@ +/**
+ AsmReadCr4 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"
+
+UINTN
+EFIAPI
+AsmReadCr4 (
+ VOID
+ )
+{
+ __asm {
+ _emit 0x0f // mov eax, cr4
+ _emit 0x20
+ _emit 0xE0
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCs.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCs.c new file mode 100644 index 0000000000..9a1c2fd10d --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCs.c @@ -0,0 +1,28 @@ +/**
+ AsmReadCs 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"
+
+UINT16
+EFIAPI
+AsmReadCs (
+ VOID
+ )
+{
+ __asm {
+ xor eax, eax
+ mov ax, cs
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr0.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr0.asm deleted file mode 100644 index bf5d5467c2..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr0.asm +++ /dev/null @@ -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:
-;
-; ReadDr0.Asm
-;
-; Abstract:
-;
-; AsmReadDr0 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr0 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr0 PROC
- mov eax, dr0
- ret
-AsmReadDr0 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr0.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr0.c new file mode 100644 index 0000000000..610e23f7c8 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr0.c @@ -0,0 +1,27 @@ +/**
+ AsmReadDr0 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"
+
+UINTN
+EFIAPI
+AsmReadDr0 (
+ VOID
+ )
+{
+ __asm {
+ mov eax, dr0
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr1.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr1.asm deleted file mode 100644 index 9b143cd0c7..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr1.asm +++ /dev/null @@ -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:
-;
-; ReadDr1.Asm
-;
-; Abstract:
-;
-; AsmReadDr1 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr1 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr1 PROC
- mov eax, dr1
- ret
-AsmReadDr1 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr1.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr1.c new file mode 100644 index 0000000000..22101212c0 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr1.c @@ -0,0 +1,27 @@ +/**
+ AsmReadDr1 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"
+
+UINTN
+EFIAPI
+AsmReadDr1 (
+ VOID
+ )
+{
+ __asm {
+ mov eax, dr1
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr2.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr2.asm deleted file mode 100644 index ba24037528..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr2.asm +++ /dev/null @@ -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:
-;
-; ReadDr2.Asm
-;
-; Abstract:
-;
-; AsmReadDr2 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr2 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr2 PROC
- mov eax, dr2
- ret
-AsmReadDr2 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr2.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr2.c new file mode 100644 index 0000000000..01e67b9b01 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr2.c @@ -0,0 +1,27 @@ +/**
+ AsmReadDr2 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"
+
+UINTN
+EFIAPI
+AsmReadDr2 (
+ VOID
+ )
+{
+ __asm {
+ mov eax, dr2
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr3.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr3.asm deleted file mode 100644 index 67a0f1c32d..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr3.asm +++ /dev/null @@ -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:
-;
-; ReadDr3.Asm
-;
-; Abstract:
-;
-; AsmReadDr3 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr3 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr3 PROC
- mov eax, dr3
- ret
-AsmReadDr3 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr3.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr3.c new file mode 100644 index 0000000000..88672e77af --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr3.c @@ -0,0 +1,27 @@ +/**
+ AsmReadDr3 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"
+
+UINTN
+EFIAPI
+AsmReadDr3 (
+ VOID
+ )
+{
+ __asm {
+ mov eax, dr3
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr4.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr4.asm deleted file mode 100644 index cfae3e8927..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr4.asm +++ /dev/null @@ -1,45 +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:
-;
-; ReadDr4.Asm
-;
-; Abstract:
-;
-; AsmReadDr4 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr4 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr4 PROC
- ;
- ; DR4 is alias to DR6 only if DE (in CR4) is cleared. Otherwise, reading
- ; this register will cause a #UD exception.
- ;
- ; MS assembler doesn't support this instruction since no one would use it
- ; under normal circustances. Here opcode is used.
- ;
- DB 0fh, 21h, 0e0h
- ret
-AsmReadDr4 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr4.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr4.c new file mode 100644 index 0000000000..537bc52e24 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr4.c @@ -0,0 +1,29 @@ +/**
+ AsmReadDr4 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"
+
+UINTN
+EFIAPI
+AsmReadDr4 (
+ VOID
+ )
+{
+ __asm {
+ _emit 0x0f
+ _emit 0x21
+ _emit 0xe0
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr5.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr5.asm deleted file mode 100644 index 9f3fec11e8..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr5.asm +++ /dev/null @@ -1,45 +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:
-;
-; ReadDr5.Asm
-;
-; Abstract:
-;
-; AsmReadDr5 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr5 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr5 PROC
- ;
- ; DR5 is alias to DR7 only if DE (in CR4) is cleared. Otherwise, reading
- ; this register will cause a #UD exception.
- ;
- ; MS assembler doesn't support this instruction since no one would use it
- ; under normal circustances. Here opcode is used.
- ;
- DB 0fh, 21h, 0e8h
- ret
-AsmReadDr5 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr5.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr5.c new file mode 100644 index 0000000000..605e58c2c3 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr5.c @@ -0,0 +1,29 @@ +/**
+ AsmReadDr5 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"
+
+UINTN
+EFIAPI
+AsmReadDr5 (
+ VOID
+ )
+{
+ __asm {
+ _emit 0x0f
+ _emit 0x21
+ _emit 0xe8
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr6.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr6.asm deleted file mode 100644 index a773f1236e..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr6.asm +++ /dev/null @@ -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:
-;
-; ReadDr6.Asm
-;
-; Abstract:
-;
-; AsmReadDr6 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr6 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr6 PROC
- mov eax, dr6
- ret
-AsmReadDr6 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr6.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr6.c new file mode 100644 index 0000000000..23813c5a54 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr6.c @@ -0,0 +1,27 @@ +/**
+ AsmReadDr6 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"
+
+UINTN
+EFIAPI
+AsmReadDr6 (
+ VOID
+ )
+{
+ __asm {
+ mov eax, dr6
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr7.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr7.asm deleted file mode 100644 index 74b2927110..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr7.asm +++ /dev/null @@ -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:
-;
-; ReadDr7.Asm
-;
-; Abstract:
-;
-; AsmReadDr7 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadDr7 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadDr7 PROC
- mov eax, dr7
- ret
-AsmReadDr7 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr7.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr7.c new file mode 100644 index 0000000000..1a5fd84162 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDr7.c @@ -0,0 +1,27 @@ +/**
+ AsmReadDr7 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"
+
+UINTN
+EFIAPI
+AsmReadDr7 (
+ VOID
+ )
+{
+ __asm {
+ mov eax, dr7
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDs.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDs.c new file mode 100644 index 0000000000..fb5efddc06 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDs.c @@ -0,0 +1,28 @@ +/**
+ AsmReadDs 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"
+
+UINT16
+EFIAPI
+AsmReadDs (
+ VOID
+ )
+{
+ __asm {
+ xor eax, eax
+ mov ax, ds
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadEflags.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadEflags.c new file mode 100644 index 0000000000..21229057b7 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadEflags.c @@ -0,0 +1,28 @@ +/**
+ AsmReadEflags 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"
+
+UINTN
+EFIAPI
+AsmReadEflags (
+ VOID
+ )
+{
+ __asm {
+ pushfd
+ pop eax
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadEs.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadEs.asm deleted file mode 100644 index 6706071b73..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadEs.asm +++ /dev/null @@ -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:
-;
-; ReadEs.Asm
-;
-; Abstract:
-;
-; AsmReadEs function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadEs (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadEs PROC
- mov eax, es
- ret
-AsmReadEs ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadEs.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadEs.c new file mode 100644 index 0000000000..97275a29cd --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadEs.c @@ -0,0 +1,28 @@ +/**
+ AsmReadEs 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"
+
+UINT16
+EFIAPI
+AsmReadEs (
+ VOID
+ )
+{
+ __asm {
+ xor eax, eax
+ mov ax, es
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadFs.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadFs.asm deleted file mode 100644 index 773da70044..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadFs.asm +++ /dev/null @@ -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:
-;
-; ReadFs.Asm
-;
-; Abstract:
-;
-; AsmReadFs function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadFs (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadFs PROC
- mov eax, fs
- ret
-AsmReadFs ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadFs.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadFs.c new file mode 100644 index 0000000000..60bb73886b --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadFs.c @@ -0,0 +1,28 @@ +/**
+ AsmReadFs 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"
+
+UINT16
+EFIAPI
+AsmReadFs (
+ VOID
+ )
+{
+ __asm {
+ xor eax, eax
+ mov ax, fs
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadGdtr.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadGdtr.asm deleted file mode 100644 index 19db886f35..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadGdtr.asm +++ /dev/null @@ -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:
-;
-; ReadGdtr.Asm
-;
-; Abstract:
-;
-; AsmReadGdtr function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86ReadGdtr (
-; OUT IA32_DESCRIPTOR *Gdtr
-; );
-;------------------------------------------------------------------------------
-InternalX86ReadGdtr PROC
- mov eax, [esp + 4]
- sgdt fword ptr [eax]
- ret
-InternalX86ReadGdtr ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadGdtr.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadGdtr.c new file mode 100644 index 0000000000..3885f105d8 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadGdtr.c @@ -0,0 +1,28 @@ +/**
+ AsmReadGdtr 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
+InternalX86ReadGdtr (
+ OUT IA32_DESCRIPTOR *Gdtr
+ )
+{
+ _asm {
+ mov eax, Gdtr
+ sgdt fword ptr [eax]
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadGs.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadGs.asm deleted file mode 100644 index 55ccca402d..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadGs.asm +++ /dev/null @@ -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:
-;
-; ReadGs.Asm
-;
-; Abstract:
-;
-; AsmReadGs function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadGs (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadGs PROC
- mov eax, gs
- ret
-AsmReadGs ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadGs.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadGs.c new file mode 100644 index 0000000000..ddce9a5e1d --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadGs.c @@ -0,0 +1,28 @@ +/**
+ AsmReadGs 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"
+
+UINT16
+EFIAPI
+AsmReadGs (
+ VOID
+ )
+{
+ __asm {
+ xor eax, eax
+ mov ax, gs
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadIdtr.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadIdtr.asm deleted file mode 100644 index 6c10fcac29..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadIdtr.asm +++ /dev/null @@ -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:
-;
-; ReadIdtr.Asm
-;
-; Abstract:
-;
-; AsmReadIdtr function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86ReadIdtr (
-; OUT IA32_DESCRIPTOR *Idtr
-; );
-;------------------------------------------------------------------------------
-InternalX86ReadIdtr PROC
- mov eax, [esp + 4]
- sidt fword ptr [eax]
- ret
-InternalX86ReadIdtr ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadIdtr.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadIdtr.c new file mode 100644 index 0000000000..842c594c03 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadIdtr.c @@ -0,0 +1,27 @@ +/**
+ AsmReadIdtr 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
+InternalX86ReadIdtr (
+ OUT IA32_DESCRIPTOR *Idtr
+ )
+{
+ _asm {
+ mov eax, Idtr
+ sidt fword ptr [eax]
+ }
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadLdtr.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadLdtr.asm deleted file mode 100644 index 7b9696f216..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadLdtr.asm +++ /dev/null @@ -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:
-;
-; ReadLdtr.Asm
-;
-; Abstract:
-;
-; AsmReadLdtr function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadLdtr (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadLdtr PROC
- sldt ax
- ret
-AsmReadLdtr ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadLdtr.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadLdtr.c new file mode 100644 index 0000000000..cc3c666d45 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadLdtr.c @@ -0,0 +1,27 @@ +/**
+ AsmReadLdtr 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"
+
+UINT16
+EFIAPI
+AsmReadLdtr (
+ VOID
+ )
+{
+ _asm {
+ sldt ax
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm0.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm0.asm deleted file mode 100644 index 1ea5b21747..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm0.asm +++ /dev/null @@ -1,43 +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:
-;
-; ReadMm0.Asm
-;
-; Abstract:
-;
-; AsmReadMm0 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm0 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm0 PROC
- push eax
- push eax
- movq [esp], mm0
- pop eax
- pop edx
- ret
-AsmReadMm0 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm0.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm0.c new file mode 100644 index 0000000000..35d108f817 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm0.c @@ -0,0 +1,32 @@ +/**
+ AsmReadMm0 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"
+
+UINT64
+EFIAPI
+AsmReadMm0 (
+ VOID
+ )
+{
+ _asm {
+ push eax
+ push eax
+ movq [esp], mm0
+ pop eax
+ pop edx
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm1.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm1.asm deleted file mode 100644 index 36d14b0b47..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm1.asm +++ /dev/null @@ -1,43 +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:
-;
-; ReadMm1.Asm
-;
-; Abstract:
-;
-; AsmReadMm1 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm1 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm1 PROC
- push eax
- push eax
- movq [esp], mm1
- pop eax
- pop edx
- ret
-AsmReadMm1 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm1.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm1.c new file mode 100644 index 0000000000..be7cc446a9 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm1.c @@ -0,0 +1,32 @@ +/**
+ AsmReadMm1 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"
+
+UINT64
+EFIAPI
+AsmReadMm1 (
+ VOID
+ )
+{
+ _asm {
+ push eax
+ push eax
+ movq [esp], mm1
+ pop eax
+ pop edx
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm2.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm2.asm deleted file mode 100644 index 652ae5e221..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm2.asm +++ /dev/null @@ -1,43 +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:
-;
-; ReadMm2.Asm
-;
-; Abstract:
-;
-; AsmReadMm2 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm2 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm2 PROC
- push eax
- push eax
- movq [esp], mm2
- pop eax
- pop edx
- ret
-AsmReadMm2 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm2.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm2.c new file mode 100644 index 0000000000..ce134e4aa8 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm2.c @@ -0,0 +1,32 @@ +/**
+ AsmReadMm2 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"
+
+UINT64
+EFIAPI
+AsmReadMm2 (
+ VOID
+ )
+{
+ _asm {
+ push eax
+ push eax
+ movq [esp], mm2
+ pop eax
+ pop edx
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm3.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm3.asm deleted file mode 100644 index 2cf4c67050..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm3.asm +++ /dev/null @@ -1,43 +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:
-;
-; ReadMm3.Asm
-;
-; Abstract:
-;
-; AsmReadMm3 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm3 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm3 PROC
- push eax
- push eax
- movq [esp], mm3
- pop eax
- pop edx
- ret
-AsmReadMm3 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm3.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm3.c new file mode 100644 index 0000000000..4561d847ae --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm3.c @@ -0,0 +1,32 @@ +/**
+ AsmReadMm3 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"
+
+UINT64
+EFIAPI
+AsmReadMm3 (
+ VOID
+ )
+{
+ _asm {
+ push eax
+ push eax
+ movq [esp], mm3
+ pop eax
+ pop edx
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm4.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm4.asm deleted file mode 100644 index 37599aeb6e..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm4.asm +++ /dev/null @@ -1,43 +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:
-;
-; ReadMm4.Asm
-;
-; Abstract:
-;
-; AsmReadMm4 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm4 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm4 PROC
- push eax
- push eax
- movq [esp], mm4
- pop eax
- pop edx
- ret
-AsmReadMm4 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm4.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm4.c new file mode 100644 index 0000000000..d1e36b8d97 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm4.c @@ -0,0 +1,32 @@ +/**
+ AsmReadMm4 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"
+
+UINT64
+EFIAPI
+AsmReadMm4 (
+ VOID
+ )
+{
+ _asm {
+ push eax
+ push eax
+ movq [esp], mm4
+ pop eax
+ pop edx
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm5.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm5.asm deleted file mode 100644 index 3722f9dae4..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm5.asm +++ /dev/null @@ -1,43 +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:
-;
-; ReadMm5.Asm
-;
-; Abstract:
-;
-; AsmReadMm5 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm5 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm5 PROC
- push eax
- push eax
- movq [esp], mm5
- pop eax
- pop edx
- ret
-AsmReadMm5 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm5.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm5.c new file mode 100644 index 0000000000..1379768155 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm5.c @@ -0,0 +1,32 @@ +/**
+ AsmReadMm5 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"
+
+UINT64
+EFIAPI
+AsmReadMm5 (
+ VOID
+ )
+{
+ _asm {
+ push eax
+ push eax
+ movq [esp], mm5
+ pop eax
+ pop edx
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm6.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm6.asm deleted file mode 100644 index 031889e6f2..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm6.asm +++ /dev/null @@ -1,43 +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:
-;
-; ReadMm6.Asm
-;
-; Abstract:
-;
-; AsmReadMm6 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm6 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm6 PROC
- push eax
- push eax
- movq [esp], mm6
- pop eax
- pop edx
- ret
-AsmReadMm6 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm6.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm6.c new file mode 100644 index 0000000000..4a085379ea --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm6.c @@ -0,0 +1,32 @@ +/**
+ AsmReadMm6 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"
+
+UINT64
+EFIAPI
+AsmReadMm6 (
+ VOID
+ )
+{
+ _asm {
+ push eax
+ push eax
+ movq [esp], mm6
+ pop eax
+ pop edx
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm7.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm7.asm deleted file mode 100644 index c83195082a..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm7.asm +++ /dev/null @@ -1,43 +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:
-;
-; ReadMm7.Asm
-;
-; Abstract:
-;
-; AsmReadMm7 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMm7 (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadMm7 PROC
- push eax
- push eax
- movq [esp], mm7
- pop eax
- pop edx
- ret
-AsmReadMm7 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm7.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm7.c new file mode 100644 index 0000000000..1395fd9c56 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMm7.c @@ -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:
+
+ ReadMm7.c
+
+Abstract:
+
+
+
+--*/
+
+#include "BaseLibInternals.h"
+
+UINT64
+EFIAPI
+AsmReadMm7 (
+ VOID
+ )
+{
+ _asm {
+ push eax
+ push eax
+ movq [esp], mm7
+ pop eax
+ pop edx
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMsr64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMsr64.asm deleted file mode 100644 index f0cf6a8308..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMsr64.asm +++ /dev/null @@ -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:
-;
-; ReadMsr64.Asm
-;
-; Abstract:
-;
-; AsmReadMsr64 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadMsr64 (
-; IN UINT64 Index
-; );
-;------------------------------------------------------------------------------
-AsmReadMsr64 PROC
- mov ecx, [esp + 4]
- rdmsr
- ret
-AsmReadMsr64 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMsr64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMsr64.c new file mode 100644 index 0000000000..a25a9e8bba --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadMsr64.c @@ -0,0 +1,28 @@ +/**
+ AsmReadMsr64 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"
+
+UINT64
+EFIAPI
+AsmReadMsr64 (
+ IN UINT32 Index
+ )
+{
+ _asm {
+ mov ecx, Index
+ rdmsr
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadPmc.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadPmc.asm deleted file mode 100644 index 3b0d0e3f1b..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadPmc.asm +++ /dev/null @@ -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:
-;
-; ReadPmc.Asm
-;
-; Abstract:
-;
-; AsmReadPmc function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadPmc (
-; IN UINT32 PmcIndex
-; );
-;------------------------------------------------------------------------------
-AsmReadPmc PROC
- mov ecx, [esp + 4]
- rdpmc
- ret
-AsmReadPmc ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadPmc.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadPmc.c new file mode 100644 index 0000000000..f8901e8872 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadPmc.c @@ -0,0 +1,28 @@ +/**
+ AsmReadPmc 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"
+
+UINT64
+EFIAPI
+AsmReadPmc (
+ IN UINT32 PmcIndex
+ )
+{
+ _asm {
+ mov ecx, PmcIndex
+ rdpmc
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadSs.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadSs.asm deleted file mode 100644 index 7788fc98bd..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadSs.asm +++ /dev/null @@ -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:
-;
-; ReadSs.Asm
-;
-; Abstract:
-;
-; AsmReadSs function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadSs (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadSs PROC
- mov eax, ss
- ret
-AsmReadSs ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadSs.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadSs.c new file mode 100644 index 0000000000..ddad517be4 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadSs.c @@ -0,0 +1,28 @@ +/**
+ AsmReadSs 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"
+
+UINT16
+EFIAPI
+AsmReadSs (
+ VOID
+ )
+{
+ __asm {
+ xor eax, eax
+ mov ax, ss
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadTr.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadTr.asm deleted file mode 100644 index 8990e3120e..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadTr.asm +++ /dev/null @@ -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:
-;
-; ReadTr.Asm
-;
-; Abstract:
-;
-; AsmReadTr function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadTr (
-; VOID
-; );
-;------------------------------------------------------------------------------
-AsmReadTr PROC
- str ax
- ret
-AsmReadTr ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadTr.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadTr.c new file mode 100644 index 0000000000..046a144b7e --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadTr.c @@ -0,0 +1,27 @@ +/**
+ AsmReadTr 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"
+
+UINT16
+EFIAPI
+AsmReadTr (
+ VOID
+ )
+{
+ _asm {
+ str ax
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadTsc.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadTsc.c new file mode 100644 index 0000000000..012991bf58 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadTsc.c @@ -0,0 +1,27 @@ +/**
+ AsmReadTsc 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"
+
+UINT64
+EFIAPI
+AsmReadTsc (
+ VOID
+ )
+{
+ _asm {
+ rdtsc
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/SetJump.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/SetJump.asm deleted file mode 100644 index e3d33e1028..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/SetJump.asm +++ /dev/null @@ -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:
-;
-; SetJump.Asm
-;
-; Abstract:
-;
-; Implementation of SetJump() on IA-32.
-;
-;------------------------------------------------------------------------------
-
- .386
- .model flat,C
- .code
-
-InternalAssertJumpBuffer PROTO C
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; SetJump (
-; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
-; );
-;------------------------------------------------------------------------------
-SetJump PROC
- push [esp + 4]
- call InternalAssertJumpBuffer ; To validate JumpBuffer
- pop ecx
- pop ecx ; ecx <- return address
- mov edx, [esp]
- mov [edx], ebx
- mov [edx + 4], esi
- mov [edx + 8], edi
- mov [edx + 12], ebp
- mov [edx + 16], esp
- mov [edx + 20], ecx ; eip value to restore in LongJump
- xor eax, eax
- jmp ecx
-SetJump ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/SetJump.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/SetJump.c new file mode 100644 index 0000000000..c4fcb8c659 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/SetJump.c @@ -0,0 +1,46 @@ +/**
+ Implementation of SetJump() on 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"
+
+VOID
+EFIAPI
+InternalAssertJumpBuffer (
+ IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
+ );
+
+_declspec (naked)
+UINTN
+EFIAPI
+SetJump (
+ OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
+ )
+{
+ _asm {
+ push [esp + 4]
+ call InternalAssertJumpBuffer
+ pop ecx
+ pop ecx
+ mov edx, [esp]
+ mov [edx], ebx
+ mov [edx + 4], esi
+ mov [edx + 8], edi
+ mov [edx + 12], ebp
+ mov [edx + 16], esp
+ mov [edx + 20], ecx
+ xor eax, eax
+ jmp ecx
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/SwapBytes64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/SwapBytes64.asm deleted file mode 100644 index 9554c1985e..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/SwapBytes64.asm +++ /dev/null @@ -1,41 +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:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; InternalMathSwapBytes64 (
-; IN UINT64 Operand
-; );
-;------------------------------------------------------------------------------
-InternalMathSwapBytes64 PROC
- mov eax, [esp + 8] ; eax <- upper 32 bits
- mov edx, [esp + 4] ; edx <- lower 32 bits
- bswap eax
- bswap edx
- ret
-InternalMathSwapBytes64 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/SwapBytes64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/SwapBytes64.c new file mode 100644 index 0000000000..f6d14ea925 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/SwapBytes64.c @@ -0,0 +1,30 @@ +/**
+ Implementation of 64-bit swap bytes
+
+ 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
+InternalMathSwapBytes64 (
+ IN UINT64 Operand
+ )
+{
+ _asm {
+ mov eax, dword ptr [Operand + 4]
+ mov edx, dword ptr [Operand + 0]
+ bswap eax
+ bswap edx
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Wbinvd.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Wbinvd.c new file mode 100644 index 0000000000..851cd53341 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Wbinvd.c @@ -0,0 +1,27 @@ +/**
+ AsmWbinvd 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
+AsmWbinvd (
+ VOID
+ )
+{
+ _asm {
+ wbinvd
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr0.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr0.c new file mode 100644 index 0000000000..136feca54d --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr0.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteCr0 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"
+
+UINTN
+EFIAPI
+AsmWriteCr0 (
+ UINTN Value
+ )
+{
+ _asm {
+ mov eax, Value
+ mov cr0, eax
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr2.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr2.asm deleted file mode 100644 index 412cb26108..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr2.asm +++ /dev/null @@ -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:
-;
-; WriteCr2.Asm
-;
-; Abstract:
-;
-; AsmWriteCr2 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteCr2 (
-; UINTN Cr2
-; );
-;------------------------------------------------------------------------------
-AsmWriteCr2 PROC
- mov eax, [esp + 4]
- mov cr2, eax
- ret
-AsmWriteCr2 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr2.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr2.c new file mode 100644 index 0000000000..daa4140fed --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr2.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteCr2 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"
+
+UINTN
+EFIAPI
+AsmWriteCr2 (
+ UINTN Value
+ )
+{
+ _asm {
+ mov eax, Value
+ mov cr2, eax
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr3.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr3.asm deleted file mode 100644 index 47514ea798..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr3.asm +++ /dev/null @@ -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:
-;
-; WriteCr3.Asm
-;
-; Abstract:
-;
-; AsmWriteCr3 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteCr3 (
-; UINTN Cr3
-; );
-;------------------------------------------------------------------------------
-AsmWriteCr3 PROC
- mov eax, [esp + 4]
- mov cr3, eax
- ret
-AsmWriteCr3 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr3.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr3.c new file mode 100644 index 0000000000..eb234dc3de --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr3.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteCr3 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"
+
+UINTN
+EFIAPI
+AsmWriteCr3 (
+ UINTN Value
+ )
+{
+ _asm {
+ mov eax, Value
+ mov cr3, eax
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr4.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr4.asm deleted file mode 100644 index dd8d37e594..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr4.asm +++ /dev/null @@ -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:
-;
-; WriteCr4.Asm
-;
-; Abstract:
-;
-; AsmWriteCr4 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteCr4 (
-; UINTN Cr4
-; );
-;------------------------------------------------------------------------------
-AsmWriteCr4 PROC
- mov eax, [esp + 4]
- mov cr4, eax
- ret
-AsmWriteCr4 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr4.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr4.c new file mode 100644 index 0000000000..7e976e4fba --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr4.c @@ -0,0 +1,30 @@ +/**
+ AsmWriteCr4 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"
+
+UINTN
+EFIAPI
+AsmWriteCr4 (
+ UINTN Value
+ )
+{
+ _asm {
+ mov eax, Value
+ _emit 0x0f // mov cr4, eax
+ _emit 0x22
+ _emit 0xE0
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr0.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr0.asm deleted file mode 100644 index 0154d0ff40..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr0.asm +++ /dev/null @@ -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:
-;
-; WriteDr0.Asm
-;
-; Abstract:
-;
-; AsmWriteDr0 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr0 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr0 PROC
- mov eax, [esp + 4]
- mov dr0, eax
- ret
-AsmWriteDr0 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr0.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr0.c new file mode 100644 index 0000000000..1e98277033 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr0.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteDr0 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"
+
+UINTN
+EFIAPI
+AsmWriteDr0 (
+ IN UINTN Value
+ )
+{
+ _asm {
+ mov eax, Value
+ mov dr0, eax
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr1.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr1.asm deleted file mode 100644 index 4c7a2b3809..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr1.asm +++ /dev/null @@ -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:
-;
-; WriteDr1.Asm
-;
-; Abstract:
-;
-; AsmWriteDr1 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr1 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr1 PROC
- mov eax, [esp + 4]
- mov dr1, eax
- ret
-AsmWriteDr1 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr1.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr1.c new file mode 100644 index 0000000000..42c163b77e --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr1.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteDr1 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"
+
+UINTN
+EFIAPI
+AsmWriteDr1 (
+ IN UINTN Value
+ )
+{
+ _asm {
+ mov eax, Value
+ mov dr1, eax
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr2.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr2.asm deleted file mode 100644 index f621f6dfa4..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr2.asm +++ /dev/null @@ -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:
-;
-; WriteDr2.Asm
-;
-; Abstract:
-;
-; AsmWriteDr2 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr2 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr2 PROC
- mov eax, [esp + 4]
- mov dr2, eax
- ret
-AsmWriteDr2 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr2.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr2.c new file mode 100644 index 0000000000..a19bad72f4 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr2.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteDr2 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"
+
+UINTN
+EFIAPI
+AsmWriteDr2 (
+ IN UINTN Value
+ )
+{
+ _asm {
+ mov eax, Value
+ mov dr2, eax
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr3.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr3.asm deleted file mode 100644 index 99a5d564be..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr3.asm +++ /dev/null @@ -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:
-;
-; WriteDr3.Asm
-;
-; Abstract:
-;
-; AsmWriteDr3 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr3 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr3 PROC
- mov eax, [esp + 4]
- mov dr3, eax
- ret
-AsmWriteDr3 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr3.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr3.c new file mode 100644 index 0000000000..74a27eb089 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr3.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteDr3 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"
+
+UINTN
+EFIAPI
+AsmWriteDr3 (
+ IN UINTN Value
+ )
+{
+ _asm {
+ mov eax, Value
+ mov dr3, eax
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr4.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr4.asm deleted file mode 100644 index 9ed8bb3f26..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr4.asm +++ /dev/null @@ -1,46 +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:
-;
-; WriteDr4.Asm
-;
-; Abstract:
-;
-; AsmWriteDr4 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr4 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr4 PROC
- mov eax, [esp + 4]
- ;
- ; DR4 is alias to DR6 only if DE (in CR4) is cleared. Otherwise, writing to
- ; this register will cause a #UD exception.
- ;
- ; MS assembler doesn't support this instruction since no one would use it
- ; under normal circustances. Here opcode is used.
- ;
- DB 0fh, 23h, 0e0h
- ret
-AsmWriteDr4 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr4.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr4.c new file mode 100644 index 0000000000..ed0d72918f --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr4.c @@ -0,0 +1,30 @@ +/**
+ AsmWriteDr4 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"
+
+UINTN
+EFIAPI
+AsmWriteDr4 (
+ IN UINTN Value
+ )
+{
+ _asm {
+ mov eax, Value
+ _emit 0x0f // mov dr4, eax
+ _emit 0x23
+ _emit 0xe0
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr5.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr5.asm deleted file mode 100644 index ba74eaa075..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr5.asm +++ /dev/null @@ -1,46 +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:
-;
-; WriteDr5.Asm
-;
-; Abstract:
-;
-; AsmWriteDr5 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr5 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr5 PROC
- mov eax, [esp + 4]
- ;
- ; DR5 is alias to DR7 only if DE (in CR4) is cleared. Otherwise, writing to
- ; this register will cause a #UD exception.
- ;
- ; MS assembler doesn't support this instruction since no one would use it
- ; under normal circustances. Here opcode is used.
- ;
- DB 0fh, 23h, 0e8h
- ret
-AsmWriteDr5 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr5.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr5.c new file mode 100644 index 0000000000..ad53bd1d72 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr5.c @@ -0,0 +1,30 @@ +/**
+ AsmWriteDr5 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"
+
+UINTN
+EFIAPI
+AsmWriteDr5 (
+ IN UINTN Value
+ )
+{
+ _asm {
+ mov eax, Value
+ _emit 0x0f // mov dr5, eax
+ _emit 0x23
+ _emit 0xe8
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr6.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr6.asm deleted file mode 100644 index f36e95e09b..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr6.asm +++ /dev/null @@ -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:
-;
-; WriteDr6.Asm
-;
-; Abstract:
-;
-; AsmWriteDr6 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr6 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr6 PROC
- mov eax, [esp + 4]
- mov dr6, eax
- ret
-AsmWriteDr6 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr6.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr6.c new file mode 100644 index 0000000000..b42ee0cda5 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr6.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteDr6 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"
+
+UINTN
+EFIAPI
+AsmWriteDr6 (
+ IN UINTN Value
+ )
+{
+ _asm {
+ mov eax, Value
+ mov dr6, eax
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr7.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr7.asm deleted file mode 100644 index cba6459231..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr7.asm +++ /dev/null @@ -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:
-;
-; WriteDr7.Asm
-;
-; Abstract:
-;
-; AsmWriteDr7 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmWriteDr7 (
-; IN UINTN Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteDr7 PROC
- mov eax, [esp + 4]
- mov dr7, eax
- ret
-AsmWriteDr7 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr7.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr7.c new file mode 100644 index 0000000000..8654eb12e0 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteDr7.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteDr7 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"
+
+UINTN
+EFIAPI
+AsmWriteDr7 (
+ IN UINTN Value
+ )
+{
+ _asm {
+ mov eax, Value
+ mov dr7, eax
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteGdtr.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteGdtr.asm deleted file mode 100644 index 0d5b5337ab..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteGdtr.asm +++ /dev/null @@ -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:
-;
-; WriteGdtr.Asm
-;
-; Abstract:
-;
-; AsmWriteGdtr function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86WriteGdtr (
-; IN CONST IA32_DESCRIPTOR *Idtr
-; );
-;------------------------------------------------------------------------------
-InternalX86WriteGdtr PROC
- mov eax, [esp + 4]
- lgdt fword ptr [eax]
- ret
-InternalX86WriteGdtr ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteGdtr.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteGdtr.c new file mode 100644 index 0000000000..060721d025 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteGdtr.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteGdtr 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
+InternalX86WriteGdtr (
+ IN CONST IA32_DESCRIPTOR *Gdtr
+ )
+{
+ _asm {
+ mov eax, Gdtr
+ lgdt fword ptr [eax]
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteIdtr.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteIdtr.asm deleted file mode 100644 index 427637a13d..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteIdtr.asm +++ /dev/null @@ -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:
-;
-; WriteIdtr.Asm
-;
-; Abstract:
-;
-; AsmWriteIdtr function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; InternalX86WriteIdtr (
-; IN CONST IA32_DESCRIPTOR *Idtr
-; );
-;------------------------------------------------------------------------------
-InternalX86WriteIdtr PROC
- mov eax, [esp + 4]
- lidt fword ptr [eax]
- ret
-InternalX86WriteIdtr ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteIdtr.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteIdtr.c new file mode 100644 index 0000000000..968c97520d --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteIdtr.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteIdtr 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
+InternalX86WriteIdtr (
+ IN CONST IA32_DESCRIPTOR *Idtr
+ )
+{
+ _asm {
+ mov eax, Idtr
+ lidt fword ptr [eax]
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteLdtr.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteLdtr.asm deleted file mode 100644 index fb24d05042..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteLdtr.asm +++ /dev/null @@ -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:
-;
-; WriteLdtr.Asm
-;
-; Abstract:
-;
-; AsmWriteLdtr function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .386p
- .model flat
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteLdtr (
-; IN UINT16 Ldtr
-; );
-;------------------------------------------------------------------------------
-_AsmWriteLdtr PROC
- mov eax, [esp + 4]
- lldt ax
- ret
-_AsmWriteLdtr ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteLdtr.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteLdtr.c new file mode 100644 index 0000000000..1d23ee2943 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteLdtr.c @@ -0,0 +1,29 @@ +/**
+ AsmWriteLdtr 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
+AsmWriteLdtr (
+ IN UINT16 Ldtr
+ )
+{
+ _asm {
+ xor eax, eax
+ mov ax, Ldtr
+ lldt ax
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm0.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm0.asm deleted file mode 100644 index 64090cecf7..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm0.asm +++ /dev/null @@ -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:
-;
-; WriteMm0.Asm
-;
-; Abstract:
-;
-; AsmWriteMm0 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm0 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm0 PROC
- movq mm0, [esp + 4]
- ret
-AsmWriteMm0 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm0.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm0.c new file mode 100644 index 0000000000..0e3003a9fe --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm0.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteMm0 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
+AsmWriteMm0 (
+ IN UINT64 Value
+ )
+{
+ _asm {
+ movq mm0, qword ptr [Value]
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm1.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm1.asm deleted file mode 100644 index 9f81608ed6..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm1.asm +++ /dev/null @@ -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:
-;
-; WriteMm1.Asm
-;
-; Abstract:
-;
-; AsmWriteMm1 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm1 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm1 PROC
- movq mm1, [esp + 4]
- ret
-AsmWriteMm1 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm1.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm1.c new file mode 100644 index 0000000000..53cf0f7176 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm1.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteMm1 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
+AsmWriteMm1 (
+ IN UINT64 Value
+ )
+{
+ _asm {
+ movq mm1, qword ptr [Value]
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm2.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm2.asm deleted file mode 100644 index e882045163..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm2.asm +++ /dev/null @@ -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:
-;
-; WriteMm2.Asm
-;
-; Abstract:
-;
-; AsmWriteMm2 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm2 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm2 PROC
- movq mm2, [esp + 4]
- ret
-AsmWriteMm2 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm2.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm2.c new file mode 100644 index 0000000000..c79fe4870f --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm2.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteMm2 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
+AsmWriteMm2 (
+ IN UINT64 Value
+ )
+{
+ _asm {
+ movq mm2, qword ptr [Value]
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm3.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm3.asm deleted file mode 100644 index c00c328940..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm3.asm +++ /dev/null @@ -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:
-;
-; WriteMm3.Asm
-;
-; Abstract:
-;
-; AsmWriteMm3 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm3 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm3 PROC
- movq mm3, [esp + 4]
- ret
-AsmWriteMm3 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm3.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm3.c new file mode 100644 index 0000000000..f90fbd877e --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm3.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteMm3 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
+AsmWriteMm3 (
+ IN UINT64 Value
+ )
+{
+ _asm {
+ movq mm3, qword ptr [Value]
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm4.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm4.asm deleted file mode 100644 index f12f1e33f5..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm4.asm +++ /dev/null @@ -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:
-;
-; WriteMm4.Asm
-;
-; Abstract:
-;
-; AsmWriteMm4 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm4 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm4 PROC
- movq mm4, [esp + 4]
- ret
-AsmWriteMm4 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm4.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm4.c new file mode 100644 index 0000000000..2651b50230 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm4.c @@ -0,0 +1,27 @@ +/**
+ AsmWriteMm4 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
+AsmWriteMm4 (
+ IN UINT64 Value
+ )
+{
+ _asm {
+ movq mm4, qword ptr [Value]
+ emms
+ }
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm5.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm5.asm deleted file mode 100644 index a6fe8fd7f7..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm5.asm +++ /dev/null @@ -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:
-;
-; WriteMm5.Asm
-;
-; Abstract:
-;
-; AsmWriteMm5 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm5 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm5 PROC
- movq mm5, [esp + 4]
- ret
-AsmWriteMm5 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm5.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm5.c new file mode 100644 index 0000000000..51f7148c89 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm5.c @@ -0,0 +1,27 @@ +/**
+ AsmWriteMm5 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
+AsmWriteMm5 (
+ IN UINT64 Value
+ )
+{
+ _asm {
+ movq mm5, qword ptr [Value]
+ emms
+ }
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm6.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm6.asm deleted file mode 100644 index b8be7e5cdf..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm6.asm +++ /dev/null @@ -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:
-;
-; WriteMm6.Asm
-;
-; Abstract:
-;
-; AsmWriteMm6 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm6 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm6 PROC
- movq mm6, [esp + 4]
- ret
-AsmWriteMm6 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm6.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm6.c new file mode 100644 index 0000000000..d431453cfd --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm6.c @@ -0,0 +1,28 @@ +/**
+ AsmWriteMm6 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
+AsmWriteMm6 (
+ IN UINT64 Value
+ )
+{
+ _asm {
+ movq mm6, qword ptr [Value]
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm7.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm7.asm deleted file mode 100644 index dfce9eb6b2..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm7.asm +++ /dev/null @@ -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:
-;
-; WriteMm7.Asm
-;
-; Abstract:
-;
-; AsmWriteMm7 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586
- .model flat,C
- .mmx
- .code
-
-;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWriteMm7 (
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMm7 PROC
- movq mm7, [esp + 4]
- ret
-AsmWriteMm7 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm7.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm7.c new file mode 100644 index 0000000000..536ffa1d93 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMm7.c @@ -0,0 +1,35 @@ +/*++
+
+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:
+
+ WriteMm7.c
+
+Abstract:
+
+
+--*/
+
+#include "BaseLibInternals.h"
+
+VOID
+EFIAPI
+AsmWriteMm7 (
+ IN UINT64 Value
+ )
+{
+ _asm {
+ movq mm7, qword ptr [Value]
+ emms
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMsr64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMsr64.asm deleted file mode 100644 index 69eaae0937..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMsr64.asm +++ /dev/null @@ -1,42 +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:
-;
-; WriteMsr64.Asm
-;
-; Abstract:
-;
-; AsmWriteMsr64 function
-;
-; Notes:
-;
-;------------------------------------------------------------------------------
-
- .586p
- .model flat,C
- .code
-
-;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmWriteMsr64 (
-; IN UINT32 Index,
-; IN UINT64 Value
-; );
-;------------------------------------------------------------------------------
-AsmWriteMsr64 PROC
- mov edx, [esp + 12]
- mov eax, [esp + 8]
- mov ecx, [esp + 4]
- wrmsr
- ret
-AsmWriteMsr64 ENDP
-
- END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMsr64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMsr64.c new file mode 100644 index 0000000000..8df203cebd --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteMsr64.c @@ -0,0 +1,31 @@ +/**
+ AsmWriteMsr64 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"
+
+UINT64
+EFIAPI
+AsmWriteMsr64 (
+ IN UINT32 Index,
+ IN UINT64 Value
+ )
+{
+ _asm {
+ mov edx, dword ptr [Value + 4]
+ mov eax, dword ptr [Value + 0]
+ mov ecx, Index
+ wrmsr
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessDbr.s b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessDbr.s new file mode 100644 index 0000000000..3f88b69353 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessDbr.s @@ -0,0 +1,117 @@ +/// Copyright (c) 2006, Intel Corporation
+/// All rights reserved. This program and the accompanying materials
+/// are licensed and made available under the terms and conditions of the BSD License
+/// which accompanies this distribution. The full text of the license may be found at
+/// http://opensource.org/licenses/bsd-license.php
+///
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+///
+/// Module Name: AccessDbr.s
+///
+///
+/// IPF specific Debug Breakpoint Registers accessing functions
+///
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadDbr
+//
+// This routine is used to Reads the current value of Data Breakpoint Register (DBR).
+//
+// Arguments :
+//
+// On Entry : The 8-bit DBR index to read.
+//
+// Return Value: The current value of DBR by Index.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadDbr, @function
+.proc AsmReadDbr
+.regstk 1, 0, 0, 0
+
+AsmReadDbr::
+ mov r8 = dbr[in0];;
+ br.ret.dpnt b0;;
+.endp AsmReadDbr
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteDbr
+//
+// This routine is used to write the current value to Data Breakpoint Register (DBR).
+//
+// Arguments :
+//
+// On Entry : The 8-bit DBR index to read.
+// The value should be written to DBR
+//
+// Return Value: The value written to DBR.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteDbr, @function
+.proc AsmWriteDbr
+.regstk 2, 0, 0, 0
+
+AsmWriteDbr::
+ mov dbr[in0] = in1
+ mov r8 = in1;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmWriteDbr
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadIbr
+//
+// This routine is used to Reads the current value of Instruction Breakpoint Register (IBR).
+//
+// Arguments :
+//
+// On Entry : The 8-bit IBR index.
+//
+// Return Value: The current value of IBR by Index.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadIbr, @function
+.proc AsmReadIbr
+.regstk 1, 0, 0, 0
+
+AsmReadIbr::
+ mov r8 = ibr[in0];;
+ br.ret.dpnt b0;;
+.endp AsmReadIbr
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteIbr
+//
+// This routine is used to write the current value to Instruction Breakpoint Register (IBR).
+//
+// Arguments :
+//
+// On Entry : The 8-bit IBR index.
+// The value should be written to IBR
+//
+// Return Value: The value written to IBR.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteIbr, @function
+.proc AsmWriteIbr
+.regstk 2, 0, 0, 0
+
+AsmWriteIbr::
+ mov ibr[in0] = in1
+ mov r8 = in1;;
+ srlz.i;;
+ br.ret.dpnt b0;;
+.endp AsmWriteIbr
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessEicr.s b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessEicr.s new file mode 100644 index 0000000000..64181a5047 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessEicr.s @@ -0,0 +1,511 @@ +/// Copyright (c) 2006, Intel Corporation
+/// All rights reserved. This program and the accompanying materials
+/// are licensed and made available under the terms and conditions of the BSD License
+/// which accompanies this distribution. The full text of the license may be found at
+/// http://opensource.org/licenses/bsd-license.php
+///
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+///
+/// Module Name: AccessEicr.s
+///
+///
+/// IPF specific External Interrupt Control Registers accessing functions
+///
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadLid
+//
+// This routine is used to read the value of Local Interrupt ID Register (LID).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of LID.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadLid, @function
+.proc AsmReadLid
+
+AsmReadLid::
+ mov r8 = cr.lid;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmReadLid
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteLid
+//
+// This routine is used to write the value to Local Interrupt ID Register (LID).
+//
+// Arguments :
+//
+// On Entry : The value need to be written to LID.
+//
+// Return Value: The value written to LID.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteLid, @function
+.proc AsmWriteLid
+.regstk 1, 0, 0, 0
+
+AsmWriteLid::
+ mov cr.lid = in0
+ mov r8 = in0;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmWriteLid
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadIvr
+//
+// This routine is used to read the value of External Interrupt Vector Register (IVR).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of IVR.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadIvr, @function
+.proc AsmReadIvr
+
+AsmReadIvr::
+ mov r8 = cr.ivr;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmReadIvr
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadTpr
+//
+// This routine is used to read the value of Task Priority Register (TPR).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of TPR.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadTpr, @function
+.proc AsmReadTpr
+
+AsmReadTpr::
+ mov r8 = cr.tpr;;
+ br.ret.dpnt b0;;
+.endp AsmReadTpr
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteTpr
+//
+// This routine is used to write the value to Task Priority Register (TPR).
+//
+// Arguments :
+//
+// On Entry : The value need to be written to TPR.
+//
+// Return Value: The value written to TPR.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteTpr, @function
+.proc AsmWriteTpr
+.regstk 1, 0, 0, 0
+
+AsmWriteTpr::
+ mov cr.tpr = in0
+ mov r8 = in0;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmWriteTpr
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteEoi
+//
+// This routine is used to write the value to End of External Interrupt Register (EOI).
+//
+// Arguments :
+//
+// On Entry : The value need to be written to EOI.
+//
+// Return Value: The value written to EOI.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteEoi, @function
+.proc AsmWriteEoi
+
+AsmWriteEoi::
+ mov cr.eoi = r0;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmWriteEoi
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadIrr0
+//
+// This routine is used to Read the value of External Interrupt Request Register 0 (IRR0).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of IRR0.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadIrr0, @function
+.proc AsmReadIrr0
+
+AsmReadIrr0::
+ mov r8 = cr.irr0;;
+ br.ret.dpnt b0;;
+.endp AsmReadIrr0
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadIrr1
+//
+// This routine is used to Read the value of External Interrupt Request Register 1 (IRR1).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of IRR1.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadIrr1, @function
+.proc AsmReadIrr1
+
+AsmReadIrr1::
+ mov r8 = cr.irr1;;
+ br.ret.dpnt b0;;
+.endp AsmReadIrr1
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadIrr2
+//
+// This routine is used to Read the value of External Interrupt Request Register 2 (IRR2).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of IRR2.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadIrr2, @function
+.proc AsmReadIrr2
+
+AsmReadIrr2::
+ mov r8 = cr.irr2;;
+ br.ret.dpnt b0;;
+.endp AsmReadIrr2
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadIrr3
+//
+// This routine is used to Read the value of External Interrupt Request Register 3 (IRR3).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of IRR3.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadIrr3, @function
+.proc AsmReadIrr3
+
+AsmReadIrr3::
+ mov r8 = cr.irr3;;
+ br.ret.dpnt b0;;
+.endp AsmReadIrr3
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadItv
+//
+// This routine is used to Read the value of Interval Timer Vector Register (ITV).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of ITV.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadItv, @function
+.proc AsmReadItv
+
+AsmReadItv::
+ mov r8 = cr.itv;;
+ br.ret.dpnt b0;;
+.endp AsmReadItv
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteItv
+//
+// This routine is used to write the value to Interval Timer Vector Register (ITV).
+//
+// Arguments :
+//
+// On Entry : The value need to be written to ITV
+//
+// Return Value: The value written to ITV.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteItv, @function
+.proc AsmWriteItv
+.regstk 1, 0, 0, 0
+
+AsmWriteItv::
+ mov cr.itv = in0
+ mov r8 = in0;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmWriteItv
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadPmv
+//
+// This routine is used to Read the value of Performance Monitoring Vector Register (PMV).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of PMV.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadPmv, @function
+.proc AsmReadPmv
+
+AsmReadPmv::
+ mov r8 = cr.pmv;;
+ br.ret.dpnt b0;;
+.endp AsmReadPmv
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWritePmv
+//
+// This routine is used to write the value to Performance Monitoring Vector Register (PMV).
+//
+// Arguments :
+//
+// On Entry : The value need to be written to PMV
+//
+// Return Value: The value written to PMV.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWritePmv, @function
+.proc AsmWritePmv
+.regstk 1, 0, 0, 0
+
+AsmWritePmv::
+ mov cr.pmv = in0
+ mov r8 = in0;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmWritePmv
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadCmcv
+//
+// This routine is used to Read the value of Corrected Machine Check Vector Register (CMCV).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of CMCV.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadCmcv, @function
+.proc AsmReadCmcv
+
+AsmReadCmcv::
+ mov r8 = cr.cmcv;;
+ br.ret.dpnt b0;;
+.endp AsmReadCmcv
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteCmcv
+//
+// This routine is used to write the value to Corrected Machine Check Vector Register (CMCV).
+//
+// Arguments :
+//
+// On Entry : The value need to be written to CMCV
+//
+// Return Value: The value written to CMCV.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteCmcv, @function
+.proc AsmWriteCmcv
+.regstk 1, 0, 0, 0
+
+AsmWriteCmcv::
+ mov cr.cmcv = in0
+ mov r8 = in0;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmWriteCmcv
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadLrr0
+//
+// This routine is used to read the value of Local Redirection Register 0 (LRR0).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of LRR0.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadLrr0, @function
+.proc AsmReadLrr0
+
+AsmReadLrr0::
+ mov r8 = cr.lrr0;;
+ br.ret.dpnt b0;;
+.endp AsmReadLrr0
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteLrr0
+//
+// This routine is used to write the value to Local Redirection Register 0 (LRR0).
+//
+// Arguments :
+//
+// On Entry : The value need to be written to LRR0.
+//
+// Return Value: The value written to LRR0.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteLrr0, @function
+.proc AsmWriteLrr0
+.regstk 1, 0, 0, 0
+
+AsmWriteLrr0::
+ mov cr.lrr0 = in0
+ mov r8 = in0;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmWriteLrr0
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadLrr1
+//
+// This routine is used to read the value of Local Redirection Register 1 (LRR1).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of LRR1.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadLrr1, @function
+.proc AsmReadLrr1
+
+AsmReadLrr1::
+ mov r8 = cr.lrr1;;
+ br.ret.dpnt b0;;
+.endp AsmReadLrr1
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteLrr1
+//
+// This routine is used to write the value to Local Redirection Register 1 (LRR1).
+//
+// Arguments :
+//
+// On Entry : The value need to be written to LRR1.
+//
+// Return Value: The value written to LRR1.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteLrr1, @function
+.proc AsmWriteLrr1
+.regstk 1, 0, 0, 0
+
+AsmWriteLrr1::
+ mov cr.lrr1 = in0
+ mov r8 = in0;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmWriteLrr1
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessGcr.s b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessGcr.s new file mode 100644 index 0000000000..a4bec292e0 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessGcr.s @@ -0,0 +1,263 @@ +/// Copyright (c) 2006, Intel Corporation
+/// All rights reserved. This program and the accompanying materials
+/// are licensed and made available under the terms and conditions of the BSD License
+/// which accompanies this distribution. The full text of the license may be found at
+/// http://opensource.org/licenses/bsd-license.php
+///
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+///
+/// Module Name: AccessGcr.s
+///
+///
+/// IPF specific Global Control Registers accessing functions
+///
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadDcr
+//
+// This routine is used to Read the value of Default Control Register (DCR).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of DCR.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadDcr, @function
+.proc AsmReadDcr
+
+AsmReadDcr::
+ mov r8 = cr.dcr;;
+ br.ret.dpnt b0;;
+.endp AsmReadDcr
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteDcr
+//
+// This routine is used to write the value to Default Control Register (DCR).
+//
+// Arguments :
+//
+// On Entry : The value need to be written to DCR
+//
+// Return Value: The value written to DCR.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteDcr, @function
+.proc AsmWriteDcr
+.regstk 1, 0, 0, 0
+
+AsmWriteDcr::
+ mov cr.dcr = in0
+ mov r8 = in0;;
+ srlz.i;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmWriteDcr
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadItc
+//
+// This routine is used to Read the value of Interval Timer Counter Register (ITC).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of ITC.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadItc, @function
+.proc AsmReadItc
+
+AsmReadItc::
+ mov r8 = ar.itc;;
+ br.ret.dpnt b0;;
+.endp AsmReadItc
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteItc
+//
+// This routine is used to write the value to Interval Timer Counter Register (ITC).
+//
+// Arguments :
+//
+// On Entry : The value need to be written to the ITC
+//
+// Return Value: The value written to the ITC.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteItc, @function
+.proc AsmWriteItc
+.regstk 1, 0, 0, 0
+
+AsmWriteItc::
+ mov ar.itc = in0
+ mov r8 = in0;;
+ br.ret.dpnt b0;;
+.endp AsmWriteItc
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadItm
+//
+// This routine is used to Read the value of Interval Timer Match Register (ITM).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of ITM.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadItm, @function
+.proc AsmReadItm
+
+AsmReadItm::
+ mov r8 = cr.itm;;
+ br.ret.dpnt b0;;
+.endp AsmReadItm
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteItm
+//
+// This routine is used to write the value to Interval Timer Match Register (ITM).
+//
+// Arguments :
+//
+// On Entry : The value need to be written to ITM
+//
+// Return Value: The value written to ITM.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteItm, @function
+.proc AsmWriteItm
+.regstk 1, 0, 0, 0
+
+AsmWriteItm::
+ mov cr.itm = in0
+ mov r8 = in0;;
+ srlz.d;
+ br.ret.dpnt b0;;
+.endp AsmWriteItm
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadIva
+//
+// This routine is used to read the value of Interruption Vector Address Register (IVA).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of IVA.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadIva, @function
+.proc AsmReadIva
+
+AsmReadIva::
+ mov r8 = cr.iva;;
+ br.ret.dpnt b0;;
+.endp AsmReadIva
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteIva
+//
+// This routine is used to write the value to Interruption Vector Address Register (IVA).
+//
+// Arguments :
+//
+// On Entry : The value need to be written to IVA
+//
+// Return Value: The value written to IVA.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteIva, @function
+.proc AsmWriteIva
+.regstk 1, 0, 0, 0
+
+AsmWriteIva::
+ mov cr.iva = in0
+ mov r8 = in0;;
+ br.ret.dpnt b0;;
+.endp AsmWriteIva
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadPta
+//
+// This routine is used to read the value of Page Table Address Register (PTA).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current value of PTA.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadPta, @function
+.proc AsmReadPta
+
+AsmReadPta::
+ mov r8 = cr.pta;;
+ br.ret.dpnt b0;;
+.endp AsmReadPta
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWritePta
+//
+// This routine is used to write the value to Page Table Address Register (PTA)).
+//
+// Arguments :
+//
+// On Entry : The value need to be written to PTA
+//
+// Return Value: The value written to PTA.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWritePta, @function
+.proc AsmWritePta
+.regstk 1, 0, 0, 0
+
+AsmWritePta::
+ mov cr.pta = in0
+ mov r8 = in0;;
+ srlz.i;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmWritePta
\ No newline at end of file diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessGp.s b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessGp.s new file mode 100644 index 0000000000..a5b357a849 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessGp.s @@ -0,0 +1,85 @@ +/// Copyright (c) 2006, Intel Corporation
+/// All rights reserved. This program and the accompanying materials
+/// are licensed and made available under the terms and conditions of the BSD License
+/// which accompanies this distribution. The full text of the license may be found at
+/// http://opensource.org/licenses/bsd-license.php
+///
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+///
+/// Module Name: AccessGp.s
+///
+///
+/// IPF specific Global Pointer and Stack Pointer accessing functions
+///
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadGp
+//
+// This routine is used to read the current value of 64-bit Global Pointer (GP).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current GP value.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadGp, @function
+.proc AsmReadGp
+
+AsmReadGp::
+ mov r8 = gp;;
+ br.ret.dpnt b0;;
+.endp AsmReadGp
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteGp
+//
+// This routine is used to write the current value of 64-bit Global Pointer (GP).
+//
+// Arguments :
+//
+// On Entry : The value need to be written.
+//
+// Return Value: The value have been written.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteGp, @function
+.proc AsmWriteGp
+.regstk 1, 0, 0, 0
+
+AsmWriteGp::
+ mov gp = in0
+ mov r8 = in0;;
+ br.ret.dpnt b0;;
+.endp AsmWriteGp
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadSp
+//
+// This routine is used to read the current value of 64-bit Stack Pointer (SP).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current SP value.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadSp, @function
+.proc AsmReadSp
+
+AsmReadSp::
+ mov r8 = sp;;
+ br.ret.dpnt b0;;
+.endp AsmReadSp
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessKr.s b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessKr.s new file mode 100644 index 0000000000..f246ced9a0 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessKr.s @@ -0,0 +1,399 @@ +/// Copyright (c) 2006, Intel Corporation
+/// All rights reserved. This program and the accompanying materials
+/// are licensed and made available under the terms and conditions of the BSD License
+/// which accompanies this distribution. The full text of the license may be found at
+/// http://opensource.org/licenses/bsd-license.php
+///
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+///
+/// Module Name: AccessKr.s
+///
+///
+/// IPF specific AsmReadKrX() and AsmWriteKrX functions, 'X' is from '0' to '7'
+///
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadKr0
+//
+// This routine is used to get KR0.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value store in KR0.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadKr0, @function
+.proc AsmReadKr0
+
+AsmReadKr0::
+ mov r8 = ar.k0;;
+ br.ret.dpnt b0;;
+.endp AsmReadKr0
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteKr0
+//
+// This routine is used to Write KR0.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value written to the KR0.
+//
+//--
+//----------------------------------------------------------------------------------
+
+.text
+.type AsmWriteKr0, @function
+.proc AsmWriteKr0
+.regstk 1, 0, 0, 0
+
+AsmWriteKr0::
+ mov ar.k0 = in0
+ mov r8 = in0;;
+ br.ret.dpnt b0;;
+.endp AsmWriteKr0
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadKr1
+//
+// This routine is used to get KR1.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value store in KR1.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadKr1, @function
+.proc AsmReadKr1
+
+AsmReadKr1::
+ mov r8 = ar.k1;;
+ br.ret.dpnt b0;;
+.endp AsmReadKr1
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteKr1
+//
+// This routine is used to Write KR1.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value written to the KR1.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteKr1, @function
+.proc AsmWriteKr1
+
+AsmWriteKr1::
+ mov ar.k1 = in0
+ mov r8 = in0;;
+ br.ret.dpnt b0;;
+.endp AsmWriteKr1
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadKr2
+//
+// This routine is used to get KR2.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value store in KR2.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadKr2, @function
+.proc AsmReadKr2
+
+AsmReadKr2::
+ mov r8 = ar.k2;;
+ br.ret.dpnt b0;;
+.endp AsmReadKr2
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteKr2
+//
+// This routine is used to Write KR2.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value written to the KR2.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteKr2, @function
+.proc AsmWriteKr2
+
+AsmWriteKr2::
+ mov ar.k2 = in0
+ mov r8 = in0;;
+ br.ret.dpnt b0;;
+.endp AsmWriteKr2
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadKr3
+//
+// This routine is used to get KR3.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value store in KR3.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadKr3, @function
+.proc AsmReadKr3
+
+AsmReadKr3::
+ mov r8 = ar.k3;;
+ br.ret.dpnt b0;;
+.endp AsmReadKr3
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteKr3
+//
+// This routine is used to Write KR3.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value written to the KR3.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteKr3, @function
+.proc AsmWriteKr3
+
+AsmWriteKr3::
+ mov ar.k3 = in0
+ mov r8 = in0;;
+ br.ret.dpnt b0;;
+.endp AsmWriteKr3
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadKr4
+//
+// This routine is used to get KR4.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value store in KR4.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadKr4, @function
+.proc AsmReadKr4
+
+AsmReadKr4::
+ mov r8 = ar.k4;;
+ br.ret.dpnt b0;;
+.endp AsmReadKr4
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteKr4
+//
+// This routine is used to Write KR4.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value written to the KR4.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteKr4, @function
+.proc AsmWriteKr4
+
+AsmWriteKr4::
+ mov ar.k4 = in0
+ mov r8 = in0;;
+ br.ret.dpnt b0;;
+.endp AsmWriteKr4
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadKr5
+//
+// This routine is used to get KR5.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value store in KR5.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadKr5, @function
+.proc AsmReadKr5
+
+AsmReadKr5::
+ mov r8 = ar.k5;;
+ br.ret.dpnt b0;;
+.endp AsmReadKr5
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteKr5
+//
+// This routine is used to Write KR5.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value written to the KR5.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteKr5, @function
+.proc AsmWriteKr5
+
+AsmWriteKr5::
+ mov ar.k5 = in0
+ mov r8 = in0;;
+ br.ret.dpnt b0;;
+.endp AsmWriteKr5
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadKr6
+//
+// This routine is used to get KR6.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value store in KR6.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadKr6, @function
+.proc AsmReadKr6
+
+AsmReadKr6::
+ mov r8 = ar.k6;;
+ br.ret.dpnt b0;;
+.endp AsmReadKr6
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteKr6
+//
+// This routine is used to write KR6.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value written to the KR6.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteKr6, @function
+.proc AsmWriteKr6
+
+AsmWriteKr6::
+ mov ar.k6 = in0
+ mov r8 = in0;;
+ br.ret.dpnt b0;;
+.endp AsmWriteKr6
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadKr7
+//
+// This routine is used to get KR7.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value store in KR7.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadKr7, @function
+.proc AsmReadKr7
+
+AsmReadKr7::
+ mov r8 = ar.k7;;
+ br.ret.dpnt b0;;
+.endp AsmReadKr7
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWriteKr7
+//
+// This routine is used to write KR7.
+//
+// Arguments :
+//
+// On Entry : None.
+//
+// Return Value: The value written to the KR7.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWriteKr7, @function
+.proc AsmWriteKr7
+
+AsmWriteKr7::
+ mov ar.k7 = in0
+ mov r8 = in0;;
+ br.ret.dpnt b0;;
+.endp AsmWriteKr7
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessPmr.s b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessPmr.s new file mode 100644 index 0000000000..39880cbf4d --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessPmr.s @@ -0,0 +1,123 @@ +/// Copyright (c) 2006, Intel Corporation
+/// All rights reserved. This program and the accompanying materials
+/// are licensed and made available under the terms and conditions of the BSD License
+/// which accompanies this distribution. The full text of the license may be found at
+/// http://opensource.org/licenses/bsd-license.php
+///
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+///
+/// Module Name: AccessPmr.s
+///
+///
+/// IPF specific Performance Monitor Configuration/Data Registers accessing functions
+///
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadPmc
+//
+// This routine is used to Reads the current value of Performance Monitor Configuration Register (PMC).
+//
+// Arguments :
+//
+// On Entry : The 8-bit PMC index.
+//
+// Return Value: The current value of PMC by Index.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadPmc, @function
+.proc AsmReadPmc
+.regstk 1, 0, 0, 0
+
+AsmReadPmc::
+ srlz.i;;
+ srlz.d;;
+ mov r8 = pmc[in0];;
+ br.ret.dpnt b0;;
+.endp AsmReadPmc
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWritePmc
+//
+// This routine is used to write the current value to a Performance Monitor Configuration Register (PMC).
+//
+// Arguments :
+//
+// On Entry : The 8-bit PMC index.
+// The value should be written to PMC
+//
+// Return Value: The value written to PMC.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWritePmc, @function
+.proc AsmWritePmc
+.regstk 2, 0, 0, 0
+
+AsmWritePmc::
+ mov pmc[in0] = in1
+ mov r8 = in1;;
+ srlz.i;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmWritePmc
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadPmd
+//
+// This routine is used to Reads the current value of Performance Monitor Data Register (PMD).
+//
+// Arguments :
+//
+// On Entry : The 8-bit PMD index.
+//
+// Return Value: The current value of PMD by Index.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadPmd, @function
+.proc AsmReadPmd
+.regstk 1, 0, 0, 0
+
+AsmReadPmd::
+ srlz.i;;
+ srlz.d;;
+ mov r8 = pmd[in0];;
+ br.ret.dpnt b0;;
+.endp AsmReadPmd
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWritePmd
+//
+// This routine is used to write the current value to Performance Monitor Data Register (PMD).
+//
+// Arguments :
+//
+// On Entry : The 8-bit PMD index.
+// The value should be written to PMD
+//
+// Return Value: The value written to PMD.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWritePmd, @function
+.proc AsmWritePmd
+.regstk 2, 0, 0, 0
+
+AsmWritePmd::
+ mov pmd[in0] = in1
+ mov r8 = in1;;
+ srlz.i;;
+ srlz.d;;
+ br.ret.dpnt b0;;
+.endp AsmWritePmd
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessPsr.s b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessPsr.s new file mode 100644 index 0000000000..6ef803397e --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AccessPsr.s @@ -0,0 +1,109 @@ +/// Copyright (c) 2006, Intel Corporation
+/// All rights reserved. This program and the accompanying materials
+/// are licensed and made available under the terms and conditions of the BSD License
+/// which accompanies this distribution. The full text of the license may be found at
+/// http://opensource.org/licenses/bsd-license.php
+///
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+///
+/// Module Name: AccessPsr.s
+///
+///
+/// IPF specific Processor Status Register accessing functions
+///
+
+#define CpuModeMask 0x0000001008020000
+
+#define CpuInVirtualMode 0x1
+#define CpuInPhysicalMode 0x0
+#define CpuInMixMode (0x0 - 0x1)
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadPsr
+//
+// This routine is used to read the current value of Processor Status Register (PSR).
+//
+// Arguments :
+//
+// On Entry :
+//
+// Return Value: The current PSR value.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadPsr, @function
+.proc AsmReadPsr
+
+AsmReadPsr::
+ mov r8 = psr;;
+ br.ret.dpnt b0;;
+.endp AsmReadPsr
+
+//---------------------------------------------------------------------------------
+//++
+// AsmWritePsr
+//
+// This routine is used to write the value of Processor Status Register (PSR).
+//
+// Arguments :
+//
+// On Entry : The value need to be written.
+//
+// Return Value: The value have been written.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmWritePsr, @function
+.proc AsmWritePsr
+.regstk 1, 0, 0, 0
+
+AsmWritePsr::
+ mov psr.l = in0
+ mov r8 = in0;;
+ srlz.d;;
+ srlz.i;;
+ br.ret.dpnt b0;;
+.endp AsmWritePsr
+
+//---------------------------------------------------------------------------------
+//++
+// AsmCpuVirtual
+//
+// This routine is used to determines if the CPU is currently executing
+// in virtual, physical, or mixed mode.
+//
+// If the CPU is in virtual mode(PSR.RT=1, PSR.DT=1, PSR.IT=1), then 1 is returned.
+// If the CPU is in physical mode(PSR.RT=0, PSR.DT=0, PSR.IT=0), then 0 is returned.
+// If the CPU is not in physical mode or virtual mode, then it is in mixed mode,
+// and -1 is returned.
+//
+// Arguments:
+//
+// On Entry: None
+//
+// Return Value: The CPU mode flag
+// return 1 The CPU is in virtual mode.
+// return 0 The CPU is in physical mode.
+// return -1 The CPU is in mixed mode.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmCpuVirtual, @function
+.proc AsmCpuVirtual
+
+AsmCpuVirtual::
+ mov r29 = psr
+ movl r30 = CpuModeMask;;
+ and r28 = r30, r29;;
+ cmp.eq p6, p7 = r30, r28;;
+(p6) mov r8 = CpuInVirtualMode;;
+(p7) cmp.eq p6, p7 = 0x0, r28;;
+(p6) mov r8 = CpuInPhysicalMode;;
+(p7) mov r8 = CpuInMixMode;;
+ br.ret.dpnt b0;;
+.endp AsmCpuVirtual
\ No newline at end of file diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AsmPalCall.s b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AsmPalCall.s new file mode 100644 index 0000000000..95df2a63b5 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/AsmPalCall.s @@ -0,0 +1,158 @@ +/// Copyright (c) 2006, Intel Corporation
+/// All rights reserved. This program and the accompanying materials
+/// are licensed and made available under the terms and conditions of the BSD License
+/// which accompanies this distribution. The full text of the license may be found at
+/// http://opensource.org/licenses/bsd-license.php
+///
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+///
+/// Module Name: AsmPalCall.s
+///
+///
+/// Contains an implementation of CallPalProcStacked on Itanium-based
+/// architecture.
+///
+
+
+
+//-----------------------------------------------------------------------------
+//++
+// AsmPalCall
+//
+// Makes a PAL procedure call.
+// This is function to make a PAL procedure call. Based on the Index
+// value this API will make static or stacked PAL call. The following table
+// describes the usage of PAL Procedure Index Assignment. Architected procedures
+// may be designated as required or optional. If a PAL procedure is specified
+// as optional, a unique return code of 0xFFFFFFFFFFFFFFFF is returned in the
+// Status field of the PAL_CALL_RETURN structure.
+// This indicates that the procedure is not present in this PAL implementation.
+// It is the caller¡¯s responsibility to check for this return code after calling
+// any optional PAL procedure.
+// No parameter checking is performed on the 5 input parameters, but there are
+// some common rules that the caller should follow when making a PAL call. Any
+// address passed to PAL as buffers for return parameters must be 8-byte aligned.
+// Unaligned addresses may cause undefined results. For those parameters defined
+// as reserved or some fields defined as reserved must be zero filled or the invalid
+// argument return value may be returned or undefined result may occur during the
+// execution of the procedure. If the PalEntryPoint does not point to a valid
+// PAL entry point then the system behavior is undefined. This function is only
+// available on IPF.
+//
+// On Entry :
+// in0: PAL_PROC entrypoint
+// in1-in4 : PAL_PROC arguments
+//
+// Return Value:
+//
+// As per stacked calling conventions.
+//
+//--
+//---------------------------------------------------------------------------
+
+//
+// PAL function calls
+//
+#define PAL_MC_CLEAR_LOG 0x0015
+#define PAL_MC_DYNAMIC_STATE 0x0018
+#define PAL_MC_ERROR_INFO 0x0019
+#define PAL_MC_RESUME 0x001a
+
+
+.text
+.proc AsmPalCall
+.type AsmPalCall, @function
+
+AsmPalCall::
+ alloc loc1 = ar.pfs,5,8,4,0
+ mov loc0 = b0
+ mov loc3 = b5
+ mov loc4 = r2
+ mov loc7 = r1
+ mov r2 = psr;;
+ mov r28 = in1
+ mov loc5 = r2;;
+
+ movl loc6 = 0x100;;
+ cmp.ge p6,p7 = r28,loc6;;
+
+(p6) movl loc6 = 0x1FF;;
+(p7) br.dpnt.few PalCallStatic;; // 0 ~ 255 make a static Pal Call
+(p6) cmp.le p6,p7 = r28,loc6;;
+(p6) br.dpnt.few PalCallStacked;; // 256 ~ 511 make a stacked Pal Call
+(p7) movl loc6 = 0x300;;
+(p7) cmp.ge p6,p7 = r28,loc6;;
+(p7) br.dpnt.few PalCallStatic;; // 512 ~ 767 make a static Pal Call
+(p6) movl loc6 = 0x3FF;;
+(p6) cmp.le p6,p7 = r28,loc6;;
+(p6) br.dpnt.few PalCallStacked;; // 768 ~ 1023 make a stacked Pal Call
+
+(p7) mov r8 = 0xFFFFFFFFFFFFFFFF;; // > 1024 return invalid
+(p7) br.dpnt.few ComeBackFromPALCall;;
+
+PalCallStatic:
+ movl loc6 = PAL_MC_CLEAR_LOG;;
+ cmp.eq p6,p7 = r28,loc6;;
+
+(p7) movl loc6 = PAL_MC_DYNAMIC_STATE;;
+(p7) cmp.eq p6,p7 = r28,loc6;;
+
+(p7) movl loc6 = PAL_MC_ERROR_INFO;;
+(p7) cmp.eq p6,p7 = r28,loc6;;
+
+(p7) movl loc6 = PAL_MC_RESUME;;
+(p7) cmp.eq p6,p7 = r28,loc6 ;;
+
+ mov loc6 = 0x1;;
+(p7) dep r2 = loc6,r2,13,1;; // psr.ic = 1
+
+// p6 will be true, if it is one of the MCHK calls. There has been lots of debate
+// on psr.ic for these values. For now, do not do any thing to psr.ic
+
+ dep r2 = r0,r2,14,1;; // psr.i = 0
+
+ mov psr.l = r2
+ srlz.d // Needs data serailization.
+ srlz.i // Needs instruction serailization.
+
+StaticGetPALLocalIP:
+ mov loc2 = ip;;
+ add loc2 = ComeBackFromPALCall - StaticGetPALLocalIP,loc2;;
+ mov b0 = loc2 // return address after Pal call
+
+ mov r29 = in2
+ mov r30 = in3
+ mov r31 = in4
+ mov b5 = in0;; // get the PalProcEntrypt from input
+ br.sptk b5;; // Take the plunge.
+
+PalCallStacked:
+ dep r2 = r0,r2,14,1;; // psr.i = 0
+ mov psr.l = r2;;
+ srlz.d // Needs data serailization.
+ srlz.i // Needs instruction serailization.
+
+StackedGetPALLocalIP:
+ mov out0 = in1
+ mov out1 = in2
+ mov out2 = in3
+ mov out3 = in4
+ mov b5 = in0 ;; // get the PalProcEntrypt from input
+ br.call.dpnt b0 = b5 ;; // Take the plunge.
+
+ComeBackFromPALCall:
+ mov psr.l = loc5 ;;
+ srlz.d // Needs data serailization.
+ srlz.i // Needs instruction serailization.
+
+ mov b5 = loc3
+ mov r2 = loc4
+ mov r1 = loc7
+
+ mov b0 = loc0
+ mov ar.pfs = loc1;;
+ br.ret.dpnt b0;;
+
+.endp AsmPalCall
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/CpuBreakpoint.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/CpuBreakpoint.c index 237ca21992..67d10807f8 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/CpuBreakpoint.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/CpuBreakpoint.c @@ -18,7 +18,7 @@ Abstract: --*/
-#include "..\BaseLibInternal.h"
+#include "BaseLibInternals.h"
//void __mfa (void);
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/ExecFc.s b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/ExecFc.s new file mode 100644 index 0000000000..3b49604b14 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/ExecFc.s @@ -0,0 +1,66 @@ +/// Copyright (c) 2006, Intel Corporation
+/// All rights reserved. This program and the accompanying materials
+/// are licensed and made available under the terms and conditions of the BSD License
+/// which accompanies this distribution. The full text of the license may be found at
+/// http://opensource.org/licenses/bsd-license.php
+///
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+///
+/// Module Name: ExecFc.s
+///
+///
+/// IPF specific AsmFc() and AsmFci () functions
+///
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmFc
+//
+// This routine is used to execute a FC instruction on the specific address.
+//
+// Arguments :
+//
+// On Entry : The specific address need to execute FC instruction.
+//
+// Return Value: The specific address have been execute FC instruction.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmFc, @function
+.proc AsmFc
+.regstk 1, 0, 0, 0
+
+AsmFc::
+ fc in0
+ mov r8 = in0;;
+ br.ret.dpnt b0;;
+.endp AsmFc
+
+
+//---------------------------------------------------------------------------------
+//++
+// AsmFci
+//
+// This routine is used to execute a FC.i instruction on the specific address.
+//
+// Arguments :
+//
+// On Entry : The specific address need to execute FC.i instruction.
+//
+// Return Value: The specific address have been execute FC.i instruction.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmFci, @function
+.proc AsmFci
+.regstk 1, 0, 0, 0
+
+AsmFci::
+ fc.i in0
+ mov r8 = in0;;
+ br.ret.dpnt b0;;
+.endp AsmFci
\ No newline at end of file diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/InternalSwitchStack.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/InternalSwitchStack.c new file mode 100644 index 0000000000..9d0a915248 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/InternalSwitchStack.c @@ -0,0 +1,68 @@ +/**
+ SwitchStack() function for IPF.
+
+ 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: InternalSwitchStack.c
+
+**/
+
+#include <BaseLibInternals.h>
+
+/**
+ Transfers control to a function starting with a new stack.
+
+ Transfers control to the function specified by EntryPoint using the
+ new stack specified by NewStack and passing in the parameters specified
+ by Context1 and Context2. Context1 and Context2 are optional and may
+ be NULL. The function EntryPoint must never return.
+ 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 Context1 A pointer to the context to pass into the EntryPoint
+ function.
+ @param Context2 A pointer to the context to pass into the EntryPoint
+ function.
+ @param NewStack A pointer to the new stack to use for the EntryPoint
+ function.
+ @param Marker VA_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+InternalSwitchStack (
+ IN SWITCH_STACK_ENTRY_POINT EntryPoint,
+ IN VOID *Context1, OPTIONAL
+ IN VOID *Context2, OPTIONAL
+ IN VOID *NewStack,
+ IN VA_LIST Marker
+ )
+
+{
+ VOID *NewBsp;
+
+ //
+ // Get new backing store pointer from variable list
+ //
+ NewBsp = VA_ARG (Marker, VOID *);
+
+ //
+ // Stack should be aligned with CPU_STACK_ALIGNMENT
+ //
+ ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
+ ASSERT (((UINTN)NewBsp & (CPU_STACK_ALIGNMENT - 1)) == 0);
+
+ AsmSwitchStackAndBackingStore (EntryPoint, Context1, Context2, NewStack, NewBsp);
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/Non-existing.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/Non-existing.c deleted file mode 100644 index 47f2f5ab3e..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/Non-existing.c +++ /dev/null @@ -1,58 +0,0 @@ -/*++
-
-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:
-
- Non-existing.c
-
-Abstract:
-
---*/
-
-#include "..\BaseLibInternal.h"
-
-/**
- Transfers control to a function starting with a new stack.
-
- Transfers control to the function specified by EntryPoint using the new stack
- specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
-
- If EntryPoint is NULL, then ASSERT().
- If NewStack is NULL, then ASSERT().
-
- @param EntryPoint A pointer to function to call with the new stack.
- @param Context1 A pointer to the context to pass into the EntryPoint
- function.
- @param Context2 A pointer to the context to pass into the EntryPoint
- function.
- @param NewStack A pointer to the new stack to use for the EntryPoint
- function.
-
-**/
-VOID
-EFIAPI
-InternalSwitchStack (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *NewStack
- )
-{
- //
- // This version of this function does not actually change the stack pointer
- // This is to support compilation of CPU types that do not support assemblers
- // such as EBC
- //
- ASSERT (FALSE);
-}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/ReadCpuid.s b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/ReadCpuid.s new file mode 100644 index 0000000000..9e958306d8 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/ReadCpuid.s @@ -0,0 +1,39 @@ +/// Copyright (c) 2006, Intel Corporation
+/// All rights reserved. This program and the accompanying materials
+/// are licensed and made available under the terms and conditions of the BSD License
+/// which accompanies this distribution. The full text of the license may be found at
+/// http://opensource.org/licenses/bsd-license.php
+///
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+///
+/// Module Name: ReadCpuid.s
+///
+///
+/// IPF specific AsmReadCpuid()function
+///
+
+//---------------------------------------------------------------------------------
+//++
+// AsmReadCpuid
+//
+// This routine is used to Reads the current value of Processor Identifier Register (CPUID).
+//
+// Arguments :
+//
+// On Entry : The 8-bit Processor Identifier Register index to read.
+//
+// Return Value: The current value of Processor Identifier Register specified by Index.
+//
+//--
+//----------------------------------------------------------------------------------
+.text
+.type AsmReadCpuid, @function
+.proc AsmReadCpuid
+.regstk 1, 0, 0, 0
+
+AsmReadCpuid::
+ mov r8 = cpuid[in0];;
+ br.ret.dpnt b0;;
+.endp AsmReadCpuid
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/ReadItc.s b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/ReadItc.s deleted file mode 100644 index 473c82ec34..0000000000 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/ReadItc.s +++ /dev/null @@ -1,26 +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:
-///
-/// ReadItc.s
-///
-/// Abstract:
-///
-///
-
-.auto
-.text
-
-.proc IpfReadItc
-.type IpfReadItc, @function
-IpfReadItc::
- mov r8 = ar.itc
- br.ret.sptk.many b0
-.endp IpfReadItc
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/Synchronization.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/Synchronization.c index e1bc578ad1..619cc01a6b 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/Synchronization.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/Synchronization.c @@ -18,7 +18,7 @@ Abstract: --*/
-#include "..\BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Performs an atomic increment of an 32-bit unsigned integer.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/Unaligned.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/Unaligned.c index bcb3bb806b..e18ca51580 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/Unaligned.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/Unaligned.c @@ -18,7 +18,7 @@ Abstract: --*/
-#include "..\BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Reads a 16-bit value from memory that may be unaligned.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LRotU32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LRotU32.c index 81ba6e0917..2a1d6545d6 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LRotU32.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LRotU32.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Rotates a 32-bit integer left between 0 and 31 bits, filling the low bits
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LRotU64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LRotU64.c index ba919b2f55..64efcee051 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LRotU64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LRotU64.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Rotates a 64-bit integer left between 0 and 63 bits, filling the low bits
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LShiftU64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LShiftU64.c index 163fb30895..6785c5210e 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LShiftU64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LShiftU64.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LinkedList.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LinkedList.c index 6c680d6863..8bd4409e14 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LinkedList.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LinkedList.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Worker function that locates the Node in the List
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LongJump.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LongJump.c index 7ca6ab9b30..c8eaa8402b 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LongJump.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LongJump.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Restores the CPU context that was saved with SetJump().
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LowBitSet32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LowBitSet32.c index eb032152ca..87d9d830e8 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LowBitSet32.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LowBitSet32.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Returns the bit position of the lowest bit set in a 32-bit value.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LowBitSet64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LowBitSet64.c index 1330c7301b..589b3874f0 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LowBitSet64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/LowBitSet64.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Returns the bit position of the lowest bit set in a 64-bit value.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Math64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Math64.c index 9ca5e0f876..02869ef3ea 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Math64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Math64.c @@ -21,7 +21,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Shifts a 64-bit integer left between 0 and 63 bits. The low bits
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/ModU64x32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/ModU64x32.c index 22824f2269..0f3263b87b 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/ModU64x32.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/ModU64x32.c @@ -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
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/MultS64x64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/MultS64x64.c index 780bfe53b2..62e0574def 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/MultS64x64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/MultS64x64.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Multiples a 64-bit signed integer by a 64-bit signed integer and generates a
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/MultU64x32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/MultU64x32.c index f9f3a28e95..acc552c53c 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/MultU64x32.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/MultU64x32.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Multiples a 64-bit unsigned integer by a 32-bit unsigned integer and
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/MultU64x64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/MultU64x64.c index c8888bc1fd..a8bf0f5efa 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/MultU64x64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/MultU64x64.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Multiples a 64-bit unsigned integer by a 64-bit unsigned integer and
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/RRotU32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/RRotU32.c index a68df78900..1fd4d7b3b5 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/RRotU32.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/RRotU32.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Rotates a 32-bit integer right between 0 and 31 bits, filling the high bits
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/RRotU64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/RRotU64.c index 18b2482e3c..430dfaae4a 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/RRotU64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/RRotU64.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Rotates a 64-bit integer right between 0 and 63 bits, filling the high bits
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/RShiftU64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/RShiftU64.c index ee29680c9b..4ef959f61c 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/RShiftU64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/RShiftU64.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Shifts a 64-bit integer right between 0 and 63 bits. This high bits are
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SetJump.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SetJump.c index b1bf185816..29abdf45ce 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SetJump.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SetJump.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Worker function that checks ASSERT condition for JumpBuffer
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/String.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/String.c index 033092323c..62d9a553ce 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/String.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/String.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Copies one Null-terminated Unicode string to another Null-terminated Unicode
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwapBytes16.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwapBytes16.c index 890369ed29..3aba030b95 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwapBytes16.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwapBytes16.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Switches the endianess of a 16-bit integer.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwapBytes32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwapBytes32.c index 59b4659663..5ce87e8857 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwapBytes32.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwapBytes32.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Switches the endianess of a 32-bit integer.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwapBytes64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwapBytes64.c index bd402d39e8..bce531a2e4 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwapBytes64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwapBytes64.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Switches the endianess of a 64-bit integer.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwitchStack.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwitchStack.c index 82a19ebdee..a9a34228f2 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwitchStack.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwitchStack.c @@ -20,19 +20,22 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack
- specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
+ new stack specified by NewStack and passing in the parameters specified
+ by Context1 and Context2. Context1 and Context2 are optional and may
+ be NULL. The function EntryPoint must never return. This function
+ supports a variable number of arguments following the NewStack parameter.
+ These additional arguments are 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().
- For IPF CPUs, if NewStack is not aligned on a 16-byte boundary, then ASSERT().
@param EntryPoint A pointer to function to call with the new stack.
@param Context1 A pointer to the context to pass into the EntryPoint
@@ -47,16 +50,23 @@ VOID EFIAPI
SwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1,
- IN VOID *Context2,
- IN VOID *NewStack
+ IN VOID *Context1, OPTIONAL
+ IN VOID *Context2, OPTIONAL
+ IN VOID *NewStack,
+ ...
)
{
- ASSERT (EntryPoint != NULL && NewStack != NULL);
+ VA_LIST Marker;
-#ifdef MDE_CPU_IPF
- ASSERT (((UINTN)NewStack & 0xf) == 0);
-#endif
+ ASSERT (EntryPoint != NULL);
+ ASSERT (NewStack != NULL);
- InternalSwitchStack (EntryPoint, Context1, Context2, NewStack);
+ VA_START (Marker, NewStack);
+
+ InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker);
+
+ //
+ // InternalSwitchStack () will never return
+ //
+ ASSERT (FALSE);
}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Synchronization.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Synchronization.c index 9165b867c5..809299cb06 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Synchronization.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Synchronization.c @@ -20,10 +20,10 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
-#define SPIN_LOCK_RELEASED ((SPIN_LOCK)1)
-#define SPIN_LOCK_ACQUIRED ((SPIN_LOCK)2)
+#define SPIN_LOCK_RELEASED ((UINTN) 1)
+#define SPIN_LOCK_ACQUIRED ((UINTN) 2)
/**
Retrieves the architecture specific spin lock alignment requirements for
@@ -157,7 +157,7 @@ AcquireSpinLockOrFail ( IN OUT SPIN_LOCK *SpinLock
)
{
- volatile SPIN_LOCK LockValue;
+ SPIN_LOCK LockValue;
ASSERT (SpinLock != NULL);
@@ -193,7 +193,7 @@ ReleaseSpinLock ( IN OUT SPIN_LOCK *SpinLock
)
{
- volatile SPIN_LOCK LockValue;
+ SPIN_LOCK LockValue;
ASSERT (SpinLock != NULL);
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SynchronizationMsc.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SynchronizationMsc.c new file mode 100644 index 0000000000..11cb5e6480 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SynchronizationMsc.c @@ -0,0 +1,375 @@ +/**
+ Implementation of synchronization 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.
+
+ Module Name: SynchronizationMsc.c
+
+**/
+
+#include "BaseLibInternals.h"
+
+//
+// Microsoft Visual Studio 7.1 Function Prototypes for read write barrier Intrinsics
+//
+void _ReadWriteBarrier (void);
+#pragma intrinsic(_ReadWriteBarrier)
+
+
+#define SPIN_LOCK_RELEASED ((UINTN) 1)
+#define SPIN_LOCK_ACQUIRED ((UINTN) 2)
+
+/**
+ Retrieves the architecture specific spin lock alignment requirements for
+ optimal spin lock performance.
+
+ This function retrieves the spin lock alignment requirements for optimal
+ performance on a given CPU architecture. The spin lock alignment must be a
+ power of two and is returned by this function. If there are no alignment
+ requirements, then 1 must be returned. The spin lock synchronization
+ functions must function correctly if the spin lock size and alignment values
+ returned by this function are not used at all. These values are hints to the
+ consumers of the spin lock synchronization functions to obtain optimal spin
+ lock performance.
+
+ @return The architecture specific spin lock alignment.
+
+**/
+UINTN
+EFIAPI
+GetSpinLockProperties (
+ VOID
+ )
+{
+ // @bug May use a PCD entry to determine this alignment.
+ return 32;
+}
+
+/**
+ Initializes a spin lock to the released state and returns the spin lock.
+
+ This function initializes the spin lock specified by SpinLock to the released
+ state, and returns SpinLock. Optimal performance can be achieved by calling
+ GetSpinLockProperties() to determine the size and alignment requirements for
+ SpinLock.
+
+ If SpinLock is NULL, then ASSERT().
+
+ @param SpinLock A pointer to the spin lock to initialize to the released
+ state.
+
+ @return SpinLock
+
+**/
+SPIN_LOCK *
+EFIAPI
+InitializeSpinLock (
+ OUT SPIN_LOCK *SpinLock
+ )
+{
+ ASSERT (SpinLock != NULL);
+
+ _ReadWriteBarrier();
+ *SpinLock = SPIN_LOCK_RELEASED;
+ _ReadWriteBarrier();
+
+ return SpinLock;
+}
+
+/**
+ Waits until a spin lock can be placed in the acquired state.
+
+ This function checks the state of the spin lock specified by SpinLock. If
+ SpinLock is in the released state, then this function places SpinLock in the
+ acquired state and returns SpinLock. Otherwise, this function waits
+ indefinitely for the spin lock to be released, and then places it in the
+ acquired state and returns SpinLock. All state transitions of SpinLock must
+ be performed using MP safe mechanisms.
+
+ If SpinLock is NULL, then ASSERT().
+ If SpinLock was not initialized with InitializeSpinLock(), then ASSERT().
+ If PcdSpinLockTimeout is not zero, and SpinLock is can not be acquired in
+ PcdSpinLockTimeout microseconds, then ASSERT().
+
+ @param SpinLock A pointer to the spin lock to place in the acquired state.
+
+ @return SpinLock
+
+**/
+SPIN_LOCK *
+EFIAPI
+AcquireSpinLock (
+ IN OUT SPIN_LOCK *SpinLock
+ )
+{
+ UINT64 Tick;
+ UINT64 Start, End;
+ UINT64 Timeout;
+
+ Tick = 0;
+ Start = 0;
+ End = 0;
+ if (PcdGet32 (PcdSpinLockTimeout) > 0) {
+ Tick = GetPerformanceCounter ();
+ Timeout = DivU64x32 (
+ MultU64x32 (
+ GetPerformanceCounterProperties (&Start, &End),
+ PcdGet32 (PcdSpinLockTimeout)
+ ),
+ 1000000
+ );
+ if (Start < End) {
+ Tick += Timeout;
+ } else {
+ Tick -= Timeout;
+ }
+ }
+
+ while (!AcquireSpinLockOrFail (SpinLock)) {
+ CpuPause ();
+ ASSERT ((Start < End) ^ (Tick <= GetPerformanceCounter ()));
+ }
+ return SpinLock;
+}
+
+/**
+ Attempts to place a spin lock in the acquired state.
+
+ This function checks the state of the spin lock specified by SpinLock. If
+ SpinLock is in the released state, then this function places SpinLock in the
+ acquired state and returns TRUE. Otherwise, FALSE is returned. All state
+ transitions of SpinLock must be performed using MP safe mechanisms.
+
+ If SpinLock is NULL, then ASSERT().
+ If SpinLock was not initialized with InitializeSpinLock(), then ASSERT().
+
+ @param SpinLock A pointer to the spin lock to place in the acquired state.
+
+ @retval TRUE SpinLock was placed in the acquired state.
+ @retval FALSE SpinLock could not be acquired.
+
+**/
+BOOLEAN
+EFIAPI
+AcquireSpinLockOrFail (
+ IN OUT SPIN_LOCK *SpinLock
+ )
+{
+ SPIN_LOCK LockValue;
+ VOID *Result;
+
+ ASSERT (SpinLock != NULL);
+
+ LockValue = *SpinLock;
+ ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED);
+
+ _ReadWriteBarrier ();
+ Result = InterlockedCompareExchangePointer (
+ (VOID**)SpinLock,
+ (VOID*)SPIN_LOCK_RELEASED,
+ (VOID*)SPIN_LOCK_ACQUIRED
+ );
+
+ _ReadWriteBarrier ();
+ return (BOOLEAN) (Result == (VOID*) SPIN_LOCK_RELEASED);
+}
+
+/**
+ Releases a spin lock.
+
+ This function places the spin lock specified by SpinLock in the release state
+ and returns SpinLock.
+
+ If SpinLock is NULL, then ASSERT().
+ If SpinLock was not initialized with InitializeSpinLock(), then ASSERT().
+
+ @param SpinLock A pointer to the spin lock to release.
+
+ @return SpinLock
+
+**/
+SPIN_LOCK *
+EFIAPI
+ReleaseSpinLock (
+ IN OUT SPIN_LOCK *SpinLock
+ )
+{
+ SPIN_LOCK LockValue;
+
+ ASSERT (SpinLock != NULL);
+
+ LockValue = *SpinLock;
+ ASSERT (LockValue == SPIN_LOCK_ACQUIRED || LockValue == SPIN_LOCK_RELEASED);
+
+ _ReadWriteBarrier ();
+ *SpinLock = SPIN_LOCK_RELEASED;
+ _ReadWriteBarrier ();
+
+ return SpinLock;
+}
+
+/**
+ 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.
+
+ If Value is NULL, then ASSERT().
+
+ @param Value A pointer to the 32-bit value to increment.
+
+ @return The incremented value.
+
+**/
+UINT32
+EFIAPI
+InterlockedIncrement (
+ IN UINT32 *Value
+ )
+{
+ ASSERT (Value != NULL);
+ return InternalSyncIncrement (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 decremented value. The decrement operation must be
+ performed using MP safe mechanisms. The state of the return value is not
+ guaranteed to be MP safe.
+
+ If Value is NULL, then ASSERT().
+
+ @param Value A pointer to the 32-bit value to decrement.
+
+ @return The decremented value.
+
+**/
+UINT32
+EFIAPI
+InterlockedDecrement (
+ IN UINT32 *Value
+ )
+{
+ ASSERT (Value != NULL);
+ return InternalSyncDecrement (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.
+
+ If Value is NULL, then ASSERT().
+
+ @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
+InterlockedCompareExchange32 (
+ IN OUT UINT32 *Value,
+ IN UINT32 CompareValue,
+ IN UINT32 ExchangeValue
+ )
+{
+ ASSERT (Value != NULL);
+ return InternalSyncCompareExchange32 (Value, CompareValue, 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.
+
+ If Value is NULL, then ASSERT().
+
+ @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
+InterlockedCompareExchange64 (
+ IN OUT UINT64 *Value,
+ IN UINT64 CompareValue,
+ IN UINT64 ExchangeValue
+ )
+{
+ ASSERT (Value != NULL);
+ return InternalSyncCompareExchange64 (Value, CompareValue, ExchangeValue);
+}
+
+/**
+ Performs an atomic compare exchange operation on a pointer value.
+
+ Performs an atomic compare exchange operation on the pointer value 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.
+
+ If Value is NULL, then ASSERT().
+
+ @param Value A pointer to the pointer value for the compare exchange
+ operation.
+ @param CompareValue Pointer value used in compare operation.
+ @param ExchangeValue Pointer value used in exchange operation.
+
+**/
+VOID *
+EFIAPI
+InterlockedCompareExchangePointer (
+ IN OUT VOID **Value,
+ IN VOID *CompareValue,
+ IN VOID *ExchangeValue
+ )
+{
+ UINT8 SizeOfValue;
+
+ SizeOfValue = sizeof (*Value);
+
+ switch (SizeOfValue) {
+ case sizeof (UINT32):
+ return (VOID*)(UINTN)InterlockedCompareExchange32 (
+ (UINT32*)Value,
+ (UINT32)(UINTN)CompareValue,
+ (UINT32)(UINTN)ExchangeValue
+ );
+ case sizeof (UINT64):
+ return (VOID*)(UINTN)InterlockedCompareExchange64 (
+ (UINT64*)Value,
+ (UINT64)(UINTN)CompareValue,
+ (UINT64)(UINTN)ExchangeValue
+ );
+ default:
+ ASSERT (FALSE);
+ return NULL;
+ }
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Unaligned.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Unaligned.c index 37c9e71f76..47eb80d26a 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Unaligned.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Unaligned.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Reads a 16-bit value from memory that may be unaligned.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/CpuBreakpoint.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/CpuBreakpoint.c new file mode 100644 index 0000000000..69849ff6c7 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/CpuBreakpoint.c @@ -0,0 +1,32 @@ +/**
+ CpuBreakpoint 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"
+
+//
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics
+//
+void __debugbreak ();
+
+#pragma intrinsic(__debugbreak)
+
+VOID
+EFIAPI
+CpuBreakpoint (
+ VOID
+ )
+{
+ __debugbreak ();
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/InterlockedCompareExchange32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/InterlockedCompareExchange32.c new file mode 100644 index 0000000000..082199dbb3 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/InterlockedCompareExchange32.c @@ -0,0 +1,38 @@ +/**
+ InterlockedCompareExchange32 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"
+
+//
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics
+//
+long _InterlockedCompareExchange(
+ long volatile * Destination,
+ long Exchange,
+ long Comperand
+);
+
+#pragma intrinsic(_InterlockedCompareExchange)
+
+UINT32
+EFIAPI
+InternalSyncCompareExchange32 (
+ IN volatile UINT32 *Value,
+ IN UINT32 CompareValue,
+ IN UINT32 ExchangeValue
+ )
+{
+ return _InterlockedCompareExchange (Value, ExchangeValue, CompareValue);
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/InterlockedCompareExchange64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/InterlockedCompareExchange64.c new file mode 100644 index 0000000000..f2864c7358 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/InterlockedCompareExchange64.c @@ -0,0 +1,38 @@ +/**
+ InterlockedCompareExchange64 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"
+
+//
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics
+//
+__int64 _InterlockedCompareExchange64(
+ __int64 volatile * Destination,
+ __int64 Exchange,
+ __int64 Comperand
+);
+
+#pragma intrinsic(_InterlockedCompareExchange64)
+
+UINT64
+EFIAPI
+InternalSyncCompareExchange64 (
+ IN volatile UINT64 *Value,
+ IN UINT64 CompareValue,
+ IN UINT64 ExchangeValue
+ )
+{
+ return _InterlockedCompareExchange64 (Value, ExchangeValue, CompareValue);
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/InterlockedDecrement.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/InterlockedDecrement.c new file mode 100644 index 0000000000..2699ba01b2 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/InterlockedDecrement.c @@ -0,0 +1,34 @@ +/**
+ InterlockedDecrement 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"
+
+//
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics
+//
+long _InterlockedDecrement(
+ long * lpAddend
+);
+
+#pragma intrinsic(_InterlockedDecrement)
+
+UINT32
+EFIAPI
+InternalSyncDecrement (
+ IN volatile UINT32 *Value
+ )
+{
+ return _InterlockedDecrement ((long *)Value);
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/InterlockedIncrement.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/InterlockedIncrement.c new file mode 100644 index 0000000000..061231bf65 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/InterlockedIncrement.c @@ -0,0 +1,34 @@ +/**
+ InterLockedIncrement 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"
+
+//
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics
+//
+long _InterlockedIncrement(
+ long * lpAddend
+);
+
+#pragma intrinsic(_InterlockedIncrement)
+
+UINT32
+EFIAPI
+InternalSyncIncrement (
+ IN volatile UINT32 *Value
+ )
+{
+ return _InterlockedIncrement ((long *)Value);
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Non-existing.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Non-existing.c index 023af1c1e0..bb1c9777e1 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Non-existing.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Non-existing.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "..\BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Enables the 32-bit paging mode on the CPU.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/ReadMsr64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/ReadMsr64.c new file mode 100644 index 0000000000..ae1db8d8b0 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/ReadMsr64.c @@ -0,0 +1,33 @@ +/**
+ CpuBreakpoint 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"
+
+//
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics
+//
+unsigned __int64 __readmsr (int register);
+
+#pragma intrinsic(__readmsr)
+
+
+UINT64
+EFIAPI
+AsmReadMsr64 (
+ IN UINT32 Index
+ )
+{
+ return __readmsr (Index);
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/WriteMsr64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/WriteMsr64.c new file mode 100644 index 0000000000..9d0e4ca89a --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/WriteMsr64.c @@ -0,0 +1,35 @@ +/**
+ CpuBreakpoint 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"
+
+
+//
+// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics
+//
+void __writemsr (unsigned long Register, unsigned __int64 Value);
+
+#pragma intrinsic(__writemsr)
+
+UINT64
+EFIAPI
+AsmWriteMsr64 (
+ IN UINT32 Index,
+ IN UINT64 Value
+ )
+{
+ __writemsr (Index, Value);
+ return Value;
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86DisablePaging32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86DisablePaging32.c index 8af5534546..4e11397a25 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86DisablePaging32.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86DisablePaging32.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Disables the 32-bit paging mode on the CPU.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86DisablePaging64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86DisablePaging64.c index 5c4737b326..287b9767af 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86DisablePaging64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86DisablePaging64.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Disables the 64-bit paging mode on the CPU.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86EnablePaging32.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86EnablePaging32.c index 33622a5a44..8462e9aae9 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86EnablePaging32.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86EnablePaging32.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Enables the 32-bit paging mode on the CPU.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86EnablePaging64.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86EnablePaging64.c index 790c80c399..e9a49adb55 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86EnablePaging64.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86EnablePaging64.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Enables the 64-bit paging mode on the CPU.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86FxRestore.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86FxRestore.c index 46a3eefe31..ce6ab00793 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86FxRestore.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86FxRestore.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Restores the current floating point/SSE/SSE2 context from a buffer.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86FxSave.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86FxSave.c index de59619aa5..e5809d0ced 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86FxSave.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86FxSave.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Save the current floating point/SSE/SSE2 context to a buffer.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86GetInterruptState.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86GetInterruptState.c index d3fd368e94..b544e2c378 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86GetInterruptState.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86GetInterruptState.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Retrieves the current CPU interrupt state.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86MemoryFence.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86MemoryFence.c index 4a9c2ade5c..9972894ffa 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86MemoryFence.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86MemoryFence.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Used to serialize load and store operations.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86Msr.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86Msr.c index ce7d58d779..ea95be5846 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86Msr.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86Msr.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Returns the lower 32-bits of a Machine Specific Register(MSR).
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86ReadGdtr.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86ReadGdtr.c index b271f7ef24..399e0e326c 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86ReadGdtr.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86ReadGdtr.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Reads the current Global Descriptor Table Register(GDTR) descriptor.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86ReadIdtr.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86ReadIdtr.c index 579b7382bc..d579558602 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86ReadIdtr.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86ReadIdtr.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86Thunk.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86Thunk.c index aafc18d8d7..16080d518b 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86Thunk.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86Thunk.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
//
// Byte packed structure for a segment descriptor in a GDT/LDT
//
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86WriteGdtr.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86WriteGdtr.c index 9dfa789525..6803d25703 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86WriteGdtr.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86WriteGdtr.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Writes the current Global Descriptor Table Register (GDTR) descriptor.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86WriteIdtr.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86WriteIdtr.c index fed0ef8ef6..4493ebb546 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86WriteIdtr.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/x86WriteIdtr.c @@ -20,7 +20,7 @@ Abstract: --*/
-#include "BaseLibInternal.h"
+#include "BaseLibInternals.h"
/**
Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/BaseMemoryLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/BaseMemoryLib.inf index 2ea4399444..829973d458 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/BaseMemoryLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/BaseMemoryLib.inf @@ -15,7 +15,10 @@ #
# Abstract:
#
-# Component description file for BaseMemoryLib.
+# Component description file for BaseMemoryLib. This instance is not the
+# BaseMemoryLib in EdkII but almost BaseMemoryLibRepStr.
+# Use REP string instructions for Ia32 and X64 for high performance and small size
+# Use C implementation for IPF and EBC
#
#--*/
@@ -24,9 +27,7 @@ BASE_NAME = EdkIIGlueBaseMemoryLib COMPONENT_TYPE = LIBRARY
[sources.common]
- CopyMem.c
MemLibGuid.c
- MemLibGeneric.c
CopyMemWrapper.c
SetMemWrapper.c
SetMem16Wrapper.c
@@ -38,15 +39,42 @@ COMPONENT_TYPE = LIBRARY ScanMem16Wrapper.c
ScanMem32Wrapper.c
ScanMem64Wrapper.c
- SetMem.c
[sources.ia32]
+ Ia32/CopyMem.asm
+ Ia32/SetMem.asm
+ Ia32/SetMem16.asm
+ Ia32/SetMem32.asm
+ Ia32/SetMem64.asm
+ Ia32/ZeroMem.asm
+ Ia32/CompareMem.asm
+ Ia32/ScanMem8.asm
+ Ia32/ScanMem16.asm
+ Ia32/ScanMem32.asm
+ Ia32/ScanMem64.asm
[sources.x64]
+ X64/CopyMem.asm
+ X64/SetMem.asm
+ X64/SetMem16.asm
+ X64/SetMem32.asm
+ X64/SetMem64.asm
+ X64/ZeroMem.asm
+ X64/CompareMem.asm
+ X64/ScanMem8.asm
+ X64/ScanMem16.asm
+ X64/ScanMem32.asm
+ X64/ScanMem64.asm
[sources.ipf]
+ Ipf/CopyMem.c
+ Ipf/MemLibGeneric.c
+ Ipf/SetMem.c
[sources.ebc]
+ Ebc/CopyMem.c
+ Ebc/MemLibGeneric.c
+ Ebc/SetMem.c
[includes.common]
.
@@ -74,7 +102,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -87,5 +115,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/CopyMem.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ebc/CopyMem.c index bd39f1f6a7..bd39f1f6a7 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/CopyMem.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ebc/CopyMem.c diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/MemLibGeneric.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ebc/MemLibGeneric.c index a7fc82f03c..a7fc82f03c 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/MemLibGeneric.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ebc/MemLibGeneric.c diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/SetMem.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ebc/SetMem.c index 364623364e..364623364e 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/SetMem.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ebc/SetMem.c diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/CompareMem.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/CompareMem.asm new file mode 100644 index 0000000000..1d0e7fad39 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/CompareMem.asm @@ -0,0 +1,54 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; CompareMem.Asm
+;
+; Abstract:
+;
+; CompareMem function
+;
+; Notes:
+;
+; The following BaseMemoryLib instances share the same version of this file:
+;
+; BaseMemoryLibRepStr
+; BaseMemoryLibMmx
+; BaseMemoryLibSse2
+;
+;------------------------------------------------------------------------------
+
+ .686
+ .model flat,C
+ .code
+
+;------------------------------------------------------------------------------
+; INTN
+; EFIAPI
+; InternalMemCompareMem (
+; IN CONST VOID *DestinationBuffer,
+; IN CONST VOID *SourceBuffer,
+; IN UINTN Length
+; );
+;------------------------------------------------------------------------------
+InternalMemCompareMem PROC USES esi edi
+ mov esi, [esp + 12]
+ mov edi, [esp + 16]
+ mov ecx, [esp + 20]
+ repe cmpsb
+ movzx eax, byte ptr [esi - 1]
+ movzx edx, byte ptr [edi - 1]
+ sub eax, edx
+ ret
+InternalMemCompareMem ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/CopyMem.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/CopyMem.asm new file mode 100644 index 0000000000..86677ef614 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/CopyMem.asm @@ -0,0 +1,63 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; CopyMem.Asm
+;
+; Abstract:
+;
+; CopyMem function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .386
+ .model flat,C
+ .code
+
+;------------------------------------------------------------------------------
+; VOID *
+; InternalMemCopyMem (
+; IN VOID *Destination,
+; IN VOID *Source,
+; IN UINTN Count
+; )
+;------------------------------------------------------------------------------
+InternalMemCopyMem PROC USES esi edi
+ mov esi, [esp + 16] ; esi <- Source
+ mov edi, [esp + 12] ; edi <- Destination
+ mov edx, [esp + 20] ; edx <- Count
+ 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
+ mov eax, [esp + 12] ; eax <- Destination as return value
+ ret
+InternalMemCopyMem ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ScanMem16.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ScanMem16.asm new file mode 100644 index 0000000000..57fab61b77 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ScanMem16.asm @@ -0,0 +1,53 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; ScanMem16.Asm
+;
+; Abstract:
+;
+; ScanMem16 function
+;
+; Notes:
+;
+; The following BaseMemoryLib instances share the same version of this file:
+;
+; BaseMemoryLibRepStr
+; BaseMemoryLibMmx
+; BaseMemoryLibSse2
+;
+;------------------------------------------------------------------------------
+
+ .686
+ .model flat,C
+ .code
+
+;------------------------------------------------------------------------------
+; CONST VOID *
+; EFIAPI
+; InternalMemScanMem16 (
+; IN CONST VOID *Buffer,
+; IN UINTN Length,
+; IN UINT16 Value
+; );
+;------------------------------------------------------------------------------
+InternalMemScanMem16 PROC USES edi
+ mov ecx, [esp + 12]
+ mov edi, [esp + 8]
+ mov eax, [esp + 16]
+ repne scasw
+ lea eax, [edi - 2]
+ cmovnz eax, ecx
+ ret
+InternalMemScanMem16 ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ScanMem32.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ScanMem32.asm new file mode 100644 index 0000000000..6ac857ce16 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ScanMem32.asm @@ -0,0 +1,53 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; ScanMem32.Asm
+;
+; Abstract:
+;
+; ScanMem32 function
+;
+; Notes:
+;
+; The following BaseMemoryLib instances share the same version of this file:
+;
+; BaseMemoryLibRepStr
+; BaseMemoryLibMmx
+; BaseMemoryLibSse2
+;
+;------------------------------------------------------------------------------
+
+ .686
+ .model flat,C
+ .code
+
+;------------------------------------------------------------------------------
+; CONST VOID *
+; EFIAPI
+; InternalMemScanMem32 (
+; IN CONST VOID *Buffer,
+; IN UINTN Length,
+; IN UINT32 Value
+; );
+;------------------------------------------------------------------------------
+InternalMemScanMem32 PROC USES edi
+ mov ecx, [esp + 12]
+ mov edi, [esp + 8]
+ mov eax, [esp + 16]
+ repne scasd
+ lea eax, [edi - 4]
+ cmovnz eax, ecx
+ ret
+InternalMemScanMem32 ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ScanMem64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ScanMem64.asm new file mode 100644 index 0000000000..ca54f13738 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ScanMem64.asm @@ -0,0 +1,62 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; ScanMem64.Asm
+;
+; Abstract:
+;
+; ScanMem64 function
+;
+; Notes:
+;
+; The following BaseMemoryLib instances share the same version of this file:
+;
+; BaseMemoryLibRepStr
+; BaseMemoryLibMmx
+; BaseMemoryLibSse2
+;
+;------------------------------------------------------------------------------
+
+ .686
+ .model flat,C
+ .code
+
+;------------------------------------------------------------------------------
+; CONST VOID *
+; EFIAPI
+; InternalMemScanMem64 (
+; IN CONST VOID *Buffer,
+; IN UINTN Length,
+; IN UINT64 Value
+; );
+;------------------------------------------------------------------------------
+InternalMemScanMem64 PROC USES edi
+ mov ecx, [esp + 12]
+ mov eax, [esp + 16]
+ mov edx, [esp + 20]
+ mov edi, [esp + 8]
+@@:
+ cmp eax, [edi]
+ lea edi, [edi + 8]
+ loopne @B
+ jne @F
+ cmp edx, [edi - 4]
+ jecxz @F
+ jne @B
+@@:
+ lea eax, [edi - 8]
+ cmovne eax, ecx
+ ret
+InternalMemScanMem64 ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ScanMem8.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ScanMem8.asm new file mode 100644 index 0000000000..a3f65b64fa --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ScanMem8.asm @@ -0,0 +1,53 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; ScanMem8.Asm
+;
+; Abstract:
+;
+; ScanMem8 function
+;
+; Notes:
+;
+; The following BaseMemoryLib instances share the same version of this file:
+;
+; BaseMemoryLibRepStr
+; BaseMemoryLibMmx
+; BaseMemoryLibSse2
+;
+;------------------------------------------------------------------------------
+
+ .686
+ .model flat,C
+ .code
+
+;------------------------------------------------------------------------------
+; CONST VOID *
+; EFIAPI
+; InternalMemScanMem8 (
+; IN CONST VOID *Buffer,
+; IN UINTN Length,
+; IN UINT8 Value
+; );
+;------------------------------------------------------------------------------
+InternalMemScanMem8 PROC USES edi
+ mov ecx, [esp + 12]
+ mov edi, [esp + 8]
+ mov al, [esp + 16]
+ repne scasb
+ lea eax, [edi - 1]
+ cmovnz eax, ecx
+ ret
+InternalMemScanMem8 ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCs.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/SetMem.asm index 69e2d11954..98b1ed84c2 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadCs.asm +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/SetMem.asm @@ -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
-; 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.
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
-; ReadCs.Asm
+; SetMem.Asm
;
; Abstract:
;
-; AsmReadCs function
+; SetMem function
;
; Notes:
;
@@ -24,15 +26,20 @@ .code
;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadCs (
-; VOID
-; );
+; VOID *
+; InternalMemSetMem (
+; IN VOID *Buffer,
+; IN UINTN Count,
+; IN UINT8 Value
+; )
;------------------------------------------------------------------------------
-AsmReadCs PROC
- mov eax, cs
+InternalMemSetMem PROC USES edi
+ mov eax, [esp + 16]
+ mov edi, [esp + 8]
+ mov ecx, [esp + 12]
+ rep stosb
+ mov eax, [esp + 8]
ret
-AsmReadCs ENDP
+InternalMemSetMem ENDP
END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDs.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/SetMem16.asm index b724a469d3..7f4a8955f9 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadDs.asm +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/SetMem16.asm @@ -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
-; 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.
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
-; ReadDs.Asm
+; SetMem16.Asm
;
; Abstract:
;
-; AsmReadDs function
+; SetMem16 function
;
; Notes:
;
@@ -24,15 +26,20 @@ .code
;------------------------------------------------------------------------------
-; UINT16
-; EFIAPI
-; AsmReadDs (
-; VOID
-; );
+; VOID *
+; InternalMemSetMem16 (
+; IN VOID *Buffer,
+; IN UINTN Count,
+; IN UINT16 Value
+; )
;------------------------------------------------------------------------------
-AsmReadDs PROC
- mov eax, ds
+InternalMemSetMem16 PROC USES edi
+ mov eax, [esp + 16]
+ mov edi, [esp + 8]
+ mov ecx, [esp + 12]
+ rep stosw
+ mov eax, [esp + 8]
ret
-AsmReadDs ENDP
+InternalMemSetMem16 ENDP
END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadEflags.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/SetMem32.asm index 5cb241f5bb..5876f4a741 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadEflags.asm +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/SetMem32.asm @@ -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
-; 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.
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
-; ReadEflags.Asm
+; SetMem32.Asm
;
; Abstract:
;
-; AsmReadEflags function
+; SetMem32 function
;
; Notes:
;
@@ -24,16 +26,20 @@ .code
;------------------------------------------------------------------------------
-; UINTN
-; EFIAPI
-; AsmReadEflags (
-; VOID
-; );
+; VOID *
+; InternalMemSetMem32 (
+; IN VOID *Buffer,
+; IN UINTN Count,
+; IN UINT32 Value
+; )
;------------------------------------------------------------------------------
-AsmReadEflags PROC
- pushfd
- pop eax
+InternalMemSetMem32 PROC USES edi
+ mov eax, [esp + 16]
+ mov edi, [esp + 8]
+ mov ecx, [esp + 12]
+ rep stosd
+ mov eax, [esp + 8]
ret
-AsmReadEflags ENDP
+InternalMemSetMem32 ENDP
END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/SetMem64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/SetMem64.asm new file mode 100644 index 0000000000..687c18f312 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/SetMem64.asm @@ -0,0 +1,49 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; SetMem64.Asm
+;
+; Abstract:
+;
+; SetMem64 function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .386
+ .model flat,C
+ .code
+
+;------------------------------------------------------------------------------
+; VOID *
+; InternalMemSetMem64 (
+; IN VOID *Buffer,
+; IN UINTN Count,
+; IN UINT64 Value
+; )
+;------------------------------------------------------------------------------
+InternalMemSetMem64 PROC USES edi
+ mov ecx, [esp + 12]
+ mov eax, [esp + 16]
+ mov edx, [esp + 20]
+ mov edi, [esp + 8]
+@@:
+ mov [edi + ecx*8 - 8], eax
+ mov [edi + ecx*8 - 4], edx
+ loop @B
+ mov eax, edi
+ ret
+InternalMemSetMem64 ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ZeroMem.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ZeroMem.asm new file mode 100644 index 0000000000..b3b8b5d1f1 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ia32/ZeroMem.asm @@ -0,0 +1,50 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; ZeroMem.Asm
+;
+; Abstract:
+;
+; ZeroMem function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .386
+ .model flat,C
+ .code
+
+;------------------------------------------------------------------------------
+; VOID *
+; InternalMemZeroMem (
+; IN VOID *Buffer,
+; IN UINTN Count
+; );
+;------------------------------------------------------------------------------
+InternalMemZeroMem PROC USES edi
+ xor eax, eax
+ mov edi, [esp + 8]
+ mov ecx, [esp + 12]
+ mov edx, ecx
+ shr ecx, 2
+ and edx, 3
+ push edi
+ rep stosd
+ mov ecx, edx
+ rep stosb
+ pop eax
+ ret
+InternalMemZeroMem ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ipf/CopyMem.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ipf/CopyMem.c new file mode 100644 index 0000000000..bd39f1f6a7 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ipf/CopyMem.c @@ -0,0 +1,65 @@ +/*++
+
+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:
+
+ CopyMem.c
+
+Abstract:
+
+ Internal CopyMem
+
+--*/
+
+#include "BaseMemoryLibInternal.h"
+
+/**
+ Copy Length bytes from Source to Destination.
+
+ @param Destination Target of copy
+ @param Source Place to copy from
+ @param Length Number of bytes to copy
+
+ @return Destination
+
+**/
+VOID *
+EFIAPI
+InternalMemCopyMem (
+ OUT VOID *Destination,
+ IN CONST VOID *Source,
+ IN UINTN Length
+ )
+{
+ //
+ // Declare the local variables that actually move the data elements as
+ // volatile to prevent the optimizer from replacing this function with
+ // the intrinsic memcpy()
+ //
+ volatile UINT8 *Destination8;
+ CONST UINT8 *Source8;
+
+ if (Source > Destination) {
+ Destination8 = (UINT8*)Destination;
+ Source8 = (CONST UINT8*)Source;
+ while (Length-- != 0) {
+ *(Destination8++) = *(Source8++);
+ }
+ } else if (Source < Destination) {
+ Destination8 = (UINT8*)Destination + Length;
+ Source8 = (CONST UINT8*)Source + Length;
+ while (Length-- != 0) {
+ *(--Destination8) = *(--Source8);
+ }
+ }
+ return Destination;
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ipf/MemLibGeneric.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ipf/MemLibGeneric.c new file mode 100644 index 0000000000..a7fc82f03c --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ipf/MemLibGeneric.c @@ -0,0 +1,261 @@ +/*++
+
+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:
+
+ MemLibGeneric.c
+
+Abstract:
+
+ Architecture Independent Base Memory Library Implementation.
+
+--*/
+
+#include "BaseMemoryLibInternal.h"
+
+/**
+ Fills a target buffer with a 16-bit value, and returns the target buffer.
+
+ @param Buffer Pointer to the target buffer to fill.
+ @param Length Number of bytes in Buffer to fill.
+ @param Value Value with which to fill Length bytes of Buffer.
+
+ @return Buffer
+
+**/
+VOID *
+EFIAPI
+InternalMemSetMem16 (
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
+ )
+{
+ do {
+ ((UINT16*)Buffer)[--Length] = Value;
+ } while (Length != 0);
+ return Buffer;
+}
+
+/**
+ Fills a target buffer with a 32-bit value, and returns the target buffer.
+
+ @param Buffer Pointer to the target buffer to fill.
+ @param Length Number of bytes in Buffer to fill.
+ @param Value Value with which to fill Length bytes of Buffer.
+
+ @return Buffer
+
+**/
+VOID *
+EFIAPI
+InternalMemSetMem32 (
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
+ )
+{
+ do {
+ ((UINT32*)Buffer)[--Length] = Value;
+ } while (Length != 0);
+ return Buffer;
+}
+
+/**
+ Fills a target buffer with a 64-bit value, and returns the target buffer.
+
+ @param Buffer Pointer to the target buffer to fill.
+ @param Length Number of bytes in Buffer to fill.
+ @param Value Value with which to fill Length bytes of Buffer.
+
+ @return Buffer
+
+**/
+VOID *
+EFIAPI
+InternalMemSetMem64 (
+ OUT VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
+ )
+{
+ do {
+ ((UINT64*)Buffer)[--Length] = Value;
+ } while (Length != 0);
+ return Buffer;
+}
+
+/**
+ Set Buffer to 0 for Size bytes.
+
+ @param Buffer Memory to set.
+ @param Size Number of bytes to set
+
+ @return Buffer
+
+**/
+VOID *
+EFIAPI
+InternalMemZeroMem (
+ OUT VOID *Buffer,
+ IN UINTN Length
+ )
+{
+ return InternalMemSetMem (Buffer, Length, 0);
+}
+
+/**
+ Compares two memory buffers of a given length.
+
+ @param DestinationBuffer First memory buffer
+ @param SourceBuffer Second memory buffer
+ @param Length Length of DestinationBuffer and SourceBuffer memory
+ regions to compare. Must be non-zero.
+
+ @retval 0 if MemOne == MemTwo
+
+**/
+INTN
+EFIAPI
+InternalMemCompareMem (
+ IN CONST VOID *DestinationBuffer,
+ IN CONST VOID *SourceBuffer,
+ IN UINTN Length
+ )
+{
+ while ((--Length != 0) &&
+ (*(INT8*)DestinationBuffer == *(INT8*)SourceBuffer)) {
+ DestinationBuffer = (INT8*)DestinationBuffer + 1;
+ SourceBuffer = (INT8*)SourceBuffer + 1;
+ }
+ return (INTN)*(UINT8*)DestinationBuffer - (INTN)*(UINT8*)SourceBuffer;
+}
+
+/**
+ Scans a target buffer for an 8-bit value, and returns a pointer to the
+ matching 8-bit value in the target buffer.
+
+ @param Buffer Pointer to the target buffer to scan.
+ @param Length Number of bytes in Buffer to scan. Must be non-zero.
+ @param Value Value to search for in the target buffer.
+
+ @return Pointer to the first occurrence or NULL if not found.
+
+**/
+CONST VOID *
+EFIAPI
+InternalMemScanMem8 (
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT8 Value
+ )
+{
+ CONST UINT8 *Pointer;
+
+ Pointer = (CONST UINT8*)Buffer;
+ do {
+ if (*(Pointer++) == Value) {
+ return Pointer;
+ }
+ } while (--Length != 0);
+ return NULL;
+}
+
+/**
+ Scans a target buffer for a 16-bit value, and returns a pointer to the
+ matching 16-bit value in the target buffer.
+
+ @param Buffer Pointer to the target buffer to scan.
+ @param Length Number of bytes in Buffer to scan. Must be non-zero.
+ @param Value Value to search for in the target buffer.
+
+ @return Pointer to the first occurrence or NULL if not found.
+
+**/
+CONST VOID *
+EFIAPI
+InternalMemScanMem16 (
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 Value
+ )
+{
+ CONST UINT16 *Pointer;
+
+ Pointer = (CONST UINT16*)Buffer;
+ do {
+ if (*(Pointer++) == Value) {
+ return Pointer;
+ }
+ } while (--Length != 0);
+ return NULL;
+}
+
+/**
+ Scans a target buffer for a 32-bit value, and returns a pointer to the
+ matching 32-bit value in the target buffer.
+
+ @param Buffer Pointer to the target buffer to scan.
+ @param Length Number of bytes in Buffer to scan. Must be non-zero.
+ @param Value Value to search for in the target buffer.
+
+ @return Pointer to the first occurrence or NULL if not found.
+
+**/
+CONST VOID *
+EFIAPI
+InternalMemScanMem32 (
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 Value
+ )
+{
+ CONST UINT32 *Pointer;
+
+ Pointer = (CONST UINT32*)Buffer;
+ do {
+ if (*(Pointer++) == Value) {
+ return Pointer;
+ }
+ } while (--Length != 0);
+ return NULL;
+}
+
+/**
+ Scans a target buffer for a 64-bit value, and returns a pointer to the
+ matching 64-bit value in the target buffer.
+
+ @param Buffer Pointer to the target buffer to scan.
+ @param Length Number of bytes in Buffer to scan. Must be non-zero.
+ @param Value Value to search for in the target buffer.
+
+ @return Pointer to the first occurrence or NULL if not found.
+
+**/
+CONST VOID *
+EFIAPI
+InternalMemScanMem64 (
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT64 Value
+ )
+{
+ CONST UINT64 *Pointer;
+
+ Pointer = (CONST UINT64*)Buffer;
+ do {
+ if (*(Pointer++) == Value) {
+ return Pointer;
+ }
+ } while (--Length != 0);
+ return NULL;
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ipf/SetMem.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ipf/SetMem.c new file mode 100644 index 0000000000..364623364e --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/Ipf/SetMem.c @@ -0,0 +1,55 @@ +/*++
+
+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:
+
+ SetMem.c
+
+Abstract:
+
+ Internal SetMem
+
+--*/
+
+#include "BaseMemoryLibInternal.h"
+
+/**
+ Set Buffer to Value for Size bytes.
+
+ @param Buffer Memory to set.
+ @param Size Number of bytes to set
+ @param Value Value of the set operation.
+
+ @return Buffer
+
+**/
+VOID *
+EFIAPI
+InternalMemSetMem (
+ IN VOID *Buffer,
+ IN UINTN Size,
+ IN UINT8 Value
+ )
+{
+ //
+ // Declare the local variables that actually move the data elements as
+ // volatile to prevent the optimizer from replacing this function with
+ // the intrinsic memset()
+ //
+ volatile UINT8 *Pointer;
+
+ Pointer = (UINT8*)Buffer;
+ while (Size-- != 0) {
+ *(Pointer++) = Value;
+ }
+ return Buffer;
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/MemLibGuid.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/MemLibGuid.c index 6a3654c1b7..0b7682c8c9 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/MemLibGuid.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/MemLibGuid.c @@ -75,17 +75,12 @@ GlueCompareGuid ( IN CONST GUID *Guid2
)
{
- UINT64 LowPartOfGuid1;
- UINT64 LowPartOfGuid2;
- UINT64 HighPartOfGuid1;
- UINT64 HighPartOfGuid2;
-
- LowPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1);
- LowPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2);
- HighPartOfGuid1 = ReadUnaligned64 ((CONST UINT64*) Guid1 + 1);
- HighPartOfGuid2 = ReadUnaligned64 ((CONST UINT64*) Guid2 + 1);
-
- return (BOOLEAN) (LowPartOfGuid1 == LowPartOfGuid2 && HighPartOfGuid1 == HighPartOfGuid2);
+ return (BOOLEAN)(
+ ReadUnaligned64 ((CONST UINT64*)Guid1)
+ == ReadUnaligned64 ((CONST UINT64*)Guid2) &&
+ ReadUnaligned64 ((CONST UINT64*)Guid1 + 1)
+ == ReadUnaligned64 ((CONST UINT64*)Guid2 + 1)
+ );
}
/**
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CompareMem.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CompareMem.asm new file mode 100644 index 0000000000..554bc07c64 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CompareMem.asm @@ -0,0 +1,52 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; CompareMem.Asm
+;
+; Abstract:
+;
+; CompareMem function
+;
+; Notes:
+;
+; The following BaseMemoryLib instances share the same version of this file:
+;
+; BaseMemoryLibRepStr
+; BaseMemoryLibMmx
+; BaseMemoryLibSse2
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; INTN
+; EFIAPI
+; InternalMemCompareMem (
+; IN CONST VOID *DestinationBuffer,
+; IN CONST VOID *SourceBuffer,
+; IN UINTN Length
+; );
+;------------------------------------------------------------------------------
+InternalMemCompareMem PROC USES rsi rdi
+ mov rsi, rcx
+ mov rdi, rdx
+ mov rcx, r8
+ repe cmpsb
+ movzx rax, byte ptr [rsi - 1]
+ movzx rdx, byte ptr [rdi - 1]
+ sub rax, rdx
+ ret
+InternalMemCompareMem ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CopyMem.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CopyMem.asm new file mode 100644 index 0000000000..a2e04056fd --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/CopyMem.asm @@ -0,0 +1,61 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; CopyMem.Asm
+;
+; Abstract:
+;
+; CopyMem function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID *
+; EFIAPI
+; InternalMemCopyMem (
+; IN VOID *Destination,
+; IN VOID *Source,
+; IN UINTN Count
+; )
+;------------------------------------------------------------------------------
+InternalMemCopyMem PROC USES rsi rdi
+ mov rsi, rdx ; rsi <- Source
+ mov rdi, rcx ; rdi <- Destination
+ lea r9, [rsi + r8 - 1] ; r9 <- End of Source
+ cmp rsi, rdi
+ mov rax, rdi ; rax <- Destination as return value
+ jae @F
+ cmp r9, rsi
+ 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
+ ret
+InternalMemCopyMem ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem16.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem16.asm new file mode 100644 index 0000000000..a2538c2cca --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem16.asm @@ -0,0 +1,51 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; ScanMem16.Asm
+;
+; Abstract:
+;
+; ScanMem16 function
+;
+; Notes:
+;
+; The following BaseMemoryLib instances share the same version of this file:
+;
+; BaseMemoryLibRepStr
+; BaseMemoryLibMmx
+; BaseMemoryLibSse2
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; CONST VOID *
+; EFIAPI
+; InternalMemScanMem16 (
+; IN CONST VOID *Buffer,
+; IN UINTN Length,
+; IN UINT16 Value
+; );
+;------------------------------------------------------------------------------
+InternalMemScanMem16 PROC USES rdi
+ mov rdi, rcx
+ mov rax, r8
+ mov rcx, rdx
+ repne scasw
+ lea rax, [rdi - 2]
+ cmovnz rax, rcx
+ ret
+InternalMemScanMem16 ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem32.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem32.asm new file mode 100644 index 0000000000..e0523d8547 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem32.asm @@ -0,0 +1,51 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; ScanMem32.Asm
+;
+; Abstract:
+;
+; ScanMem32 function
+;
+; Notes:
+;
+; The following BaseMemoryLib instances share the same version of this file:
+;
+; BaseMemoryLibRepStr
+; BaseMemoryLibMmx
+; BaseMemoryLibSse2
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; CONST VOID *
+; EFIAPI
+; InternalMemScanMem32 (
+; IN CONST VOID *Buffer,
+; IN UINTN Length,
+; IN UINT32 Value
+; );
+;------------------------------------------------------------------------------
+InternalMemScanMem32 PROC USES rdi
+ mov rdi, rcx
+ mov rax, r8
+ mov rcx, rdx
+ repne scasd
+ lea rax, [rdi - 4]
+ cmovnz rax, rcx
+ ret
+InternalMemScanMem32 ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem64.asm new file mode 100644 index 0000000000..0e7e9c782f --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem64.asm @@ -0,0 +1,51 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; ScanMem64.Asm
+;
+; Abstract:
+;
+; ScanMem64 function
+;
+; Notes:
+;
+; The following BaseMemoryLib instances share the same version of this file:
+;
+; BaseMemoryLibRepStr
+; BaseMemoryLibMmx
+; BaseMemoryLibSse2
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; CONST VOID *
+; EFIAPI
+; InternalMemScanMem64 (
+; IN CONST VOID *Buffer,
+; IN UINTN Length,
+; IN UINT64 Value
+; );
+;------------------------------------------------------------------------------
+InternalMemScanMem64 PROC USES rdi
+ mov rdi, rcx
+ mov rax, r8
+ mov rcx, rdx
+ repne scasq
+ lea rax, [rdi - 8]
+ cmovnz rax, rcx
+ ret
+InternalMemScanMem64 ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem8.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem8.asm new file mode 100644 index 0000000000..879273f960 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ScanMem8.asm @@ -0,0 +1,51 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; ScanMem8.Asm
+;
+; Abstract:
+;
+; ScanMem8 function
+;
+; Notes:
+;
+; The following BaseMemoryLib instances share the same version of this file:
+;
+; BaseMemoryLibRepStr
+; BaseMemoryLibMmx
+; BaseMemoryLibSse2
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; CONST VOID *
+; EFIAPI
+; InternalMemScanMem8 (
+; IN CONST VOID *Buffer,
+; IN UINTN Length,
+; IN UINT8 Value
+; );
+;------------------------------------------------------------------------------
+InternalMemScanMem8 PROC USES rdi
+ mov rdi, rcx
+ mov rcx, rdx
+ mov rax, r8
+ repne scasb
+ lea rax, [rdi - 1]
+ cmovnz rax, rcx ; set rax to 0 if not found
+ ret
+InternalMemScanMem8 ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Invd.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem.asm index 24a3869ed2..5306520169 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Invd.asm +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem.asm @@ -1,38 +1,44 @@ -; Copyright (c) 2004, Intel Corporation
-; All rights reserved. This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
-; Invd.Asm
+; SetMem.Asm
;
; Abstract:
;
-; AsmInvd function
+; SetMem function
;
; Notes:
;
;------------------------------------------------------------------------------
- .486p
- .model flat
.code
;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmInvd (
-; VOID
-; );
+; VOID *
+; EFIAPI
+; InternalMemSetMem (
+; IN VOID *Buffer,
+; IN UINTN Count,
+; IN UINT8 Value
+; )
;------------------------------------------------------------------------------
-_AsmInvd PROC
- invd
+InternalMemSetMem PROC USES rdi
+ mov rax, r8
+ mov rdi, rcx
+ xchg rcx, rdx
+ rep stosb
+ mov rax, rdx
ret
-_AsmInvd ENDP
+InternalMemSetMem ENDP
END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Wbinvd.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem16.asm index 9ffdec9474..fce9ed7ed5 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/Wbinvd.asm +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem16.asm @@ -1,38 +1,44 @@ -; Copyright (c) 2004, Intel Corporation
-; All rights reserved. This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
-; Wbinvd.Asm
+; SetMem16.Asm
;
; Abstract:
;
-; AsmWbinvd function
+; SetMem16 function
;
; Notes:
;
;------------------------------------------------------------------------------
- .486p
- .model flat,C
.code
;------------------------------------------------------------------------------
-; VOID
-; EFIAPI
-; AsmWbinvd (
-; VOID
-; );
+; VOID *
+; EFIAPI
+; InternalMemSetMem16 (
+; IN VOID *Buffer,
+; IN UINTN Count,
+; IN UINT16 Value
+; )
;------------------------------------------------------------------------------
-AsmWbinvd PROC
- wbinvd
+InternalMemSetMem16 PROC USES rdi
+ mov rdi, rcx
+ mov rax, r8
+ xchg rcx, rdx
+ rep stosw
+ mov rax, rdx
ret
-AsmWbinvd ENDP
+InternalMemSetMem16 ENDP
END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadTsc.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem32.asm index 8ff0ea40f4..ce9e54da85 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/ReadTsc.asm +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem32.asm @@ -1,38 +1,44 @@ -; Copyright (c) 2004, Intel Corporation
-; All rights reserved. This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD License
-; which accompanies this distribution. The full text of the license may be found at
-; http://opensource.org/licenses/bsd-license.php
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
-; ReadTsc.Asm
+; SetMem32.Asm
;
; Abstract:
;
-; AsmReadTsc function
+; SetMem32 function
;
; Notes:
;
;------------------------------------------------------------------------------
- .586p
- .model flat,C
.code
;------------------------------------------------------------------------------
-; UINT64
-; EFIAPI
-; AsmReadTsc (
-; VOID
-; );
+; VOID *
+; EFIAPI
+; InternalMemSetMem32 (
+; IN VOID *Buffer,
+; IN UINTN Count,
+; IN UINT32 Value
+; );
;------------------------------------------------------------------------------
-AsmReadTsc PROC
- rdtsc
+InternalMemSetMem32 PROC USES rdi
+ mov rdi, rcx
+ mov rax, r8
+ xchg rcx, rdx
+ rep stosd
+ mov rax, rdx
ret
-AsmReadTsc ENDP
+InternalMemSetMem32 ENDP
END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem64.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem64.asm new file mode 100644 index 0000000000..97884a36fe --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/SetMem64.asm @@ -0,0 +1,43 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; SetMem64.Asm
+;
+; Abstract:
+;
+; SetMem64 function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID *
+; InternalMemSetMem64 (
+; IN VOID *Buffer,
+; IN UINTN Count,
+; IN UINT64 Value
+; )
+;------------------------------------------------------------------------------
+InternalMemSetMem64 PROC USES rdi
+ mov rdi, rcx
+ mov rax, r8
+ xchg rcx, rdx
+ rep stosq
+ mov rax, rdx
+ ret
+InternalMemSetMem64 ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ZeroMem.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ZeroMem.asm new file mode 100644 index 0000000000..c01af8e6e4 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseMemoryLib/X64/ZeroMem.asm @@ -0,0 +1,47 @@ +;------------------------------------------------------------------------------
+;
+; Copyright (c) 2006, Intel Corporation
+; All rights reserved. This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD License
+; which accompanies this distribution. The full text of the license may be found at
+; http://opensource.org/licenses/bsd-license.php
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+; ZeroMem.Asm
+;
+; Abstract:
+;
+; ZeroMem function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID *
+; InternalMemZeroMem (
+; IN VOID *Buffer,
+; IN UINTN Count
+; );
+;------------------------------------------------------------------------------
+InternalMemZeroMem PROC USES rdi
+ push rcx
+ xor rax, rax
+ mov rdi, rcx
+ mov rcx, rdx
+ shr rcx, 3
+ and rdx, 7
+ rep stosq
+ mov ecx, edx
+ rep stosb
+ pop rax
+ ret
+InternalMemZeroMem ENDP
+
+ END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciCf8Lib/BasePciCf8Lib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciCf8Lib/BasePciCf8Lib.inf index 94af7735c8..071dfc9af1 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciCf8Lib/BasePciCf8Lib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciCf8Lib/BasePciCf8Lib.inf @@ -67,7 +67,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -80,5 +80,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciExpressLib/BasePciExpressLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciExpressLib/BasePciExpressLib.inf index b408dc3f4d..6261c5c47c 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciExpressLib/BasePciExpressLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciExpressLib/BasePciExpressLib.inf @@ -1,4 +1,4 @@ -#/*++
+#/*++
#
# Copyright (c) 2004 - 2006, Intel Corporation
# All rights reserved. This program and the accompanying materials
@@ -66,7 +66,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -79,5 +79,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciLibCf8/BasePciLibCf8.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciLibCf8/BasePciLibCf8.inf index 2196639d52..d08f7ee3e0 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciLibCf8/BasePciLibCf8.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciLibCf8/BasePciLibCf8.inf @@ -64,7 +64,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -77,5 +77,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf index 84af9d6161..0df887f48e 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf @@ -64,7 +64,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -77,5 +77,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf index 7b272bf2e4..e1a3767dd0 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf @@ -66,7 +66,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -79,5 +79,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePeCoffLib/BasePeCoffLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePeCoffLib/BasePeCoffLib.inf index 8c9f6bc31b..85d5722f14 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePeCoffLib/BasePeCoffLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePeCoffLib/BasePeCoffLib.inf @@ -66,7 +66,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -79,5 +79,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf index 4911096127..0c71b4bdab 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf @@ -64,7 +64,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -77,5 +77,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf index f7376ca098..07e21773aa 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf @@ -67,7 +67,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -80,5 +80,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePrintLib/BasePrintLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePrintLib/BasePrintLib.inf index 4e1030920d..7d815df709 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePrintLib/BasePrintLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePrintLib/BasePrintLib.inf @@ -65,7 +65,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -78,5 +78,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/BaseTimerLibLocalApic.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/BaseTimerLibLocalApic.inf index d84842b2bb..c734168451 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/BaseTimerLibLocalApic.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/BaseTimerLibLocalApic.inf @@ -24,12 +24,13 @@ BASE_NAME = EdkIIGlueBaseTimerLibLocalApic COMPONENT_TYPE = LIBRARY
[sources.common]
-
[sources.ia32]
x86TimerLib.c
+ Ia32\x86LocalApicTimerInitialize.asm
[sources.x64]
x86TimerLib.c
+ X64\x86LocalApicTimerInitialize.asm
[sources.ipf]
Ipf/IpfTimerLib.c
@@ -67,7 +68,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -80,5 +81,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuSleep.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/Ia32/x86LocalApicTimerInitialize.asm index 4220834104..428cc64a41 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/CpuSleep.asm +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/Ia32/x86LocalApicTimerInitialize.asm @@ -1,4 +1,4 @@ -; Copyright (c) 2004, Intel Corporation
+; 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
@@ -9,11 +9,11 @@ ;
; Module Name:
;
-; CpuSleep.Asm
+; x86LocalApicTimerInitialize.Asm
;
; Abstract:
;
-; CpuSleep function
+; Initialize Local Apic Timer
;
; Notes:
;
@@ -23,16 +23,21 @@ .model flat,C
.code
+InternalX86GetApicBase PROTO C
+
;------------------------------------------------------------------------------
; VOID
; EFIAPI
-; CpuSleep (
+; CpuInitLocalApicTimer (
; VOID
; );
;------------------------------------------------------------------------------
-CpuSleep PROC
- hlt
+CpuInitLocalApicTimer PROC
+ call InternalX86GetApicBase
+ mov dword ptr ds:[eax + 3e0h], 0ah
+ bts dword ptr ds:[eax + 320h], 17
+ mov dword ptr ds:[eax + 380h], -1
ret
-CpuSleep ENDP
+CpuInitLocalApicTimer ENDP
END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/Ipf/IpfTimerLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/Ipf/IpfTimerLib.c index 524d973c16..fb4fb5a9cd 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/Ipf/IpfTimerLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/Ipf/IpfTimerLib.c @@ -47,14 +47,14 @@ InternalIpfDelay ( //
// The target timer count is calculated here
//
- Ticks = IpfReadItc () + Delay;
+ Ticks = (INT64)AsmReadItc () + Delay;
//
// Wait until time out
// Delay > 2^63 could not be handled by this function
// Timer wrap-arounds are handled correctly by this function
//
- while (Ticks - IpfReadItc () >= 0);
+ while (Ticks - (INT64)AsmReadItc() >= 0);
}
/**
@@ -123,7 +123,7 @@ GetPerformanceCounter ( VOID
)
{
- return IpfReadItc ();
+ return AsmReadItc ();
}
/**
@@ -156,7 +156,7 @@ GetPerformanceCounterProperties ( OUT UINT64 *EndValue OPTIONAL
)
{
- PAL_PROC_RETURN PalRet;
+ PAL_CALL_RETURN PalRet;
UINT64 BaseFrequence;
PalRet = PalCallStatic (NULL, 13, 0, 0, 0);
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr0.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/X64/x86LocalApicTimerInitialize.asm index d87c7e323d..c15b7208da 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ia32/WriteCr0.asm +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/X64/x86LocalApicTimerInitialize.asm @@ -1,4 +1,4 @@ -; Copyright (c) 2004, Intel Corporation
+; 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
@@ -9,31 +9,33 @@ ;
; Module Name:
;
-; WriteCr0.Asm
+; x86LocalApicTimerInitialize.Asm
;
; Abstract:
;
-; AsmWriteCr0 function
+; Initialize Local Apic Timer
;
; Notes:
;
;------------------------------------------------------------------------------
- .386p
- .model flat,C
.code
+EXTERNDEF InternalX86GetApicBase:PROC
+
;------------------------------------------------------------------------------
-; UINTN
+; VOID
; EFIAPI
-; AsmWriteCr0 (
-; UINTN Cr0
+; CpuInitLocalApicTimer (
+; VOID
; );
;------------------------------------------------------------------------------
-AsmWriteCr0 PROC
- mov eax, [esp + 4]
- mov cr0, eax
+CpuInitLocalApicTimer PROC
+ call InternalX86GetApicBase
+ mov dword ptr [rax + 3e0h], 0ah
+ bts dword ptr [rax + 320h], 17
+ mov dword ptr [rax + 380h], -1
ret
-AsmWriteCr0 ENDP
+CpuInitLocalApicTimer ENDP
END
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/x86TimerLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/x86TimerLib.c index be4d8c1d35..e2f97b7e59 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/x86TimerLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/x86TimerLib.c @@ -38,6 +38,26 @@ CONST UINT8 mTimerLibLocalApicDivisor[] = { 0x20, 0x40, 0x80, 0x01
};
+VOID
+CpuInitLocalApicTimer (
+ VOID
+ );
+
+/**
+ Local Apic Timer Initialize
+ Local Apic Timer needs to be initialized before being used
+ **/
+EFI_STATUS
+EFIAPI
+BaseTimerLibLocalApicInit (
+ VOID
+ )
+{
+ CpuInitLocalApicTimer();
+
+ return EFI_SUCCESS;
+}
+
/**
Internal function to retrieve the base address of local APIC.
@@ -46,7 +66,6 @@ CONST UINT8 mTimerLibLocalApicDivisor[] = { @return The base address of local APIC
**/
-STATIC
UINTN
InternalX86GetApicBase (
VOID
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf index bc1c6dc7c3..62b093a70d 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf @@ -61,7 +61,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -74,5 +74,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeHobLib/DxeHobLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeHobLib/DxeHobLib.inf index 64cdfeccf9..d6989370d3 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeHobLib/DxeHobLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeHobLib/DxeHobLib.inf @@ -67,7 +67,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -80,5 +80,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.inf index a721a14ff3..e069234ab4 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.inf @@ -63,7 +63,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -76,5 +76,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf index ad90935a99..0339bae047 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf @@ -64,7 +64,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -77,5 +77,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxePerformanceLib/DxePerformanceLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxePerformanceLib/DxePerformanceLib.inf new file mode 100644 index 0000000000..efcb27261d --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxePerformanceLib/DxePerformanceLib.inf @@ -0,0 +1,85 @@ +#/*++
+#
+# Copyright (c) 2004 - 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+# DxePerformanceLib.inf
+#
+# Abstract:
+#
+# Component description file for DxePerformanceLib. This library provides
+# routines used by START_PERF() and END_PERF()
+#
+#--*/
+
+[defines]
+BASE_NAME = EdkIIGlueDxePerformanceLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ PerformanceLib.c
+
+[sources.ia32]
+
+[sources.x64]
+
+[sources.ipf]
+
+[sources.ebc]
+
+
+[includes.common]
+ .
+ ..\..\Include
+ ..\..\include\Library
+ $(EDK_SOURCE)\Foundation
+ $(EDK_SOURCE)\Foundation\Framework
+ $(EDK_SOURCE)\Foundation\Efi
+ $(EDK_SOURCE)\Foundation\Include
+ $(EDK_SOURCE)\Foundation\Efi\Include
+ $(EDK_SOURCE)\Foundation\Framework\Include
+ $(EDK_SOURCE)\Foundation\Include\IndustryStandard
+ $(EDK_SOURCE)\Foundation\Core\Dxe
+ $(EDK_SOURCE)\Foundation\Library\Dxe\Include
+ $(EDK_SOURCE)\Foundation\Cpu\Pentium\Include
+
+[libraries.common]
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGlueDxeMemoryAllocationLib
+ EdkIIGlueDxeHobLib
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiLib
+ EdkProtocolLib
+
+[libraries.ia32]
+
+
+[libraries.x64]
+
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
+ LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
+
+[nmake.ia32]
+ C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
+
+[nmake.x64]
+ C_FLAGS = $(C_FLAGS) /D MDE_CPU_X64
+
+[nmake.ipf]
+ C_FLAGS = $(C_FLAGS) /D MDE_CPU_IPF
+
+[nmake.ebc]
+ EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
+ EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxePerformanceLib/PerformanceLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxePerformanceLib/PerformanceLib.c new file mode 100644 index 0000000000..285056ee78 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxePerformanceLib/PerformanceLib.c @@ -0,0 +1,883 @@ +/*++
+
+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:
+
+ PerformanceLib.c
+
+Abstract:
+
+ Routines used by START_PERF() and END_PERF()
+
+--*/
+
+#include "EdkIIGlueDxe.h"
+
+
+#define EFI_PERFORMANCE_SIGNATURE EFI_SIGNATURE_32 ('P', 'E', 'R', 'F')
+#define EFI_PERFORMANCE_DATA_SIGNATURE EFI_SIGNATURE_32 ('P', 'E', 'D', 'A')
+
+#define GAUGE_DATA_FROM_GAUGE(_GaugeData) \
+ CR(_GaugeData, EFI_PERF_DATA_LIST, GaugeData, EFI_PERFORMANCE_DATA_SIGNATURE)
+
+#define GAUGE_DATA_FROM_LINK(_link) \
+ CR(_link, EFI_PERF_DATA_LIST, Link, EFI_PERFORMANCE_DATA_SIGNATURE)
+
+//
+// Performace protocol instance containing record macro
+//
+#define EFI_PERFORMANCE_FROM_THIS(a) \
+ CR(a, EFI_PERFORMANCE_INSTANCE, Perf, EFI_PERFORMANCE_SIGNATURE)
+
+
+typedef struct {
+ UINT32 Signature;
+ LIST_ENTRY Link;
+ EFI_GAUGE_DATA GaugeData;
+} EFI_PERF_DATA_LIST;
+
+//
+// Performance protocol instance data structure
+//
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+ EFI_PERFORMANCE_PROTOCOL Perf;
+ UINT8 Phase;
+} EFI_PERFORMANCE_INSTANCE;
+
+
+LIST_ENTRY mPerfDataHead = INITIALIZE_LIST_HEAD_VARIABLE(mPerfDataHead);
+
+
+STATIC
+VOID
+InternalGetTimerValue (
+ OUT UINT64 *TimerValue
+ )
+/*++
+
+Routine Description:
+
+ Set TimerValue with current tick.
+
+Arguments:
+
+ TimerValue - Timer value to be set
+
+Returns:
+
+ EFI_SUCCESS - TimerValue is set.
+
+--*/
+{
+ *TimerValue = AsmReadTsc ();
+}
+
+
+STATIC
+VOID
+GetShortPdbFileName (
+ CHAR8 *PdbFileName,
+ CHAR8 *GaugeString
+ )
+/*++
+
+Routine Description:
+
+Arguments:
+
+Returns:
+
+--*/
+{
+ UINTN Index;
+ UINTN Index1;
+ UINTN StartIndex;
+ UINTN EndIndex;
+
+ if (PdbFileName == NULL) {
+ AsciiStrCpy (GaugeString, " ");
+ } else {
+ StartIndex = 0;
+ for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
+ ;
+
+ for (Index = 0; PdbFileName[Index] != 0; Index++) {
+ if (PdbFileName[Index] == '\\') {
+ StartIndex = Index + 1;
+ }
+
+ if (PdbFileName[Index] == '.') {
+ EndIndex = Index;
+ }
+ }
+
+ Index1 = 0;
+ for (Index = StartIndex; Index < EndIndex; Index++) {
+ GaugeString[Index1] = PdbFileName[Index];
+ Index1++;
+ if (Index1 == EFI_PERF_PDBFILENAME_LENGTH - 1) {
+ break;
+ }
+ }
+
+ GaugeString[Index1] = 0;
+ }
+
+ return;
+}
+
+
+STATIC
+CHAR8 *
+GetPdbPath (
+ VOID *ImageBase
+ )
+/*++
+
+Routine Description:
+
+ Located PDB path name in PE image
+
+Arguments:
+
+ ImageBase - base of PE to search
+
+Returns:
+
+ Pointer into image at offset of PDB file name if PDB file name is found,
+ Otherwise a pointer to an empty string.
+
+--*/
+{
+ CHAR8 *PdbPath;
+ UINT32 DirCount;
+ EFI_IMAGE_DOS_HEADER *DosHdr;
+ EFI_IMAGE_NT_HEADERS *NtHdr;
+ UINT16 Magic;
+ EFI_IMAGE_OPTIONAL_HEADER32 *OptionalHdr32;
+ EFI_IMAGE_OPTIONAL_HEADER64 *OptionalHdr64;
+ EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
+ EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
+ VOID *CodeViewEntryPointer;
+
+ CodeViewEntryPointer = NULL;
+ PdbPath = NULL;
+ DosHdr = ImageBase;
+ if (DosHdr && DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
+ NtHdr = (EFI_IMAGE_NT_HEADERS *) ((UINT8 *) DosHdr + DosHdr->e_lfanew);
+ //
+ // NOTE: We use Machine to identify PE32/PE32+, instead of Magic.
+ // It is for backward-compatibility consideration, because
+ // some system will generate PE32+ image with PE32 Magic.
+ //
+ if (NtHdr->FileHeader.Machine == IMAGE_FILE_MACHINE_I386) {
+ Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
+ } else if (NtHdr->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64) {
+ Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
+ } else if (NtHdr->FileHeader.Machine == IMAGE_FILE_MACHINE_X64) {
+ Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
+ } else {
+ Magic = NtHdr->OptionalHeader.Magic;
+ }
+ if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
+ OptionalHdr32 = (VOID *) &NtHdr->OptionalHeader;
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *) &(OptionalHdr32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+ } else {
+ OptionalHdr64 = (VOID *) &NtHdr->OptionalHeader;
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *) &(OptionalHdr64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+ }
+
+ if (DirectoryEntry->VirtualAddress != 0) {
+ for (DirCount = 0;
+ (DirCount < DirectoryEntry->Size / sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)) && CodeViewEntryPointer == NULL;
+ DirCount++
+ ) {
+ DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (DirectoryEntry->VirtualAddress + (UINTN) ImageBase + DirCount * sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY));
+ if (DebugEntry->Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
+ CodeViewEntryPointer = (VOID *) ((UINTN) DebugEntry->RVA + (UINTN) ImageBase);
+ switch (*(UINT32 *) CodeViewEntryPointer) {
+ case CODEVIEW_SIGNATURE_NB10:
+ PdbPath = (CHAR8 *) CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY);
+ break;
+
+ case CODEVIEW_SIGNATURE_RSDS:
+ PdbPath = (CHAR8 *) CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY);
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return PdbPath;
+}
+
+
+STATIC
+VOID
+GetNameFromHandle (
+ IN EFI_HANDLE Handle,
+ OUT CHAR8 *GaugeString
+ )
+{
+ EFI_STATUS Status;
+ EFI_LOADED_IMAGE_PROTOCOL *Image;
+ CHAR8 *PdbFileName;
+ EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
+
+ AsciiStrCpy (GaugeString, " ");
+
+ //
+ // Get handle name from image protocol
+ //
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID**)&Image
+ );
+
+ if (EFI_ERROR (Status)) {
+ Status = gBS->OpenProtocol (
+ Handle,
+ &gEfiDriverBindingProtocolGuid,
+ (VOID **) &DriverBinding,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ return ;
+ }
+ //
+ // Get handle name from image protocol
+ //
+ Status = gBS->HandleProtocol (
+ DriverBinding->ImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ (VOID**)&Image
+ );
+ }
+
+ PdbFileName = GetPdbPath (Image->ImageBase);
+
+ if (PdbFileName != NULL) {
+ GetShortPdbFileName (PdbFileName, GaugeString);
+ }
+
+ return ;
+}
+
+
+EFI_PERF_DATA_LIST *
+CreateDataNode (
+ IN EFI_HANDLE Handle,
+ IN UINT16 *Token,
+ IN UINT16 *Host
+ )
+/*++
+
+Routine Description:
+
+ Create a EFI_PERF_DATA_LIST data node.
+
+Arguments:
+
+ Handle - Handle of gauge data
+ Token - Token of gauge data
+ Host - Host of gauge data
+
+Returns:
+
+ Pointer to a data node created.
+
+--*/
+{
+ EFI_PERF_DATA_LIST *Node;
+
+ //
+ // Allocate a new image structure
+ //
+ Node = AllocateZeroPool (sizeof (EFI_PERF_DATA_LIST));
+ if (Node != NULL) {
+
+ Node->Signature = EFI_PERFORMANCE_DATA_SIGNATURE;
+
+ Node->GaugeData.Handle = Handle;
+
+ if (Token != NULL) {
+ StrCpy ((Node->GaugeData).Token, Token);
+ }
+
+ if (Host != NULL) {
+ StrCpy ((Node->GaugeData).Host, Host);
+ }
+
+ if (Handle != NULL) {
+ GetNameFromHandle (Handle, Node->GaugeData.PdbFileName);
+ }
+ }
+
+ return Node;
+}
+
+
+EFI_PERF_DATA_LIST *
+GetDataNode (
+ IN EFI_HANDLE Handle,
+ IN UINT16 *Token,
+ IN UINT16 *Host,
+ IN EFI_GUID *GuidName,
+ IN EFI_GAUGE_DATA *PrevGauge
+ )
+/*++
+
+Routine Description:
+
+ Search gauge node list to find one node with matched handle, token, host and Guid name.
+
+Arguments:
+
+ Handle - Handle to match
+ Token - Token to match
+ Host - Host to match
+ GuidName - Guid name to match
+ PrevGauge - Start node, start from list head if NULL
+
+Returns:
+
+ Return pointer to the node found, NULL if not found.
+
+--*/
+{
+ EFI_PERF_DATA_LIST *Node;
+ EFI_PERF_DATA_LIST *Temp;
+ EFI_PERF_DATA_LIST *Temp2;
+ LIST_ENTRY *CurrentLink;
+ EFI_GUID NullGuid = EFI_NULL_GUID;
+
+ Node = NULL;
+ Temp = NULL;
+ Temp2 = NULL;
+
+ if (PrevGauge == NULL) {
+ CurrentLink = mPerfDataHead.ForwardLink;
+ } else {
+ Temp2 = GAUGE_DATA_FROM_GAUGE (PrevGauge);
+ CurrentLink = (Temp2->Link).ForwardLink;
+ }
+
+ while (CurrentLink && CurrentLink != &mPerfDataHead) {
+ Node = GAUGE_DATA_FROM_LINK (CurrentLink);
+
+ if (Handle == 0 && Token == NULL && Host == NULL && GuidName == NULL) {
+ return Node;
+ }
+
+ if (Handle != (Node->GaugeData).Handle) {
+ CurrentLink = CurrentLink->ForwardLink;
+ continue;
+ }
+
+ if (GuidName == NULL && !CompareGuid (&((Node->GaugeData).GuidName), &NullGuid)) {
+ CurrentLink = CurrentLink->ForwardLink;
+ continue;
+ }
+
+ if (GuidName && !CompareGuid (&((Node->GaugeData).GuidName), GuidName)) {
+ CurrentLink = CurrentLink->ForwardLink;
+ continue;
+ }
+
+ if (Token == NULL && StrCmp (Node->GaugeData.Token, L"")) {
+ CurrentLink = CurrentLink->ForwardLink;
+ continue;
+ }
+
+ if (Token && StrCmp (Node->GaugeData.Token, Token)) {
+ CurrentLink = CurrentLink->ForwardLink;
+ continue;
+ }
+
+ if (Host == NULL && StrCmp (Node->GaugeData.Host, L"")) {
+ CurrentLink = CurrentLink->ForwardLink;
+ continue;
+ }
+
+ if (Host && StrCmp (Node->GaugeData.Host, Host)) {
+ CurrentLink = CurrentLink->ForwardLink;
+ continue;
+ }
+
+ Temp = Node;
+ break;
+ }
+
+ return Temp;
+}
+
+
+EFI_STATUS
+GetPeiPerformance (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable,
+ IN UINT64 Ticker
+ )
+/*++
+
+Routine Description:
+
+ Transfer PEI performance data to gauge data node.
+
+Arguments:
+
+ ImageHandle - Standard entry point parameter
+ SystemTable - Standard entry point parameter
+ Ticker - Start tick
+
+Returns:
+
+ EFI_OUT_OF_RESOURCES - No enough resource to create data node.
+ EFI_SUCCESS - Transfer done successfully.
+
+--*/
+{
+ EFI_STATUS Status;
+ VOID *HobList;
+ EFI_HOB_GUID_TYPE *GuidHob;
+ EFI_HOB_GUID_DATA_PERFORMANCE_LOG *LogHob;
+ PEI_PERFORMANCE_MEASURE_LOG_ENTRY *LogEntry;
+ UINT32 Index;
+ EFI_PERF_DATA_LIST *Node;
+ UINT64 TimerValue;
+
+ Node = CreateDataNode (0, PEI_TOK, NULL);
+ if (!Node) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (Ticker != 0) {
+ TimerValue = Ticker;
+ } else {
+ InternalGetTimerValue (&TimerValue);
+ }
+ (Node->GaugeData).EndTick = TimerValue;
+
+ InsertTailList (&mPerfDataHead, &(Node->Link));
+
+ Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, &HobList);
+ ASSERT_EFI_ERROR (Status);
+
+ do {
+ GuidHob = (EFI_HOB_GUID_TYPE *)GlueGetNextGuidHob (&gEfiPeiPerformanceHobGuid, &HobList);
+ LogHob = (EFI_HOB_GUID_DATA_PERFORMANCE_LOG *)GET_GUID_HOB_DATA (GuidHob);
+
+ for (Index = 0; Index < LogHob->NumberOfEntries; Index++) {
+ LogEntry = &(LogHob->Log[Index]);
+ Node = CreateDataNode (0, LogEntry->DescriptionString, NULL);
+ if (!Node) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ (Node->GaugeData).StartTick = LogEntry->StartTimeCount;
+
+ CopyMem (&(Node->GaugeData.GuidName), &LogEntry->Name, sizeof (EFI_GUID));
+
+ InsertTailList (&mPerfDataHead, &(Node->Link));
+
+ (Node->GaugeData).EndTick = LogEntry->StopTimeCount;
+ }
+ } while (!EFI_ERROR (Status));
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+EFIAPI
+StartGauge (
+ IN EFI_PERFORMANCE_PROTOCOL *This,
+ IN EFI_HANDLE Handle,
+ IN UINT16 *Token,
+ IN UINT16 *Host,
+ IN UINT64 Ticker
+ )
+/*++
+
+Routine Description:
+
+ Create a guage data node and initialized it.
+
+Arguments:
+
+ This - Calling context
+ Handle - Handle of gauge data
+ Token - Token of gauge data
+ Host - Host of gauge data
+ Ticker - Set gauge data's StartTick. If 0, StartTick is current timer.
+
+Returns:
+
+ EFI_SUCCESS - Successfully create and initialized a guage data node.
+ EFI_OUT_OF_RESOURCES - No enough resource to create a guage data node.
+
+--*/
+{
+ EFI_PERFORMANCE_INSTANCE *PerfInstance;
+ EFI_PERF_DATA_LIST *Node;
+ UINT64 TimerValue;
+
+ TimerValue = 0;
+ PerfInstance = EFI_PERFORMANCE_FROM_THIS (This);
+
+ Node = CreateDataNode (Handle, Token, Host);
+ if (!Node) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ if (Ticker != 0) {
+ TimerValue = Ticker;
+ } else {
+ InternalGetTimerValue (&TimerValue);
+ }
+
+ Node->GaugeData.StartTick = TimerValue;
+
+ if (!StrCmp (Token, DXE_TOK)) {
+ PerfInstance->Phase = DXE_PHASE;
+ }
+
+ if (!StrCmp (Token, SHELL_TOK)) {
+ PerfInstance->Phase = SHELL_PHASE;
+ }
+
+ Node->GaugeData.Phase = PerfInstance->Phase;
+
+ InsertTailList (&mPerfDataHead, &(Node->Link));
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+EFIAPI
+EndGauge (
+ IN EFI_PERFORMANCE_PROTOCOL *This,
+ IN EFI_HANDLE Handle,
+ IN UINT16 *Token,
+ IN UINT16 *Host,
+ IN UINT64 Ticker
+ )
+/*++
+
+Routine Description:
+
+ End all unfinished gauge data node that match specified handle, token and host.
+
+Arguments:
+
+ This - Calling context
+ Handle - Handle to stop
+ Token - Token to stop
+ Host - Host to stop
+ Ticker - End tick, if 0 then get current timer
+
+Returns:
+
+ EFI_NOT_FOUND - Node not found
+ EFI_SUCCESS - Gauge data node successfully ended.
+
+--*/
+{
+ EFI_PERFORMANCE_INSTANCE *PerfInstance;
+ EFI_PERF_DATA_LIST *Node;
+ UINT64 TimerValue;
+
+ TimerValue = 0;
+ PerfInstance = EFI_PERFORMANCE_FROM_THIS (This);
+
+ Node = GetDataNode (Handle, Token, Host, NULL, NULL);
+ if (!Node) {
+ return EFI_NOT_FOUND;
+ }
+
+ while (Node->GaugeData.EndTick != 0) {
+ Node = GetDataNode (Handle, Token, Host, NULL, &(Node->GaugeData));
+ if (!Node) {
+ return EFI_NOT_FOUND;
+ }
+ }
+
+ if (Ticker != 0) {
+ TimerValue = Ticker;
+ } else {
+ InternalGetTimerValue (&TimerValue);
+ }
+
+ Node->GaugeData.EndTick = TimerValue;
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_GAUGE_DATA *
+EFIAPI
+GetGauge (
+ IN EFI_PERFORMANCE_PROTOCOL *This,
+ IN EFI_HANDLE Handle,
+ IN UINT16 *Token,
+ IN UINT16 *Host,
+ IN EFI_GAUGE_DATA *PrevGauge
+ )
+/*++
+
+Routine Description:
+ Get gauge.
+
+Arguments:
+ This - A pointer to the EFI_PERFORMANCE_PROTOCOL.
+ Handle - A pointer of a efi handle.
+ Token - A pointer to the token.
+ Host - A pointer to the host.
+ PrevGauge - A pointer to the EFI_GAUGE_DATA structure.
+
+
+Returns:
+ Status code.
+
+--*/
+{
+ EFI_PERFORMANCE_INSTANCE *PerfInstance;
+ EFI_PERF_DATA_LIST *Node;
+
+ PerfInstance = EFI_PERFORMANCE_FROM_THIS (This);
+
+ Node = GetDataNode (Handle, Token, Host, NULL, PrevGauge);
+ if (Node != NULL) {
+ return &(Node->GaugeData);
+ } else {
+ return NULL;
+ }
+}
+
+
+//
+// Install Performance Protocol
+//
+// This is the support routine for PERF_ENABLE() which is called on
+// an user's demand. This function isn't necessary to be called
+// automatically.
+//
+EFI_STATUS
+EFIAPI
+InitializePerformanceInfrastructure (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable,
+ IN UINT64 Ticker
+ )
+/*++
+
+Routine Description:
+
+ Install gEfiPerformanceProtocolGuid protocol and transfer PEI performance to gauge data nodes.
+
+Arguments:
+
+ ImageHandle - Standard driver entry point parameter
+ SystemTable - Standard driver entry point parameter
+ Ticker - End tick for PEI performance
+
+Returns:
+
+ EFI_OUT_OF_RESOURCES - No enough buffer to allocate
+ EFI_SUCCESS - Protocol installed.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_PERFORMANCE_INSTANCE *PerfInstance;
+
+ //
+ // Allocate a new image structure
+ //
+ PerfInstance = AllocateZeroPool (sizeof (EFI_PERFORMANCE_INSTANCE));
+ if (PerfInstance == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ PerfInstance->Signature = EFI_PERFORMANCE_SIGNATURE;
+ PerfInstance->Perf.StartGauge = StartGauge;
+ PerfInstance->Perf.EndGauge = EndGauge;
+ PerfInstance->Perf.GetGauge = GetGauge;
+
+ //
+ // Install the protocol interfaces
+ //
+ Status = gBS->InstallProtocolInterface (
+ &PerfInstance->Handle,
+ &gEfiPerformanceProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &PerfInstance->Perf
+ );
+
+ if (!EFI_ERROR (Status)) {
+ GetPeiPerformance (ImageHandle, SystemTable, Ticker);
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+EFI_STATUS
+EFIAPI
+StartMeasure (
+ EFI_HANDLE Handle,
+ IN UINT16 *Token,
+ IN UINT16 *Host,
+ IN UINT64 Ticker
+ )
+/*++
+
+Routine Description:
+
+ Start to gauge on a specified handle, token and host, with Ticker as start tick.
+
+Arguments:
+
+ Handle - Handle to measure
+ Token - Token to measure
+ Host - Host to measure
+ Ticker - Ticker as start tick
+
+Returns:
+
+ Status code.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_PERFORMANCE_PROTOCOL *Perf;
+
+ Status = gBS->LocateProtocol (&gEfiPerformanceProtocolGuid, NULL, (VOID **) &Perf);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ return Perf->StartGauge (Perf, Handle, Token, Host, Ticker);
+
+}
+
+
+EFI_STATUS
+EFIAPI
+EndMeasure (
+ EFI_HANDLE Handle,
+ IN UINT16 *Token,
+ IN UINT16 *Host,
+ IN UINT64 Ticker
+ )
+/*++
+
+Routine Description:
+
+ End gauging on a specified handle, token and host, with Ticker as end tick.
+
+Arguments:
+
+ Handle - Handle to stop
+ Token - Token to stop
+ Host - Host to stop
+ Ticker - Ticker as end tick
+
+Returns:
+
+ Status code.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_PERFORMANCE_PROTOCOL *Perf;
+
+ Status = gBS->LocateProtocol (&gEfiPerformanceProtocolGuid, NULL, (VOID **) &Perf);
+ if (Status != EFI_SUCCESS) {
+ return Status;
+ }
+
+ return (Perf->EndGauge( Perf, Handle, Token, Host, Ticker)) ;
+}
+
+
+EFI_STATUS
+EFIAPI
+UpdateMeasure (
+ EFI_HANDLE Handle,
+ IN UINT16 *Token,
+ IN UINT16 *Host,
+ EFI_HANDLE HandleNew,
+ IN UINT16 *TokenNew,
+ IN UINT16 *HostNew
+ )
+/*++
+
+Routine Description:
+ Update measure.
+
+Arguments:
+ Handle - A pointer of an efi handle.
+ Token - A pointer to the token.
+ Host - A pointer to the host.
+ HandleNew - A pointer of an new efi handle.
+ TokenNew - A pointer to the new token.
+ HostNew - A pointer to the new host.
+
+Returns:
+ Status code.
+
+ EFI_NOT_FOUND - The speicified gauge data node not found.
+
+ EFI_SUCCESS - Update successfully.
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_GAUGE_DATA *GaugeData;
+ EFI_PERFORMANCE_PROTOCOL *Perf;
+
+ Status = gBS->LocateProtocol (&gEfiPerformanceProtocolGuid, NULL, (VOID **) &Perf);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ GaugeData = Perf->GetGauge (Perf, Handle, Token, Host, NULL);
+ if (!GaugeData) {
+ return EFI_NOT_FOUND;
+ }
+
+ GaugeData->Handle = HandleNew;
+ if (HostNew != NULL) {
+ StrCpy (GaugeData->Host, HostNew);
+ } else {
+ StrCpy (GaugeData->Host, L"");
+ }
+
+ if (TokenNew != NULL) {
+ StrCpy (GaugeData->Token, TokenNew);
+ } else {
+ StrCpy (GaugeData->Token, L"");
+ }
+
+ return EFI_SUCCESS;
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf index 766559c18b..d7a6f2eee3 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf @@ -80,7 +80,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -93,5 +93,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeServicesTableLib/DxeServicesTableLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeServicesTableLib/DxeServicesTableLib.inf index f3be24fbb2..efcfd31051 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeServicesTableLib/DxeServicesTableLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeServicesTableLib/DxeServicesTableLib.inf @@ -62,7 +62,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -75,5 +75,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeSmbusLib/DxeSmbusLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeSmbusLib/DxeSmbusLib.inf index a3819b20ea..cbc2d3ded8 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeSmbusLib/DxeSmbusLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeSmbusLib/DxeSmbusLib.inf @@ -65,7 +65,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -78,5 +78,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/Common/RuntimeLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/Common/RuntimeLib.c index 73ed44ffc3..36cf5fcd2c 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/Common/RuntimeLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/Common/RuntimeLib.c @@ -121,7 +121,7 @@ RuntimeDriverLibConstruct ( ASSERT_EFI_ERROR (Status);
- return EFI_SUCCESS;
+ return Status;
}
/**
@@ -147,8 +147,8 @@ RuntimeDriverLibDeconstruct ( ASSERT (gBS != NULL);
Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);
ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
+
+ return Status;
}
/**
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/EdkDxeRuntimeDriverLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/EdkDxeRuntimeDriverLib.inf index aa4f6acf01..734db91adb 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/EdkDxeRuntimeDriverLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/EdkDxeRuntimeDriverLib.inf @@ -79,7 +79,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -92,5 +92,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/Ipf/RuntimeLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/Ipf/RuntimeLib.c index 9f262301e7..777ff2a8ab 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/Ipf/RuntimeLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/Ipf/RuntimeLib.c @@ -57,6 +57,7 @@ Returns: }
}
+STATIC
VOID
EFIAPI
RuntimeLibVirtualNotifyEvent (
@@ -147,7 +148,8 @@ Returns: EFI_STATUS
EFIAPI
RuntimeDriverLibDeconstruct (
- VOID
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
@@ -199,9 +201,12 @@ Returns: --*/
{
- EFI_GUID Guid = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid;
SAL_RETURN_REGS ReturnReg;
+ *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO;
+ *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI;
+
ReturnReg = EfiCallEsalService (&Guid, IsEfiRuntime, 0, 0, 0, 0, 0, 0, 0);
return (BOOLEAN) (ReturnReg.r9 == 1);
@@ -225,9 +230,12 @@ Returns: --*/
{
- EFI_GUID Guid = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid;
SAL_RETURN_REGS ReturnReg;
+ *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO;
+ *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI;
+
ReturnReg = EfiCallEsalService (&Guid, IsVirtual, 0, 0, 0, 0, 0, 0, 0);
return (BOOLEAN) (ReturnReg.r9 == 1);
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/Ipf/RuntimeService.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/Ipf/RuntimeService.c index d4010b264b..c92bf3f1f9 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/Ipf/RuntimeService.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeRuntimeDriverLib/Ipf/RuntimeService.c @@ -50,7 +50,10 @@ Returns: --*/
{
- EFI_GUID Guid = EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid;
+
+ *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_LO;
+ *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_HI;
EfiCallEsalService (
&Guid,
@@ -96,7 +99,10 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid;
+
+ *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO;
+ *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI;
ReturnReg = EfiCallEsalService (&Guid, GetTime, (UINT64) Time, (UINT64) Capabilities, 0, 0, 0, 0, 0);
return ReturnReg.Status;
@@ -124,7 +130,10 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid;
+
+ *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO;
+ *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI;
ReturnReg = EfiCallEsalService (&Guid, SetTime, (UINT64) Time, 0, 0, 0, 0, 0, 0);
return ReturnReg.Status;
@@ -156,7 +165,10 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid;
+
+ *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO;
+ *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI;
ReturnReg = EfiCallEsalService (&Guid, GetWakeupTime, (UINT64) Enabled, (UINT64) Pending, (UINT64) Time, 0, 0, 0, 0);
return ReturnReg.Status;
@@ -187,7 +199,10 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid;
+
+ *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO;
+ *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI;
ReturnReg = EfiCallEsalService (&Guid, SetWakeupTime, (UINT64) Enable, (UINT64) Time, 0, 0, 0, 0, 0);
return ReturnReg.Status;
@@ -226,7 +241,10 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid;
+
+ *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO;
+ *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI;
ReturnReg = EfiCallEsalService (
&Guid,
@@ -273,7 +291,10 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid;
+
+ *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO;
+ *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI;
ReturnReg = EfiCallEsalService (
&Guid,
@@ -320,7 +341,10 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid;
+
+ *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO;
+ *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI;
ReturnReg = EfiCallEsalService (
&Guid,
@@ -358,7 +382,10 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid;
+
+ *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_LO;
+ *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_HI;
ReturnReg = EfiCallEsalService (&Guid, GetNextHighMonotonicCount, (UINT64) HighCount, 0, 0, 0, 0, 0, 0);
return (EFI_STATUS) ReturnReg.Status;
@@ -472,7 +499,10 @@ EfiSetVirtualAddressMap ( )
{
SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid;
+
+ *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO;
+ *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI;
ReturnReg = EfiCallEsalService (
&Guid,
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeSalLib/EdkDxeSalLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeSalLib/EdkDxeSalLib.inf index fabb4edb2f..a9f0b1bb01 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeSalLib/EdkDxeSalLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeSalLib/EdkDxeSalLib.inf @@ -66,7 +66,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -79,5 +79,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c index 377ac79a62..e07f52a27b 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c @@ -25,6 +25,7 @@ Abstract: EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService = NULL;
EFI_PLABEL mPlabel;
+STATIC
EFI_STATUS
EFIAPI
DxeSalLibInitialize (
@@ -46,7 +47,7 @@ DxeSalLibInitialize ( // virtual). So lets grap the physical PLABEL for the EsalEntryPoint and store it
// away. We cache it in a module global, so we can register the vitrual version.
//
- Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, &mEsalBootService);
+ Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, (VOID **) &mEsalBootService);
if (EFI_ERROR (Status)) {
mEsalBootService = NULL;
return EFI_SUCCESS;
@@ -63,46 +64,6 @@ DxeSalLibInitialize ( EFI_STATUS
EFIAPI
-DxeSalLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- return DxeSalLibInitialize ();
-}
-
-VOID
-EFIAPI
-DxeSalVirtualNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Fixup virtual address pointer of label.
-
-Arguments:
-
- Event - The Event that is being processed
-
- Context - Event Context
-
-Returns:
-
- None
-
---*/
-{
- EfiConvertPointer (0x0, (VOID **) &mPlabel.EntryPoint);
- EfiConvertPointer (EFI_IPF_GP_POINTER, (VOID **) &mPlabel.GP);
-
- SetEsalVirtualEntryPoint (mPlabel.EntryPoint, mPlabel.GP);
-}
-
-EFI_STATUS
-EFIAPI
RegisterEsalFunction (
IN UINT64 FunctionId,
IN EFI_GUID *ClassGuid,
@@ -118,11 +79,11 @@ Routine Description: Arguments:
FunctionId - ID of function to register
- ClassGuid - GUID of function class
+ ClassGuid - GUID of function class
Function - Function to register under ClassGuid/FunctionId pair
ModuleGlobal - Module global for Function.
-Returns:
+Returns:
EFI_SUCCESS - If ClassGuid/FunctionId Function was registered.
--*/
@@ -152,12 +113,12 @@ Routine Description: This function is boot service only!
Arguments:
- ClassGuid - GUID of function class
+ ClassGuid - GUID of function class
ModuleGlobal - Module global for Function.
- ... - SAL_INTERNAL_EXTENDED_SAL_PROC and FunctionId pairs. NULL
+ ... - SAL_INTERNAL_EXTENDED_SAL_PROC and FunctionId pairs. NULL
indicates the end of the list.
-Returns:
+Returns:
EFI_SUCCESS - All members of ClassGuid registered
--*/
@@ -212,7 +173,7 @@ EfiCallEsalService ( Routine Description:
- Call module that is not linked direclty to this module. This code is IP
+ Call module that is not linked direclty to this module. This code is IP
relative and hides the binding issues of virtual or physical calling. The
function that gets dispatched has extra arguments that include the registered
module global and a boolean flag to indicate if the system is in virutal mode.
@@ -228,7 +189,7 @@ Arguments: Arg7 - Argument 7 ClassGuid/FunctionId defined
Arg8 - Argument 8 ClassGuid/FunctionId defined
-Returns:
+Returns:
Status of ClassGuid/FuncitonId
--*/
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/HiiLib/HiiLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/HiiLib/HiiLib.c index e0f7be081b..302747eaf9 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/HiiLib/HiiLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/HiiLib/HiiLib.c @@ -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
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
@@ -22,6 +22,7 @@ Abstract: #include "EdkIIGlueDxe.h"
+#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
/**
This function allocates pool for an EFI_HII_PACKAGES structure
with enough space for the variable argument list of package pointers.
@@ -68,3 +69,4 @@ GluePreparePackages ( return HiiPackages;
}
+#endif
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/HiiLib/HiiLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/HiiLib/HiiLib.inf index 102cd8693d..3d6412b4d1 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/HiiLib/HiiLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/HiiLib/HiiLib.inf @@ -62,7 +62,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -75,5 +75,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c index d21e5174a3..ff6405f88c 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c @@ -211,86 +211,3 @@ DebugClearMemory ( return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
}
-
-/**
-
- 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 (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-
-/**
-
- 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 (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-
-/**
-
- 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 (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-
-/**
-
- 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 (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf index 270f7f61b4..eee03b3e12 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf @@ -1,4 +1,4 @@ -#/*++
+#/*++
#
# Copyright (c) 2004 - 2006, Intel Corporation
# All rights reserved. This program and the accompanying materials
@@ -72,7 +72,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -85,5 +85,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf index 9b346dd00e..b51d73ef8b 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf @@ -66,7 +66,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -79,5 +79,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiHobLib/HobLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiHobLib/HobLib.c index 55b7242ced..0d2ba02a7b 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiHobLib/HobLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiHobLib/HobLib.c @@ -493,7 +493,7 @@ BuildStackHob ( CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocStackGuid);
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
Hob->AllocDescriptor.MemoryLength = Length;
- Hob->AllocDescriptor.MemoryType = EfiConventionalMemory;
+ Hob->AllocDescriptor.MemoryType = EfiBootServicesData;
//
// Zero the reserved space to match HOB spec
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiHobLib/PeiHobLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiHobLib/PeiHobLib.inf index 0ec70a3208..a9ce3f6f92 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiHobLib/PeiHobLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiHobLib/PeiHobLib.inf @@ -66,7 +66,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -79,5 +79,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf index 8cfa7f15ff..f4ddc17e9b 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf @@ -70,7 +70,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -83,5 +83,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiPerformanceLib/PeiPerformanceLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiPerformanceLib/PeiPerformanceLib.inf new file mode 100644 index 0000000000..ec0a4b4939 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiPerformanceLib/PeiPerformanceLib.inf @@ -0,0 +1,93 @@ +#/*++
+#
+# Copyright (c) 2004 - 2006, Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+# Module Name:
+#
+# PeiPerformanceLib.inf
+#
+# Abstract:
+#
+# Component description file for PeiPerformanceLib
+#
+#--*/
+
+[defines]
+BASE_NAME = EdkIIGluePeiPerformanceLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ PerformanceLib.c
+
+[sources.ia32]
+
+
+[sources.x64]
+
+
+[sources.ipf]
+
+
+[sources.ebc]
+
+
+[includes.common]
+ .
+ ..\..\Include
+ ..\..\include\Library
+ $(EDK_SOURCE)\Foundation
+ $(EDK_SOURCE)\Foundation\Include\Pei
+ $(EDK_SOURCE)\Foundation\Framework
+ $(EDK_SOURCE)\Foundation\Efi
+ $(EDK_SOURCE)\Foundation\Include
+ $(EDK_SOURCE)\Foundation\Efi\Include
+ $(EDK_SOURCE)\Foundation\Framework\Include
+ $(EDK_SOURCE)\Foundation\Include\IndustryStandard
+ $(EDK_SOURCE)\Foundation\Core\Dxe
+ $(EDK_SOURCE)\Foundation\Library\Dxe\Include
+ $(EDK_SOURCE)\Foundation\Cpu\Pentium\Include
+ $(EDK_SOURCE)\Foundation\Framework\Guid\DataHubRecords
+ $(EDK_SOURCE)\Foundation\Framework\Guid\StatusCodeDataTypeId
+
+[libraries.common]
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiServicesLib
+
+[libraries.ia32]
+
+
+
+[libraries.x64]
+
+
+[libraries.ipf]
+
+
+[libraries.ebc]
+
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
+ LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
+
+[nmake.ia32]
+ C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
+
+[nmake.x64]
+ C_FLAGS = $(C_FLAGS) /D MDE_CPU_X64
+
+[nmake.ipf]
+ C_FLAGS = $(C_FLAGS) /D MDE_CPU_IPF
+
+[nmake.ebc]
+ EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
+ EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiPerformanceLib/PerformanceLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiPerformanceLib/PerformanceLib.c new file mode 100644 index 0000000000..2080a76ad4 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiPerformanceLib/PerformanceLib.c @@ -0,0 +1,241 @@ +/*++
+
+Copyright (c) 2004 - 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+
+Module Name:
+
+ PerformanceLib.c
+
+Abstract:
+
+ Support routines used by PEI_PERF_START() and PEI_PERF_END()
+
+--*/
+
+#include "EdkIIGluePeim.h"
+
+
+#define MAX_PEI_PERF_LOG_ENTRIES 28
+
+
+STATIC
+VOID
+InternalGetTimerValue (
+ OUT UINT64 *TimerValue
+ )
+/*++
+
+Routine Description:
+
+ Set TimerValue with current tick.
+
+Arguments:
+
+ TimerValue - Timer value to be set
+
+Returns:
+
+ EFI_SUCCESS - TimerValue is set.
+
+--*/
+{
+ *TimerValue = AsmReadTsc ();
+}
+
+
+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:
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_HOB_GUID_TYPE *Hob;
+ EFI_HOB_GUID_DATA_PERFORMANCE_LOG *PerfHobData;
+ PEI_PERFORMANCE_MEASURE_LOG_ENTRY *Log;
+ EFI_PEI_PPI_DESCRIPTOR *PerfHobDescriptor;
+ UINT64 TimeCount;
+ INTN Index;
+ UINTN Index2;
+ EFI_GUID *Guid;
+ EFI_GUID *CheckGuid;
+
+ TimeCount = 0;
+ //
+ // Get the END time as early as possible to make it more accurate.
+ //
+ if (EntryExit) {
+ InternalGetTimerValue (&TimeCount);
+ }
+
+ //
+ // Locate the Pei Performance Log Hob.
+ //
+ Status = PeiServicesLocatePpi (
+ &gEfiPeiPerformanceHobGuid,
+ 0,
+ &PerfHobDescriptor,
+ NULL
+ );
+
+ //
+ // If the Performance Hob was not found, build and install one.
+ //
+ if (EFI_ERROR(Status)) {
+ Hob = BuildGuidHob (
+ &gEfiPeiPerformanceHobGuid,
+ (sizeof(EFI_HOB_GUID_DATA_PERFORMANCE_LOG) +
+ ((MAX_PEI_PERF_LOG_ENTRIES-1) *
+ sizeof(PEI_PERFORMANCE_MEASURE_LOG_ENTRY)) +
+ sizeof(EFI_PEI_PPI_DESCRIPTOR)
+ ));
+ Hob = (VOID *)((UINTN)Hob - sizeof (EFI_HOB_GUID_TYPE));
+ ASSERT_EFI_ERROR (Status);
+
+ PerfHobData = (EFI_HOB_GUID_DATA_PERFORMANCE_LOG *)(Hob+1);
+ PerfHobData->NumberOfEntries = 0;
+
+ PerfHobDescriptor = (EFI_PEI_PPI_DESCRIPTOR *)((UINT8 *)(PerfHobData+1) +
+ (sizeof(PEI_PERFORMANCE_MEASURE_LOG_ENTRY) *
+ (MAX_PEI_PERF_LOG_ENTRIES-1)
+ )
+ );
+ PerfHobDescriptor->Flags = (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
+ PerfHobDescriptor->Guid = &gEfiPeiPerformanceHobGuid;
+ PerfHobDescriptor->Ppi = NULL;
+
+ (*PeiServices)->InstallPpi (
+ PeiServices,
+ PerfHobDescriptor
+ );
+ }
+
+ PerfHobData = (EFI_HOB_GUID_DATA_PERFORMANCE_LOG *)(((UINT8 *)(PerfHobDescriptor)) -
+ ((sizeof(PEI_PERFORMANCE_MEASURE_LOG_ENTRY) *
+ (MAX_PEI_PERF_LOG_ENTRIES-1)
+ )
+ + sizeof(EFI_HOB_GUID_DATA_PERFORMANCE_LOG)
+ )
+ );
+
+ if (PerfHobData->NumberOfEntries >= MAX_PEI_PERF_LOG_ENTRIES) {
+ return;
+ }
+
+ if (!EntryExit) {
+ Log = &(PerfHobData->Log[PerfHobData->NumberOfEntries]);
+ ((*PeiServices)->SetMem) (Log, sizeof(PEI_PERFORMANCE_MEASURE_LOG_ENTRY), 0);
+
+ //
+ // If not NULL pointer, copy the file name
+ //
+ if (FileHeader != NULL) {
+ Log->Name = FileHeader->Name;
+ }
+
+ //
+ // Copy the description string
+ //
+ ((*PeiServices)->CopyMem) (
+ &(Log->DescriptionString),
+ Token,
+ (PEI_PERF_MAX_DESC_STRING-1) * sizeof(UINT16)
+ );
+
+ //
+ // Get the start time as late as possible to make it more accurate.
+ //
+ InternalGetTimerValue (&TimeCount);
+
+ //
+ // Record the time stamp.
+ //
+ if (Value != 0) {
+ Log->StartTimeCount = Value;
+ } else {
+ Log->StartTimeCount = TimeCount;
+ }
+ Log->StopTimeCount = 0;
+
+ //
+ // Increment the number of valid log entries.
+ //
+ PerfHobData->NumberOfEntries++;
+
+ } else {
+
+ for (Index = PerfHobData->NumberOfEntries-1; Index >= 0; Index--) {
+ Log = NULL;
+ for (Index2 = 0; Index2 < PEI_PERF_MAX_DESC_STRING; Index2++) {
+ if (PerfHobData->Log[Index].DescriptionString[Index2] == 0) {
+ Log = &(PerfHobData->Log[Index]);
+ break;
+ }
+ if (PerfHobData->Log[Index].DescriptionString[Index2] !=
+ Token[Index2]) {
+ break;
+ }
+ }
+ if (Log != NULL) {
+ if (FileHeader != NULL) {
+ Guid = &(Log->Name);
+ CheckGuid = &(FileHeader->Name);
+ if ((((INT32 *)Guid)[0] == ((INT32 *)CheckGuid)[0]) &&
+ (((INT32 *)Guid)[1] == ((INT32 *)CheckGuid)[1]) &&
+ (((INT32 *)Guid)[2] == ((INT32 *)CheckGuid)[2]) &&
+ (((INT32 *)Guid)[3] == ((INT32 *)CheckGuid)[3])) {
+ if (Value != 0) {
+ Log->StopTimeCount = Value;
+ } else {
+ Log->StopTimeCount = TimeCount;
+ }
+ break;
+ }
+ } else {
+ if (Value != 0) {
+ Log->StopTimeCount = Value;
+ } else {
+ Log->StopTimeCount = TimeCount;
+ }
+ break;
+ }
+ }
+ }
+
+ }
+
+ return;
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf index a60f1b208d..bd737e96f3 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf @@ -91,7 +91,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -104,5 +104,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf index 53de36a937..3d127bdb7c 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf @@ -64,7 +64,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -77,5 +77,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesLib/PeiServicesLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesLib/PeiServicesLib.inf index efe0622a7c..b63bb422e6 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesLib/PeiServicesLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesLib/PeiServicesLib.inf @@ -69,7 +69,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -82,5 +82,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c index d3c0c98263..56e8a10630 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLib/PeiServicesTablePointer.c @@ -34,6 +34,7 @@ static EFI_PEI_SERVICES **gPeiServices; **/
EFI_PEI_SERVICES **
+EFIAPI
GetPeiServicesTablePointer (
VOID
)
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf index 180bee65fd..548766ef57 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf @@ -62,7 +62,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -75,5 +75,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointer.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointer.c index a122ce867b..898166f4e8 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointer.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointer.c @@ -39,7 +39,11 @@ GetPeiServicesTablePointer ( {
EFI_PEI_SERVICES **PeiServices;
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
PeiServices = (EFI_PEI_SERVICES **)(UINTN)AsmReadKr1 ();
+#else
+ PeiServices = (EFI_PEI_SERVICES **)(UINTN)AsmReadKr7 ();
+#endif
ASSERT (PeiServices != NULL);
return PeiServices;
}
@@ -63,6 +67,8 @@ PeiServicesTablePointerLibConstructor ( IN EFI_PEI_SERVICES **PeiServices
)
{
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
AsmWriteKr1 ((UINT64)(UINTN)PeiServices);
+#endif
return EFI_SUCCESS;
}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointerLibInternals.h b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointerLibInternals.h index ee0f2a5721..6add1b04ec 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointerLibInternals.h +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointerLibInternals.h @@ -43,10 +43,10 @@ AsmReadKr1 ( @param Value The 64-bit value to write to Kr1.
**/
-VOID
+UINT64
EFIAPI
AsmWriteKr1 (
- IN UINT64 Value
+ IN UINT64 Value
);
#endif
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointerLibKr1.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointerLibKr1.inf index 24b5d6be5f..d6ab1508d4 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointerLibKr1.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibKr1/PeiServicesTablePointerLibKr1.inf @@ -57,7 +57,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -70,5 +70,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointer.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointer.c index f91a2f582a..ca75a9493d 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointer.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointer.c @@ -38,8 +38,16 @@ GetPeiServicesTablePointer ( )
{
EFI_PEI_SERVICES **PeiServices;
+#if (PI_SPECIFICATION_VERSION >= 0x00010000)
+ IA32_DESCRIPTOR Idtr;
+#endif
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
PeiServices = (EFI_PEI_SERVICES **)(UINTN)AsmReadMm7 ();
+#else
+ AsmReadIdtr (&Idtr);
+ PeiServices = (EFI_PEI_SERVICES **)(UINTN)(*(UINTN*)(Idtr.Base - sizeof (UINTN)));
+#endif
ASSERT (PeiServices != NULL);
return PeiServices;
}
@@ -63,6 +71,8 @@ PeiServicesTablePointerLibConstructor ( IN EFI_PEI_SERVICES **PeiServices
)
{
+#if (PI_SPECIFICATION_VERSION < 0x00010000)
AsmWriteMm7 ((UINT64)(UINTN)PeiServices);
+#endif
return EFI_SUCCESS;
}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointerLibMm7.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointerLibMm7.inf index 0bcc415b63..9dc7dea768 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointerLibMm7.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointerLibMm7.inf @@ -24,16 +24,15 @@ BASE_NAME = EdkIIGluePeiServicesTablePointerLibMm7 COMPONENT_TYPE = LIBRARY
[sources.common]
- PeiServicesTablePointer.c
[sources.ia32]
-
+ PeiServicesTablePointer.c
[sources.x64]
+ PeiServicesTablePointer.c
[sources.ipf]
[sources.ebc]
-
[includes.common]
.
@@ -62,7 +61,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -75,5 +74,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiSmbusLib/PeiSmbusLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiSmbusLib/PeiSmbusLib.inf index c3bfa95efb..9f106ed3d3 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiSmbusLib/PeiSmbusLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiSmbusLib/PeiSmbusLib.inf @@ -69,7 +69,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -82,5 +82,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c index 1727759a3c..7142e906b2 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c @@ -22,7 +22,6 @@ Abstract: #include "EdkIIGlueUefi.h"
-EFI_HANDLE gImageHandle;
EFI_SYSTEM_TABLE *gST;
EFI_BOOT_SERVICES *gBS;
@@ -48,11 +47,6 @@ UefiBootServicesTableLibConstructor ( )
{
//
- // Cache the Image Handle
- //
- gImageHandle = ImageHandle;
-
- //
// Cache pointer to the EFI System Table
//
gST = SystemTable;
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf index 9b14aaf3ce..913f1cee39 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf @@ -60,7 +60,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -73,5 +73,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDevicePathLib/UefiDevicePathLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDevicePathLib/UefiDevicePathLib.inf index 6c4bc04ebf..04671cfcf3 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDevicePathLib/UefiDevicePathLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDevicePathLib/UefiDevicePathLib.inf @@ -67,7 +67,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -80,5 +80,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDriverModelLib/UefiDriverModelLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDriverModelLib/UefiDriverModelLib.c index 60ab4412a2..df9a681a00 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDriverModelLib/UefiDriverModelLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDriverModelLib/UefiDriverModelLib.c @@ -22,6 +22,14 @@ Abstract: #include "EdkIIGlueUefi.h"
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
+ #define EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL_GUID gEfiComponentName2ProtocolGuid
+ #define EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME2_PROTOCOL
+#else
+ #define EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL_GUID gEfiComponentNameProtocolGuid
+ #define EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME_PROTOCOL
+#endif
+
/**
The constructor function installs the standard EFI Driver Model Protocols.
@@ -71,21 +79,12 @@ UefiDriverModelLibConstructor ( NULL
);
} else {
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentName2ProtocolGuid, (EFI_COMPONENT_NAME2_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
- NULL
- );
-#else
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBindingHandle,
&gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentNameProtocolGuid, (EFI_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
+ &EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL_GUID, (EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
NULL
);
-#endif
}
} else {
if (_gDriverModelProtocolList[0].ComponentName == NULL) {
@@ -96,23 +95,13 @@ UefiDriverModelLibConstructor ( NULL
);
} else {
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentName2ProtocolGuid, (EFI_COMPONENT_NAME2_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
- &gEfiDriverConfigurationProtocolGuid, (EFI_DRIVER_CONFIGURATION_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration,
- NULL
- );
-#else
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBindingHandle,
&gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentNameProtocolGuid, (EFI_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
+ &EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL_GUID, (EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
&gEfiDriverConfigurationProtocolGuid, (EFI_DRIVER_CONFIGURATION_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration,
NULL
);
-#endif
}
}
} else {
@@ -125,23 +114,13 @@ UefiDriverModelLibConstructor ( NULL
);
} else {
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentName2ProtocolGuid, (EFI_COMPONENT_NAME2_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, (EFI_DRIVER_DIAGNOSTICS_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics,
- NULL
- );
-#else
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBindingHandle,
&gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentNameProtocolGuid, (EFI_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
+ &EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL_GUID, (EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
&gEfiDriverDiagnosticsProtocolGuid, (EFI_DRIVER_DIAGNOSTICS_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics,
NULL
);
-#endif
}
} else {
if (_gDriverModelProtocolList[0].ComponentName == NULL) {
@@ -153,25 +132,14 @@ UefiDriverModelLibConstructor ( NULL
);
} else {
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentName2ProtocolGuid, (EFI_COMPONENT_NAME2_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
- &gEfiDriverConfigurationProtocolGuid, (EFI_DRIVER_CONFIGURATION_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, (EFI_DRIVER_DIAGNOSTICS_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics,
- NULL
- );
-#else
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverBindingHandle,
&gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentNameProtocolGuid, (EFI_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
+ &EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL_GUID, (EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
&gEfiDriverConfigurationProtocolGuid, (EFI_DRIVER_CONFIGURATION_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration,
&gEfiDriverDiagnosticsProtocolGuid, (EFI_DRIVER_DIAGNOSTICS_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics,
NULL
);
-#endif
}
}
}
@@ -240,22 +208,12 @@ UefiDriverModelLibDestructor ( NULL
);
} else {
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
- Status = gBS->UninstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentName2ProtocolGuid, (EFI_COMPONENT_NAME2_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
- NULL
- );
-#else
Status = gBS->UninstallMultipleProtocolInterfaces (
&DriverBindingHandle,
&gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentNameProtocolGuid, (EFI_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
+ &EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL_GUID, (EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
NULL
);
-
-#endif
}
} else {
if (_gDriverModelProtocolList[0].ComponentName == NULL) {
@@ -266,23 +224,13 @@ UefiDriverModelLibDestructor ( NULL
);
} else {
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
Status = gBS->UninstallMultipleProtocolInterfaces (
&DriverBindingHandle,
&gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentName2ProtocolGuid, (EFI_COMPONENT_NAME2_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
+ &EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL_GUID, (EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
&gEfiDriverConfigurationProtocolGuid, (EFI_DRIVER_CONFIGURATION_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration,
NULL
);
-#else
- Status = gBS->UninstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentNameProtocolGuid, (EFI_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
- &gEfiDriverConfigurationProtocolGuid, (EFI_DRIVER_CONFIGURATION_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration,
- NULL
- );
-#endif
}
}
} else {
@@ -295,23 +243,13 @@ UefiDriverModelLibDestructor ( NULL
);
} else {
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
- Status = gBS->UninstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentName2ProtocolGuid, (EFI_COMPONENT_NAME2_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, (EFI_DRIVER_DIAGNOSTICS_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics,
- NULL
- );
-#else
Status = gBS->UninstallMultipleProtocolInterfaces (
&DriverBindingHandle,
&gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentNameProtocolGuid, (EFI_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
+ &EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL_GUID, (EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
&gEfiDriverDiagnosticsProtocolGuid, (EFI_DRIVER_DIAGNOSTICS_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics,
NULL
);
-#endif
}
} else {
if (_gDriverModelProtocolList[0].ComponentName == NULL) {
@@ -323,25 +261,14 @@ UefiDriverModelLibDestructor ( NULL
);
} else {
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
Status = gBS->UninstallMultipleProtocolInterfaces (
&DriverBindingHandle,
&gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentName2ProtocolGuid, (EFI_COMPONENT_NAME2_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
+ &EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL_GUID, (EDKII_GLUE_SELECTED_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
&gEfiDriverConfigurationProtocolGuid, (EFI_DRIVER_CONFIGURATION_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration,
&gEfiDriverDiagnosticsProtocolGuid, (EFI_DRIVER_DIAGNOSTICS_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics,
NULL
);
-#else
- Status = gBS->UninstallMultipleProtocolInterfaces (
- &DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, (EFI_DRIVER_BINDING_PROTOCOL *)_gDriverModelProtocolList[0].DriverBinding,
- &gEfiComponentNameProtocolGuid, (EFI_COMPONENT_NAME_PROTOCOL *)_gDriverModelProtocolList[0].ComponentName,
- &gEfiDriverConfigurationProtocolGuid, (EFI_DRIVER_CONFIGURATION_PROTOCOL *)_gDriverModelProtocolList[0].DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, (EFI_DRIVER_DIAGNOSTICS_PROTOCOL *)_gDriverModelProtocolList[0].DriverDiagnostics,
- NULL
- );
-#endif
}
}
}
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDriverModelLib/UefiDriverModelLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDriverModelLib/UefiDriverModelLib.inf index 6618c6ae69..d94c5c8182 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDriverModelLib/UefiDriverModelLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiDriverModelLib/UefiDriverModelLib.inf @@ -50,7 +50,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -63,5 +63,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiLib/UefiLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiLib/UefiLib.inf index 0d6b8ac429..91a167afc5 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiLib/UefiLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiLib/UefiLib.inf @@ -72,7 +72,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -85,5 +85,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf index 86c499cf44..8c36b763da 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf @@ -61,7 +61,7 @@ COMPONENT_TYPE = LIBRARY [nmake.common]
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]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -74,5 +74,5 @@ COMPONENT_TYPE = LIBRARY [nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
- EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
+ EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/EfiCommonLib.inf b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/EfiCommonLib.inf index 561345fb5d..b736eca9be 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/EfiCommonLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/EfiCommonLib.inf @@ -33,9 +33,12 @@ COMPONENT_TYPE = LIBRARY LinkedList.c
[sources.ia32]
- Ia32\EfiCopyMem.c
- Ia32\EfiSetMem.c
- Ia32\EfiZeroMem.c
+ Ia32\EfiCopyMemRep1.c
+ Ia32\EfiSetMemRep4.c
+ Ia32\EfiZeroMemRep4.c
+# Ia32\EfiCopyMem.c
+# Ia32\EfiSetMem.c
+# Ia32\EfiZeroMem.c
Ia32\LShiftU64.c
Ia32\RShiftU64.c
Ia32\MultU64x32.c
@@ -57,9 +60,12 @@ COMPONENT_TYPE = LIBRARY Math.c
[sources.x64]
- x64\EfiCopyMem.asm
- x64\EfiSetMem.asm
- x64\EfiZeroMem.asm
+ x64\EfiCopyMemRep1.asm
+ x64\EfiSetMemRep4.asm
+ x64\EfiZeroMemRep4.asm
+# x64\EfiCopyMem.asm
+# x64\EfiSetMem.asm
+# x64\EfiZeroMem.asm
Math.c
[includes.common]
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiCopyMemRep1.c b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiCopyMemRep1.c new file mode 100644 index 0000000000..3b4804f15d --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiCopyMemRep1.c @@ -0,0 +1,73 @@ +/*++
+
+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:
+
+ EfiCopyMemRep1.c
+
+Abstract:
+
+ This is the code that uses rep movsb CopyMem service
+
+--*/
+
+#include "Tiano.h"
+
+VOID
+EfiCommonLibCopyMem (
+ IN VOID *Destination,
+ IN VOID *Source,
+ IN UINTN Count
+ )
+/*++
+
+Routine Description:
+
+ Copy Length bytes from Source to Destination.
+
+Arguments:
+
+ Destination - Target of copy
+
+ Source - Place to copy from
+
+ Length - Number of bytes to copy
+
+Returns:
+
+ None
+
+--*/
+{
+ __asm {
+ mov esi, Source ; esi <- Source
+ mov edi, Destination ; edi <- Destination
+ mov edx, Count ; 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 _CopyBytes
+ cmp eax, edi
+ jb _CopyBytes ; Copy backward if overlapped
+ 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:
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiCopyMemRep4.c b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiCopyMemRep4.c new file mode 100644 index 0000000000..033d9b9d76 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiCopyMemRep4.c @@ -0,0 +1,79 @@ +/*++
+
+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:
+
+ EfiCopyMemRep4.c
+
+Abstract:
+
+ This is the code that uses rep movsd CopyMem service
+
+--*/
+
+#include "Tiano.h"
+
+VOID
+EfiCommonLibCopyMem (
+ IN VOID *Destination,
+ IN VOID *Source,
+ IN UINTN Count
+ )
+/*++
+
+Routine Description:
+
+ Copy Length bytes from Source to Destination.
+
+Arguments:
+
+ Destination - Target of copy
+
+ Source - Place to copy from
+
+ Length - Number of bytes to copy
+
+Returns:
+
+ None
+
+--*/
+{
+ __asm {
+ mov esi, Source ; esi <- Source
+ mov edi, Destination ; edi <- Destination
+ mov edx, Count ; 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 _CopyDWord
+ cmp eax, edi
+ jae _CopyBackward ; Copy backward if overlapped
+_CopyDWord:
+ 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:
+ }
+}
\ No newline at end of file diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiSetMemRep1.c b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiSetMemRep1.c new file mode 100644 index 0000000000..eeee1c6fd1 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiSetMemRep1.c @@ -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:
+
+ EfiSetMemRep1.c
+
+Abstract:
+
+ This is the code that uses rep stosb SetMem service
+
+--*/
+
+#include "Tiano.h"
+
+VOID
+EfiCommonLibSetMem (
+ IN VOID *Buffer,
+ IN UINTN Count,
+ IN UINT8 Value
+ )
+/*++
+
+Input: VOID *Buffer - Pointer to buffer to write
+ UINTN Count - Number of bytes to write
+ UINT8 Value - Value to write
+
+Output: None.
+
+Saves:
+
+Modifies:
+
+Description: This function uses rep stosb to set memory.
+
+--*/
+{
+ __asm {
+ mov ecx, Count
+ test ecx, ecx
+ je Exit
+ mov al, Value
+ mov edi, Buffer
+ rep stosb
+Exit:
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiSetMemRep4.c b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiSetMemRep4.c new file mode 100644 index 0000000000..e1809f07e6 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiSetMemRep4.c @@ -0,0 +1,64 @@ +/*++
+
+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:
+
+ EfiSetMemRep4.c
+
+Abstract:
+
+ This is the code that uses rep stosd SetMem service
+
+--*/
+
+#include "Tiano.h"
+
+VOID
+EfiCommonLibSetMem (
+ IN VOID *Buffer,
+ IN UINTN Count,
+ IN UINT8 Value
+ )
+/*++
+
+Input: VOID *Buffer - Pointer to buffer to write
+ UINTN Count - Number of bytes to write
+ UINT8 Value - Value to write
+
+Output: None.
+
+Saves:
+
+Modifies:
+
+Description: This function uses rep stosd to set memory.
+
+--*/
+{
+ __asm {
+ mov ecx, Count
+ test ecx, ecx
+ je Exit
+ mov al, Value
+ mov ah, al
+ shrd edx, eax, 16
+ shld eax, edx, 16
+ mov edx, ecx
+ mov edi, Buffer
+ shr ecx, 2
+ rep stosd
+ mov ecx, edx
+ and ecx, 3
+ rep stosb
+Exit:
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiZeroMemRep1.c b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiZeroMemRep1.c new file mode 100644 index 0000000000..d41d4bcf31 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiZeroMemRep1.c @@ -0,0 +1,52 @@ +/*++
+
+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:
+
+ EfiZeroMemRep1.c
+
+Abstract:
+
+ This is the code that uses rep stosb ZeroMem service
+
+--*/
+
+#include "Tiano.h"
+
+VOID
+EfiCommonLibZeroMem (
+ IN VOID *Buffer,
+ IN UINTN Count
+ )
+/*++
+
+Input: VOID *Buffer - Pointer to buffer to clear
+ UINTN Count - Number of bytes to clear
+
+Output: None.
+
+Saves:
+
+Modifies:
+
+Description: This function uses rep stosb to zero memory.
+
+--*/
+{
+ __asm {
+ mov ecx, Count
+ xor eax, eax
+ mov edi, Buffer
+ rep stosb
+Exit:
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiZeroMemRep4.c b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiZeroMemRep4.c new file mode 100644 index 0000000000..48936a829f --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/EfiZeroMemRep4.c @@ -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:
+
+ EfiZeroMemRep4.c
+
+Abstract:
+
+ This is the code that uses rep stosd ZeroMem service
+
+--*/
+
+#include "Tiano.h"
+
+VOID
+EfiCommonLibZeroMem (
+ IN VOID *Buffer,
+ IN UINTN Count
+ )
+/*++
+
+Input: VOID *Buffer - Pointer to buffer to clear
+ UINTN Count - Number of bytes to clear
+
+Output: None.
+
+Saves:
+
+Modifies:
+
+Description: This function uses rep stosd to zero memory.
+
+--*/
+{
+ __asm {
+ mov ecx, Count
+ test ecx, ecx
+ je Exit
+ xor eax, eax
+ mov edi, Buffer
+ mov edx, ecx
+ shr ecx, 2
+ and edx, 3
+ rep stosd
+ mov ecx, edx
+ rep stosb
+Exit:
+ }
+}
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiCopyMemRep1.asm b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiCopyMemRep1.asm new file mode 100644 index 0000000000..b96d861477 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiCopyMemRep1.asm @@ -0,0 +1,58 @@ +;------------------------------------------------------------------------------
+;
+; 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:
+;
+; EfiCopyMemRep1.asm
+;
+; Abstract:
+;
+; CopyMem function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID
+; EfiCommonLibCopyMem (
+; OUT VOID *Destination,
+; IN VOID *Source,
+; IN UINTN Count
+; );
+;------------------------------------------------------------------------------
+EfiCommonLibCopyMem PROC USES rsi rdi
+ 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 @CopyBytes
+ cmp r9, rdi
+ jb @CopyBytes ; Copy backward if overlapped
+ 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
+EfiCommonLibCopyMem ENDP
+
+ END
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiCopyMemRep4.asm b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiCopyMemRep4.asm new file mode 100644 index 0000000000..9cd3961d37 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiCopyMemRep4.asm @@ -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:
+;
+; EfiCopyMemRep4.asm
+;
+; Abstract:
+;
+; CopyMem function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID
+; EfiCommonLibCopyMem (
+; OUT VOID *Destination,
+; IN VOID *Source,
+; IN UINTN Count
+; );
+;------------------------------------------------------------------------------
+EfiCommonLibCopyMem PROC USES rsi rdi
+ 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
+EfiCommonLibCopyMem ENDP
+
+ END
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiCopyMemRep8.asm b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiCopyMemRep8.asm new file mode 100644 index 0000000000..1494b9feb9 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiCopyMemRep8.asm @@ -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:
+;
+; EfiCopyMemRep8.asm
+;
+; Abstract:
+;
+; CopyMem function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID
+; EfiCommonLibCopyMem (
+; OUT VOID *Destination,
+; IN VOID *Source,
+; IN UINTN Count
+; );
+;------------------------------------------------------------------------------
+EfiCommonLibCopyMem PROC USES rsi rdi
+ 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
+EfiCommonLibCopyMem ENDP
+
+ END
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiSetMemRep1.asm b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiSetMemRep1.asm new file mode 100644 index 0000000000..ef2ab8cb2f --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiSetMemRep1.asm @@ -0,0 +1,46 @@ +;------------------------------------------------------------------------------
+;
+; 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:
+;
+; EfiSetMemRep1.asm
+;
+; Abstract:
+;
+; SetMem function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID
+; EfiCommonLibSetMem (
+; OUT VOID *Buffer,
+; IN UINTN Size,
+; IN UINT8 Value
+; );
+;------------------------------------------------------------------------------
+EfiCommonLibSetMem PROC USES rdi
+ cmp rdx, 0 ; if Size == 0, do nothing
+ je @SetDone
+ mov rax, r8
+ mov rdi, rcx
+ mov rcx, rdx
+ rep stosb
+@SetDone:
+ ret
+EfiCommonLibSetMem ENDP
+
+ END
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiSetMemRep4.asm b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiSetMemRep4.asm new file mode 100644 index 0000000000..8e3e7e5619 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiSetMemRep4.asm @@ -0,0 +1,53 @@ +;------------------------------------------------------------------------------
+;
+; 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:
+;
+; EfiSetMemRep4.asm
+;
+; Abstract:
+;
+; SetMem function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID
+; EfiCommonLibSetMem (
+; OUT VOID *Buffer,
+; IN UINTN Size,
+; IN UINT8 Value
+; );
+;------------------------------------------------------------------------------
+EfiCommonLibSetMem PROC USES rdi
+ cmp rdx, 0 ; if Size == 0, do nothing
+ je @SetDone
+ mov rdi, rcx
+ mov al, r8b
+ mov ah, al
+ shrd ecx, eax, 16
+ shld eax, ecx, 16
+ mov rcx, rdx
+ shr rcx, 2
+ rep stosd
+ mov rcx, rdx
+ and rcx, 3
+ rep stosb
+@SetDone:
+ ret
+EfiCommonLibSetMem ENDP
+
+ END
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiSetMemRep8.asm b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiSetMemRep8.asm new file mode 100644 index 0000000000..09a76b1834 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiSetMemRep8.asm @@ -0,0 +1,58 @@ +;------------------------------------------------------------------------------
+;
+; 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:
+;
+; EfiSetMemRep8.asm
+;
+; Abstract:
+;
+; SetMem function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID
+; EfiCommonLibSetMem (
+; OUT VOID *Buffer,
+; IN UINTN Size,
+; IN UINT8 Value
+; );
+;------------------------------------------------------------------------------
+EfiCommonLibSetMem PROC USES rdi rbx
+ cmp rdx, 0 ; if Size == 0, do nothing
+ je @SetDone
+ mov rax, r8
+ 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, rdx
+ shr rcx, 3
+ rep stosq
+ mov rcx, rdx
+ and rcx, 7
+ rep stosb
+@SetDone:
+ ret
+EfiCommonLibSetMem ENDP
+
+ END
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiZeroMemRep1.asm b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiZeroMemRep1.asm new file mode 100644 index 0000000000..6b66165ee2 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiZeroMemRep1.asm @@ -0,0 +1,42 @@ +;------------------------------------------------------------------------------
+;
+; 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:
+;
+; EfiZeroMemRep1.asm
+;
+; Abstract:
+;
+; ZeroMem function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID
+; EfiCommonLibZeroMem (
+; IN VOID *Buffer,
+; IN UINTN Size
+; );
+;------------------------------------------------------------------------------
+EfiCommonLibZeroMem PROC USES rdi
+ xor rax, rax
+ mov rdi, rcx
+ mov rcx, rdx
+ rep stosb
+ ret
+EfiCommonLibZeroMem ENDP
+
+ END
+
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiZeroMemRep4.asm b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiZeroMemRep4.asm new file mode 100644 index 0000000000..7df6eee6a0 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiZeroMemRep4.asm @@ -0,0 +1,45 @@ +;------------------------------------------------------------------------------
+;
+; 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:
+;
+; EfiZeroMemRep4.asm
+;
+; Abstract:
+;
+; ZeroMem function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID
+; EfiCommonLibZeroMem (
+; IN VOID *Buffer,
+; IN UINTN Size
+; );
+;------------------------------------------------------------------------------
+EfiCommonLibZeroMem PROC USES rdi
+ xor rax, rax
+ mov rdi, rcx
+ mov rcx, rdx
+ shr rcx, 2
+ and rdx, 3
+ rep stosd
+ mov rcx, rdx
+ rep stosb
+ ret
+EfiCommonLibZeroMem ENDP
+
+ END
\ No newline at end of file diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiZeroMemRep8.asm b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiZeroMemRep8.asm new file mode 100644 index 0000000000..a93a702789 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/x64/EfiZeroMemRep8.asm @@ -0,0 +1,45 @@ +;------------------------------------------------------------------------------
+;
+; 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:
+;
+; EfiZeroMemRep8.asm
+;
+; Abstract:
+;
+; ZeroMem function
+;
+; Notes:
+;
+;------------------------------------------------------------------------------
+
+ .code
+
+;------------------------------------------------------------------------------
+; VOID
+; EfiCommonLibZeroMem (
+; IN VOID *Buffer,
+; IN UINTN Size
+; );
+;------------------------------------------------------------------------------
+EfiCommonLibZeroMem PROC USES rdi
+ xor rax, rax
+ mov rdi, rcx
+ mov rcx, rdx
+ shr rcx, 3
+ and rdx, 7
+ rep stosq
+ mov rcx, rdx
+ rep stosb
+ ret
+EfiCommonLibZeroMem ENDP
+
+ END
\ No newline at end of file diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/Hob/PeiHobLib.c b/EdkCompatibilityPkg/Foundation/Library/Pei/Hob/PeiHobLib.c index c28fd0386f..02ffcda34d 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Pei/Hob/PeiHobLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/Pei/Hob/PeiHobLib.c @@ -420,7 +420,7 @@ Returns: CopyMem(&(Hob.MemoryAllocationStack->AllocDescriptor.Name), &gEfiHobMemeryAllocStackGuid, sizeof(EFI_GUID));
(Hob.MemoryAllocationStack->AllocDescriptor).MemoryBaseAddress = BaseAddress;
(Hob.MemoryAllocationStack->AllocDescriptor).MemoryLength = Length;
- (Hob.MemoryAllocationStack->AllocDescriptor).MemoryType = EfiConventionalMemory;
+ (Hob.MemoryAllocationStack->AllocDescriptor).MemoryType = EfiBootServicesData;
Hob.MemoryAllocationStack++;
HandOffHob.HandoffInformationTable->EfiEndOfHobList = (EFI_PHYSICAL_ADDRESS) (UINTN) Hob.Raw;
@@ -601,3 +601,121 @@ Returns: return Status;
}
+
+VOID *
+GetHob (
+ IN UINT16 Type,
+ IN VOID *HobStart
+ )
+/*++
+
+Routine Description:
+
+ This function returns the first instance of a HOB type in a HOB list.
+
+Arguments:
+
+ Type The HOB type to return.
+ HobStart The first HOB in the HOB list.
+
+Returns:
+
+ HobStart There were no HOBs found with the requested type.
+ else Returns the first HOB with the matching type.
+
+--*/
+{
+ EFI_PEI_HOB_POINTERS Hob;
+
+ Hob.Raw = HobStart;
+ //
+ // Return input if not found
+ //
+ if (HobStart == NULL) {
+ return HobStart;
+ }
+
+ //
+ // Parse the HOB list, stop if end of list or matching type found.
+ //
+ while (!END_OF_HOB_LIST (Hob)) {
+
+ if (Hob.Header->HobType == Type) {
+ break;
+ }
+
+ Hob.Raw = GET_NEXT_HOB (Hob);
+ }
+
+ //
+ // Return input if not found
+ //
+ if (END_OF_HOB_LIST (Hob)) {
+ return HobStart;
+ }
+
+ return (VOID *) (Hob.Raw);
+}
+
+EFI_STATUS
+GetNextGuidHob (
+ IN OUT VOID **HobStart,
+ IN EFI_GUID * Guid,
+ OUT VOID **Buffer,
+ OUT UINTN *BufferSize OPTIONAL
+ )
+/*++
+
+Routine Description:
+ Get the next guid hob.
+
+Arguments:
+ HobStart A pointer to the start hob.
+ Guid A pointer to a guid.
+ Buffer A pointer to the buffer.
+ BufferSize Buffer size.
+
+Returns:
+ Status code.
+
+ EFI_NOT_FOUND - Next Guid hob not found
+
+ EFI_SUCCESS - Next Guid hob found and data for this Guid got
+
+ EFI_INVALID_PARAMETER - invalid parameter
+
+--*/
+{
+ EFI_STATUS Status;
+ EFI_PEI_HOB_POINTERS GuidHob;
+
+ if (Buffer == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ for (Status = EFI_NOT_FOUND; EFI_ERROR (Status);) {
+
+ GuidHob.Raw = *HobStart;
+ if (END_OF_HOB_LIST (GuidHob)) {
+ return EFI_NOT_FOUND;
+ }
+
+ GuidHob.Raw = GetHob (EFI_HOB_TYPE_GUID_EXTENSION, *HobStart);
+ if (GuidHob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION) {
+ if ( ((INT32 *)Guid)[0] == ((INT32 *)&GuidHob.Guid->Name)[0] &&
+ ((INT32 *)Guid)[1] == ((INT32 *)&GuidHob.Guid->Name)[1] &&
+ ((INT32 *)Guid)[2] == ((INT32 *)&GuidHob.Guid->Name)[2] &&
+ ((INT32 *)Guid)[3] == ((INT32 *)&GuidHob.Guid->Name)[3] ) {
+ Status = EFI_SUCCESS;
+ *Buffer = (VOID *) ((UINT8 *) (&GuidHob.Guid->Name) + sizeof (EFI_GUID));
+ if (BufferSize != NULL) {
+ *BufferSize = GuidHob.Header->HobLength - sizeof (EFI_HOB_GUID_TYPE);
+ }
+ }
+ }
+
+ *HobStart = GET_NEXT_HOB (GuidHob);
+ }
+
+ return Status;
+}
diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/Include/PeiLib.h b/EdkCompatibilityPkg/Foundation/Library/Pei/Include/PeiLib.h index f2cfdb865c..df86d4f27d 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Pei/Include/PeiLib.h +++ b/EdkCompatibilityPkg/Foundation/Library/Pei/Include/PeiLib.h @@ -25,6 +25,7 @@ Abstract: #include "Tiano.h"
#include "Pei.h"
#include "peiHobLib.h"
+#include "PeiPerf.h"
#include EFI_PROTOCOL_DEFINITION (Decompress)
#include EFI_PROTOCOL_DEFINITION (TianoDecompress)
#include EFI_GUID_DEFINITION (PeiPeCoffLoader)
@@ -709,37 +710,6 @@ Returns: --*/
;
-VOID
-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:
-
---*/
-;
-
EFI_STATUS
GetTimerValue (
OUT UINT64 *TimerValue
@@ -761,14 +731,6 @@ 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
-
#ifdef EFI_NT_EMULATOR
EFI_STATUS
PeCoffLoaderWinNtLoadAsDll (
@@ -1306,6 +1268,7 @@ Returns: ;
EFI_STATUS
+EFIAPI
FindFv (
IN EFI_FIND_FV_PPI *This,
IN EFI_PEI_SERVICES **PeiServices,
diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/Include/peihoblib.h b/EdkCompatibilityPkg/Foundation/Library/Pei/Include/peihoblib.h index 23101754b1..0e90e454fa 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Pei/Include/peihoblib.h +++ b/EdkCompatibilityPkg/Foundation/Library/Pei/Include/peihoblib.h @@ -313,6 +313,30 @@ Returns: --*/
;
+VOID *
+GetHob (
+ IN UINT16 Type,
+ IN VOID *HobStart
+ )
+/*++
+
+Routine Description:
+
+ This function returns the first instance of a HOB type in a HOB list.
+
+Arguments:
+
+ Type The HOB type to return.
+ HobStart The first HOB in the HOB list.
+
+Returns:
+
+ HobStart There were no HOBs found with the requested type.
+ else Returns the first HOB with the matching type.
+
+--*/
+;
+
EFI_STATUS
GetFirstGuidHob (
IN VOID **HobStart,
@@ -342,4 +366,35 @@ Returns: --*/
;
+
+EFI_STATUS
+GetNextGuidHob (
+ IN OUT VOID **HobStart,
+ IN EFI_GUID * Guid,
+ OUT VOID **Buffer,
+ OUT UINTN *BufferSize OPTIONAL
+ )
+/*++
+
+Routine Description:
+ Get the next guid hob.
+
+Arguments:
+ HobStart A pointer to the start hob.
+ Guid A pointer to a guid.
+ Buffer A pointer to the buffer.
+ BufferSize Buffer size.
+
+Returns:
+ Status code.
+
+ EFI_NOT_FOUND - Next Guid hob not found
+
+ EFI_SUCCESS - Next Guid hob found and data for this Guid got
+
+ EFI_INVALID_PARAMETER - invalid parameter
+
+--*/
+;
+
#endif
diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/FindFv.c b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/FindFv.c index fcff7a648d..cbfad238bc 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/FindFv.c +++ b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/FindFv.c @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2006, Intel Corporation
+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
@@ -29,7 +29,7 @@ Abstract: static
VOID *
-GetHob (
+FindFvGetHob (
IN UINT16 Type,
IN VOID *HobStart
)
@@ -84,6 +84,7 @@ Returns: }
EFI_STATUS
+EFIAPI
FindFv (
IN EFI_FIND_FV_PPI *This,
IN EFI_PEI_SERVICES **PeiServices,
@@ -146,7 +147,7 @@ Returns: //
while (FvIndex <= *FvNumber) {
- Hob.Raw = GetHob (EFI_HOB_TYPE_FV, HobStart.Raw);
+ Hob.Raw = FindFvGetHob (EFI_HOB_TYPE_FV, HobStart.Raw);
//
// If the Hob is not EFI_HOB_TYPE_FV, it indicates that
diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Hob/Hob.c b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Hob/Hob.c index eb1ae2d437..fcdda931c5 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Hob/Hob.c +++ b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Hob/Hob.c @@ -387,7 +387,7 @@ Returns: Hob->AllocDescriptor.Name = gEfiHobMemeryAllocStackGuid;
Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
Hob->AllocDescriptor.MemoryLength = Length;
- Hob->AllocDescriptor.MemoryType = EfiConventionalMemory;
+ Hob->AllocDescriptor.MemoryType = EfiBootServicesData;
(*PeiServices)->SetMem (
Hob->AllocDescriptor.Reserved,
sizeof (Hob->AllocDescriptor.Reserved),
diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/PeCoffLoader.c b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/PeCoffLoader.c index c276aa8bda..18376bbe05 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/PeCoffLoader.c +++ b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/PeCoffLoader.c @@ -434,7 +434,7 @@ Returns: ImageContext->ImageAddress = Hdr.Pe32Plus->OptionalHeader.ImageBase;
}
} else {
- ImageContext->ImageAddress = (EFI_PHYSICAL_ADDRESS)(Hdr.Te->ImageBase);
+ ImageContext->ImageAddress = (EFI_PHYSICAL_ADDRESS)(Hdr.Te->ImageBase + Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER));
}
//
@@ -799,8 +799,8 @@ Returns: }
} else {
Hdr.Te = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress);
- Adjust = (UINT64) (BaseAddress - Hdr.Te->ImageBase);
- Hdr.Te->ImageBase = (UINT64) (BaseAddress);
+ Adjust = (UINT64) (BaseAddress - Hdr.Te->StrippedSize + sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->ImageBase);
+ Hdr.Te->ImageBase = (UINT64) (BaseAddress - Hdr.Te->StrippedSize + sizeof (EFI_TE_IMAGE_HEADER));
//
// Find the relocation block
diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/PeiLib.c b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/PeiLib.c index c2d5bb3c34..23156bb573 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/PeiLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/PeiLib.c @@ -23,7 +23,7 @@ Abstract: #include "PeiHob.h"
#include "Pei.h"
#include "PeiLib.h"
-
+#include "EfiCommonLib.h"
VOID
PeiCopyMem (
@@ -55,12 +55,7 @@ Returns: --*/
{
- INT8 *Ptr;
-
- Ptr = Buffer;
- while (Size--) {
- *(Ptr++) = 0;
- }
+ EfiCommonLibZeroMem (Buffer, Size);
}
VOID
@@ -89,20 +84,7 @@ Returns: --*/
{
- CHAR8 *Destination8;
- CHAR8 *Source8;
-
- Destination8 = Destination;
- Source8 = Source;
- if (((Source8 + Length) <= Destination8) || (Source8 >= Destination8)) {
- while (Length--) {
- *(Destination8++) = *(Source8++);
- }
- } else {
- while (Length--) {
- *(Destination8 + Length) = *(Source8 + Length);
- }
- }
+ EfiCommonLibCopyMem (Destination, Source, Length);
}
VOID
@@ -131,20 +113,7 @@ Returns: --*/
{
- CHAR8 *Destination8;
- CHAR8 *Source8;
-
- Destination8 = Destination;
- Source8 = Source;
- if (((Source8 + Length) <= Destination8) || (Source8 >= Destination8)) {
- while (Length--) {
- *(Destination8++) = *(Source8++);
- }
- } else {
- while (Length--) {
- *(Destination8 + Length) = *(Source8 + Length);
- }
- }
+ EfiCommonLibCopyMem (Destination, Source, Length);
}
diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Perf.c b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Perf.c index cfc265ee66..acae16dde2 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Perf.c +++ b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Perf.c @@ -42,6 +42,7 @@ GetTimerValue ( VOID
+EFIAPI
PeiPerfMeasure (
EFI_PEI_SERVICES **PeiServices,
IN UINT16 *Token,
diff --git a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/EfiRuntimeLib.inf b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/EfiRuntimeLib.inf index aea21c42c7..9411f0009c 100644 --- a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/EfiRuntimeLib.inf +++ b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/EfiRuntimeLib.inf @@ -44,6 +44,7 @@ COMPONENT_TYPE = LIBRARY x64\Lock.c
x64\PlatformIoLib.c
x64\Fvb.c
+ x64\RuntimeLibAsm.asm
[sources.ipf]
Ipf\RuntimeLib.c
diff --git a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/Ipf/Fvb.c b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/Ipf/Fvb.c index 266c6b1951..6af839a576 100644 --- a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/Ipf/Fvb.c +++ b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/Ipf/Fvb.c @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2004, Intel Corporation
+Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -182,15 +182,13 @@ EfiFvbSetVolumeAttributes ( Routine Description:
Modifies the current settings of the firmware volume according to the
- input parameter, and returns the new setting of the volume
+ input parameter.
Arguments:
Instance - The FV instance whose attributes is going to be
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.
- On successful return, it contains the new settings
- of the firmware volume
Returns:
Status code
@@ -199,7 +197,7 @@ Returns: {
EFI_GUID Guid = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID;
- return EfiCallEsalService (&Guid, SetVolumeAttributes, Instance, (UINT64) Attributes, 0, 0, 0, 0, 0).Status;
+ return EfiCallEsalService (&Guid, SetVolumeAttributes, Instance, (UINT64) (&Attributes), 0, 0, 0, 0, 0).Status;
}
EFI_STATUS
diff --git a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/ia32/Fvb.c b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/ia32/Fvb.c index 1cecb47852..b8e4c7d6f7 100644 --- a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/ia32/Fvb.c +++ b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/ia32/Fvb.c @@ -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
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
@@ -470,15 +470,13 @@ EfiFvbSetVolumeAttributes ( Routine Description:
Modifies the current settings of the firmware volume according to the
- input parameter, and returns the new setting of the volume
+ input parameter.
Arguments:
Instance - The FV instance whose attributes is going to be
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.
- On successful return, it contains the new settings
- of the firmware volume
Returns:
Status code
diff --git a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/ia32/RuntimeLib.c b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/ia32/RuntimeLib.c index d1a9080bf8..d146b375fe 100644 --- a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/ia32/RuntimeLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/ia32/RuntimeLib.c @@ -792,7 +792,13 @@ Returns: #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
if (gStatusCode == NULL) {
- return EFI_UNSUPPORTED;
+ if (EfiAtRuntime ()) {
+ return EFI_UNSUPPORTED;
+ }
+ Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
+ if (EFI_ERROR (Status) || gStatusCode == NULL) {
+ return EFI_UNSUPPORTED;
+ }
}
Status = gStatusCode->ReportStatusCode (CodeType, Value, Instance, CallerId, Data);
#else
@@ -838,5 +844,8 @@ Returns: --*/
{
+ __asm {
+ wbinvd
+ }
return EFI_SUCCESS;
}
diff --git a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/x64/Fvb.c b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/x64/Fvb.c index de151cdda0..d8cdbbab22 100644 --- a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/x64/Fvb.c +++ b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/x64/Fvb.c @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2005 - 2006, Intel Corporation
+Copyright (c) 2005 - 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
@@ -473,15 +473,13 @@ EfiFvbSetVolumeAttributes ( Routine Description:
Modifies the current settings of the firmware volume according to the
- input parameter, and returns the new setting of the volume
+ input parameter.
Arguments:
Instance - The FV instance whose attributes is going to be
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.
- On successful return, it contains the new settings
- of the firmware volume
Returns:
Status code
diff --git a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/x64/RuntimeLib.c b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/x64/RuntimeLib.c index d9d5f70f46..93cef53e0f 100644 --- a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/x64/RuntimeLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/x64/RuntimeLib.c @@ -792,7 +792,13 @@ Returns: #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
if (gStatusCode == NULL) {
- return EFI_UNSUPPORTED;
+ if (EfiAtRuntime ()) {
+ return EFI_UNSUPPORTED;
+ }
+ Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID **)&gStatusCode);
+ if (EFI_ERROR (Status) || gStatusCode == NULL) {
+ return EFI_UNSUPPORTED;
+ }
}
Status = gStatusCode->ReportStatusCode (CodeType, Value, Instance, CallerId, Data);
#else
@@ -811,33 +817,3 @@ Returns: #endif
return Status;
}
-
-//
-// Cache Flush Routine.
-//
-EFI_STATUS
-EfiCpuFlushCache (
- IN EFI_PHYSICAL_ADDRESS Start,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
-
- Flush cache with specified range.
-
-Arguments:
-
- Start - Start address
- Length - Length in bytes
-
-Returns:
-
- Status code
-
- EFI_SUCCESS - success
-
---*/
-{
- return EFI_SUCCESS;
-}
diff --git a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/x64/RuntimeLibAsm.asm b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/x64/RuntimeLibAsm.asm new file mode 100644 index 0000000000..c73e08d058 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/x64/RuntimeLibAsm.asm @@ -0,0 +1,37 @@ +;------------------------------------------------------------------------------
+;
+; 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:
+;
+; RuntimeLibAsm.asm
+;
+; Abstract:
+;
+;
+;------------------------------------------------------------------------------
+
+.code
+
+;------------------------------------------------------------------------------
+;EFI_STATUS
+;EfiCpuFlushCache (
+; IN EFI_PHYSICAL_ADDRESS Start,
+; IN UINT64 Length
+; );
+;------------------------------------------------------------------------------
+
+EfiCpuFlushCache PROC PUBLIC
+ wbinvd
+ mov rax, 0
+ ret
+EfiCpuFlushCache ENDP
+
+END
\ No newline at end of file diff --git a/EdkCompatibilityPkg/Foundation/Ppi/OperatorPresence/OperatorPresence.c b/EdkCompatibilityPkg/Foundation/Ppi/OperatorPresence/OperatorPresence.c index a5a2e145fe..ddc3079c98 100644 --- a/EdkCompatibilityPkg/Foundation/Ppi/OperatorPresence/OperatorPresence.c +++ b/EdkCompatibilityPkg/Foundation/Ppi/OperatorPresence/OperatorPresence.c @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2006, Intel Corporation
+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
@@ -19,7 +19,7 @@ Abstract: --*/
-#include <Tiano.h>
+#include "Tiano.h"
#include EFI_PPI_DEFINITION (OperatorPresence)
diff --git a/EdkCompatibilityPkg/Foundation/Protocol/DiskInfo/DiskInfo.c b/EdkCompatibilityPkg/Foundation/Protocol/DiskInfo/DiskInfo.c index fb09f3093f..a2f14dae39 100644 --- a/EdkCompatibilityPkg/Foundation/Protocol/DiskInfo/DiskInfo.c +++ b/EdkCompatibilityPkg/Foundation/Protocol/DiskInfo/DiskInfo.c @@ -25,6 +25,7 @@ EFI_GUID gEfiDiskInfoProtocolGuid = EFI_DISK_INFO_PROTOCOL_GUID; EFI_GUID_STRING(&gEfiDiskInfoProtocolGuid, "Disk Info Protocol", "Disk Info Protocol");
+EFI_GUID gEfiDiskInfoAhciInterfaceGuid = EFI_DISK_INFO_AHCI_INTERFACE_GUID;
EFI_GUID gEfiDiskInfoIdeInterfaceGuid = EFI_DISK_INFO_IDE_INTERFACE_GUID;
EFI_GUID gEfiDiskInfoScsiInterfaceGuid = EFI_DISK_INFO_SCSI_INTERFACE_GUID;
EFI_GUID gEfiDiskInfoUsbInterfaceGuid = EFI_DISK_INFO_USB_INTERFACE_GUID;
diff --git a/EdkCompatibilityPkg/Foundation/Protocol/DiskInfo/DiskInfo.h b/EdkCompatibilityPkg/Foundation/Protocol/DiskInfo/DiskInfo.h index 3de25d9817..a6301b34f7 100644 --- a/EdkCompatibilityPkg/Foundation/Protocol/DiskInfo/DiskInfo.h +++ b/EdkCompatibilityPkg/Foundation/Protocol/DiskInfo/DiskInfo.h @@ -161,6 +161,12 @@ extern EFI_GUID gEfiDiskInfoScsiInterfaceGuid; }
extern EFI_GUID gEfiDiskInfoUsbInterfaceGuid;
+#define EFI_DISK_INFO_AHCI_INTERFACE_GUID \
+ { \
+ 0x9e498932, 0x4abc, 0x45af, 0xa3, 0x4d, 0x2, 0x47, 0x78, 0x7b, 0xe7, 0xc6 \
+ }
+extern EFI_GUID gEfiDiskInfoAhciInterfaceGuid;
+
typedef struct _EFI_DISK_INFO_PROTOCOL {
EFI_GUID Interface;
EFI_DISK_INFO_INQUIRY Inquiry;
diff --git a/EdkCompatibilityPkg/Foundation/Protocol/Dpc/Dpc.c b/EdkCompatibilityPkg/Foundation/Protocol/Dpc/Dpc.c new file mode 100644 index 0000000000..6152748842 --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Protocol/Dpc/Dpc.c @@ -0,0 +1,27 @@ +/*++
+
+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:
+
+ Dpc.c
+
+Abstract:
+
+ EFI Deferred Procedure Call Protocol
+
+--*/
+
+#include "EfiSpec.h"
+#include EFI_PROTOCOL_DEFINITION (Dpc)
+
+EFI_GUID gEfiDpcProtocolGuid = EFI_DPC_PROTOCOL_GUID;
+
+EFI_GUID_STRING (&gEfiDpcProtocolGuid, "EFI Deferred Procedure Call Protocol", "EFI Deferred Procedure Call Protocol");
diff --git a/EdkCompatibilityPkg/Foundation/Protocol/Dpc/Dpc.h b/EdkCompatibilityPkg/Foundation/Protocol/Dpc/Dpc.h new file mode 100644 index 0000000000..e49ece806b --- /dev/null +++ b/EdkCompatibilityPkg/Foundation/Protocol/Dpc/Dpc.h @@ -0,0 +1,109 @@ +/*++
+
+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:
+
+ Dpc.h
+
+Abstract:
+
+ EFI Deferred Procedure Call Protocol
+
+Revision History
+
+--*/
+
+
+#ifndef _EFIDPC_H
+#define _EFIDPC_H
+
+//
+// DPC Protocol GUID value
+//
+#define EFI_DPC_PROTOCOL_GUID \
+ { 0x480f8ae9, 0xc46, 0x4aa9, 0xbc, 0x89, 0xdb, 0x9f, 0xba, 0x61, 0x98, 0x6 }
+
+//
+// Forward reference for pure ANSI compatability
+//
+typedef struct _EFI_DPC_PROTOCOL EFI_DPC_PROTOCOL;
+
+
+/**
+ Invoke a Deferred Procedure Call.
+
+ @param DpcContext Pointer to the Deferred Procedure Call's context,
+ which is implementation dependent.
+
+**/
+typedef
+VOID
+(EFIAPI *EFI_DPC_PROCEDURE) (
+ IN VOID *DpcContext
+ );
+
+/**
+ Add a Deferred Procedure Call to the end of the DPC queue.
+
+ @param This Protocol instance pointer.
+ @param DpcTpl The EFI_TPL that the DPC should be invoked.
+ @param DpcProcedure Pointer to the DPC's function.
+ @param DpcContext Pointer to the DPC's context. Passed to DpcProcedure
+ when DpcProcedure is invoked.
+
+ @retval EFI_SUCCESS The DPC was queued.
+ @retval EFI_INVALID_PARAMETER DpcTpl is not a valid EFI_TPL.
+ @retval EFI_INVALID_PARAMETER DpcProcedure is NULL.
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources available to
+ add the DPC to the queue.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_DPC_QUEUE_DPC) (
+ IN EFI_DPC_PROTOCOL *This,
+ IN EFI_TPL DpcTpl,
+ IN EFI_DPC_PROCEDURE DpcProcedure,
+ IN VOID *DpcContext OPTIONAL
+ );
+
+/**
+ Dispatch the queue of DPCs. ALL DPCs that have been queued with a DpcTpl
+ value greater than or equal to the current TPL are invoked in the order that
+ they were queued. DPCs with higher DpcTpl values are invoked before DPCs with
+ lower DpcTpl values.
+
+ @param This Protocol instance pointer.
+
+ @retval EFI_SUCCESS One or more DPCs were invoked.
+ @retval EFI_NOT_FOUND No DPCs were invoked.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_DPC_DISPATCH_DPC) (
+ IN EFI_DPC_PROTOCOL *This
+ );
+
+//
+// DPC Protocol structure
+//
+typedef struct _EFI_DPC_PROTOCOL {
+ EFI_DPC_QUEUE_DPC QueueDpc;
+ EFI_DPC_DISPATCH_DPC DispatchDpc;
+};
+
+//
+// DPC Protocol GUID variable
+//
+extern EFI_GUID gEfiDpcProtocolGuid;
+
+#endif /* _EFIDPC_H */
diff --git a/EdkCompatibilityPkg/Foundation/Protocol/EdkProtocolLib.inf b/EdkCompatibilityPkg/Foundation/Protocol/EdkProtocolLib.inf index 7d769c0ecc..a627454d8d 100644 --- a/EdkCompatibilityPkg/Foundation/Protocol/EdkProtocolLib.inf +++ b/EdkCompatibilityPkg/Foundation/Protocol/EdkProtocolLib.inf @@ -51,6 +51,8 @@ COMPONENT_TYPE= LIBRARY DebugSerialIo\DebugSerialIo.c
DiskInfo\DiskInfo.h
DiskInfo\DiskInfo.c
+ Dpc\Dpc.h
+ Dpc\Dpc.c
EfiOemBadging\EfiOemBadging.h
EfiOemBadging\EfiOemBadging.c
FaultTolerantWriteLite\FaultTolerantWriteLite.h
diff --git a/EdkCompatibilityPkg/Foundation/Protocol/GuidedSectionExtraction/GuidedSectionExtraction.h b/EdkCompatibilityPkg/Foundation/Protocol/GuidedSectionExtraction/GuidedSectionExtraction.h index 83708b00df..9deb5c89be 100644 --- a/EdkCompatibilityPkg/Foundation/Protocol/GuidedSectionExtraction/GuidedSectionExtraction.h +++ b/EdkCompatibilityPkg/Foundation/Protocol/GuidedSectionExtraction/GuidedSectionExtraction.h @@ -51,7 +51,7 @@ EFI_FORWARD_DECLARATION (EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL); typedef
EFI_STATUS
(EFIAPI *EFI_EXTRACT_GUIDED_SECTION) (
- IN EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *This,
+ IN EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL * This,
IN VOID *InputSection,
OUT VOID **OutputBuffer,
OUT UINTN *OutputSize,
diff --git a/EdkCompatibilityPkg/Foundation/Protocol/PlatformMemTest/PlatformMemTest.h b/EdkCompatibilityPkg/Foundation/Protocol/PlatformMemTest/PlatformMemTest.h index 356563edaf..5f499adc7b 100644 --- a/EdkCompatibilityPkg/Foundation/Protocol/PlatformMemTest/PlatformMemTest.h +++ b/EdkCompatibilityPkg/Foundation/Protocol/PlatformMemTest/PlatformMemTest.h @@ -1,7 +1,7 @@ /*++
-Copyright (c) 2004, Intel Corporation
+Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -22,8 +22,11 @@ Abstract: #ifndef __PLATFORM_MEMTEST_H__
#define __PLATFORM_MEMTEST_H__
-
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+#include EFI_PROTOCOL_CONSUMER (HiiDatabase)
+#else
#include EFI_PROTOCOL_CONSUMER (Hii)
+#endif
#include EFI_PROTOCOL_CONSUMER (GenericMemoryTest)
diff --git a/EdkCompatibilityPkg/Foundation/Protocol/TcgService/TcgService.c b/EdkCompatibilityPkg/Foundation/Protocol/TcgService/TcgService.c index 2af838d532..261b145891 100644 --- a/EdkCompatibilityPkg/Foundation/Protocol/TcgService/TcgService.c +++ b/EdkCompatibilityPkg/Foundation/Protocol/TcgService/TcgService.c @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2006, Intel Corporation
+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
@@ -21,10 +21,11 @@ Abstract: --*/
-#include <Tiano.h>
+#include "Tiano.h"
#include EFI_PROTOCOL_DEFINITION(TcgService)
-EFI_GUID gEfiTcgProtocolGuid = EFI_TCG_PROTOCOL_GUID;
+EFI_GUID gEfiTcgProtocolGuid = EFI_TCG_PROTOCOL_GUID;
+EFI_GUID gEfiTcgPlatformProtocolGuid = EFI_TCG_PLATFORM_PROTOCOL_GUID;
EFI_GUID_STRING(&gEfiTcgServiceProtocolGuid, "TcgService", "TCG Services Protocol");
diff --git a/EdkCompatibilityPkg/Foundation/Protocol/TcgService/TcgService.h b/EdkCompatibilityPkg/Foundation/Protocol/TcgService/TcgService.h index 0a8cf7d77a..d461e95917 100644 --- a/EdkCompatibilityPkg/Foundation/Protocol/TcgService/TcgService.h +++ b/EdkCompatibilityPkg/Foundation/Protocol/TcgService/TcgService.h @@ -24,13 +24,27 @@ Abstract: #ifndef _TCG_SERVICE_PROTOCOL_H_
#define _TCG_SERVICE_PROTOCOL_H_
-#include <EfiTpm.h>
+#include "EfiTpm.h"
#define EFI_TCG_PROTOCOL_GUID \
{0xf541796d, 0xa62e, 0x4954, 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd}
+#define EFI_TCG_PLATFORM_PROTOCOL_GUID \
+ { 0x8c4c9a41, 0xbf56, 0x4627, 0x9e, 0xa, 0xc8, 0x38, 0x6d, 0x66, 0x11, 0x5c }
+
#define TSS_EVENT_DATA_MAX_SIZE 256
+#define EFI_CALLING_EFI_APPLICATION \
+ "Calling EFI Application from Boot Option"
+#define EFI_RETURNING_FROM_EFI_APPLICATOIN \
+ "Returning from EFI Application from Boot Option"
+#define EFI_EXIT_BOOT_SERVICES_INVOCATION \
+ "Exit Boot Services Invocation"
+#define EFI_EXIT_BOOT_SERVICES_FAILED \
+ "Exit Boot Services Returned with Failure"
+#define EFI_EXIT_BOOT_SERVICES_SUCCEEDED \
+ "Exit Boot Services Returned with Success"
+
EFI_FORWARD_DECLARATION (EFI_TCG_PROTOCOL);
//
@@ -125,4 +139,32 @@ typedef struct _EFI_TCG_PROTOCOL { extern EFI_GUID gEfiTcgProtocolGuid;
+//
+// EFI TCG Platform Protocol
+//
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCG_MEASURE_PE_IMAGE) (
+ IN BOOLEAN BootPolicy,
+ IN EFI_PHYSICAL_ADDRESS ImageAddress,
+ IN UINTN ImageSize,
+ IN UINTN LinkTimeBase,
+ IN UINT16 ImageType,
+ IN EFI_HANDLE DeviceHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_TCG_MEASURE_ACTION) (
+ IN CHAR8 *ActionString
+ );
+
+typedef struct tdEFI_TCG_PLATFORM_PROTOCOL {
+ EFI_TCG_MEASURE_PE_IMAGE MeasurePeImage;
+ EFI_TCG_MEASURE_ACTION MeasureAction;
+} EFI_TCG_PLATFORM_PROTOCOL;
+
+extern EFI_GUID gEfiTcgPlatformProtocolGuid;
+
#endif
|