diff options
author | Guo Mang <mang.guo@intel.com> | 2017-04-27 11:23:01 +0800 |
---|---|---|
committer | Guo Mang <mang.guo@intel.com> | 2017-04-27 11:23:01 +0800 |
commit | b0de74900192ab1a4a6157e76703eacfb4448f37 (patch) | |
tree | 838a377191b0093b94ccc90b8f8ef0215aa8d67e /IntelFrameworkPkg/Library | |
parent | 38c2cbb9354d7f58e48f9f649f23eb9bd0d3cfca (diff) | |
download | edk2-platforms-b0de74900192ab1a4a6157e76703eacfb4448f37.tar.xz |
IntelFrameworkPkg: Move to new location
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'IntelFrameworkPkg/Library')
25 files changed, 0 insertions, 10108 deletions
diff --git a/IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeCpuIoLibInternal.h b/IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeCpuIoLibInternal.h deleted file mode 100644 index c15bca8ee4..0000000000 --- a/IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeCpuIoLibInternal.h +++ /dev/null @@ -1,178 +0,0 @@ -/** @file
- Internal include file of DXE CPU IO Library.
- It includes all necessary protocol/library class's header file
- for implementation of IoLib library instance. It is included
- all source code of this library instance.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: DxeCpuIoLibInternal.h
-
-**/
-
-#ifndef _DXE_CPUIO_LIB_INTERNAL_H_
-#define _DXE_CPUIO_LIB_INTERNAL_H_
-
-
-#include <FrameworkDxe.h>
-
-#include <Protocol/CpuIo.h>
-
-#include <Library/IoLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-
-
-/**
- Reads registers in the EFI CPU I/O space.
-
- Reads the I/O port specified by Port with registers width specified by Width.
- The read value is returned.
-
- This function must guarantee that all I/O read and write operations are serialized.
- If such operations are not supported, then ASSERT().
-
- @param Port The base address of the I/O operation.
- The caller is responsible for aligning the Address if required.
- @param Width The width of the I/O operation.
-
- @return Data read from registers in the EFI CPU I/O space.
-
-**/
-UINT64
-EFIAPI
-IoReadWorker (
- IN UINTN Port,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width
- );
-
-/**
- Writes registers in the EFI CPU I/O space.
-
- Writes the I/O port specified by Port with registers width and value specified by Width
- and Data respectively. Data is returned.
-
- This function must guarantee that all I/O read and write operations are serialized.
- If such operations are not supported, then ASSERT().
-
- @param Port The base address of the I/O operation.
- The caller is responsible for aligning the Address if required.
- @param Width The width of the I/O operation.
- @param Data The value to write to the I/O port.
-
- @return The parameter of Data.
-
-**/
-UINT64
-EFIAPI
-IoWriteWorker (
- IN UINTN Port,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Data
- );
-
-/**
- Reads registers in the EFI CPU I/O space.
-
- Reads the I/O port specified by Port with registers width specified by Width.
- The port is read Count times, and the read data is stored in the provided Buffer.
-
- This function must guarantee that all I/O read and write operations are serialized.
- If such operations are not supported, then ASSERT().
-
- @param Port The base address of the I/O operation.
- The caller is responsible for aligning the Address if required.
- @param Width The width of the I/O operation.
- @param Count The number of times to read I/O port.
- @param Buffer The buffer to store the read data into.
-
-**/
-VOID
-EFIAPI
-IoReadFifoWorker (
- IN UINTN Port,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINTN Count,
- IN VOID *Buffer
- );
-
-/**
- Writes registers in the EFI CPU I/O space.
-
- Writes the I/O port specified by Port with registers width specified by Width.
- The port is written Count times, and the write data is retrieved from the provided Buffer.
-
- This function must guarantee that all I/O read and write operations are serialized.
- If such operations are not supported, then ASSERT().
-
- @param Port The base address of the I/O operation.
- The caller is responsible for aligning the Address if required.
- @param Width The width of the I/O operation.
- @param Count The number of times to write I/O port.
- @param Buffer The buffer to store the read data into.
-
-**/
-VOID
-EFIAPI
-IoWriteFifoWorker (
- IN UINTN Port,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINTN Count,
- IN VOID *Buffer
- );
-
-/**
- Reads memory-mapped registers in the EFI system memory space.
-
- Reads the MMIO registers specified by Address with registers width specified by Width.
- The read value is returned. If such operations are not supported, then ASSERT().
- This function must guarantee that all MMIO read and write operations are serialized.
-
- @param Address The MMIO register to read.
- The caller is responsible for aligning the Address if required.
- @param Width The width of the I/O operation.
-
- @return Data read from registers in the EFI system memory space.
-
-**/
-UINT64
-EFIAPI
-MmioReadWorker (
- IN UINTN Address,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width
- );
-
-/**
- Writes memory-mapped registers in the EFI system memory space.
-
- Writes the MMIO registers specified by Address with registers width and value specified by Width
- and Data respectively. Data is returned. If such operations are not supported, then ASSERT().
- This function must guarantee that all MMIO read and write operations are serialized.
-
- @param Address The MMIO register to read.
- The caller is responsible for aligning the Address if required.
- @param Width The width of the I/O operation.
- @param Data The value to write to the I/O port.
-
- @return Data read from registers in the EFI system memory space.
-
-**/
-UINT64
-EFIAPI
-MmioWriteWorker (
- IN UINTN Address,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Data
- );
-
-#endif
diff --git a/IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.inf b/IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.inf deleted file mode 100644 index e3c6890442..0000000000 --- a/IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.inf +++ /dev/null @@ -1,52 +0,0 @@ -## @file
-# I/O Library implementation that uses the CPU I/O Protocol for I/O and MMIO operations.
-#
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DxeIoLibCpuIo
- MODULE_UNI_FILE = DxeIoLibCpuIo.uni
- FILE_GUID = e94cd42a-3aad-4ea0-9b09-945891c60ccd
- MODULE_TYPE = DXE_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = IoLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
- CONSTRUCTOR = IoLibConstructor
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- IoLibMmioBuffer.c
- DxeCpuIoLibInternal.h
- IoHighLevel.c
- IoLib.c
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
-
-[LibraryClasses]
- BaseLib
- DebugLib
- UefiBootServicesTableLib
-
-[Protocols]
- gEfiCpuIoProtocolGuid ## CONSUMES
-
-[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER]
- gEfiCpuIoProtocolGuid
-
diff --git a/IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.uni b/IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.uni deleted file mode 100644 index b2a4b4a063..0000000000 --- a/IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file
-// I/O Library implementation that uses the CPU I/O Protocol for I/O and MMIO operations.
-//
-// The I/O Library implementation that uses the CPU I/O Protocol for I/O and MMIO operations.
-//
-// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "Uses the CPU I/O Protocol for I/O and MMIO operations"
-
-#string STR_MODULE_DESCRIPTION #language en-US "The I/O Library implementation that uses the CPU I/O Protocol for I/O and MMIO operations."
-
diff --git a/IntelFrameworkPkg/Library/DxeIoLibCpuIo/IoHighLevel.c b/IntelFrameworkPkg/Library/DxeIoLibCpuIo/IoHighLevel.c deleted file mode 100644 index 2ba291f415..0000000000 --- a/IntelFrameworkPkg/Library/DxeIoLibCpuIo/IoHighLevel.c +++ /dev/null @@ -1,2315 +0,0 @@ -/** @file
- High-level Io/Mmio functions.
-
- All assertions for bit field operations are handled bit field functions in the
- Base Library.
-
- Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: IoHighLevel.c
-
- The following IoLib instances share the same version of this file:
-
- BaseIoLibIntrinsic
- DxeIoLibCpuIo
- PeiIoLibCpuIo
-
-**/
-
-
-#include "DxeCpuIoLibInternal.h"
-
-/**
- Reads an 8-bit I/O port, performs a bitwise OR, and writes the
- result back to the 8-bit I/O port.
-
- Reads the 8-bit I/O port specified by Port, performs a bitwise OR
- between the read result and the value specified by OrData, and writes the
- result to the 8-bit I/O port specified by Port. The value written to the I/O
- port is returned. This function must guarantee that all I/O read and write
- operations are serialized.
-
- If 8-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param OrData The value to OR with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoOr8 (
- IN UINTN Port,
- IN UINT8 OrData
- )
-{
- return IoWrite8 (Port, (UINT8) (IoRead8 (Port) | OrData));
-}
-
-/**
- Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
- to the 8-bit I/O port.
-
- Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
- the read result and the value specified by AndData, and writes the result to
- the 8-bit I/O port specified by Port. The value written to the I/O port is
- returned. This function must guarantee that all I/O read and write operations
- are serialized.
-
- If 8-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param AndData The value to AND with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoAnd8 (
- IN UINTN Port,
- IN UINT8 AndData
- )
-{
- return IoWrite8 (Port, (UINT8) (IoRead8 (Port) & AndData));
-}
-
-/**
- Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
- inclusive OR, and writes the result back to the 8-bit I/O port.
-
- Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
- the read result and the value specified by AndData, performs a bitwise OR
- between the result of the AND operation and the value specified by OrData,
- and writes the result to the 8-bit I/O port specified by Port. The value
- written to the I/O port is returned. This function must guarantee that all
- I/O read and write operations are serialized.
-
- If 8-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param AndData The value to AND with the read value from the I/O port.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoAndThenOr8 (
- IN UINTN Port,
- IN UINT8 AndData,
- IN UINT8 OrData
- )
-{
- return IoWrite8 (Port, (UINT8) ((IoRead8 (Port) & AndData) | OrData));
-}
-
-/**
- Reads a bit field of an I/O register.
-
- Reads the bit field in an 8-bit I/O register. The bit field is specified by
- the StartBit and the EndBit. The value of the bit field is returned.
-
- If 8-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 7, then ASSERT().
- If EndBit is greater than 7, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
-
- @param Port The I/O port to read.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..7.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..7.
-
- @return The value read.
-
-**/
-UINT8
-EFIAPI
-IoBitFieldRead8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
- )
-{
- return BitFieldRead8 (IoRead8 (Port), StartBit, EndBit);
-}
-
-/**
- Writes a bit field to an I/O register.
-
- Writes Value to the bit field of the I/O register. The bit field is specified
- by the StartBit and the EndBit. All other bits in the destination I/O
- register are preserved. The value written to the I/O port is returned. Extra
- left bits in Value are stripped.
-
- If 8-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 7, then ASSERT().
- If EndBit is greater than 7, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..7.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..7.
- @param Value New value of the bit field.
-
- @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoBitFieldWrite8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
- )
-{
- return IoWrite8 (
- Port,
- BitFieldWrite8 (IoRead8 (Port), StartBit, EndBit, Value)
- );
-}
-
-/**
- Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
- result back to the bit field in the 8-bit port.
-
- Reads the 8-bit I/O port specified by Port, performs a bitwise OR
- between the read result and the value specified by OrData, and writes the
- result to the 8-bit I/O port specified by Port. The value written to the I/O
- port is returned. This function must guarantee that all I/O read and write
- operations are serialized. Extra left bits in OrData are stripped.
-
- If 8-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 7, then ASSERT().
- If EndBit is greater than 7, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..7.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..7.
- @param OrData The value to OR with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoBitFieldOr8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
- )
-{
- return IoWrite8 (
- Port,
- BitFieldOr8 (IoRead8 (Port), StartBit, EndBit, OrData)
- );
-}
-
-/**
- Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
- result back to the bit field in the 8-bit port.
-
- Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
- the read result and the value specified by AndData, and writes the result to
- the 8-bit I/O port specified by Port. The value written to the I/O port is
- returned. This function must guarantee that all I/O read and write operations
- are serialized. Extra left bits in AndData are stripped.
-
- If 8-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 7, then ASSERT().
- If EndBit is greater than 7, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..7.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..7.
- @param AndData The value to AND with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoBitFieldAnd8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
- )
-{
- return IoWrite8 (
- Port,
- BitFieldAnd8 (IoRead8 (Port), StartBit, EndBit, AndData)
- );
-}
-
-/**
- Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
- bitwise OR, and writes the result back to the bit field in the
- 8-bit port.
-
- Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
- by a bitwise OR between the read result and the value specified by
- AndData, and writes the result to the 8-bit I/O port specified by Port. The
- value written to the I/O port is returned. This function must guarantee that
- all I/O read and write operations are serialized. Extra left bits in both
- AndData and OrData are stripped.
-
- If 8-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 7, then ASSERT().
- If EndBit is greater than 7, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..7.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..7.
- @param AndData The value to AND with the read value from the I/O port.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoBitFieldAndThenOr8 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
- )
-{
- return IoWrite8 (
- Port,
- BitFieldAndThenOr8 (IoRead8 (Port), StartBit, EndBit, AndData, OrData)
- );
-}
-
-/**
- Reads a 16-bit I/O port, performs a bitwise OR, and writes the
- result back to the 16-bit I/O port.
-
- Reads the 16-bit I/O port specified by Port, performs a bitwise OR
- between the read result and the value specified by OrData, and writes the
- result to the 16-bit I/O port specified by Port. The value written to the I/O
- port is returned. This function must guarantee that all I/O read and write
- operations are serialized.
-
- If 16-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param OrData The value to OR with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoOr16 (
- IN UINTN Port,
- IN UINT16 OrData
- )
-{
- return IoWrite16 (Port, (UINT16) (IoRead16 (Port) | OrData));
-}
-
-/**
- Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
- to the 16-bit I/O port.
-
- Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
- the read result and the value specified by AndData, and writes the result to
- the 16-bit I/O port specified by Port. The value written to the I/O port is
- returned. This function must guarantee that all I/O read and write operations
- are serialized.
-
- If 16-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param AndData The value to AND with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoAnd16 (
- IN UINTN Port,
- IN UINT16 AndData
- )
-{
- return IoWrite16 (Port, (UINT16) (IoRead16 (Port) & AndData));
-}
-
-/**
- Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
- inclusive OR, and writes the result back to the 16-bit I/O port.
-
- Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
- the read result and the value specified by AndData, performs a bitwise OR
- between the result of the AND operation and the value specified by OrData,
- and writes the result to the 16-bit I/O port specified by Port. The value
- written to the I/O port is returned. This function must guarantee that all
- I/O read and write operations are serialized.
-
- If 16-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param AndData The value to AND with the read value from the I/O port.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoAndThenOr16 (
- IN UINTN Port,
- IN UINT16 AndData,
- IN UINT16 OrData
- )
-{
- return IoWrite16 (Port, (UINT16) ((IoRead16 (Port) & AndData) | OrData));
-}
-
-/**
- Reads a bit field of an I/O register.
-
- Reads the bit field in a 16-bit I/O register. The bit field is specified by
- the StartBit and the EndBit. The value of the bit field is returned.
-
- If 16-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 15, then ASSERT().
- If EndBit is greater than 15, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
-
- @param Port The I/O port to read.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..15.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..15.
-
- @return The value read.
-
-**/
-UINT16
-EFIAPI
-IoBitFieldRead16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
- )
-{
- return BitFieldRead16 (IoRead16 (Port), StartBit, EndBit);
-}
-
-/**
- Writes a bit field to an I/O register.
-
- Writes Value to the bit field of the I/O register. The bit field is specified
- by the StartBit and the EndBit. All other bits in the destination I/O
- register are preserved. The value written to the I/O port is returned. Extra
- left bits in Value are stripped.
-
- If 16-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 15, then ASSERT().
- If EndBit is greater than 15, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..15.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..15.
- @param Value New value of the bit field.
-
- @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoBitFieldWrite16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
- )
-{
- return IoWrite16 (
- Port,
- BitFieldWrite16 (IoRead16 (Port), StartBit, EndBit, Value)
- );
-}
-
-/**
- Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
- result back to the bit field in the 16-bit port.
-
- Reads the 16-bit I/O port specified by Port, performs a bitwise OR
- between the read result and the value specified by OrData, and writes the
- result to the 16-bit I/O port specified by Port. The value written to the I/O
- port is returned. This function must guarantee that all I/O read and write
- operations are serialized. Extra left bits in OrData are stripped.
-
- If 16-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 15, then ASSERT().
- If EndBit is greater than 15, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..15.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..15.
- @param OrData The value to OR with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoBitFieldOr16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
- )
-{
- return IoWrite16 (
- Port,
- BitFieldOr16 (IoRead16 (Port), StartBit, EndBit, OrData)
- );
-}
-
-/**
- Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
- result back to the bit field in the 16-bit port.
-
- Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
- the read result and the value specified by AndData, and writes the result to
- the 16-bit I/O port specified by Port. The value written to the I/O port is
- returned. This function must guarantee that all I/O read and write operations
- are serialized. Extra left bits in AndData are stripped.
-
- If 16-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 15, then ASSERT().
- If EndBit is greater than 15, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..15.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..15.
- @param AndData The value to AND with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoBitFieldAnd16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
- )
-{
- return IoWrite16 (
- Port,
- BitFieldAnd16 (IoRead16 (Port), StartBit, EndBit, AndData)
- );
-}
-
-/**
- Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
- bitwise OR, and writes the result back to the bit field in the
- 16-bit port.
-
- Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
- by a bitwise OR between the read result and the value specified by
- AndData, and writes the result to the 16-bit I/O port specified by Port. The
- value written to the I/O port is returned. This function must guarantee that
- all I/O read and write operations are serialized. Extra left bits in both
- AndData and OrData are stripped.
-
- If 16-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 15, then ASSERT().
- If EndBit is greater than 15, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..15.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..15.
- @param AndData The value to AND with the read value from the I/O port.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoBitFieldAndThenOr16 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
- )
-{
- return IoWrite16 (
- Port,
- BitFieldAndThenOr16 (IoRead16 (Port), StartBit, EndBit, AndData, OrData)
- );
-}
-
-/**
- Reads a 32-bit I/O port, performs a bitwise OR, and writes the
- result back to the 32-bit I/O port.
-
- Reads the 32-bit I/O port specified by Port, performs a bitwise OR
- between the read result and the value specified by OrData, and writes the
- result to the 32-bit I/O port specified by Port. The value written to the I/O
- port is returned. This function must guarantee that all I/O read and write
- operations are serialized.
-
- If 32-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param OrData The value to OR with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoOr32 (
- IN UINTN Port,
- IN UINT32 OrData
- )
-{
- return IoWrite32 (Port, IoRead32 (Port) | OrData);
-}
-
-/**
- Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
- to the 32-bit I/O port.
-
- Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
- the read result and the value specified by AndData, and writes the result to
- the 32-bit I/O port specified by Port. The value written to the I/O port is
- returned. This function must guarantee that all I/O read and write operations
- are serialized.
-
- If 32-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param AndData The value to AND with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoAnd32 (
- IN UINTN Port,
- IN UINT32 AndData
- )
-{
- return IoWrite32 (Port, IoRead32 (Port) & AndData);
-}
-
-/**
- Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
- inclusive OR, and writes the result back to the 32-bit I/O port.
-
- Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
- the read result and the value specified by AndData, performs a bitwise OR
- between the result of the AND operation and the value specified by OrData,
- and writes the result to the 32-bit I/O port specified by Port. The value
- written to the I/O port is returned. This function must guarantee that all
- I/O read and write operations are serialized.
-
- If 32-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param AndData The value to AND with the read value from the I/O port.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoAndThenOr32 (
- IN UINTN Port,
- IN UINT32 AndData,
- IN UINT32 OrData
- )
-{
- return IoWrite32 (Port, (IoRead32 (Port) & AndData) | OrData);
-}
-
-/**
- Reads a bit field of an I/O register.
-
- Reads the bit field in a 32-bit I/O register. The bit field is specified by
- the StartBit and the EndBit. The value of the bit field is returned.
-
- If 32-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 31, then ASSERT().
- If EndBit is greater than 31, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
-
- @param Port The I/O port to read.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..31.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..31.
-
- @return The value read.
-
-**/
-UINT32
-EFIAPI
-IoBitFieldRead32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
- )
-{
- return BitFieldRead32 (IoRead32 (Port), StartBit, EndBit);
-}
-
-/**
- Writes a bit field to an I/O register.
-
- Writes Value to the bit field of the I/O register. The bit field is specified
- by the StartBit and the EndBit. All other bits in the destination I/O
- register are preserved. The value written to the I/O port is returned. Extra
- left bits in Value are stripped.
-
- If 32-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 31, then ASSERT().
- If EndBit is greater than 31, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..31.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..31.
- @param Value New value of the bit field.
-
- @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoBitFieldWrite32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
- )
-{
- return IoWrite32 (
- Port,
- BitFieldWrite32 (IoRead32 (Port), StartBit, EndBit, Value)
- );
-}
-
-/**
- Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
- result back to the bit field in the 32-bit port.
-
- Reads the 32-bit I/O port specified by Port, performs a bitwise OR
- between the read result and the value specified by OrData, and writes the
- result to the 32-bit I/O port specified by Port. The value written to the I/O
- port is returned. This function must guarantee that all I/O read and write
- operations are serialized. Extra left bits in OrData are stripped.
-
- If 32-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 31, then ASSERT().
- If EndBit is greater than 31, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..31.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..31.
- @param OrData The value to OR with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoBitFieldOr32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
- )
-{
- return IoWrite32 (
- Port,
- BitFieldOr32 (IoRead32 (Port), StartBit, EndBit, OrData)
- );
-}
-
-/**
- Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
- result back to the bit field in the 32-bit port.
-
- Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
- the read result and the value specified by AndData, and writes the result to
- the 32-bit I/O port specified by Port. The value written to the I/O port is
- returned. This function must guarantee that all I/O read and write operations
- are serialized. Extra left bits in AndData are stripped.
-
- If 32-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 31, then ASSERT().
- If EndBit is greater than 31, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..31.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..31.
- @param AndData The value to AND with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoBitFieldAnd32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
- )
-{
- return IoWrite32 (
- Port,
- BitFieldAnd32 (IoRead32 (Port), StartBit, EndBit, AndData)
- );
-}
-
-/**
- Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
- bitwise OR, and writes the result back to the bit field in the
- 32-bit port.
-
- Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
- by a bitwise OR between the read result and the value specified by
- AndData, and writes the result to the 32-bit I/O port specified by Port. The
- value written to the I/O port is returned. This function must guarantee that
- all I/O read and write operations are serialized. Extra left bits in both
- AndData and OrData are stripped.
-
- If 32-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 31, then ASSERT().
- If EndBit is greater than 31, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..31.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..31.
- @param AndData The value to AND with the read value from the I/O port.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoBitFieldAndThenOr32 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
- )
-{
- return IoWrite32 (
- Port,
- BitFieldAndThenOr32 (IoRead32 (Port), StartBit, EndBit, AndData, OrData)
- );
-}
-
-/**
- Reads a 64-bit I/O port, performs a bitwise OR, and writes the
- result back to the 64-bit I/O port.
-
- Reads the 64-bit I/O port specified by Port, performs a bitwise OR
- between the read result and the value specified by OrData, and writes the
- result to the 64-bit I/O port specified by Port. The value written to the I/O
- port is returned. This function must guarantee that all I/O read and write
- operations are serialized.
-
- If 64-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param OrData The value to OR with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoOr64 (
- IN UINTN Port,
- IN UINT64 OrData
- )
-{
- return IoWrite64 (Port, IoRead64 (Port) | OrData);
-}
-
-/**
- Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
- to the 64-bit I/O port.
-
- Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
- the read result and the value specified by AndData, and writes the result to
- the 64-bit I/O port specified by Port. The value written to the I/O port is
- returned. This function must guarantee that all I/O read and write operations
- are serialized.
-
- If 64-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param AndData The value to AND with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoAnd64 (
- IN UINTN Port,
- IN UINT64 AndData
- )
-{
- return IoWrite64 (Port, IoRead64 (Port) & AndData);
-}
-
-/**
- Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
- inclusive OR, and writes the result back to the 64-bit I/O port.
-
- Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
- the read result and the value specified by AndData, performs a bitwise OR
- between the result of the AND operation and the value specified by OrData,
- and writes the result to the 64-bit I/O port specified by Port. The value
- written to the I/O port is returned. This function must guarantee that all
- I/O read and write operations are serialized.
-
- If 64-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param AndData The value to AND with the read value from the I/O port.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoAndThenOr64 (
- IN UINTN Port,
- IN UINT64 AndData,
- IN UINT64 OrData
- )
-{
- return IoWrite64 (Port, (IoRead64 (Port) & AndData) | OrData);
-}
-
-/**
- Reads a bit field of an I/O register.
-
- Reads the bit field in a 64-bit I/O register. The bit field is specified by
- the StartBit and the EndBit. The value of the bit field is returned.
-
- If 64-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 63, then ASSERT().
- If EndBit is greater than 63, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
-
- @param Port The I/O port to read.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..63.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..63.
-
- @return The value read.
-
-**/
-UINT64
-EFIAPI
-IoBitFieldRead64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit
- )
-{
- return BitFieldRead64 (IoRead64 (Port), StartBit, EndBit);
-}
-
-/**
- Writes a bit field to an I/O register.
-
- Writes Value to the bit field of the I/O register. The bit field is specified
- by the StartBit and the EndBit. All other bits in the destination I/O
- register are preserved. The value written to the I/O port is returned. Extra
- left bits in Value are stripped.
-
- If 64-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 63, then ASSERT().
- If EndBit is greater than 63, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..63.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..63.
- @param Value New value of the bit field.
-
- @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoBitFieldWrite64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
- )
-{
- return IoWrite64 (
- Port,
- BitFieldWrite64 (IoRead64 (Port), StartBit, EndBit, Value)
- );
-}
-
-/**
- Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
- result back to the bit field in the 64-bit port.
-
- Reads the 64-bit I/O port specified by Port, performs a bitwise OR
- between the read result and the value specified by OrData, and writes the
- result to the 64-bit I/O port specified by Port. The value written to the I/O
- port is returned. This function must guarantee that all I/O read and write
- operations are serialized. Extra left bits in OrData are stripped.
-
- If 64-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 63, then ASSERT().
- If EndBit is greater than 63, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..63.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..63.
- @param OrData The value to OR with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoBitFieldOr64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
- )
-{
- return IoWrite64 (
- Port,
- BitFieldOr64 (IoRead64 (Port), StartBit, EndBit, OrData)
- );
-}
-
-/**
- Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
- result back to the bit field in the 64-bit port.
-
- Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
- the read result and the value specified by AndData, and writes the result to
- the 64-bit I/O port specified by Port. The value written to the I/O port is
- returned. This function must guarantee that all I/O read and write operations
- are serialized. Extra left bits in AndData are stripped.
-
- If 64-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 63, then ASSERT().
- If EndBit is greater than 63, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..63.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..63.
- @param AndData The value to AND with the read value from the I/O port.
-
- @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoBitFieldAnd64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
- )
-{
- return IoWrite64 (
- Port,
- BitFieldAnd64 (IoRead64 (Port), StartBit, EndBit, AndData)
- );
-}
-
-/**
- Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
- bitwise OR, and writes the result back to the bit field in the
- 64-bit port.
-
- Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
- by a bitwise OR between the read result and the value specified by
- AndData, and writes the result to the 64-bit I/O port specified by Port. The
- value written to the I/O port is returned. This function must guarantee that
- all I/O read and write operations are serialized. Extra left bits in both
- AndData and OrData are stripped.
-
- If 64-bit I/O port operations are not supported, then ASSERT().
- If StartBit is greater than 63, then ASSERT().
- If EndBit is greater than 63, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Port The I/O port to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..63.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..63.
- @param AndData The value to AND with the read value from the I/O port.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoBitFieldAndThenOr64 (
- IN UINTN Port,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
- )
-{
- return IoWrite64 (
- Port,
- BitFieldAndThenOr64 (IoRead64 (Port), StartBit, EndBit, AndData, OrData)
- );
-}
-
-/**
- Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
- result back to the 8-bit MMIO register.
-
- Reads the 8-bit MMIO register specified by Address, performs a bitwise
- inclusive OR between the read result and the value specified by OrData, and
- writes the result to the 8-bit MMIO register specified by Address. The value
- written to the MMIO register is returned. This function must guarantee that
- all MMIO read and write operations are serialized.
-
- If 8-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to write.
- @param OrData The value to OR with the read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioOr8 (
- IN UINTN Address,
- IN UINT8 OrData
- )
-{
- return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) | OrData));
-}
-
-/**
- Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
- back to the 8-bit MMIO register.
-
- Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
- between the read result and the value specified by AndData, and writes the
- result to the 8-bit MMIO register specified by Address. The value written to
- the MMIO register is returned. This function must guarantee that all MMIO
- read and write operations are serialized.
-
- If 8-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to write.
- @param AndData The value to AND with the read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
- )
-{
- return MmioWrite8 (Address, (UINT8) (MmioRead8 (Address) & AndData));
-}
-
-/**
- Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
- inclusive OR, and writes the result back to the 8-bit MMIO register.
-
- Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
- between the read result and the value specified by AndData, performs a
- bitwise OR between the result of the AND operation and the value specified by
- OrData, and writes the result to the 8-bit MMIO register specified by
- Address. The value written to the MMIO register is returned. This function
- must guarantee that all MMIO read and write operations are serialized.
-
- If 8-bit MMIO register operations are not supported, then ASSERT().
-
-
- @param Address The MMIO register to write.
- @param AndData The value to AND with the read value from the MMIO register.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
- )
-{
- return MmioWrite8 (Address, (UINT8) ((MmioRead8 (Address) & AndData) | OrData));
-}
-
-/**
- Reads a bit field of a MMIO register.
-
- Reads the bit field in an 8-bit MMIO register. The bit field is specified by
- the StartBit and the EndBit. The value of the bit field is returned.
-
- If 8-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 7, then ASSERT().
- If EndBit is greater than 7, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
-
- @param Address MMIO register to read.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..7.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..7.
-
- @return The value read.
-
-**/
-UINT8
-EFIAPI
-MmioBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
- )
-{
- return BitFieldRead8 (MmioRead8 (Address), StartBit, EndBit);
-}
-
-/**
- Writes a bit field to a MMIO register.
-
- Writes Value to the bit field of the MMIO register. The bit field is
- specified by the StartBit and the EndBit. All other bits in the destination
- MMIO register are preserved. The new value of the 8-bit register is returned.
-
- If 8-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 7, then ASSERT().
- If EndBit is greater than 7, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..7.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..7.
- @param Value New value of the bit field.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
- )
-{
- return MmioWrite8 (
- Address,
- BitFieldWrite8 (MmioRead8 (Address), StartBit, EndBit, Value)
- );
-}
-
-/**
- Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
- writes the result back to the bit field in the 8-bit MMIO register.
-
- Reads the 8-bit MMIO register specified by Address, performs a bitwise
- inclusive OR between the read result and the value specified by OrData, and
- writes the result to the 8-bit MMIO register specified by Address. The value
- written to the MMIO register is returned. This function must guarantee that
- all MMIO read and write operations are serialized. Extra left bits in OrData
- are stripped.
-
- If 8-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 7, then ASSERT().
- If EndBit is greater than 7, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..7.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..7.
- @param OrData The value to OR with read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
- )
-{
- return MmioWrite8 (
- Address,
- BitFieldOr8 (MmioRead8 (Address), StartBit, EndBit, OrData)
- );
-}
-
-/**
- Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
- writes the result back to the bit field in the 8-bit MMIO register.
-
- Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
- between the read result and the value specified by AndData, and writes the
- result to the 8-bit MMIO register specified by Address. The value written to
- the MMIO register is returned. This function must guarantee that all MMIO
- read and write operations are serialized. Extra left bits in AndData are
- stripped.
-
- If 8-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 7, then ASSERT().
- If EndBit is greater than 7, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..7.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..7.
- @param AndData The value to AND with read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
- )
-{
- return MmioWrite8 (
- Address,
- BitFieldAnd8 (MmioRead8 (Address), StartBit, EndBit, AndData)
- );
-}
-
-/**
- Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
- by a bitwise OR, and writes the result back to the bit field in the
- 8-bit MMIO register.
-
- Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
- followed by a bitwise OR between the read result and the value
- specified by AndData, and writes the result to the 8-bit MMIO register
- specified by Address. The value written to the MMIO register is returned.
- This function must guarantee that all MMIO read and write operations are
- serialized. Extra left bits in both AndData and OrData are stripped.
-
- If 8-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 7, then ASSERT().
- If EndBit is greater than 7, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..7.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..7.
- @param AndData The value to AND with read value from the MMIO register.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
- )
-{
- return MmioWrite8 (
- Address,
- BitFieldAndThenOr8 (MmioRead8 (Address), StartBit, EndBit, AndData, OrData)
- );
-}
-
-/**
- Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
- result back to the 16-bit MMIO register.
-
- Reads the 16-bit MMIO register specified by Address, performs a bitwise
- inclusive OR between the read result and the value specified by OrData, and
- writes the result to the 16-bit MMIO register specified by Address. The value
- written to the MMIO register is returned. This function must guarantee that
- all MMIO read and write operations are serialized.
-
- If 16-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to write.
- @param OrData The value to OR with the read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioOr16 (
- IN UINTN Address,
- IN UINT16 OrData
- )
-{
- return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) | OrData));
-}
-
-/**
- Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
- back to the 16-bit MMIO register.
-
- Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
- between the read result and the value specified by AndData, and writes the
- result to the 16-bit MMIO register specified by Address. The value written to
- the MMIO register is returned. This function must guarantee that all MMIO
- read and write operations are serialized.
-
- If 16-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to write.
- @param AndData The value to AND with the read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
- )
-{
- return MmioWrite16 (Address, (UINT16) (MmioRead16 (Address) & AndData));
-}
-
-/**
- Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
- inclusive OR, and writes the result back to the 16-bit MMIO register.
-
- Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
- between the read result and the value specified by AndData, performs a
- bitwise OR between the result of the AND operation and the value specified by
- OrData, and writes the result to the 16-bit MMIO register specified by
- Address. The value written to the MMIO register is returned. This function
- must guarantee that all MMIO read and write operations are serialized.
-
- If 16-bit MMIO register operations are not supported, then ASSERT().
-
-
- @param Address The MMIO register to write.
- @param AndData The value to AND with the read value from the MMIO register.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
- )
-{
- return MmioWrite16 (Address, (UINT16) ((MmioRead16 (Address) & AndData) | OrData));
-}
-
-/**
- Reads a bit field of a MMIO register.
-
- Reads the bit field in a 16-bit MMIO register. The bit field is specified by
- the StartBit and the EndBit. The value of the bit field is returned.
-
- If 16-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 15, then ASSERT().
- If EndBit is greater than 15, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
-
- @param Address MMIO register to read.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..15.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..15.
-
- @return The value read.
-
-**/
-UINT16
-EFIAPI
-MmioBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
- )
-{
- return BitFieldRead16 (MmioRead16 (Address), StartBit, EndBit);
-}
-
-/**
- Writes a bit field to a MMIO register.
-
- Writes Value to the bit field of the MMIO register. The bit field is
- specified by the StartBit and the EndBit. All other bits in the destination
- MMIO register are preserved. The new value of the 16-bit register is returned.
-
- If 16-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 15, then ASSERT().
- If EndBit is greater than 15, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..15.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..15.
- @param Value New value of the bit field.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
- )
-{
- return MmioWrite16 (
- Address,
- BitFieldWrite16 (MmioRead16 (Address), StartBit, EndBit, Value)
- );
-}
-
-/**
- Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
- writes the result back to the bit field in the 16-bit MMIO register.
-
- Reads the 16-bit MMIO register specified by Address, performs a bitwise
- inclusive OR between the read result and the value specified by OrData, and
- writes the result to the 16-bit MMIO register specified by Address. The value
- written to the MMIO register is returned. This function must guarantee that
- all MMIO read and write operations are serialized. Extra left bits in OrData
- are stripped.
-
- If 16-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 15, then ASSERT().
- If EndBit is greater than 15, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..15.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..15.
- @param OrData The value to OR with read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
- )
-{
- return MmioWrite16 (
- Address,
- BitFieldOr16 (MmioRead16 (Address), StartBit, EndBit, OrData)
- );
-}
-
-/**
- Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
- writes the result back to the bit field in the 16-bit MMIO register.
-
- Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
- between the read result and the value specified by AndData, and writes the
- result to the 16-bit MMIO register specified by Address. The value written to
- the MMIO register is returned. This function must guarantee that all MMIO
- read and write operations are serialized. Extra left bits in AndData are
- stripped.
-
- If 16-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 15, then ASSERT().
- If EndBit is greater than 15, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..15.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..15.
- @param AndData The value to AND with read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
- )
-{
- return MmioWrite16 (
- Address,
- BitFieldAnd16 (MmioRead16 (Address), StartBit, EndBit, AndData)
- );
-}
-
-/**
- Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
- by a bitwise OR, and writes the result back to the bit field in the
- 16-bit MMIO register.
-
- Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
- followed by a bitwise OR between the read result and the value
- specified by AndData, and writes the result to the 16-bit MMIO register
- specified by Address. The value written to the MMIO register is returned.
- This function must guarantee that all MMIO read and write operations are
- serialized. Extra left bits in both AndData and OrData are stripped.
-
- If 16-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 15, then ASSERT().
- If EndBit is greater than 15, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..15.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..15.
- @param AndData The value to AND with read value from the MMIO register.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
- )
-{
- return MmioWrite16 (
- Address,
- BitFieldAndThenOr16 (MmioRead16 (Address), StartBit, EndBit, AndData, OrData)
- );
-}
-
-/**
- Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
- result back to the 32-bit MMIO register.
-
- Reads the 32-bit MMIO register specified by Address, performs a bitwise
- inclusive OR between the read result and the value specified by OrData, and
- writes the result to the 32-bit MMIO register specified by Address. The value
- written to the MMIO register is returned. This function must guarantee that
- all MMIO read and write operations are serialized.
-
- If 32-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to write.
- @param OrData The value to OR with the read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioOr32 (
- IN UINTN Address,
- IN UINT32 OrData
- )
-{
- return MmioWrite32 (Address, MmioRead32 (Address) | OrData);
-}
-
-/**
- Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
- back to the 32-bit MMIO register.
-
- Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
- between the read result and the value specified by AndData, and writes the
- result to the 32-bit MMIO register specified by Address. The value written to
- the MMIO register is returned. This function must guarantee that all MMIO
- read and write operations are serialized.
-
- If 32-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to write.
- @param AndData The value to AND with the read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
- )
-{
- return MmioWrite32 (Address, MmioRead32 (Address) & AndData);
-}
-
-/**
- Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
- inclusive OR, and writes the result back to the 32-bit MMIO register.
-
- Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
- between the read result and the value specified by AndData, performs a
- bitwise OR between the result of the AND operation and the value specified by
- OrData, and writes the result to the 32-bit MMIO register specified by
- Address. The value written to the MMIO register is returned. This function
- must guarantee that all MMIO read and write operations are serialized.
-
- If 32-bit MMIO register operations are not supported, then ASSERT().
-
-
- @param Address The MMIO register to write.
- @param AndData The value to AND with the read value from the MMIO register.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
- )
-{
- return MmioWrite32 (Address, (MmioRead32 (Address) & AndData) | OrData);
-}
-
-/**
- Reads a bit field of a MMIO register.
-
- Reads the bit field in a 32-bit MMIO register. The bit field is specified by
- the StartBit and the EndBit. The value of the bit field is returned.
-
- If 32-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 31, then ASSERT().
- If EndBit is greater than 31, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
-
- @param Address MMIO register to read.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..31.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..31.
-
- @return The value read.
-
-**/
-UINT32
-EFIAPI
-MmioBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
- )
-{
- return BitFieldRead32 (MmioRead32 (Address), StartBit, EndBit);
-}
-
-/**
- Writes a bit field to a MMIO register.
-
- Writes Value to the bit field of the MMIO register. The bit field is
- specified by the StartBit and the EndBit. All other bits in the destination
- MMIO register are preserved. The new value of the 32-bit register is returned.
-
- If 32-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 31, then ASSERT().
- If EndBit is greater than 31, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..31.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..31.
- @param Value New value of the bit field.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
- )
-{
- return MmioWrite32 (
- Address,
- BitFieldWrite32 (MmioRead32 (Address), StartBit, EndBit, Value)
- );
-}
-
-/**
- Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
- writes the result back to the bit field in the 32-bit MMIO register.
-
- Reads the 32-bit MMIO register specified by Address, performs a bitwise
- inclusive OR between the read result and the value specified by OrData, and
- writes the result to the 32-bit MMIO register specified by Address. The value
- written to the MMIO register is returned. This function must guarantee that
- all MMIO read and write operations are serialized. Extra left bits in OrData
- are stripped.
-
- If 32-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 31, then ASSERT().
- If EndBit is greater than 31, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..31.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..31.
- @param OrData The value to OR with read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
- )
-{
- return MmioWrite32 (
- Address,
- BitFieldOr32 (MmioRead32 (Address), StartBit, EndBit, OrData)
- );
-}
-
-/**
- Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
- writes the result back to the bit field in the 32-bit MMIO register.
-
- Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
- between the read result and the value specified by AndData, and writes the
- result to the 32-bit MMIO register specified by Address. The value written to
- the MMIO register is returned. This function must guarantee that all MMIO
- read and write operations are serialized. Extra left bits in AndData are
- stripped.
-
- If 32-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 31, then ASSERT().
- If EndBit is greater than 31, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..31.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..31.
- @param AndData The value to AND with read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
- )
-{
- return MmioWrite32 (
- Address,
- BitFieldAnd32 (MmioRead32 (Address), StartBit, EndBit, AndData)
- );
-}
-
-/**
- Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
- by a bitwise OR, and writes the result back to the bit field in the
- 32-bit MMIO register.
-
- Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
- followed by a bitwise OR between the read result and the value
- specified by AndData, and writes the result to the 32-bit MMIO register
- specified by Address. The value written to the MMIO register is returned.
- This function must guarantee that all MMIO read and write operations are
- serialized. Extra left bits in both AndData and OrData are stripped.
-
- If 32-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 31, then ASSERT().
- If EndBit is greater than 31, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..31.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..31.
- @param AndData The value to AND with read value from the MMIO register.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
- )
-{
- return MmioWrite32 (
- Address,
- BitFieldAndThenOr32 (MmioRead32 (Address), StartBit, EndBit, AndData, OrData)
- );
-}
-
-/**
- Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
- result back to the 64-bit MMIO register.
-
- Reads the 64-bit MMIO register specified by Address, performs a bitwise
- inclusive OR between the read result and the value specified by OrData, and
- writes the result to the 64-bit MMIO register specified by Address. The value
- written to the MMIO register is returned. This function must guarantee that
- all MMIO read and write operations are serialized.
-
- If 64-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to write.
- @param OrData The value to OR with the read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioOr64 (
- IN UINTN Address,
- IN UINT64 OrData
- )
-{
- return MmioWrite64 (Address, MmioRead64 (Address) | OrData);
-}
-
-/**
- Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
- back to the 64-bit MMIO register.
-
- Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
- between the read result and the value specified by AndData, and writes the
- result to the 64-bit MMIO register specified by Address. The value written to
- the MMIO register is returned. This function must guarantee that all MMIO
- read and write operations are serialized.
-
- If 64-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to write.
- @param AndData The value to AND with the read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioAnd64 (
- IN UINTN Address,
- IN UINT64 AndData
- )
-{
- return MmioWrite64 (Address, MmioRead64 (Address) & AndData);
-}
-
-/**
- Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
- inclusive OR, and writes the result back to the 64-bit MMIO register.
-
- Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
- between the read result and the value specified by AndData, performs a
- bitwise OR between the result of the AND operation and the value specified by
- OrData, and writes the result to the 64-bit MMIO register specified by
- Address. The value written to the MMIO register is returned. This function
- must guarantee that all MMIO read and write operations are serialized.
-
- If 64-bit MMIO register operations are not supported, then ASSERT().
-
-
- @param Address The MMIO register to write.
- @param AndData The value to AND with the read value from the MMIO register.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioAndThenOr64 (
- IN UINTN Address,
- IN UINT64 AndData,
- IN UINT64 OrData
- )
-{
- return MmioWrite64 (Address, (MmioRead64 (Address) & AndData) | OrData);
-}
-
-/**
- Reads a bit field of a MMIO register.
-
- Reads the bit field in a 64-bit MMIO register. The bit field is specified by
- the StartBit and the EndBit. The value of the bit field is returned.
-
- If 64-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 63, then ASSERT().
- If EndBit is greater than 63, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
-
- @param Address MMIO register to read.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..63.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..63.
-
- @return The value read.
-
-**/
-UINT64
-EFIAPI
-MmioBitFieldRead64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
- )
-{
- return BitFieldRead64 (MmioRead64 (Address), StartBit, EndBit);
-}
-
-/**
- Writes a bit field to a MMIO register.
-
- Writes Value to the bit field of the MMIO register. The bit field is
- specified by the StartBit and the EndBit. All other bits in the destination
- MMIO register are preserved. The new value of the 64-bit register is returned.
-
- If 64-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 63, then ASSERT().
- If EndBit is greater than 63, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..63.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..63.
- @param Value New value of the bit field.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioBitFieldWrite64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 Value
- )
-{
- return MmioWrite64 (
- Address,
- BitFieldWrite64 (MmioRead64 (Address), StartBit, EndBit, Value)
- );
-}
-
-/**
- Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
- writes the result back to the bit field in the 64-bit MMIO register.
-
- Reads the 64-bit MMIO register specified by Address, performs a bitwise
- inclusive OR between the read result and the value specified by OrData, and
- writes the result to the 64-bit MMIO register specified by Address. The value
- written to the MMIO register is returned. This function must guarantee that
- all MMIO read and write operations are serialized. Extra left bits in OrData
- are stripped.
-
- If 64-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 63, then ASSERT().
- If EndBit is greater than 63, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..63.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..63.
- @param OrData The value to OR with read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioBitFieldOr64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 OrData
- )
-{
- return MmioWrite64 (
- Address,
- BitFieldOr64 (MmioRead64 (Address), StartBit, EndBit, OrData)
- );
-}
-
-/**
- Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
- writes the result back to the bit field in the 64-bit MMIO register.
-
- Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
- between the read result and the value specified by AndData, and writes the
- result to the 64-bit MMIO register specified by Address. The value written to
- the MMIO register is returned. This function must guarantee that all MMIO
- read and write operations are serialized. Extra left bits in AndData are
- stripped.
-
- If 64-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 63, then ASSERT().
- If EndBit is greater than 63, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..63.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..63.
- @param AndData The value to AND with read value from the MMIO register.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioBitFieldAnd64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData
- )
-{
- return MmioWrite64 (
- Address,
- BitFieldAnd64 (MmioRead64 (Address), StartBit, EndBit, AndData)
- );
-}
-
-/**
- Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
- by a bitwise OR, and writes the result back to the bit field in the
- 64-bit MMIO register.
-
- Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
- followed by a bitwise OR between the read result and the value
- specified by AndData, and writes the result to the 64-bit MMIO register
- specified by Address. The value written to the MMIO register is returned.
- This function must guarantee that all MMIO read and write operations are
- serialized. Extra left bits in both AndData and OrData are stripped.
-
- If 64-bit MMIO register operations are not supported, then ASSERT().
- If StartBit is greater than 63, then ASSERT().
- If EndBit is greater than 63, then ASSERT().
- If EndBit is less than StartBit, then ASSERT().
- If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
- If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
-
- @param Address MMIO register to write.
- @param StartBit The ordinal of the least significant bit in the bit field.
- Range 0..63.
- @param EndBit The ordinal of the most significant bit in the bit field.
- Range 0..63.
- @param AndData The value to AND with read value from the MMIO register.
- @param OrData The value to OR with the result of the AND operation.
-
- @return The value written back to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioBitFieldAndThenOr64 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT64 AndData,
- IN UINT64 OrData
- )
-{
- return MmioWrite64 (
- Address,
- BitFieldAndThenOr64 (MmioRead64 (Address), StartBit, EndBit, AndData, OrData)
- );
-}
diff --git a/IntelFrameworkPkg/Library/DxeIoLibCpuIo/IoLib.c b/IntelFrameworkPkg/Library/DxeIoLibCpuIo/IoLib.c deleted file mode 100644 index 1dbc362f09..0000000000 --- a/IntelFrameworkPkg/Library/DxeIoLibCpuIo/IoLib.c +++ /dev/null @@ -1,870 +0,0 @@ -/** @file
- I/O Library.
- The implementation of I/O operation for this library instance
- are based on EFI_CPU_IO_PROTOCOL.
-
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
- Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: IoLib.c
-
-**/
-
-
-#include "DxeCpuIoLibInternal.h"
-
-//
-// Globle varible to cache pointer to CpuIo protocol.
-//
-EFI_CPU_IO_PROTOCOL *mCpuIo = NULL;
-
-/**
- The constructor function caches the pointer to CpuIo protocol.
-
- The constructor function locates CpuIo protocol from protocol database.
- It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-IoLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &mCpuIo);
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-/**
- Reads registers in the EFI CPU I/O space.
-
- Reads the I/O port specified by Port with registers width specified by Width.
- The read value is returned. If such operations are not supported, then ASSERT().
- This function must guarantee that all I/O read and write operations are serialized.
-
- @param Port The base address of the I/O operation.
- The caller is responsible for aligning the Address if required.
- @param Width The width of the I/O operation.
-
- @return Data read from registers in the EFI CPU I/O space.
-
-**/
-UINT64
-EFIAPI
-IoReadWorker (
- IN UINTN Port,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width
- )
-{
- EFI_STATUS Status;
- UINT64 Data;
-
- Status = mCpuIo->Io.Read (mCpuIo, Width, Port, 1, &Data);
- ASSERT_EFI_ERROR (Status);
-
- return Data;
-}
-
-/**
- Writes registers in the EFI CPU I/O space.
-
- Writes the I/O port specified by Port with registers width and value specified by Width
- and Data respectively. Data is returned. If such operations are not supported, then ASSERT().
- This function must guarantee that all I/O read and write operations are serialized.
-
- @param Port The base address of the I/O operation.
- The caller is responsible for aligning the Address if required.
- @param Width The width of the I/O operation.
- @param Data The value to write to the I/O port.
-
- @return The parameter of Data.
-
-**/
-UINT64
-EFIAPI
-IoWriteWorker (
- IN UINTN Port,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Data
- )
-{
- EFI_STATUS Status;
-
- Status = mCpuIo->Io.Write (mCpuIo, Width, Port, 1, &Data);
- ASSERT_EFI_ERROR (Status);
-
- return Data;
-}
-
-/**
- Reads registers in the EFI CPU I/O space.
-
- Reads the I/O port specified by Port with registers width specified by Width.
- The port is read Count times, and the read data is stored in the provided Buffer.
-
- This function must guarantee that all I/O read and write operations are serialized.
- If such operations are not supported, then ASSERT().
-
- @param Port The base address of the I/O operation.
- The caller is responsible for aligning the Address if required.
- @param Width The width of the I/O operation.
- @param Count The number of times to read I/O port.
- @param Buffer The buffer to store the read data into.
-
-**/
-VOID
-EFIAPI
-IoReadFifoWorker (
- IN UINTN Port,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINTN Count,
- IN VOID *Buffer
- )
-{
- EFI_STATUS Status;
-
- Status = mCpuIo->Io.Read (mCpuIo, Width, Port, Count, Buffer);
- ASSERT_EFI_ERROR (Status);
-}
-
-/**
- Writes registers in the EFI CPU I/O space.
-
- Writes the I/O port specified by Port with registers width specified by Width.
- The port is written Count times, and the write data is retrieved from the provided Buffer.
-
- This function must guarantee that all I/O read and write operations are serialized.
- If such operations are not supported, then ASSERT().
-
- @param Port The base address of the I/O operation.
- The caller is responsible for aligning the Address if required.
- @param Width The width of the I/O operation.
- @param Count The number of times to write I/O port.
- @param Buffer The buffer to store the read data into.
-
-**/
-VOID
-EFIAPI
-IoWriteFifoWorker (
- IN UINTN Port,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINTN Count,
- IN VOID *Buffer
- )
-{
- EFI_STATUS Status;
-
- Status = mCpuIo->Io.Write (mCpuIo, Width, Port, Count, Buffer);
- ASSERT_EFI_ERROR (Status);
-}
-
-/**
- Reads memory-mapped registers in the EFI system memory space.
-
- Reads the MMIO registers specified by Address with registers width specified by Width.
- The read value is returned. If such operations are not supported, then ASSERT().
- This function must guarantee that all MMIO read and write operations are serialized.
-
- @param Address The MMIO register to read.
- The caller is responsible for aligning the Address if required.
- @param Width The width of the I/O operation.
-
- @return Data read from registers in the EFI system memory space.
-
-**/
-UINT64
-EFIAPI
-MmioReadWorker (
- IN UINTN Address,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width
- )
-{
- EFI_STATUS Status;
- UINT64 Data;
-
- Status = mCpuIo->Mem.Read (mCpuIo, Width, Address, 1, &Data);
- ASSERT_EFI_ERROR (Status);
-
- return Data;
-}
-
-/**
- Writes memory-mapped registers in the EFI system memory space.
-
- Writes the MMIO registers specified by Address with registers width and value specified by Width
- and Data respectively. Data is returned. If such operations are not supported, then ASSERT().
- This function must guarantee that all MMIO read and write operations are serialized.
-
- @param Address The MMIO register to read.
- The caller is responsible for aligning the Address if required.
- @param Width The width of the I/O operation.
- @param Data The value to write to the I/O port.
-
- @return Data read from registers in the EFI system memory space.
-
-**/
-UINT64
-EFIAPI
-MmioWriteWorker (
- IN UINTN Address,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Data
- )
-{
- EFI_STATUS Status;
-
- Status = mCpuIo->Mem.Write (mCpuIo, Width, Address, 1, &Data);
- ASSERT_EFI_ERROR (Status);
-
- return Data;
-}
-
-/**
- Reads an 8-bit I/O port.
-
- Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
- This function must guarantee that all I/O read and write operations are
- serialized.
-
- If 8-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to read.
-
- @return The value read.
-
-**/
-UINT8
-EFIAPI
-IoRead8 (
- IN UINTN Port
- )
-{
- return (UINT8)IoReadWorker (Port, EfiCpuIoWidthUint8);
-}
-
-/**
- Writes an 8-bit I/O port.
-
- Writes the 8-bit I/O port specified by Port with the value specified by Value
- and returns Value. This function must guarantee that all I/O read and write
- operations are serialized.
-
- If 8-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param Value The value to write to the I/O port.
-
- @return The value written the I/O port.
-
-**/
-UINT8
-EFIAPI
-IoWrite8 (
- IN UINTN Port,
- IN UINT8 Value
- )
-{
- return (UINT8)IoWriteWorker (Port, EfiCpuIoWidthUint8, Value);
-}
-
-/**
- Reads a 16-bit I/O port.
-
- Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
- This function must guarantee that all I/O read and write operations are
- serialized.
-
- If Port is not aligned on a 16-bit boundary, then ASSERT().
-
- If 16-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to read.
-
- @return The value read.
-
-**/
-UINT16
-EFIAPI
-IoRead16 (
- IN UINTN Port
- )
-{
- //
- // Make sure Port is aligned on a 16-bit boundary.
- //
- ASSERT ((Port & 1) == 0);
- return (UINT16)IoReadWorker (Port, EfiCpuIoWidthUint16);
-}
-
-/**
- Writes a 16-bit I/O port.
-
- Writes the 16-bit I/O port specified by Port with the value specified by Value
- and returns Value. This function must guarantee that all I/O read and write
- operations are serialized.
-
- If Port is not aligned on a 16-bit boundary, then ASSERT().
-
- If 16-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param Value The value to write to the I/O port.
-
- @return The value written the I/O port.
-
-**/
-UINT16
-EFIAPI
-IoWrite16 (
- IN UINTN Port,
- IN UINT16 Value
- )
-{
- //
- // Make sure Port is aligned on a 16-bit boundary.
- //
- ASSERT ((Port & 1) == 0);
- return (UINT16)IoWriteWorker (Port, EfiCpuIoWidthUint16, Value);
-}
-
-/**
- Reads a 32-bit I/O port.
-
- Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
- This function must guarantee that all I/O read and write operations are
- serialized.
-
- If Port is not aligned on a 32-bit boundary, then ASSERT().
-
- If 32-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to read.
-
- @return The value read.
-
-**/
-UINT32
-EFIAPI
-IoRead32 (
- IN UINTN Port
- )
-{
- //
- // Make sure Port is aligned on a 32-bit boundary.
- //
- ASSERT ((Port & 3) == 0);
- return (UINT32)IoReadWorker (Port, EfiCpuIoWidthUint32);
-}
-
-/**
- Writes a 32-bit I/O port.
-
- Writes the 32-bit I/O port specified by Port with the value specified by Value
- and returns Value. This function must guarantee that all I/O read and write
- operations are serialized.
-
- If Port is not aligned on a 32-bit boundary, then ASSERT().
-
- If 32-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param Value The value to write to the I/O port.
-
- @return The value written the I/O port.
-
-**/
-UINT32
-EFIAPI
-IoWrite32 (
- IN UINTN Port,
- IN UINT32 Value
- )
-{
- //
- // Make sure Port is aligned on a 32-bit boundary.
- //
- ASSERT ((Port & 3) == 0);
- return (UINT32)IoWriteWorker (Port, EfiCpuIoWidthUint32, Value);
-}
-
-/**
- Reads a 64-bit I/O port.
-
- Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
- This function must guarantee that all I/O read and write operations are
- serialized.
-
- If Port is not aligned on a 64-bit boundary, then ASSERT().
-
- If 64-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to read.
-
- @return The value read.
-
-**/
-UINT64
-EFIAPI
-IoRead64 (
- IN UINTN Port
- )
-{
- //
- // Make sure Port is aligned on a 64-bit boundary.
- //
- ASSERT ((Port & 7) == 0);
- return IoReadWorker (Port, EfiCpuIoWidthUint64);
-}
-
-/**
- Writes a 64-bit I/O port.
-
- Writes the 64-bit I/O port specified by Port with the value specified by Value
- and returns Value. This function must guarantee that all I/O read and write
- operations are serialized.
-
- If Port is not aligned on a 64-bit boundary, then ASSERT().
-
- If 64-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param Value The value to write to the I/O port.
-
- @return The value written the I/O port.
-
-**/
-UINT64
-EFIAPI
-IoWrite64 (
- IN UINTN Port,
- IN UINT64 Value
- )
-{
- //
- // Make sure Port is aligned on a 64-bit boundary.
- //
- ASSERT ((Port & 7) == 0);
- return IoWriteWorker (Port, EfiCpuIoWidthUint64, Value);
-}
-
-/**
- Reads an 8-bit I/O port fifo into a block of memory.
-
- Reads the 8-bit I/O fifo port specified by Port.
- The port is read Count times, and the read data is
- stored in the provided Buffer.
-
- This function must guarantee that all I/O read and write operations are
- serialized.
-
- If 8-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to read.
- @param Count The number of times to read I/O port.
- @param Buffer The buffer to store the read data into.
-
-**/
-VOID
-EFIAPI
-IoReadFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
- )
-{
- IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer);
-}
-
-/**
- Writes a block of memory into an 8-bit I/O port fifo.
-
- Writes the 8-bit I/O fifo port specified by Port.
- The port is written Count times, and the write data is
- retrieved from the provided Buffer.
-
- This function must guarantee that all I/O write and write operations are
- serialized.
-
- If 8-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param Count The number of times to write I/O port.
- @param Buffer The buffer to retrieve the write data from.
-
-**/
-VOID
-EFIAPI
-IoWriteFifo8 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
- )
-{
- IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer);
-}
-
-/**
- Reads a 16-bit I/O port fifo into a block of memory.
-
- Reads the 16-bit I/O fifo port specified by Port.
- The port is read Count times, and the read data is
- stored in the provided Buffer.
-
- This function must guarantee that all I/O read and write operations are
- serialized.
-
- If 16-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to read.
- @param Count The number of times to read I/O port.
- @param Buffer The buffer to store the read data into.
-
-**/
-VOID
-EFIAPI
-IoReadFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
- )
-{
- //
- // Make sure Port is aligned on a 16-bit boundary.
- //
- ASSERT ((Port & 1) == 0);
- IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint16, Count, Buffer);
-}
-
-/**
- Writes a block of memory into a 16-bit I/O port fifo.
-
- Writes the 16-bit I/O fifo port specified by Port.
- The port is written Count times, and the write data is
- retrieved from the provided Buffer.
-
- This function must guarantee that all I/O write and write operations are
- serialized.
-
- If 16-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param Count The number of times to write I/O port.
- @param Buffer The buffer to retrieve the write data from.
-
-**/
-VOID
-EFIAPI
-IoWriteFifo16 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
- )
-{
- //
- // Make sure Port is aligned on a 16-bit boundary.
- //
- ASSERT ((Port & 1) == 0);
- IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint16, Count, Buffer);
-}
-
-/**
- Reads a 32-bit I/O port fifo into a block of memory.
-
- Reads the 32-bit I/O fifo port specified by Port.
- The port is read Count times, and the read data is
- stored in the provided Buffer.
-
- This function must guarantee that all I/O read and write operations are
- serialized.
-
- If 32-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to read.
- @param Count The number of times to read I/O port.
- @param Buffer The buffer to store the read data into.
-
-**/
-VOID
-EFIAPI
-IoReadFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- OUT VOID *Buffer
- )
-{
- //
- // Make sure Port is aligned on a 32-bit boundary.
- //
- ASSERT ((Port & 3) == 0);
- IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint32, Count, Buffer);
-}
-
-/**
- Writes a block of memory into a 32-bit I/O port fifo.
-
- Writes the 32-bit I/O fifo port specified by Port.
- The port is written Count times, and the write data is
- retrieved from the provided Buffer.
-
- This function must guarantee that all I/O write and write operations are
- serialized.
-
- If 32-bit I/O port operations are not supported, then ASSERT().
-
- @param Port The I/O port to write.
- @param Count The number of times to write I/O port.
- @param Buffer The buffer to retrieve the write data from.
-
-**/
-VOID
-EFIAPI
-IoWriteFifo32 (
- IN UINTN Port,
- IN UINTN Count,
- IN VOID *Buffer
- )
-{
- //
- // Make sure Port is aligned on a 32-bit boundary.
- //
- ASSERT ((Port & 3) == 0);
- IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint32, Count, Buffer);
-}
-
-/**
- Reads an 8-bit MMIO register.
-
- Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
- returned. This function must guarantee that all MMIO read and write
- operations are serialized.
-
- If 8-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to read.
-
- @return The value read.
-
-**/
-UINT8
-EFIAPI
-MmioRead8 (
- IN UINTN Address
- )
-{
- return (UINT8)MmioReadWorker (Address, EfiCpuIoWidthUint8);
-}
-
-/**
- Writes an 8-bit MMIO register.
-
- Writes the 8-bit MMIO register specified by Address with the value specified
- by Value and returns Value. This function must guarantee that all MMIO read
- and write operations are serialized.
-
- If 8-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to write.
- @param Value The value to write to the MMIO register.
-
-**/
-UINT8
-EFIAPI
-MmioWrite8 (
- IN UINTN Address,
- IN UINT8 Value
- )
-{
- return (UINT8)MmioWriteWorker (Address, EfiCpuIoWidthUint8, Value);
-}
-
-/**
- Reads a 16-bit MMIO register.
-
- Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
- returned. This function must guarantee that all MMIO read and write
- operations are serialized.
-
- If Address is not aligned on a 16-bit boundary, then ASSERT().
-
- If 16-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to read.
-
- @return The value read.
-
-**/
-UINT16
-EFIAPI
-MmioRead16 (
- IN UINTN Address
- )
-{
- //
- // Make sure Address is aligned on a 16-bit boundary.
- //
- ASSERT ((Address & 1) == 0);
- return (UINT16)MmioReadWorker (Address, EfiCpuIoWidthUint16);
-}
-
-/**
- Writes a 16-bit MMIO register.
-
- Writes the 16-bit MMIO register specified by Address with the value specified
- by Value and returns Value. This function must guarantee that all MMIO read
- and write operations are serialized.
-
- If Address is not aligned on a 16-bit boundary, then ASSERT().
-
- If 16-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to write.
- @param Value The value to write to the MMIO register.
-
-**/
-UINT16
-EFIAPI
-MmioWrite16 (
- IN UINTN Address,
- IN UINT16 Value
- )
-{
- //
- // Make sure Address is aligned on a 16-bit boundary.
- //
- ASSERT ((Address & 1) == 0);
- return (UINT16)MmioWriteWorker (Address, EfiCpuIoWidthUint16, Value);
-}
-
-/**
- Reads a 32-bit MMIO register.
-
- Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
- returned. This function must guarantee that all MMIO read and write
- operations are serialized.
-
- If Address is not aligned on a 32-bit boundary, then ASSERT().
-
- If 32-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to read.
-
- @return The value read.
-
-**/
-UINT32
-EFIAPI
-MmioRead32 (
- IN UINTN Address
- )
-{
- //
- // Make sure Address is aligned on a 32-bit boundary.
- //
- ASSERT ((Address & 3) == 0);
- return (UINT32)MmioReadWorker (Address, EfiCpuIoWidthUint32);
-}
-
-/**
- Writes a 32-bit MMIO register.
-
- Writes the 32-bit MMIO register specified by Address with the value specified
- by Value and returns Value. This function must guarantee that all MMIO read
- and write operations are serialized.
-
- If Address is not aligned on a 32-bit boundary, then ASSERT().
-
- If 32-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to write.
- @param Value The value to write to the MMIO register.
-
-**/
-UINT32
-EFIAPI
-MmioWrite32 (
- IN UINTN Address,
- IN UINT32 Value
- )
-{
- //
- // Make sure Address is aligned on a 32-bit boundary.
- //
- ASSERT ((Address & 3) == 0);
- return (UINT32)MmioWriteWorker (Address, EfiCpuIoWidthUint32, Value);
-}
-
-/**
- Reads a 64-bit MMIO register.
-
- Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
- returned. This function must guarantee that all MMIO read and write
- operations are serialized.
-
- If Address is not aligned on a 64-bit boundary, then ASSERT().
-
- If 64-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to read.
-
- @return The value read.
-
-**/
-UINT64
-EFIAPI
-MmioRead64 (
- IN UINTN Address
- )
-{
- //
- // Make sure Address is aligned on a 64-bit boundary.
- //
- ASSERT ((Address & 7) == 0);
- return (UINT64)MmioReadWorker (Address, EfiCpuIoWidthUint64);
-}
-
-/**
- Writes a 64-bit MMIO register.
-
- Writes the 64-bit MMIO register specified by Address with the value specified
- by Value and returns Value. This function must guarantee that all MMIO read
- and write operations are serialized.
-
- If Address is not aligned on a 64-bit boundary, then ASSERT().
-
- If 64-bit MMIO register operations are not supported, then ASSERT().
-
- @param Address The MMIO register to write.
- @param Value The value to write to the MMIO register.
-
-**/
-UINT64
-EFIAPI
-MmioWrite64 (
- IN UINTN Address,
- IN UINT64 Value
- )
-{
- //
- // Make sure Address is aligned on a 64-bit boundary.
- //
- ASSERT ((Address & 7) == 0);
- return (UINT64)MmioWriteWorker (Address, EfiCpuIoWidthUint64, Value);
-}
diff --git a/IntelFrameworkPkg/Library/DxeIoLibCpuIo/IoLibMmioBuffer.c b/IntelFrameworkPkg/Library/DxeIoLibCpuIo/IoLibMmioBuffer.c deleted file mode 100644 index b4b9ad5d2f..0000000000 --- a/IntelFrameworkPkg/Library/DxeIoLibCpuIo/IoLibMmioBuffer.c +++ /dev/null @@ -1,416 +0,0 @@ -/** @file
- I/O Library MMIO Buffer Functions.
-
- Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: IoLibMmioBuffer.c
-
-**/
-
-
-#include "DxeCpuIoLibInternal.h"
-
-/**
- Copy data from MMIO region to system memory by using 8-bit access.
-
- Copy data from MMIO region specified by starting address StartAddress
- to system memory specified by Buffer by using 8-bit access. The total
- number of byte to be copied is specified by Length. Buffer is returned.
-
- If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
- If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
-
-
- @param StartAddress Starting address for the MMIO region to be copied from.
- @param Length Size in bytes of the copy.
- @param Buffer Pointer to a system memory buffer receiving the data read.
-
- @return Buffer
-
-**/
-UINT8 *
-EFIAPI
-MmioReadBuffer8 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT8 *Buffer
- )
-{
- UINT8 *ReturnBuffer;
-
- ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
-
- ReturnBuffer = Buffer;
-
- while (Length-- > 0) {
- *(Buffer++) = MmioRead8 (StartAddress++);
- }
-
- return ReturnBuffer;
-}
-
-/**
- Copy data from MMIO region to system memory by using 16-bit access.
-
- Copy data from MMIO region specified by starting address StartAddress
- to system memory specified by Buffer by using 16-bit access. The total
- number of byte to be copied is specified by Length. Buffer is returned.
-
- If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
-
- If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
- If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
-
- If Length is not aligned on a 16-bit boundary, then ASSERT().
-
- If Buffer is not aligned on a 16-bit boundary, then ASSERT().
-
- @param StartAddress Starting address for the MMIO region to be copied from.
- @param Length Size in bytes of the copy.
- @param Buffer Pointer to a system memory buffer receiving the data read.
-
- @return Buffer
-
-**/
-UINT16 *
-EFIAPI
-MmioReadBuffer16 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT16 *Buffer
- )
-{
- UINT16 *ReturnBuffer;
-
- ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
-
- ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
-
- ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
-
- ReturnBuffer = Buffer;
-
- while (Length > 0) {
- *(Buffer++) = MmioRead16 (StartAddress);
- StartAddress += sizeof (UINT16);
- Length -= sizeof (UINT16);
- }
-
- return ReturnBuffer;
-}
-
-/**
- Copy data from MMIO region to system memory by using 32-bit access.
-
- Copy data from MMIO region specified by starting address StartAddress
- to system memory specified by Buffer by using 32-bit access. The total
- number of byte to be copied is specified by Length. Buffer is returned.
-
- If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
-
- If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
- If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
-
- If Length is not aligned on a 32-bit boundary, then ASSERT().
- If Buffer is not aligned on a 32-bit boundary, then ASSERT().
-
- @param StartAddress Starting address for the MMIO region to be copied from.
- @param Length Size in bytes of the copy.
- @param Buffer Pointer to a system memory buffer receiving the data read.
-
- @return Buffer
-
-**/
-UINT32 *
-EFIAPI
-MmioReadBuffer32 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT32 *Buffer
- )
-{
- UINT32 *ReturnBuffer;
-
- ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
-
- ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
-
- ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
-
- ReturnBuffer = Buffer;
-
- while (Length > 0) {
- *(Buffer++) = MmioRead32 (StartAddress);
- StartAddress += sizeof (UINT32);
- Length -= sizeof (UINT32);
- }
-
- return ReturnBuffer;
-}
-
-/**
- Copy data from MMIO region to system memory by using 64-bit access.
-
- Copy data from MMIO region specified by starting address StartAddress
- to system memory specified by Buffer by using 64-bit access. The total
- number of byte to be copied is specified by Length. Buffer is returned.
-
- If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
-
- If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
- If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
-
- If Length is not aligned on a 64-bit boundary, then ASSERT().
-
- If Buffer is not aligned on a 64-bit boundary, then ASSERT().
-
- @param StartAddress Starting address for the MMIO region to be copied from.
- @param Length Size in bytes of the copy.
- @param Buffer Pointer to a system memory buffer receiving the data read.
-
- @return Buffer
-
-**/
-UINT64 *
-EFIAPI
-MmioReadBuffer64 (
- IN UINTN StartAddress,
- IN UINTN Length,
- OUT UINT64 *Buffer
- )
-{
- UINT64 *ReturnBuffer;
-
- ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
-
- ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
-
- ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
-
- ReturnBuffer = Buffer;
-
- while (Length > 0) {
- *(Buffer++) = MmioRead64 (StartAddress);
- StartAddress += sizeof (UINT64);
- Length -= sizeof (UINT64);
- }
-
- return ReturnBuffer;
-}
-
-
-/**
- Copy data from system memory to MMIO region by using 8-bit access.
-
- Copy data from system memory specified by Buffer to MMIO region specified
- by starting address StartAddress by using 8-bit access. The total number
- of byte to be copied is specified by Length. Buffer is returned.
-
- If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
- If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
-
-
- @param StartAddress Starting address for the MMIO region to be copied to.
- @param Length Size in bytes of the copy.
- @param Buffer Pointer to a system memory buffer containing the data to write.
-
- @return Buffer
-
-**/
-UINT8 *
-EFIAPI
-MmioWriteBuffer8 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT8 *Buffer
- )
-{
- VOID* ReturnBuffer;
-
- ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
-
- ReturnBuffer = (UINT8 *) Buffer;
-
- while (Length-- > 0) {
- MmioWrite8 (StartAddress++, *(Buffer++));
- }
-
- return ReturnBuffer;
-
-}
-
-/**
- Copy data from system memory to MMIO region by using 16-bit access.
-
- Copy data from system memory specified by Buffer to MMIO region specified
- by starting address StartAddress by using 16-bit access. The total number
- of byte to be copied is specified by Length. Buffer is returned.
-
- If StartAddress is not aligned on a 16-bit boundary, then ASSERT().
-
- If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
- If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
-
- If Length is not aligned on a 16-bit boundary, then ASSERT().
-
- If Buffer is not aligned on a 16-bit boundary, then ASSERT().
-
- @param StartAddress Starting address for the MMIO region to be copied to.
- @param Length Size in bytes of the copy.
- @param Buffer Pointer to a system memory buffer containing the data to write.
-
- @return Buffer
-
-**/
-UINT16 *
-EFIAPI
-MmioWriteBuffer16 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT16 *Buffer
- )
-{
- UINT16 *ReturnBuffer;
-
- ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
-
- ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
-
- ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT16) - 1)) == 0);
-
- ReturnBuffer = (UINT16 *) Buffer;
-
- while (Length > 0) {
- MmioWrite16 (StartAddress, *(Buffer++));
-
- StartAddress += sizeof (UINT16);
- Length -= sizeof (UINT16);
- }
-
- return ReturnBuffer;
-}
-
-
-/**
- Copy data from system memory to MMIO region by using 32-bit access.
-
- Copy data from system memory specified by Buffer to MMIO region specified
- by starting address StartAddress by using 32-bit access. The total number
- of byte to be copied is specified by Length. Buffer is returned.
-
- If StartAddress is not aligned on a 32-bit boundary, then ASSERT().
-
- If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
- If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
-
- If Length is not aligned on a 32-bit boundary, then ASSERT().
-
- If Buffer is not aligned on a 32-bit boundary, then ASSERT().
-
- @param StartAddress Starting address for the MMIO region to be copied to.
- @param Length Size in bytes of the copy.
- @param Buffer Pointer to a system memory buffer containing the data to write.
-
- @return Buffer
-
-**/
-UINT32 *
-EFIAPI
-MmioWriteBuffer32 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT32 *Buffer
- )
-{
- UINT32 *ReturnBuffer;
-
- ASSERT ((StartAddress & (sizeof (UINT32) - 1)) == 0);
-
- ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
-
- ASSERT ((Length & (sizeof (UINT32) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT32) - 1)) == 0);
-
- ReturnBuffer = (UINT32 *) Buffer;
-
- while (Length > 0) {
- MmioWrite32 (StartAddress, *(Buffer++));
-
- StartAddress += sizeof (UINT32);
- Length -= sizeof (UINT32);
- }
-
- return ReturnBuffer;
-}
-
-/**
- Copy data from system memory to MMIO region by using 64-bit access.
-
- Copy data from system memory specified by Buffer to MMIO region specified
- by starting address StartAddress by using 64-bit access. The total number
- of byte to be copied is specified by Length. Buffer is returned.
-
- If StartAddress is not aligned on a 64-bit boundary, then ASSERT().
-
- If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().
- If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().
-
- If Length is not aligned on a 64-bit boundary, then ASSERT().
-
- If Buffer is not aligned on a 64-bit boundary, then ASSERT().
-
- @param StartAddress Starting address for the MMIO region to be copied to.
- @param Length Size in bytes of the copy.
- @param Buffer Pointer to a system memory buffer containing the data to write.
-
- @return Buffer
-
-**/
-UINT64 *
-EFIAPI
-MmioWriteBuffer64 (
- IN UINTN StartAddress,
- IN UINTN Length,
- IN CONST UINT64 *Buffer
- )
-{
- UINT64 *ReturnBuffer;
-
- ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
-
- ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
- ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN) Buffer));
-
- ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
- ASSERT (((UINTN) Buffer & (sizeof (UINT64) - 1)) == 0);
-
- ReturnBuffer = (UINT64 *) Buffer;
-
- while (Length > 0) {
- MmioWrite64 (StartAddress, *(Buffer++));
-
- StartAddress += sizeof (UINT64);
- Length -= sizeof (UINT64);
- }
-
- return ReturnBuffer;
-}
-
diff --git a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c b/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c deleted file mode 100644 index e6892cbafe..0000000000 --- a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DriverEntryPoint.c +++ /dev/null @@ -1,276 +0,0 @@ -/** @file
- This file implement EfiMain() for library class DxeSmmDriverEntryPoint.
- EfiMain() is common driver entry point for all SMM driver who uses DxeSmmDriverEntryPoint
- library class.
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-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 <FrameworkSmm.h>
-
-#include <Protocol/LoadedImage.h>
-#include <Protocol/SmmBase.h>
-#include <Protocol/DevicePath.h>
-
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/DebugLib.h>
-#include <Library/DevicePathLib.h>
-
-/**
- This function returns the size, in bytes,
- of the device path data structure specified by DevicePath.
- If DevicePath is NULL, then 0 is returned.
-
- @param DevicePath A pointer to a device path data structure.
-
- @return The size of a device path in bytes.
-
-**/
-UINTN
-EFIAPI
-SmmGetDevicePathSize (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-{
- CONST EFI_DEVICE_PATH_PROTOCOL *Start;
-
- if (DevicePath == NULL) {
- return 0;
- }
-
- //
- // Search for the end of the device path structure
- //
- Start = DevicePath;
- while (!IsDevicePathEnd (DevicePath)) {
- DevicePath = NextDevicePathNode (DevicePath);
- }
-
- //
- // Compute the size and add back in the size of the end device path structure
- //
- return ((UINTN) DevicePath - (UINTN) Start) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
-}
-
-/**
- This function appends the device path SecondDevicePath
- to every device path instance in FirstDevicePath.
-
- @param FirstDevicePath A pointer to a device path data structure.
-
- @param SecondDevicePath A pointer to a device path data structure.
-
- @return A pointer to the new device path is returned.
- NULL is returned if space for the new device path could not be allocated from pool.
- It is up to the caller to free the memory used by FirstDevicePath and SecondDevicePath
- if they are no longer needed.
-
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-EFIAPI
-SmmAppendDevicePath (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath
- )
-{
- EFI_STATUS Status;
- UINTN Size;
- UINTN Size1;
- UINTN Size2;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath2;
-
- ASSERT (FirstDevicePath != NULL && SecondDevicePath != NULL);
-
- //
- // Allocate space for the combined device path. It only has one end node of
- // length EFI_DEVICE_PATH_PROTOCOL
- //
- Size1 = SmmGetDevicePathSize (FirstDevicePath);
- Size2 = SmmGetDevicePathSize (SecondDevicePath);
- Size = Size1 + Size2 - sizeof (EFI_DEVICE_PATH_PROTOCOL);
-
- Status = gBS->AllocatePool (EfiBootServicesData, Size, (VOID **) &NewDevicePath);
-
- if (EFI_SUCCESS == Status) {
- //
- // CopyMem in gBS is used as this service should always be ready. We didn't choose
- // to use a BaseMemoryLib function as such library instance may have constructor.
- //
- gBS->CopyMem ((VOID *) NewDevicePath, (VOID *) FirstDevicePath, Size1);
- //
- // Over write Src1 EndNode and do the copy
- //
- DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath + (Size1 - sizeof (EFI_DEVICE_PATH_PROTOCOL)));
- gBS->CopyMem ((VOID *) DevicePath2, (VOID *) SecondDevicePath, Size2);
- }
-
- return NewDevicePath;
-}
-
-/**
- Unload function that is registered in the LoadImage protocol. It un-installs
- protocols produced and deallocates pool used by the driver. Called by the core
- when unloading the driver.
-
- @param ImageHandle ImageHandle of the unloaded driver
-
- @return Status of the ProcessModuleUnloadList.
-
-**/
-EFI_STATUS
-EFIAPI
-_DriverUnloadHandler (
- EFI_HANDLE ImageHandle
- )
-{
- //
- // Call the unload handlers for all the modules.
- //
- // Note: All libraries were constructed in SMM space,
- // therefore we can not destruct them in Unload
- // handler.
- //
- return ProcessModuleUnloadList (ImageHandle);
-}
-
-/**
- Enrty point to DXE SMM Driver.
-
- @param ImageHandle ImageHandle of the loaded driver.
- @param SystemTable Pointer to the EFI System Table.
-
- @retval EFI_SUCCESS One or more of the drivers returned a success code.
- @retval !EFI_SUCESS The return status from the last driver entry point in the list.
-
-**/
-EFI_STATUS
-EFIAPI
-_ModuleEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- EFI_SMM_BASE_PROTOCOL *SmmBase;
- BOOLEAN InSmm;
- EFI_DEVICE_PATH_PROTOCOL *CompleteFilePath;
- EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
- EFI_HANDLE Handle;
-
- //
- // Cache a pointer to the Boot Services Table
- //
- gBS = SystemTable->BootServices;
-
- //
- // Retrieve SMM Base Protocol
- //
- Status = gBS->LocateProtocol (
- &gEfiSmmBaseProtocolGuid,
- NULL,
- (VOID **) &SmmBase
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Check to see if we are already in SMM
- //
- SmmBase->InSmm (SmmBase, &InSmm);
-
- //
- //
- //
- if (!InSmm) {
- //
- // Retrieve the Loaded Image Protocol
- //
- Status = gBS->HandleProtocol (
- ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID*)&LoadedImage
- );
- ASSERT_EFI_ERROR (Status);
- //
- // Retrieve the Device Path Protocol from the DeviceHandle from which this driver was loaded
- //
- Status = gBS->HandleProtocol (
- LoadedImage->DeviceHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID*)&ImageDevicePath
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Build the full device path to the currently execuing image
- //
- CompleteFilePath = SmmAppendDevicePath (ImageDevicePath, LoadedImage->FilePath);
-
- //
- // Load the image in memory to SMRAM; it will automatically generate the
- // SMI.
- //
- Status = SmmBase->Register (SmmBase, CompleteFilePath, LoadedImage->ImageBase, 0, &Handle, FALSE);
- ASSERT_EFI_ERROR (Status);
- //
- // Optionally install the unload handler
- //
- if (_gDriverUnloadImageCount > 0) {
- Status = gBS->HandleProtocol (
- ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID **)&LoadedImage
- );
- ASSERT_EFI_ERROR (Status);
- LoadedImage->Unload = _DriverUnloadHandler;
- }
-
- return Status;
- }
-
- //
- // Call constructor for all libraries
- //
- ProcessLibraryConstructorList (ImageHandle, SystemTable);
-
- //
- // Call the list of driver entry points
- //
- Status = ProcessModuleEntryPointList (ImageHandle, SystemTable);
- if (EFI_ERROR (Status)) {
- ProcessLibraryDestructorList (ImageHandle, SystemTable);
- }
-
- return Status;
-}
-
-/**
- Enrty point wrapper of DXE SMM Driver.
-
- @param ImageHandle ImageHandle of the loaded driver.
- @param SystemTable Pointer to the EFI System Table.
-
- @retval EFI_SUCCESS One or more of the drivers returned a success code.
- @retval !EFI_SUCESS The return status from the last driver entry point in the list.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiMain (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- return _ModuleEntryPoint (ImageHandle, SystemTable);
-}
diff --git a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DxeSmmDriverEntryPoint.inf b/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DxeSmmDriverEntryPoint.inf deleted file mode 100644 index 9a5b523ea0..0000000000 --- a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DxeSmmDriverEntryPoint.inf +++ /dev/null @@ -1,55 +0,0 @@ -## @file
-# Framework SMM driver entry point library.
-#
-# Register driver in SMRAM and wrapper driver's library constructors and entry point.
-#
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = DxeSmmDriverEntryPoint
- MODULE_UNI_FILE = DxeSmmDriverEntryPoint.uni
- FILE_GUID = 79C5C7B7-1083-42a6-AD15-2A4E7C4274D7
- MODULE_TYPE = DXE_SMM_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = UefiDriverEntryPoint|DXE_SMM_DRIVER
-
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64
-#
-
-[Sources]
- DriverEntryPoint.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
-
-
-[LibraryClasses]
- DebugLib
- UefiBootServicesTableLib
- DevicePathLib
-
-[Protocols]
- gEfiLoadedImageProtocolGuid ## CONSUMES
- gEfiSmmBaseProtocolGuid ## CONSUMES
- gEfiDevicePathProtocolGuid ## CONSUMES
-
-[Depex]
- gEfiSmmBaseProtocolGuid
-
diff --git a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DxeSmmDriverEntryPoint.uni b/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DxeSmmDriverEntryPoint.uni deleted file mode 100644 index 5042026ac0..0000000000 --- a/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DxeSmmDriverEntryPoint.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file
-// Framework SMM driver entry point library.
-//
-// Register driver in SMRAM and wrapper driver's library constructors and entry point.
-//
-// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "SMM Driver Entry Point Library"
-
-#string STR_MODULE_DESCRIPTION #language en-US "Registers a driver in SMRAM, and wrappers the driver's library constructors and entry point."
-
diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/Console.c b/IntelFrameworkPkg/Library/FrameworkUefiLib/Console.c deleted file mode 100644 index 244e532f57..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/Console.c +++ /dev/null @@ -1,476 +0,0 @@ -/** @file
- This module provide help function for displaying unicode string.
-
- Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- 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 "UefiLibInternal.h"
-
-typedef struct {
- CHAR16 WChar;
- UINT32 Width;
-} UNICODE_WIDTH_ENTRY;
-
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
- //
- // General script area
- //
- {(CHAR16)0x1FFF, 1},
- /*
- * Merge the blocks and replace them with the above entry as they fall to
- * the same category and they are all narrow glyph. This will reduce search
- * time and table size. The merge will omit the reserved code.
- *
- * Remove the above item if below is un-commented.
- *
- {(CHAR16)0x007F, 1}, // C0 controls and basic Latin. 0x0000-0x007F
- {(CHAR16)0x00FF, 1}, // C1 controls and Latin-1 support. 0x0080-0x00FF
- {(CHAR16)0x017F, 1}, // Latin extended-A. 0x0100-0x017F
- {(CHAR16)0x024F, 1}, // Latin extended-B. 0x0180-0x024F
- {(CHAR16)0x02AF, 1}, // IPA extensions. 0x0250-0x02AF
- {(CHAR16)0x02FF, 1}, // Spacing modifier letters. 0x02B0-0x02FF
- {(CHAR16)0x036F, 1}, // Combining diacritical marks. 0x0300-0x036F
- {(CHAR16)0x03FF, 1}, // Greek. 0x0370-0x03FF
- {(CHAR16)0x04FF, 1}, // Cyrillic. 0x0400-0x04FF
- {(CHAR16)0x052F, 0}, // Unassigned. As Armenian in ver3.0. 0x0500-0x052F
- {(CHAR16)0x058F, 1}, // Armenian. 0x0530-0x058F
- {(CHAR16)0x05FF, 1}, // Hebrew. 0x0590-0x05FF
- {(CHAR16)0x06FF, 1}, // Arabic. 0x0600-0x06FF
- {(CHAR16)0x08FF, 0}, // Unassigned. 0x0700-0x08FF
- {(CHAR16)0x097F, 1}, // Devanagari. 0x0900-0x097F
- {(CHAR16)0x09FF, 1}, // Bengali. 0x0980-0x09FF
- {(CHAR16)0x0A7F, 1}, // Gurmukhi. 0x0A00-0x0A7F
- {(CHAR16)0x0AFF, 1}, // Gujarati. 0x0A80-0x0AFF
- {(CHAR16)0x0B7F, 1}, // Oriya. 0x0B00-0x0B7F
- {(CHAR16)0x0BFF, 1}, // Tamil. (See page 7-92). 0x0B80-0x0BFF
- {(CHAR16)0x0C7F, 1}, // Telugu. 0x0C00-0x0C7F
- {(CHAR16)0x0CFF, 1}, // Kannada. (See page 7-100). 0x0C80-0x0CFF
- {(CHAR16)0x0D7F, 1}, // Malayalam (See page 7-104). 0x0D00-0x0D7F
- {(CHAR16)0x0DFF, 0}, // Unassigned. 0x0D80-0x0DFF
- {(CHAR16)0x0E7F, 1}, // Thai. 0x0E00-0x0E7F
- {(CHAR16)0x0EFF, 1}, // Lao. 0x0E80-0x0EFF
- {(CHAR16)0x0FBF, 1}, // Tibetan. 0x0F00-0x0FBF
- {(CHAR16)0x109F, 0}, // Unassigned. 0x0FC0-0x109F
- {(CHAR16)0x10FF, 1}, // Georgian. 0x10A0-0x10FF
- {(CHAR16)0x11FF, 1}, // Hangul Jamo. 0x1100-0x11FF
- {(CHAR16)0x1DFF, 0}, // Unassigned. 0x1200-0x1DFF
- {(CHAR16)0x1EFF, 1}, // Latin extended additional. 0x1E00-0x1EFF
- {(CHAR16)0x1FFF, 1}, // Greek extended. 0x1F00-0x1FFF
- *
- */
-
- //
- // Symbol area
- //
- {(CHAR16)0x2FFF, 1},
- /*
- * Merge the blocks and replace them with the above entry as they fall to
- * the same category and they are all narrow glyph. This will reduce search
- * time and table size. The merge will omit the reserved code.
- *
- * Remove the above item if below is un-commented.
- *
- {(CHAR16)0x206F, 1}, // General punctuation. (See page7-154). 0x200-0x206F
- {(CHAR16)0x209F, 1}, // Superscripts and subscripts. 0x2070-0x209F
- {(CHAR16)0x20CF, 1}, // Currency symbols. 0x20A0-0x20CF
- {(CHAR16)0x20FF, 1}, // Combining diacritical marks for symbols. 0x20D0-0x20FF
- {(CHAR16)0x214F, 1}, // Letterlike sympbols. 0x2100-0x214F
- {(CHAR16)0x218F, 1}, // Number forms. 0x2150-0x218F
- {(CHAR16)0x21FF, 1}, // Arrows. 0x2190-0x21FF
- {(CHAR16)0x22FF, 1}, // Mathematical operators. 0x2200-0x22FF
- {(CHAR16)0x23FF, 1}, // Miscellaneous technical. 0x2300-0x23FF
- {(CHAR16)0x243F, 1}, // Control pictures. 0x2400-0x243F
- {(CHAR16)0x245F, 1}, // Optical character recognition. 0x2440-0x245F
- {(CHAR16)0x24FF, 1}, // Enclosed alphanumerics. 0x2460-0x24FF
- {(CHAR16)0x257F, 1}, // Box drawing. 0x2500-0x257F
- {(CHAR16)0x259F, 1}, // Block elements. 0x2580-0x259F
- {(CHAR16)0x25FF, 1}, // Geometric shapes. 0x25A0-0x25FF
- {(CHAR16)0x26FF, 1}, // Miscellaneous symbols. 0x2600-0x26FF
- {(CHAR16)0x27BF, 1}, // Dingbats. 0x2700-0x27BF
- {(CHAR16)0x2FFF, 0}, // Reserved. 0x27C0-0x2FFF
- *
- */
-
- //
- // CJK phonetics and symbol area
- //
- {(CHAR16)0x33FF, 2},
- /*
- * Merge the blocks and replace them with the above entry as they fall to
- * the same category and they are all wide glyph. This will reduce search
- * time and table size. The merge will omit the reserved code.
- *
- * Remove the above item if below is un-commented.
- *
- {(CHAR16)0x303F, 2}, // CJK symbols and punctuation. 0x3000-0x303F
- {(CHAR16)0x309F, 2}, // Hiragana. 0x3040-0x309F
- {(CHAR16)0x30FF, 2}, // Katakana. 0x30A0-0x30FF
- {(CHAR16)0x312F, 2}, // Bopomofo. 0x3100-0x312F
- {(CHAR16)0x318F, 2}, // Hangul compatibility jamo. 0x3130-0x318F
- {(CHAR16)0x319F, 2}, // Kanbun. 0x3190-0x319F
- {(CHAR16)0x31FF, 0}, // Reserved. As Bopomofo extended in ver3.0. 0x31A0-0x31FF
- {(CHAR16)0x32FF, 2}, // Enclosed CJK letters and months. 0x3200-0x32FF
- {(CHAR16)0x33FF, 2}, // CJK compatibility. 0x3300-0x33FF
- *
- */
-
- //
- // CJK ideograph area
- //
- {(CHAR16)0x9FFF, 2},
- /*
- * Merge the blocks and replace them with the above entry as they fall to
- * the same category and they are all wide glyph. This will reduce search
- * time and table size. The merge will omit the reserved code.
- *
- * Remove the above item if below is un-commented.
- *
- {(CHAR16)0x4DFF, 0}, // Reserved. 0x3400-0x4DBF as CJK unified ideographs
- // extension A in ver3.0. 0x3400-0x4DFF
- {(CHAR16)0x9FFF, 2}, // CJK unified ideographs. 0x4E00-0x9FFF
- *
- */
-
- //
- // Reserved
- //
- {(CHAR16)0xABFF, 0}, // Reserved. 0xA000-0xA490 as Yi syllables. 0xA490-0xA4D0
- // as Yi radicals in ver3.0. 0xA000-0xABFF
- //
- // Hangul syllables
- //
- {(CHAR16)0xD7FF, 2},
- /*
- * Merge the blocks and replace them with the above entry as they fall to
- * the same category and they are all wide glyph. This will reduce search
- * time and table size. The merge will omit the reserved code.
- *
- * Remove the above item if below is un-commented.
- *
- {(CHAR16)0xD7A3, 2}, // Hangul syllables. 0xAC00-0xD7A3
- {(CHAR16)0xD7FF, 0}, // Reserved. 0xD7A3-0xD7FF
- *
- */
-
- //
- // Surrogates area
- //
- {(CHAR16)0xDFFF, 0}, // Surrogates, not used now. 0xD800-0xDFFF
-
- //
- // Private use area
- //
- {(CHAR16)0xF8FF, 0}, // Private use area. 0xE000-0xF8FF
-
- //
- // Compatibility area and specials
- //
- {(CHAR16)0xFAFF, 2}, // CJK compatibility ideographs. 0xF900-0xFAFF
- {(CHAR16)0xFB4F, 1}, // Alphabetic presentation forms. 0xFB00-0xFB4F
- {(CHAR16)0xFDFF, 1}, // Arabic presentation forms-A. 0xFB50-0xFDFF
- {(CHAR16)0xFE1F, 0}, // Reserved. As variation selectors in ver3.0. 0xFE00-0xFE1F
- {(CHAR16)0xFE2F, 1}, // Combining half marks. 0xFE20-0xFE2F
- {(CHAR16)0xFE4F, 2}, // CJK compatibility forms. 0xFE30-0xFE4F
- {(CHAR16)0xFE6F, 1}, // Small Form Variants. 0xFE50-0xFE6F
- {(CHAR16)0xFEFF, 1}, // Arabic presentation forms-B. 0xFE70-0xFEFF
- {(CHAR16)0xFFEF, 1}, // Half width and full width forms. 0xFF00-0xFFEF
- {(CHAR16)0xFFFF, 0}, // Speicials. 0xFFF0-0xFFFF
-};
-
-/**
- Retrieves the width of a Unicode character.
-
- This function computes and returns the width of the Unicode character specified
- by UnicodeChar.
-
- @param UnicodeChar A Unicode character.
-
- @retval 0 The width if UnicodeChar could not be determined.
- @retval 1 UnicodeChar is a narrow glyph.
- @retval 2 UnicodeChar is a wide glyph.
-
-**/
-UINTN
-EFIAPI
-GetGlyphWidth (
- IN CHAR16 UnicodeChar
- )
-{
- UINTN Index;
- UINTN Low;
- UINTN High;
- CONST UNICODE_WIDTH_ENTRY *Item;
-
- Item = NULL;
- Low = 0;
- High = (sizeof (mUnicodeWidthTable)) / (sizeof (UNICODE_WIDTH_ENTRY)) - 1;
- while (Low <= High) {
- Index = (Low + High) >> 1;
- Item = &(mUnicodeWidthTable[Index]);
- if (Index == 0) {
- if (UnicodeChar <= Item->WChar) {
- break;
- }
-
- return 0;
- }
-
- if (UnicodeChar > Item->WChar) {
- Low = Index + 1;
- } else if (UnicodeChar <= mUnicodeWidthTable[Index - 1].WChar) {
- High = Index - 1;
- } else {
- //
- // Index - 1 < UnicodeChar <= Index. Found
- //
- break;
- }
- }
-
- if (Low <= High) {
- return Item->Width;
- }
-
- return 0;
-}
-
-/**
- Computes the display length of a Null-terminated Unicode String.
-
- This function computes and returns the display length of the Null-terminated Unicode
- string specified by String. If String is NULL then 0 is returned. If any of the widths
- of the Unicode characters in String can not be determined, then 0 is returned. The display
- width of String can be computed by summing the display widths of each Unicode character
- in String. Unicode characters that are narrow glyphs have a width of 1, and Unicode
- characters that are width glyphs have a width of 2.
- If String is not aligned on a 16-bit boundary, then ASSERT().
-
- @param String A pointer to a Null-terminated Unicode string.
-
- @return The display length of the Null-terminated Unicode string specified by String.
-
-**/
-UINTN
-EFIAPI
-UnicodeStringDisplayLength (
- IN CONST CHAR16 *String
- )
-{
- UINTN Length;
- UINTN Width;
-
- if (String == NULL) {
- return 0;
- }
-
- Length = 0;
- while (*String != 0) {
- Width = GetGlyphWidth (*String);
- if (Width == 0) {
- return 0;
- }
-
- Length += Width;
- String++;
- }
-
- return Length;
-}
-
-/**
- Draws a dialog box to the console output device specified by
- ConOut defined in the EFI_SYSTEM_TABLE and waits for a keystroke
- from the console input device specified by ConIn defined in the
- EFI_SYSTEM_TABLE.
-
- If there are no strings in the variable argument list, then ASSERT().
- If all the strings in the variable argument list are empty, then ASSERT().
-
- @param[in] Attribute Specifies the foreground and background color of the popup.
- @param[out] Key A pointer to the EFI_KEY value of the key that was
- pressed. This is an optional parameter that may be NULL.
- If it is NULL then no wait for a keypress will be performed.
- @param[in] ... The variable argument list that contains pointers to Null-
- terminated Unicode strings to display in the dialog box.
- The variable argument list is terminated by a NULL.
-
-**/
-VOID
-EFIAPI
-CreatePopUp (
- IN UINTN Attribute,
- OUT EFI_INPUT_KEY *Key, OPTIONAL
- ...
- )
-{
- EFI_STATUS Status;
- VA_LIST Args;
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
- EFI_SIMPLE_TEXT_OUTPUT_MODE SavedConsoleMode;
- UINTN Columns;
- UINTN Rows;
- UINTN Column;
- UINTN Row;
- UINTN NumberOfLines;
- UINTN MaxLength;
- CHAR16 *String;
- UINTN Length;
- CHAR16 *Line;
- UINTN EventIndex;
-
- //
- // Determine the length of the longest line in the popup and the the total
- // number of lines in the popup
- //
- VA_START (Args, Key);
- MaxLength = 0;
- NumberOfLines = 0;
- while ((String = VA_ARG (Args, CHAR16 *)) != NULL) {
- MaxLength = MAX (MaxLength, StrLen (String));
- NumberOfLines++;
- }
- VA_END (Args);
-
- //
- // If the total number of lines in the popup is zero, then ASSERT()
- //
- ASSERT (NumberOfLines != 0);
-
- //
- // If the maximum length of all the strings is zero, then ASSERT()
- //
- ASSERT (MaxLength != 0);
-
- //
- // Cache a pointer to the Simple Text Output Protocol in the EFI System Table
- //
- ConOut = gST->ConOut;
-
- //
- // Save the current console cursor position and attributes
- //
- CopyMem (&SavedConsoleMode, ConOut->Mode, sizeof (SavedConsoleMode));
-
- //
- // Retrieve the number of columns and rows in the current console mode
- //
- ConOut->QueryMode (ConOut, SavedConsoleMode.Mode, &Columns, &Rows);
-
- //
- // Disable cursor and set the foreground and background colors specified by Attribute
- //
- ConOut->EnableCursor (ConOut, FALSE);
- ConOut->SetAttribute (ConOut, Attribute);
-
- //
- // Limit NumberOfLines to height of the screen minus 3 rows for the box itself
- //
- NumberOfLines = MIN (NumberOfLines, Rows - 3);
-
- //
- // Limit MaxLength to width of the screen minus 2 columns for the box itself
- //
- MaxLength = MIN (MaxLength, Columns - 2);
-
- //
- // Compute the starting row and starting column for the popup
- //
- Row = (Rows - (NumberOfLines + 3)) / 2;
- Column = (Columns - (MaxLength + 2)) / 2;
-
- //
- // Allocate a buffer for a single line of the popup with borders and a Null-terminator
- //
- Line = AllocateZeroPool ((MaxLength + 3) * sizeof (CHAR16));
- ASSERT (Line != NULL);
-
- //
- // Draw top of popup box
- //
- SetMem16 (Line, (MaxLength + 2) * 2, BOXDRAW_HORIZONTAL);
- Line[0] = BOXDRAW_DOWN_RIGHT;
- Line[MaxLength + 1] = BOXDRAW_DOWN_LEFT;
- Line[MaxLength + 2] = L'\0';
- ConOut->SetCursorPosition (ConOut, Column, Row++);
- ConOut->OutputString (ConOut, Line);
-
- //
- // Draw middle of the popup with strings
- //
- VA_START (Args, Key);
- while ((String = VA_ARG (Args, CHAR16 *)) != NULL && NumberOfLines > 0) {
- Length = StrLen (String);
- SetMem16 (Line, (MaxLength + 2) * 2, L' ');
- if (Length <= MaxLength) {
- //
- // Length <= MaxLength
- //
- CopyMem (Line + 1 + (MaxLength - Length) / 2, String , Length * sizeof (CHAR16));
- } else {
- //
- // Length > MaxLength
- //
- CopyMem (Line + 1, String + (Length - MaxLength) / 2 , MaxLength * sizeof (CHAR16));
- }
- Line[0] = BOXDRAW_VERTICAL;
- Line[MaxLength + 1] = BOXDRAW_VERTICAL;
- Line[MaxLength + 2] = L'\0';
- ConOut->SetCursorPosition (ConOut, Column, Row++);
- ConOut->OutputString (ConOut, Line);
- NumberOfLines--;
- }
- VA_END (Args);
-
- //
- // Draw bottom of popup box
- //
- SetMem16 (Line, (MaxLength + 2) * 2, BOXDRAW_HORIZONTAL);
- Line[0] = BOXDRAW_UP_RIGHT;
- Line[MaxLength + 1] = BOXDRAW_UP_LEFT;
- Line[MaxLength + 2] = L'\0';
- ConOut->SetCursorPosition (ConOut, Column, Row++);
- ConOut->OutputString (ConOut, Line);
-
- //
- // Free the allocated line buffer
- //
- FreePool (Line);
-
- //
- // Restore the cursor visibility, position, and attributes
- //
- ConOut->EnableCursor (ConOut, SavedConsoleMode.CursorVisible);
- ConOut->SetCursorPosition (ConOut, SavedConsoleMode.CursorColumn, SavedConsoleMode.CursorRow);
- ConOut->SetAttribute (ConOut, SavedConsoleMode.Attribute);
-
- //
- // Wait for a keystroke
- //
- if (Key != NULL) {
- while (TRUE) {
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, Key);
- if (!EFI_ERROR (Status)) {
- break;
- }
-
- //
- // If we encounter error, continue to read another key in.
- //
- if (Status != EFI_NOT_READY) {
- continue;
- }
- gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
- }
- }
-}
diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUefiLib.inf b/IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUefiLib.inf deleted file mode 100644 index 7057ef6e26..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUefiLib.inf +++ /dev/null @@ -1,82 +0,0 @@ -## @file
-# Library to abstract Framework extensions that conflict with UEFI 2.0 Specification.
-#
-# This library is helpful to port Framework/Tinao code that has conflicts with UEFI 2.0.
-# It hides the old conflicts with library functions and supporting implementations of
-# the old (EDK/EFI 1.10) and new (EDK II/UEFI 2.0) way.
-#
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = FrameworkUefiLib
- MODULE_UNI_FILE = FrameworkUefiLib.uni
- FILE_GUID = B2F0D71A-A39F-4094-854B-0C6BA6910CCE
- MODULE_TYPE = UEFI_DRIVER
- VERSION_STRING = 1.0
- LIBRARY_CLASS = UefiLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- UefiLibPrint.c
- UefiNotTiano.c
- UefiDriverModel.c
- Console.c
- UefiLib.c
- UefiLibInternal.h
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
-
-[LibraryClasses]
- PrintLib
- PcdLib
- MemoryAllocationLib
- DebugLib
- BaseMemoryLib
- BaseLib
- UefiBootServicesTableLib
- DevicePathLib
-
-[Guids]
- gEfiEventReadyToBootGuid ## SOMETIMES_CONSUMES ## Event
- gEfiEventLegacyBootGuid ## SOMETIMES_CONSUMES ## Event
-
-[Protocols]
- gEfiDriverBindingProtocolGuid ## SOMETIMES_PRODUCES
- gEfiSimpleTextOutProtocolGuid ## SOMETIMES_CONSUMES
- gEfiGraphicsOutputProtocolGuid ## SOMETIMES_CONSUMES
- gEfiHiiFontProtocolGuid ## SOMETIMES_CONSUMES
- gEfiComponentNameProtocolGuid ## SOMETIMES_PRODUCES
- gEfiComponentName2ProtocolGuid ## SOMETIMES_PRODUCES
- gEfiDriverConfigurationProtocolGuid ## SOMETIMES_PRODUCES
- gEfiDriverConfiguration2ProtocolGuid ## SOMETIMES_PRODUCES
- gEfiDriverDiagnosticsProtocolGuid ## SOMETIMES_PRODUCES
- gEfiDriverDiagnostics2ProtocolGuid ## SOMETIMES_PRODUCES
- gEfiUgaDrawProtocolGuid ## SOMETIMES_CONSUMES
-
-
-[Pcd]
- gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize ## SOMETIMES_CONSUMES
-
-[FeaturePcd]
- gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable ## CONSUMES
- gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable ## CONSUMES
- gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable ## CONSUMES
- gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable ## CONSUMES
- gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## CONSUMES
-
diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUefiLib.uni b/IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUefiLib.uni deleted file mode 100644 index 8643521eff..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUefiLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file
-// Library to abstract Framework extensions that conflict with UEFI 2.0 Specification.
-//
-// This library is helpful to port Framework/Tinao code that has conflicts with UEFI 2.0.
-// It hides the old conflicts with library functions and supporting implementations of
-// the old (EDK/EFI 1.10) and new (EDK II/UEFI 2.0) way.
-//
-// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "Library to abstract Framework extensions that conflict with the UEFI 2.0 Specification"
-
-#string STR_MODULE_DESCRIPTION #language en-US "This library is helpful to port Framework/Tiano code that has conflicts with UEFI 2.0. It hides the old conflicts with library functions and supporting implementations of the old (EDK/EFI 1.10) and new (EDK II/UEFI 2.0) methods."
-
diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiDriverModel.c b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiDriverModel.c deleted file mode 100644 index 9cd35fb3ca..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiDriverModel.c +++ /dev/null @@ -1,1056 +0,0 @@ -/** @file
- Library functions that abstract driver model protocols
- installation.
-
- Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials are
- licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- 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 "UefiLibInternal.h"
-
-/**
- Installs and completes the initialization of a Driver Binding Protocol instance.
-
- Installs the Driver Binding Protocol specified by DriverBinding onto the handle
- specified by DriverBindingHandle. If DriverBindingHandle is NULL, then DriverBinding
- is installed onto a newly created handle. DriverBindingHandle is typically the same
- as the driver's ImageHandle, but it can be different if the driver produces multiple
- Driver Binding Protocols.
- If DriverBinding is NULL, then ASSERT().
- If DriverBinding can not be installed onto a handle, then ASSERT().
-
- @param ImageHandle The image handle of the driver.
- @param SystemTable The EFI System Table that was passed to the driver's entry point.
- @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
- @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
- parameter is NULL, then a new handle is created.
-
- @retval EFI_SUCCESS The protocol installation is completed successfully.
- @retval EFI_OUT_OF_RESOURCES There was not enough system resources to install the protocol.
- @retval Others Status from gBS->InstallMultipleProtocolInterfaces().
-
-**/
-EFI_STATUS
-EFIAPI
-EfiLibInstallDriverBinding (
- IN CONST EFI_HANDLE ImageHandle,
- IN CONST EFI_SYSTEM_TABLE *SystemTable,
- IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
- IN EFI_HANDLE DriverBindingHandle
- )
-{
- EFI_STATUS Status;
-
- ASSERT (DriverBinding != NULL);
-
- //
- // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
- //
- DriverBinding->ImageHandle = ImageHandle;
- DriverBinding->DriverBindingHandle = DriverBindingHandle;
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- NULL
- );
- //
- // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
- //
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-
-/**
- Installs and completes the initialization of a Driver Binding Protocol instance and
- optionally installs the Component Name, Driver Configuration and Driver Diagnostics Protocols.
-
- Initializes a driver by installing the Driver Binding Protocol together with the
- optional Component Name, optional Driver Configure and optional Driver Diagnostic
- Protocols onto the driver's DriverBindingHandle. If DriverBindingHandle is NULL,
- then the protocols are installed onto a newly created handle. DriverBindingHandle
- is typically the same as the driver's ImageHandle, but it can be different if the
- driver produces multiple Driver Binding Protocols.
- If DriverBinding is NULL, then ASSERT().
- If the installation fails, then ASSERT().
-
- @param ImageHandle The image handle of the driver.
- @param SystemTable The EFI System Table that was passed to the driver's entry point.
- @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
- @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
- parameter is NULL, then a new handle is created.
- @param ComponentName A Component Name Protocol instance that this driver is producing.
- @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
- @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
-
- @retval EFI_SUCCESS The protocol installation is completed successfully.
- @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiLibInstallAllDriverProtocols (
- IN CONST EFI_HANDLE ImageHandle,
- IN CONST EFI_SYSTEM_TABLE *SystemTable,
- IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
- IN EFI_HANDLE DriverBindingHandle,
- IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
- IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
- IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics OPTIONAL
- )
-{
- EFI_STATUS Status;
-
- ASSERT (DriverBinding != NULL);
-
- //
- // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
- //
- DriverBinding->ImageHandle = ImageHandle;
- DriverBinding->DriverBindingHandle = DriverBindingHandle;
-
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
- if (DriverConfiguration == NULL) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- NULL
- );
- }
- } else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- NULL
- );
- }
- }
- } else {
- if (DriverConfiguration == NULL) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- }
- } else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- }
- }
- }
-
- //
- // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
- //
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-
-
-/**
- Installs Driver Binding Protocol with optional Component Name and Component Name 2 Protocols.
-
- Initializes a driver by installing the Driver Binding Protocol together with the
- optional Component Name and optional Component Name 2 protocols onto the driver's
- DriverBindingHandle. If DriverBindingHandle is NULL, then the protocols are installed
- onto a newly created handle. DriverBindingHandle is typically the same as the driver's
- ImageHandle, but it can be different if the driver produces multiple Driver Binding Protocols.
- If DriverBinding is NULL, then ASSERT().
- If the installation fails, then ASSERT().
-
- @param ImageHandle The image handle of the driver.
- @param SystemTable The EFI System Table that was passed to the driver's entry point.
- @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
- @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
- parameter is NULL, then a new handle is created.
- @param ComponentName A Component Name Protocol instance that this driver is producing.
- @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
-
- @retval EFI_SUCCESS The protocol installation is completed successfully.
- @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiLibInstallDriverBindingComponentName2 (
- IN CONST EFI_HANDLE ImageHandle,
- IN CONST EFI_SYSTEM_TABLE *SystemTable,
- IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
- IN EFI_HANDLE DriverBindingHandle,
- IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
- IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL
- )
-{
- EFI_STATUS Status;
-
- ASSERT (DriverBinding != NULL);
-
- //
- // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
- //
- DriverBinding->ImageHandle = ImageHandle;
- DriverBinding->DriverBindingHandle = DriverBindingHandle;
-
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- NULL
- );
- }
- }
-
- //
- // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
- //
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-
-
-/**
- Installs Driver Binding Protocol with optional Component Name, Component Name 2, Driver
- Configuration, Driver Configuration 2, Driver Diagnostics, and Driver Diagnostics 2 Protocols.
-
- Initializes a driver by installing the Driver Binding Protocol together with the optional
- Component Name, optional Component Name 2, optional Driver Configuration, optional Driver Configuration 2,
- optional Driver Diagnostic, and optional Driver Diagnostic 2 Protocols onto the driver's DriverBindingHandle.
- DriverBindingHandle is typically the same as the driver's ImageHandle, but it can be different if the driver
- produces multiple Driver Binding Protocols.
- If DriverBinding is NULL, then ASSERT().
- If the installation fails, then ASSERT().
-
-
- @param ImageHandle The image handle of the driver.
- @param SystemTable The EFI System Table that was passed to the driver's entry point.
- @param DriverBinding A Driver Binding Protocol instance that this driver is producing.
- @param DriverBindingHandle The handle that DriverBinding is to be installed onto. If this
- parameter is NULL, then a new handle is created.
- @param ComponentName A Component Name Protocol instance that this driver is producing.
- @param ComponentName2 A Component Name 2 Protocol instance that this driver is producing.
- @param DriverConfiguration A Driver Configuration Protocol instance that this driver is producing.
- @param DriverConfiguration2 A Driver Configuration Protocol 2 instance that this driver is producing.
- @param DriverDiagnostics A Driver Diagnostics Protocol instance that this driver is producing.
- @param DriverDiagnostics2 A Driver Diagnostics Protocol 2 instance that this driver is producing.
-
- @retval EFI_SUCCESS The protocol installation is completed successfully.
- @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiLibInstallAllDriverProtocols2 (
- IN CONST EFI_HANDLE ImageHandle,
- IN CONST EFI_SYSTEM_TABLE *SystemTable,
- IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding,
- IN EFI_HANDLE DriverBindingHandle,
- IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL
- IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL
- IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL
- IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL
- IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL
- IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL
- )
-{
- EFI_STATUS Status;
-
- ASSERT (DriverBinding != NULL);
-
- //
- // Update the ImageHandle and DriverBindingHandle fields of the Driver Binding Protocol
- //
- DriverBinding->ImageHandle = ImageHandle;
- DriverBinding->DriverBindingHandle = DriverBindingHandle;
-
- if (DriverConfiguration2 == NULL) {
- if (DriverConfiguration == NULL) {
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- NULL
- );
- }
- }
- } else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- }
- }
- } else {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- }
- }
- } else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- }
- }
- }
- } else {
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- NULL
- );
- }
- }
- } else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- }
- }
- } else {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- }
- }
- } else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- }
- }
- }
- }
- } else {
- if (DriverConfiguration == NULL) {
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- NULL
- );
- }
- }
- } else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- }
- }
- } else {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- }
- }
- } else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- }
- }
- }
- } else {
- if (DriverDiagnostics == NULL || FeaturePcdGet(PcdDriverDiagnosticsDisable)) {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- NULL
- );
- }
- }
- } else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- }
- }
- } else {
- if (DriverDiagnostics2 == NULL || FeaturePcdGet(PcdDriverDiagnostics2Disable)) {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- NULL
- );
- }
- }
- } else {
- if (ComponentName == NULL || FeaturePcdGet(PcdComponentNameDisable)) {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- } else {
- if (ComponentName2 == NULL || FeaturePcdGet(PcdComponentName2Disable)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverBinding->DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid, DriverBinding,
- &gEfiComponentNameProtocolGuid, ComponentName,
- &gEfiComponentName2ProtocolGuid, ComponentName2,
- &gEfiDriverConfigurationProtocolGuid, DriverConfiguration,
- &gEfiDriverConfiguration2ProtocolGuid, DriverConfiguration2,
- &gEfiDriverDiagnosticsProtocolGuid, DriverDiagnostics,
- &gEfiDriverDiagnostics2ProtocolGuid, DriverDiagnostics2,
- NULL
- );
- }
- }
- }
- }
- }
- }
-
- //
- // ASSERT if the call to InstallMultipleProtocolInterfaces() failed
- //
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c deleted file mode 100644 index 30b6dc9218..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c +++ /dev/null @@ -1,1477 +0,0 @@ -/** @file
- The UEFI Library provides functions and macros that simplify the development of
- UEFI Drivers and UEFI Applications. These functions and macros help manage EFI
- events, build simple locks utilizing EFI Task Priority Levels (TPLs), install
- EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers,
- and print messages on the console output and standard error devices.
-
- Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- 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 "UefiLibInternal.h"
-
-/**
- Compare whether two names of languages are identical.
-
- @param Language1 Name of language 1.
- @param Language2 Name of language 2.
-
- @retval TRUE Language 1 and language 2 are the same.
- @retval FALSE Language 1 and language 2 are not the same.
-
-**/
-BOOLEAN
-CompareIso639LanguageCode (
- IN CONST CHAR8 *Language1,
- IN CONST CHAR8 *Language2
- )
-{
- UINT32 Name1;
- UINT32 Name2;
-
- Name1 = ReadUnaligned24 ((CONST UINT32 *) Language1);
- Name2 = ReadUnaligned24 ((CONST UINT32 *) Language2);
-
- return (BOOLEAN) (Name1 == Name2);
-}
-
-/**
- Retrieves a pointer to the system configuration table from the EFI System Table
- based on a specified GUID.
-
- This function searches the list of configuration tables stored in the EFI System Table
- for a table with a GUID that matches TableGuid. If a match is found, then a pointer to
- the configuration table is returned in Table., and EFI_SUCCESS is returned. If a matching GUID
- is not found, then EFI_NOT_FOUND is returned.
- If TableGuid is NULL, then ASSERT().
- If Table is NULL, then ASSERT().
-
- @param TableGuid Pointer to table's GUID type..
- @param Table Pointer to the table associated with TableGuid in the EFI System Table.
-
- @retval EFI_SUCCESS A configuration table matching TableGuid was found.
- @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiGetSystemConfigurationTable (
- IN EFI_GUID *TableGuid,
- OUT VOID **Table
- )
-{
- EFI_SYSTEM_TABLE *SystemTable;
- UINTN Index;
-
- ASSERT (TableGuid != NULL);
- ASSERT (Table != NULL);
-
- SystemTable = gST;
- *Table = NULL;
- for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {
- if (CompareGuid (TableGuid, &(SystemTable->ConfigurationTable[Index].VendorGuid))) {
- *Table = SystemTable->ConfigurationTable[Index].VendorTable;
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-/**
- Creates and returns a notification event and registers that event with all the protocol
- instances specified by ProtocolGuid.
-
- This function causes the notification function to be executed for every protocol of type
- ProtocolGuid instance that exists in the system when this function is invoked. If there are
- no instances of ProtocolGuid in the handle database at the time this function is invoked,
- then the notification function is still executed one time. In addition, every time a protocol
- of type ProtocolGuid instance is installed or reinstalled, the notification function is also
- executed. This function returns the notification event that was created.
- If ProtocolGuid is NULL, then ASSERT().
- If NotifyTpl is not a legal TPL value, then ASSERT().
- If NotifyFunction is NULL, then ASSERT().
- If Registration is NULL, then ASSERT().
-
-
- @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.
- @param NotifyTpl Supplies the task priority level of the event notifications.
- @param NotifyFunction Supplies the function to notify when the event is signaled.
- @param NotifyContext The context parameter to pass to NotifyFunction.
- @param Registration A pointer to a memory location to receive the registration value.
- This value is passed to LocateHandle() to obtain new handles that
- have been added that support the ProtocolGuid-specified protocol.
-
- @return The notification event that was created.
-
-**/
-EFI_EVENT
-EFIAPI
-EfiCreateProtocolNotifyEvent(
- IN EFI_GUID *ProtocolGuid,
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction,
- IN VOID *NotifyContext, OPTIONAL
- OUT VOID **Registration
- )
-{
- EFI_STATUS Status;
- EFI_EVENT Event;
-
- ASSERT (ProtocolGuid != NULL);
- ASSERT (NotifyFunction != NULL);
- ASSERT (Registration != NULL);
-
- //
- // Create the event
- //
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
- NotifyTpl,
- NotifyFunction,
- NotifyContext,
- &Event
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Register for protocol notifications on this event
- //
-
- Status = gBS->RegisterProtocolNotify (
- ProtocolGuid,
- Event,
- Registration
- );
-
- ASSERT_EFI_ERROR (Status);
-
- //
- // Kick the event so we will perform an initial pass of
- // current installed drivers
- //
-
- gBS->SignalEvent (Event);
- return Event;
-}
-
-/**
- Creates a named event that can be signaled with EfiNamedEventSignal().
-
- This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.
- This event is signaled with EfiNamedEventSignal(). This provides the ability for one or more
- listeners on the same event named by the GUID specified by Name.
- If Name is NULL, then ASSERT().
- If NotifyTpl is not a legal TPL value, then ASSERT().
- If NotifyFunction is NULL, then ASSERT().
-
- @param Name Supplies GUID name of the event.
- @param NotifyTpl Supplies the task priority level of the event notifications.
- @param NotifyFunction Supplies the function to notify when the event is signaled.
- @param NotifyContext The context parameter to pass to NotifyFunction.
- @param Registration A pointer to a memory location to receive the registration value.
-
- @retval EFI_SUCCESS A named event was created.
- @retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiNamedEventListen (
- IN CONST EFI_GUID *Name,
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction,
- IN CONST VOID *NotifyContext, OPTIONAL
- OUT VOID *Registration OPTIONAL
- )
-{
- EFI_STATUS Status;
- EFI_EVENT Event;
- VOID *RegistrationLocal;
-
- ASSERT (Name != NULL);
- ASSERT (NotifyFunction != NULL);
- ASSERT (NotifyTpl <= TPL_HIGH_LEVEL);
-
- //
- // Create event
- //
- Status = gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
- NotifyTpl,
- NotifyFunction,
- (VOID *) NotifyContext,
- &Event
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // The Registration is not optional to RegisterProtocolNotify().
- // To make it optional to EfiNamedEventListen(), may need to substitute with a local.
- //
- if (Registration != NULL) {
- RegistrationLocal = Registration;
- } else {
- RegistrationLocal = &RegistrationLocal;
- }
-
- //
- // Register for an installation of protocol interface
- //
-
- Status = gBS->RegisterProtocolNotify (
- (EFI_GUID *) Name,
- Event,
- RegistrationLocal
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-/**
- Signals a named event created with EfiNamedEventListen().
-
- This function signals the named event specified by Name. The named event must have been
- created with EfiNamedEventListen().
- If Name is NULL, then ASSERT().
-
- @param Name Supplies GUID name of the event.
-
- @retval EFI_SUCCESS A named event was signaled.
- @retval EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiNamedEventSignal (
- IN CONST EFI_GUID *Name
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
-
- ASSERT(Name != NULL);
-
- Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &Handle,
- (EFI_GUID *) Name,
- EFI_NATIVE_INTERFACE,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->UninstallProtocolInterface (
- Handle,
- (EFI_GUID *) Name,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-/**
- Signals an event group by placing a new event in the group temporarily and
- signaling it.
-
- @param[in] EventGroup Supplies the unique identifier of the event
- group to signal.
-
- @retval EFI_SUCCESS The event group was signaled successfully.
- @retval EFI_INVALID_PARAMETER EventGroup is NULL.
- @return Error codes that report problems about event
- creation or signaling.
-**/
-EFI_STATUS
-EFIAPI
-EfiEventGroupSignal (
- IN CONST EFI_GUID *EventGroup
- )
-{
- EFI_STATUS Status;
- EFI_EVENT Event;
-
- if (EventGroup == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- EfiEventEmptyFunction,
- NULL,
- EventGroup,
- &Event
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->SignalEvent (Event);
- gBS->CloseEvent (Event);
-
- return Status;
-}
-
-/**
- An empty function that can be used as NotifyFunction parameter of
- CreateEvent() or CreateEventEx().
-
- @param Event Event whose notification function is being invoked.
- @param Context The pointer to the notification function's context,
- which is implementation-dependent.
-
-**/
-VOID
-EFIAPI
-EfiEventEmptyFunction (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
-}
-
-/**
- Returns the current TPL.
-
- This function returns the current TPL. There is no EFI service to directly
- retrieve the current TPL. Instead, the RaiseTPL() function is used to raise
- the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level
- can then immediately be restored back to the current TPL level with a call
- to RestoreTPL().
-
- @return The current TPL.
-
-**/
-EFI_TPL
-EFIAPI
-EfiGetCurrentTpl (
- VOID
- )
-{
- EFI_TPL Tpl;
-
- Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
- gBS->RestoreTPL (Tpl);
-
- return Tpl;
-}
-
-
-/**
- Initializes a basic mutual exclusion lock.
-
- This function initializes a basic mutual exclusion lock to the released state
- and returns the lock. Each lock provides mutual exclusion access at its task
- priority level. Since there is no preemption or multiprocessor support in EFI,
- acquiring the lock only consists of raising to the locks TPL.
- If Lock is NULL, then ASSERT().
- If Priority is not a valid TPL value, then ASSERT().
-
- @param Lock A pointer to the lock data structure to initialize.
- @param Priority EFI TPL associated with the lock.
-
- @return The lock.
-
-**/
-EFI_LOCK *
-EFIAPI
-EfiInitializeLock (
- IN OUT EFI_LOCK *Lock,
- IN EFI_TPL Priority
- )
-{
- ASSERT (Lock != NULL);
- ASSERT (Priority <= TPL_HIGH_LEVEL);
-
- Lock->Tpl = Priority;
- Lock->OwnerTpl = TPL_APPLICATION;
- Lock->Lock = EfiLockReleased ;
- return Lock;
-}
-
-/**
- Acquires ownership of a lock.
-
- This function raises the system's current task priority level to the task
- priority level of the mutual exclusion lock. Then, it places the lock in the
- acquired state.
- If Lock is NULL, then ASSERT().
- If Lock is not initialized, then ASSERT().
- If Lock is already in the acquired state, then ASSERT().
-
- @param Lock A pointer to the lock to acquire.
-
-**/
-VOID
-EFIAPI
-EfiAcquireLock (
- IN EFI_LOCK *Lock
- )
-{
- ASSERT (Lock != NULL);
- ASSERT (Lock->Lock == EfiLockReleased);
-
- Lock->OwnerTpl = gBS->RaiseTPL (Lock->Tpl);
- Lock->Lock = EfiLockAcquired;
-}
-
-/**
- Acquires ownership of a lock.
-
- This function raises the system's current task priority level to the task priority
- level of the mutual exclusion lock. Then, it attempts to place the lock in the acquired state.
- If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned.
- Otherwise, EFI_SUCCESS is returned.
- If Lock is NULL, then ASSERT().
- If Lock is not initialized, then ASSERT().
-
- @param Lock A pointer to the lock to acquire.
-
- @retval EFI_SUCCESS The lock was acquired.
- @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiAcquireLockOrFail (
- IN EFI_LOCK *Lock
- )
-{
-
- ASSERT (Lock != NULL);
- ASSERT (Lock->Lock != EfiLockUninitialized);
-
- if (Lock->Lock == EfiLockAcquired) {
- //
- // Lock is already owned, so bail out
- //
- return EFI_ACCESS_DENIED;
- }
-
- Lock->OwnerTpl = gBS->RaiseTPL (Lock->Tpl);
-
- Lock->Lock = EfiLockAcquired;
-
- return EFI_SUCCESS;
-}
-
-/**
- Releases ownership of a lock.
-
- This function transitions a mutual exclusion lock from the acquired state to
- the released state, and restores the system's task priority level to its
- previous level.
- If Lock is NULL, then ASSERT().
- If Lock is not initialized, then ASSERT().
- If Lock is already in the released state, then ASSERT().
-
- @param Lock A pointer to the lock to release.
-
-**/
-VOID
-EFIAPI
-EfiReleaseLock (
- IN EFI_LOCK *Lock
- )
-{
- EFI_TPL Tpl;
-
- ASSERT (Lock != NULL);
- ASSERT (Lock->Lock == EfiLockAcquired);
-
- Tpl = Lock->OwnerTpl;
-
- Lock->Lock = EfiLockReleased;
-
- gBS->RestoreTPL (Tpl);
-}
-
-/**
- Tests whether a controller handle is being managed by a specific driver.
-
- This function tests whether the driver specified by DriverBindingHandle is
- currently managing the controller specified by ControllerHandle. This test
- is performed by evaluating if the the protocol specified by ProtocolGuid is
- present on ControllerHandle and is was opened by DriverBindingHandle with an
- attribute of EFI_OPEN_PROTOCOL_BY_DRIVER.
- If ProtocolGuid is NULL, then ASSERT().
-
- @param ControllerHandle A handle for a controller to test.
- @param DriverBindingHandle Specifies the driver binding handle for the
- driver.
- @param ProtocolGuid Specifies the protocol that the driver specified
- by DriverBindingHandle opens in its Start()
- function.
-
- @retval EFI_SUCCESS ControllerHandle is managed by the driver
- specified by DriverBindingHandle.
- @retval EFI_UNSUPPORTED ControllerHandle is not managed by the driver
- specified by DriverBindingHandle.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiTestManagedDevice (
- IN CONST EFI_HANDLE ControllerHandle,
- IN CONST EFI_HANDLE DriverBindingHandle,
- IN CONST EFI_GUID *ProtocolGuid
- )
-{
- EFI_STATUS Status;
- VOID *ManagedInterface;
-
- ASSERT (ProtocolGuid != NULL);
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- (EFI_GUID *) ProtocolGuid,
- &ManagedInterface,
- DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- (EFI_GUID *) ProtocolGuid,
- DriverBindingHandle,
- ControllerHandle
- );
- return EFI_UNSUPPORTED;
- }
-
- if (Status != EFI_ALREADY_STARTED) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Tests whether a child handle is a child device of the controller.
-
- This function tests whether ChildHandle is one of the children of
- ControllerHandle. This test is performed by checking to see if the protocol
- specified by ProtocolGuid is present on ControllerHandle and opened by
- ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
- If ProtocolGuid is NULL, then ASSERT().
-
- @param ControllerHandle A handle for a (parent) controller to test.
- @param ChildHandle A child handle to test.
- @param ProtocolGuid Supplies the protocol that the child controller
- opens on its parent controller.
-
- @retval EFI_SUCCESS ChildHandle is a child of the ControllerHandle.
- @retval EFI_UNSUPPORTED ChildHandle is not a child of the
- ControllerHandle.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiTestChildHandle (
- IN CONST EFI_HANDLE ControllerHandle,
- IN CONST EFI_HANDLE ChildHandle,
- IN CONST EFI_GUID *ProtocolGuid
- )
-{
- EFI_STATUS Status;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
- UINTN EntryCount;
- UINTN Index;
-
- ASSERT (ProtocolGuid != NULL);
-
- //
- // Retrieve the list of agents that are consuming the specific protocol
- // on ControllerHandle.
- //
- Status = gBS->OpenProtocolInformation (
- ControllerHandle,
- (EFI_GUID *) ProtocolGuid,
- &OpenInfoBuffer,
- &EntryCount
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Inspect if ChildHandle is one of the agents.
- //
- Status = EFI_UNSUPPORTED;
- for (Index = 0; Index < EntryCount; Index++) {
- if ((OpenInfoBuffer[Index].ControllerHandle == ChildHandle) &&
- (OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
- Status = EFI_SUCCESS;
- break;
- }
- }
-
- FreePool (OpenInfoBuffer);
- return Status;
-}
-
-/**
- This function looks up a Unicode string in UnicodeStringTable.
-
- If Language is a member of SupportedLanguages and a Unicode string is found in
- UnicodeStringTable that matches the language code specified by Language, then it
- is returned in UnicodeString.
-
- @param Language A pointer to the ISO 639-2 language code for the
- Unicode string to look up and return.
- @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
- that the Unicode string table supports. Language
- must be a member of this set.
- @param UnicodeStringTable A pointer to the table of Unicode strings.
- @param UnicodeString A pointer to the Unicode string from UnicodeStringTable
- that matches the language specified by Language.
-
- @retval EFI_SUCCESS The Unicode string that matches the language
- specified by Language was found
- in the table of Unicode strings UnicodeStringTable,
- and it was returned in UnicodeString.
- @retval EFI_INVALID_PARAMETER Language is NULL.
- @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
- @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
- @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
- @retval EFI_UNSUPPORTED The language specified by Language is not a
- member of SupportedLanguages.
- @retval EFI_UNSUPPORTED The language specified by Language is not
- supported by UnicodeStringTable.
-
-**/
-EFI_STATUS
-EFIAPI
-LookupUnicodeString (
- IN CONST CHAR8 *Language,
- IN CONST CHAR8 *SupportedLanguages,
- IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,
- OUT CHAR16 **UnicodeString
- )
-{
- //
- // Make sure the parameters are valid
- //
- if (Language == NULL || UnicodeString == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // If there are no supported languages, or the Unicode String Table is empty, then the
- // Unicode String specified by Language is not supported by this Unicode String Table
- //
- if (SupportedLanguages == NULL || UnicodeStringTable == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Make sure Language is in the set of Supported Languages
- //
- while (*SupportedLanguages != 0) {
- if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
-
- //
- // Search the Unicode String Table for the matching Language specifier
- //
- while (UnicodeStringTable->Language != NULL) {
- if (CompareIso639LanguageCode (Language, UnicodeStringTable->Language)) {
-
- //
- // A matching string was found, so return it
- //
- *UnicodeString = UnicodeStringTable->UnicodeString;
- return EFI_SUCCESS;
- }
-
- UnicodeStringTable++;
- }
-
- return EFI_UNSUPPORTED;
- }
-
- SupportedLanguages += 3;
- }
-
- return EFI_UNSUPPORTED;
-}
-
-
-
-/**
- This function looks up a Unicode string in UnicodeStringTable.
-
- If Language is a member of SupportedLanguages and a Unicode string is found in
- UnicodeStringTable that matches the language code specified by Language, then
- it is returned in UnicodeString.
-
- @param Language A pointer to an ASCII string containing the ISO 639-2 or the
- RFC 4646 language code for the Unicode string to look up and
- return. If Iso639Language is TRUE, then this ASCII string is
- not assumed to be Null-terminated, and only the first three
- characters are used. If Iso639Language is FALSE, then this ASCII
- string must be Null-terminated.
- @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains a
- set of ISO 639-2 or RFC 4646 language codes that the Unicode
- string table supports. Language must be a member of this set.
- If Iso639Language is TRUE, then this string contains one or more
- ISO 639-2 language codes with no separator characters. If Iso639Language
- is FALSE, then is string contains one or more RFC 4646 language
- codes separated by ';'.
- @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE
- is defined in "Related Definitions".
- @param UnicodeString A pointer to the Null-terminated Unicode string from UnicodeStringTable
- that matches the language specified by Language.
- @param Iso639Language Specifies the supported language code format. If it is TRUE, then
- Language and SupportedLanguages follow ISO 639-2 language code format.
- Otherwise, they follow RFC 4646 language code format.
-
-
- @retval EFI_SUCCESS The Unicode string that matches the language specified by Language
- was found in the table of Unicode strings UnicodeStringTable, and
- it was returned in UnicodeString.
- @retval EFI_INVALID_PARAMETER Language is NULL.
- @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
- @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
- @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.
- @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.
- @retval EFI_UNSUPPORTED The language specified by Language is not supported by UnicodeStringTable.
-
-**/
-EFI_STATUS
-EFIAPI
-LookupUnicodeString2 (
- IN CONST CHAR8 *Language,
- IN CONST CHAR8 *SupportedLanguages,
- IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,
- OUT CHAR16 **UnicodeString,
- IN BOOLEAN Iso639Language
- )
-{
- BOOLEAN Found;
- UINTN Index;
- CHAR8 *LanguageString;
-
- //
- // Make sure the parameters are valid
- //
- if (Language == NULL || UnicodeString == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // If there are no supported languages, or the Unicode String Table is empty, then the
- // Unicode String specified by Language is not supported by this Unicode String Table
- //
- if (SupportedLanguages == NULL || UnicodeStringTable == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Make sure Language is in the set of Supported Languages
- //
- Found = FALSE;
- while (*SupportedLanguages != 0) {
- if (Iso639Language) {
- if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
- Found = TRUE;
- break;
- }
- SupportedLanguages += 3;
- } else {
- for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);
- if ((AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) && (Language[Index] == 0)) {
- Found = TRUE;
- break;
- }
- SupportedLanguages += Index;
- for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);
- }
- }
-
- //
- // If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED
- //
- if (!Found) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Search the Unicode String Table for the matching Language specifier
- //
- while (UnicodeStringTable->Language != NULL) {
- LanguageString = UnicodeStringTable->Language;
- while (0 != *LanguageString) {
- for (Index = 0 ;LanguageString[Index] != 0 && LanguageString[Index] != ';'; Index++);
- if (AsciiStrnCmp(LanguageString, Language, Index) == 0) {
- *UnicodeString = UnicodeStringTable->UnicodeString;
- return EFI_SUCCESS;
- }
- LanguageString += Index;
- for (Index = 0 ;LanguageString[Index] != 0 && LanguageString[Index] == ';'; Index++);
- }
- UnicodeStringTable++;
- }
-
- return EFI_UNSUPPORTED;
-}
-
-
-/**
- This function adds a Unicode string to UnicodeStringTable.
-
- If Language is a member of SupportedLanguages then UnicodeString is added to
- UnicodeStringTable. New buffers are allocated for both Language and
- UnicodeString. The contents of Language and UnicodeString are copied into
- these new buffers. These buffers are automatically freed when
- FreeUnicodeStringTable() is called.
-
- @param Language A pointer to the ISO 639-2 language code for the Unicode
- string to add.
- @param SupportedLanguages A pointer to the set of ISO 639-2 language codes
- that the Unicode string table supports.
- Language must be a member of this set.
- @param UnicodeStringTable A pointer to the table of Unicode strings.
- @param UnicodeString A pointer to the Unicode string to add.
-
- @retval EFI_SUCCESS The Unicode string that matches the language
- specified by Language was found in the table of
- Unicode strings UnicodeStringTable, and it was
- returned in UnicodeString.
- @retval EFI_INVALID_PARAMETER Language is NULL.
- @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
- @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
- @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
- @retval EFI_ALREADY_STARTED A Unicode string with language Language is
- already present in UnicodeStringTable.
- @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another
- Unicode string to UnicodeStringTable.
- @retval EFI_UNSUPPORTED The language specified by Language is not a
- member of SupportedLanguages.
-
-**/
-EFI_STATUS
-EFIAPI
-AddUnicodeString (
- IN CONST CHAR8 *Language,
- IN CONST CHAR8 *SupportedLanguages,
- IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
- IN CONST CHAR16 *UnicodeString
- )
-{
- UINTN NumberOfEntries;
- EFI_UNICODE_STRING_TABLE *OldUnicodeStringTable;
- EFI_UNICODE_STRING_TABLE *NewUnicodeStringTable;
- UINTN UnicodeStringLength;
-
- //
- // Make sure the parameter are valid
- //
- if (Language == NULL || UnicodeString == NULL || UnicodeStringTable == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // If there are no supported languages, then a Unicode String can not be added
- //
- if (SupportedLanguages == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // If the Unicode String is empty, then a Unicode String can not be added
- //
- if (UnicodeString[0] == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Make sure Language is a member of SupportedLanguages
- //
- while (*SupportedLanguages != 0) {
- if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
-
- //
- // Determine the size of the Unicode String Table by looking for a NULL Language entry
- //
- NumberOfEntries = 0;
- if (*UnicodeStringTable != NULL) {
- OldUnicodeStringTable = *UnicodeStringTable;
- while (OldUnicodeStringTable->Language != NULL) {
- if (CompareIso639LanguageCode (Language, OldUnicodeStringTable->Language)) {
- return EFI_ALREADY_STARTED;
- }
-
- OldUnicodeStringTable++;
- NumberOfEntries++;
- }
- }
-
- //
- // Allocate space for a new Unicode String Table. It must hold the current number of
- // entries, plus 1 entry for the new Unicode String, plus 1 entry for the end of table
- // marker
- //
- NewUnicodeStringTable = AllocatePool ((NumberOfEntries + 2) * sizeof (EFI_UNICODE_STRING_TABLE));
- if (NewUnicodeStringTable == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // If the current Unicode String Table contains any entries, then copy them to the
- // newly allocated Unicode String Table.
- //
- if (*UnicodeStringTable != NULL) {
- CopyMem (
- NewUnicodeStringTable,
- *UnicodeStringTable,
- NumberOfEntries * sizeof (EFI_UNICODE_STRING_TABLE)
- );
- }
-
- //
- // Allocate space for a copy of the Language specifier
- //
- NewUnicodeStringTable[NumberOfEntries].Language = AllocateCopyPool (3, Language);
- if (NewUnicodeStringTable[NumberOfEntries].Language == NULL) {
- gBS->FreePool (NewUnicodeStringTable);
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Compute the length of the Unicode String
- //
- for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++)
- ;
-
- //
- // Allocate space for a copy of the Unicode String
- //
- NewUnicodeStringTable[NumberOfEntries].UnicodeString = AllocateCopyPool (
- (UnicodeStringLength + 1) * sizeof (CHAR16),
- UnicodeString
- );
- if (NewUnicodeStringTable[NumberOfEntries].UnicodeString == NULL) {
- gBS->FreePool (NewUnicodeStringTable[NumberOfEntries].Language);
- gBS->FreePool (NewUnicodeStringTable);
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Mark the end of the Unicode String Table
- //
- NewUnicodeStringTable[NumberOfEntries + 1].Language = NULL;
- NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString = NULL;
-
- //
- // Free the old Unicode String Table
- //
- if (*UnicodeStringTable != NULL) {
- gBS->FreePool (*UnicodeStringTable);
- }
-
- //
- // Point UnicodeStringTable at the newly allocated Unicode String Table
- //
- *UnicodeStringTable = NewUnicodeStringTable;
-
- return EFI_SUCCESS;
- }
-
- SupportedLanguages += 3;
- }
-
- return EFI_UNSUPPORTED;
-}
-
-
-/**
- This function adds the Null-terminated Unicode string specified by UnicodeString
- to UnicodeStringTable.
-
- If Language is a member of SupportedLanguages then UnicodeString is added to
- UnicodeStringTable. New buffers are allocated for both Language and UnicodeString.
- The contents of Language and UnicodeString are copied into these new buffers.
- These buffers are automatically freed when EfiLibFreeUnicodeStringTable() is called.
-
- @param Language A pointer to an ASCII string containing the ISO 639-2 or
- the RFC 4646 language code for the Unicode string to add.
- If Iso639Language is TRUE, then this ASCII string is not
- assumed to be Null-terminated, and only the first three
- chacters are used. If Iso639Language is FALSE, then this
- ASCII string must be Null-terminated.
- @param SupportedLanguages A pointer to a Null-terminated ASCII string that contains
- a set of ISO 639-2 or RFC 4646 language codes that the Unicode
- string table supports. Language must be a member of this set.
- If Iso639Language is TRUE, then this string contains one or more
- ISO 639-2 language codes with no separator characters.
- If Iso639Language is FALSE, then is string contains one or more
- RFC 4646 language codes separated by ';'.
- @param UnicodeStringTable A pointer to the table of Unicode strings. Type EFI_UNICODE_STRING_TABLE
- is defined in "Related Definitions".
- @param UnicodeString A pointer to the Unicode string to add.
- @param Iso639Language Specifies the supported language code format. If it is TRUE,
- then Language and SupportedLanguages follow ISO 639-2 language code format.
- Otherwise, they follow RFC 4646 language code format.
-
- @retval EFI_SUCCESS The Unicode string that matches the language specified by
- Language was found in the table of Unicode strings UnicodeStringTable,
- and it was returned in UnicodeString.
- @retval EFI_INVALID_PARAMETER Language is NULL.
- @retval EFI_INVALID_PARAMETER UnicodeString is NULL.
- @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.
- @retval EFI_UNSUPPORTED SupportedLanguages is NULL.
- @retval EFI_ALREADY_STARTED A Unicode string with language Language is already present in
- UnicodeStringTable.
- @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another Unicode string UnicodeStringTable.
- @retval EFI_UNSUPPORTED The language specified by Language is not a member of SupportedLanguages.
-
-**/
-EFI_STATUS
-EFIAPI
-AddUnicodeString2 (
- IN CONST CHAR8 *Language,
- IN CONST CHAR8 *SupportedLanguages,
- IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,
- IN CONST CHAR16 *UnicodeString,
- IN BOOLEAN Iso639Language
- )
-{
- UINTN NumberOfEntries;
- EFI_UNICODE_STRING_TABLE *OldUnicodeStringTable;
- EFI_UNICODE_STRING_TABLE *NewUnicodeStringTable;
- UINTN UnicodeStringLength;
- BOOLEAN Found;
- UINTN Index;
- CHAR8 *LanguageString;
-
- //
- // Make sure the parameter are valid
- //
- if (Language == NULL || UnicodeString == NULL || UnicodeStringTable == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // If there are no supported languages, then a Unicode String can not be added
- //
- if (SupportedLanguages == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // If the Unicode String is empty, then a Unicode String can not be added
- //
- if (UnicodeString[0] == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Make sure Language is a member of SupportedLanguages
- //
- Found = FALSE;
- while (*SupportedLanguages != 0) {
- if (Iso639Language) {
- if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
- Found = TRUE;
- break;
- }
- SupportedLanguages += 3;
- } else {
- for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);
- if (AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) {
- Found = TRUE;
- break;
- }
- SupportedLanguages += Index;
- for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);
- }
- }
-
- //
- // If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED
- //
- if (!Found) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Determine the size of the Unicode String Table by looking for a NULL Language entry
- //
- NumberOfEntries = 0;
- if (*UnicodeStringTable != NULL) {
- OldUnicodeStringTable = *UnicodeStringTable;
- while (OldUnicodeStringTable->Language != NULL) {
- LanguageString = OldUnicodeStringTable->Language;
-
- while (*LanguageString != 0) {
- for (Index = 0; LanguageString[Index] != 0 && LanguageString[Index] != ';'; Index++);
-
- if (AsciiStrnCmp (Language, LanguageString, Index) == 0) {
- return EFI_ALREADY_STARTED;
- }
- LanguageString += Index;
- for (; *LanguageString != 0 && *LanguageString == ';'; LanguageString++);
- }
- OldUnicodeStringTable++;
- NumberOfEntries++;
- }
- }
-
- //
- // Allocate space for a new Unicode String Table. It must hold the current number of
- // entries, plus 1 entry for the new Unicode String, plus 1 entry for the end of table
- // marker
- //
- NewUnicodeStringTable = AllocatePool ((NumberOfEntries + 2) * sizeof (EFI_UNICODE_STRING_TABLE));
- if (NewUnicodeStringTable == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // If the current Unicode String Table contains any entries, then copy them to the
- // newly allocated Unicode String Table.
- //
- if (*UnicodeStringTable != NULL) {
- CopyMem (
- NewUnicodeStringTable,
- *UnicodeStringTable,
- NumberOfEntries * sizeof (EFI_UNICODE_STRING_TABLE)
- );
- }
-
- //
- // Allocate space for a copy of the Language specifier
- //
- NewUnicodeStringTable[NumberOfEntries].Language = AllocateCopyPool (AsciiStrSize(Language), Language);
- if (NewUnicodeStringTable[NumberOfEntries].Language == NULL) {
- gBS->FreePool (NewUnicodeStringTable);
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Compute the length of the Unicode String
- //
- for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++);
-
- //
- // Allocate space for a copy of the Unicode String
- //
- NewUnicodeStringTable[NumberOfEntries].UnicodeString = AllocateCopyPool (StrSize (UnicodeString), UnicodeString);
- if (NewUnicodeStringTable[NumberOfEntries].UnicodeString == NULL) {
- gBS->FreePool (NewUnicodeStringTable[NumberOfEntries].Language);
- gBS->FreePool (NewUnicodeStringTable);
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Mark the end of the Unicode String Table
- //
- NewUnicodeStringTable[NumberOfEntries + 1].Language = NULL;
- NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString = NULL;
-
- //
- // Free the old Unicode String Table
- //
- if (*UnicodeStringTable != NULL) {
- gBS->FreePool (*UnicodeStringTable);
- }
-
- //
- // Point UnicodeStringTable at the newly allocated Unicode String Table
- //
- *UnicodeStringTable = NewUnicodeStringTable;
-
- return EFI_SUCCESS;
-}
-
-/**
- This function frees the table of Unicode strings in UnicodeStringTable.
-
- If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.
- Otherwise, each language code, and each Unicode string in the Unicode string
- table are freed, and EFI_SUCCESS is returned.
-
- @param UnicodeStringTable A pointer to the table of Unicode strings.
-
- @retval EFI_SUCCESS The Unicode string table was freed.
-
-**/
-EFI_STATUS
-EFIAPI
-FreeUnicodeStringTable (
- IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable
- )
-{
- UINTN Index;
-
- //
- // If the Unicode String Table is NULL, then it is already freed
- //
- if (UnicodeStringTable == NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // Loop through the Unicode String Table until we reach the end of table marker
- //
- for (Index = 0; UnicodeStringTable[Index].Language != NULL; Index++) {
-
- //
- // Free the Language string from the Unicode String Table
- //
- gBS->FreePool (UnicodeStringTable[Index].Language);
-
- //
- // Free the Unicode String from the Unicode String Table
- //
- if (UnicodeStringTable[Index].UnicodeString != NULL) {
- gBS->FreePool (UnicodeStringTable[Index].UnicodeString);
- }
- }
-
- //
- // Free the Unicode String Table itself
- //
- gBS->FreePool (UnicodeStringTable);
-
- return EFI_SUCCESS;
-}
-
-/**
- Returns a pointer to an allocated buffer that contains the contents of a
- variable retrieved through the UEFI Runtime Service GetVariable(). The
- returned buffer is allocated using AllocatePool(). The caller is responsible
- for freeing this buffer with FreePool().
-
- If Name is NULL, then ASSERT().
- If Guid is NULL, then ASSERT().
-
- @param[in] Name Pointer to a Null-terminated Unicode string.
- @param[in] Guid Pointer to an EFI_GUID structure
-
- @retval NULL The variable could not be retrieved.
- @retval NULL There are not enough resources available for the variable contents.
- @retval Other A pointer to allocated buffer containing the variable contents.
-
-**/
-VOID *
-EFIAPI
-GetVariable (
- IN CONST CHAR16 *Name,
- IN CONST EFI_GUID *Guid
- )
-{
- EFI_STATUS Status;
- UINTN Size;
- VOID *Value;
-
- ASSERT (Name != NULL);
- ASSERT (Guid != NULL);
-
- //
- // Try to get the variable size.
- //
- Value = NULL;
- Size = 0;
- Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &Size, Value);
- if (Status != EFI_BUFFER_TOO_SMALL) {
- return NULL;
- }
-
- //
- // Allocate buffer to get the variable.
- //
- Value = AllocatePool (Size);
- if (Value == NULL) {
- return NULL;
- }
-
- //
- // Get the variable data.
- //
- Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &Size, Value);
- if (EFI_ERROR (Status)) {
- FreePool(Value);
- return NULL;
- }
-
- return Value;
-}
-
-
-/**
- Returns a pointer to an allocated buffer that contains the contents of a
- variable retrieved through the UEFI Runtime Service GetVariable(). This
- function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables.
- The returned buffer is allocated using AllocatePool(). The caller is
- responsible for freeing this buffer with FreePool().
-
- If Name is NULL, then ASSERT().
-
- @param[in] Name Pointer to a Null-terminated Unicode string.
-
- @retval NULL The variable could not be retrieved.
- @retval NULL There are not enough resources available for the variable contents.
- @retval Other A pointer to allocated buffer containing the variable contents.
-
-**/
-VOID *
-EFIAPI
-GetEfiGlobalVariable (
- IN CONST CHAR16 *Name
- )
-{
- return GetVariable (Name, &gEfiGlobalVariableGuid);
-}
-
-
-/**
- Returns a pointer to an allocated buffer that contains the best matching language
- from a set of supported languages.
-
- This function supports both ISO 639-2 and RFC 4646 language codes, but language
- code types may not be mixed in a single call to this function. The language
- code returned is allocated using AllocatePool(). The caller is responsible for
- freeing the allocated buffer using FreePool(). This function supports a variable
- argument list that allows the caller to pass in a prioritized list of language
- codes to test against all the language codes in SupportedLanguages.
-
- If SupportedLanguages is NULL, then ASSERT().
-
- @param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that
- contains a set of language codes in the format
- specified by Iso639Language.
- @param[in] Iso639Language If TRUE, then all language codes are assumed to be
- in ISO 639-2 format. If FALSE, then all language
- codes are assumed to be in RFC 4646 language format
- @param[in] ... A variable argument list that contains pointers to
- Null-terminated ASCII strings that contain one or more
- language codes in the format specified by Iso639Language.
- The first language code from each of these language
- code lists is used to determine if it is an exact or
- close match to any of the language codes in
- SupportedLanguages. Close matches only apply to RFC 4646
- language codes, and the matching algorithm from RFC 4647
- is used to determine if a close match is present. If
- an exact or close match is found, then the matching
- language code from SupportedLanguages is returned. If
- no matches are found, then the next variable argument
- parameter is evaluated. The variable argument list
- is terminated by a NULL.
-
- @retval NULL The best matching language could not be found in SupportedLanguages.
- @retval NULL There are not enough resources available to return the best matching
- language.
- @retval Other A pointer to a Null-terminated ASCII string that is the best matching
- language in SupportedLanguages.
-
-**/
-CHAR8 *
-EFIAPI
-GetBestLanguage (
- IN CONST CHAR8 *SupportedLanguages,
- IN BOOLEAN Iso639Language,
- ...
- )
-{
- VA_LIST Args;
- CHAR8 *Language;
- UINTN CompareLength;
- UINTN LanguageLength;
- CONST CHAR8 *Supported;
- CHAR8 *BestLanguage;
-
- ASSERT (SupportedLanguages != NULL);
-
- VA_START (Args, Iso639Language);
- while ((Language = VA_ARG (Args, CHAR8 *)) != NULL) {
- //
- // Default to ISO 639-2 mode
- //
- CompareLength = 3;
- LanguageLength = MIN (3, AsciiStrLen (Language));
-
- //
- // If in RFC 4646 mode, then determine the length of the first RFC 4646 language code in Language
- //
- if (!Iso639Language) {
- for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++);
- }
-
- //
- // Trim back the length of Language used until it is empty
- //
- while (LanguageLength > 0) {
- //
- // Loop through all language codes in SupportedLanguages
- //
- for (Supported = SupportedLanguages; *Supported != '\0'; Supported += CompareLength) {
- //
- // In RFC 4646 mode, then Loop through all language codes in SupportedLanguages
- //
- if (!Iso639Language) {
- //
- // Skip ';' characters in Supported
- //
- for (; *Supported != '\0' && *Supported == ';'; Supported++);
- //
- // Determine the length of the next language code in Supported
- //
- for (CompareLength = 0; Supported[CompareLength] != 0 && Supported[CompareLength] != ';'; CompareLength++);
- //
- // If Language is longer than the Supported, then skip to the next language
- //
- if (LanguageLength > CompareLength) {
- continue;
- }
- }
- //
- // See if the first LanguageLength characters in Supported match Language
- //
- if (AsciiStrnCmp (Supported, Language, LanguageLength) == 0) {
- VA_END (Args);
- //
- // Allocate, copy, and return the best matching language code from SupportedLanguages
- //
- BestLanguage = AllocateZeroPool (CompareLength + 1);
- if (BestLanguage == NULL) {
- return NULL;
- }
- return CopyMem (BestLanguage, Supported, CompareLength);
- }
- }
-
- if (Iso639Language) {
- //
- // If ISO 639 mode, then each language can only be tested once
- //
- LanguageLength = 0;
- } else {
- //
- // If RFC 4646 mode, then trim Language from the right to the next '-' character
- //
- for (LanguageLength--; LanguageLength > 0 && Language[LanguageLength] != '-'; LanguageLength--);
- }
- }
- }
- VA_END (Args);
-
- //
- // No matches were found
- //
- return NULL;
-}
diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibInternal.h b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibInternal.h deleted file mode 100644 index 51f58176de..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibInternal.h +++ /dev/null @@ -1,44 +0,0 @@ -/** @file
- Internal include file for UefiLib.
-
- Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-
-#ifndef __UEFI_LIB_INTERNAL_H_
-#define __UEFI_LIB_INTERNAL_H_
-
-
-#include <FrameworkDxe.h>
-#include <Protocol/DriverBinding.h>
-#include <Protocol/ComponentName.h>
-#include <Protocol/ComponentName2.h>
-#include <Protocol/DriverConfiguration.h>
-#include <Protocol/DriverConfiguration2.h>
-#include <Protocol/DriverDiagnostics.h>
-#include <Protocol/DriverDiagnostics2.h>
-#include <Protocol/LoadedImage.h>
-#include <Protocol/GraphicsOutput.h>
-#include <Protocol/UgaDraw.h>
-#include <Protocol/HiiFont.h>
-
-#include <Guid/EventGroup.h>
-#include <Guid/EventLegacyBios.h>
-#include <Guid/GlobalVariable.h>
-#include <Library/UefiLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
-#include <Library/PrintLib.h>
-#include <Library/DevicePathLib.h>
-
-#endif
diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibPrint.c b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibPrint.c deleted file mode 100644 index f0dcf9fb25..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibPrint.c +++ /dev/null @@ -1,815 +0,0 @@ -/** @file
- Mde UEFI library API implementation.
- Print to StdErr or ConOut defined in EFI_SYSTEM_TABLE
-
- Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- 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 "UefiLibInternal.h"
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
- { 0x00, 0x00, 0x00, 0x00 },
- { 0x98, 0x00, 0x00, 0x00 },
- { 0x00, 0x98, 0x00, 0x00 },
- { 0x98, 0x98, 0x00, 0x00 },
- { 0x00, 0x00, 0x98, 0x00 },
- { 0x98, 0x00, 0x98, 0x00 },
- { 0x00, 0x98, 0x98, 0x00 },
- { 0x98, 0x98, 0x98, 0x00 },
- { 0x10, 0x10, 0x10, 0x00 },
- { 0xff, 0x10, 0x10, 0x00 },
- { 0x10, 0xff, 0x10, 0x00 },
- { 0xff, 0xff, 0x10, 0x00 },
- { 0x10, 0x10, 0xff, 0x00 },
- { 0xf0, 0x10, 0xff, 0x00 },
- { 0x10, 0xff, 0xff, 0x00 },
- { 0xff, 0xff, 0xff, 0x00 }
-};
-
-/**
- Internal function which prints a formatted Unicode string to the console output device
- specified by Console
-
- This function prints a formatted Unicode string to the console output device
- specified by Console and returns the number of Unicode characters that printed
- to it. If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize,
- then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
- If Format is NULL, then ASSERT().
- If Format is not aligned on a 16-bit boundary, then ASSERT().
-
- @param Format Null-terminated Unicode format string.
- @param Console The output console.
- @param Marker VA_LIST marker for the variable argument list.
-
- @return The number of Unicode characters in the produced
- output buffer not including the Null-terminator.
-**/
-UINTN
-InternalPrint (
- IN CONST CHAR16 *Format,
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console,
- IN VA_LIST Marker
- )
-{
- EFI_STATUS Status;
- UINTN Return;
- CHAR16 *Buffer;
- UINTN BufferSize;
-
- ASSERT (Format != NULL);
- ASSERT (((UINTN) Format & BIT0) == 0);
- ASSERT (Console != NULL);
-
- BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
-
- Buffer = (CHAR16 *) AllocatePool(BufferSize);
- ASSERT (Buffer != NULL);
-
- Return = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);
-
- if (Console != NULL && Return > 0) {
- //
- // To be extra safe make sure Console has been initialized
- //
- Status = Console->OutputString (Console, Buffer);
- if (EFI_ERROR (Status)) {
- Return = 0;
- }
- }
-
- FreePool (Buffer);
-
- return Return;
-}
-
-/**
- Prints a formatted Unicode string to the console output device specified by
- ConOut defined in the EFI_SYSTEM_TABLE.
-
- This function prints a formatted Unicode string to the console output device
- specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
- characters that printed to ConOut. If the length of the formatted Unicode
- string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
- PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
- If Format is NULL, then ASSERT().
- If Format is not aligned on a 16-bit boundary, then ASSERT().
- If gST->ConOut is NULL, then ASSERT().
-
- @param Format Null-terminated Unicode format string.
- @param ... Variable argument list whose contents are accessed based
- on the format string specified by Format.
-
- @return Number of Unicode characters printed to ConOut.
-
-**/
-UINTN
-EFIAPI
-Print (
- IN CONST CHAR16 *Format,
- ...
- )
-{
- VA_LIST Marker;
- UINTN Return;
-
- VA_START (Marker, Format);
-
- Return = InternalPrint (Format, gST->ConOut, Marker);
-
- VA_END (Marker);
-
- return Return;
-}
-
-/**
- Prints a formatted Unicode string to the console output device specified by
- StdErr defined in the EFI_SYSTEM_TABLE.
-
- This function prints a formatted Unicode string to the console output device
- specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
- characters that printed to StdErr. If the length of the formatted Unicode
- string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
- PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
- If Format is NULL, then ASSERT().
- If Format is not aligned on a 16-bit boundary, then ASSERT().
- If gST->StdErr is NULL, then ASSERT().
-
- @param Format Null-terminated Unicode format string.
- @param ... Variable argument list whose contents are accessed based
- on the format string specified by Format.
-
- @return Number of Unicode characters printed to StdErr.
-
-**/
-UINTN
-EFIAPI
-ErrorPrint (
- IN CONST CHAR16 *Format,
- ...
- )
-{
- VA_LIST Marker;
- UINTN Return;
-
- VA_START (Marker, Format);
-
- Return = InternalPrint( Format, gST->StdErr, Marker);
-
- VA_END (Marker);
-
- return Return;
-}
-
-
-/**
- Internal function which prints a formatted ASCII string to the console output device
- specified by Console
-
- This function prints a formatted ASCII string to the console output device
- specified by Console and returns the number of ASCII characters that printed
- to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize,
- then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
-
- If Format is NULL, then ASSERT().
-
- @param Format Null-terminated ASCII format string.
- @param Console The output console.
- @param Marker VA_LIST marker for the variable argument list.
-
- @return The number of Unicode characters in the produced
- output buffer not including the Null-terminator.
-
-**/
-UINTN
-AsciiInternalPrint (
- IN CONST CHAR8 *Format,
- IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console,
- IN VA_LIST Marker
- )
-{
- EFI_STATUS Status;
- UINTN Return;
- CHAR16 *Buffer;
- UINTN BufferSize;
-
- ASSERT (Format != NULL);
- ASSERT (Console != NULL);
-
- BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
-
- Buffer = (CHAR16 *) AllocatePool(BufferSize);
- ASSERT (Buffer != NULL);
-
- Return = UnicodeVSPrintAsciiFormat (Buffer, BufferSize, Format, Marker);
-
- if (Console != NULL) {
- //
- // To be extra safe make sure Console has been initialized
- //
- Status = Console->OutputString (Console, Buffer);
- if (EFI_ERROR (Status)) {
- Return = 0;
- }
- }
-
- FreePool (Buffer);
-
- return Return;
-}
-
-/**
- Prints a formatted ASCII string to the console output device specified by
- ConOut defined in the EFI_SYSTEM_TABLE.
-
- This function prints a formatted ASCII string to the console output device
- specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
- characters that printed to ConOut. If the length of the formatted ASCII
- string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
- PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
- If Format is NULL, then ASSERT().
- If gST->ConOut is NULL, then ASSERT().
-
- @param Format Null-terminated ASCII format string.
- @param ... Variable argument list whose contents are accessed based
- on the format string specified by Format.
-
- @return Number of ASCII characters printed to ConOut.
-
-**/
-UINTN
-EFIAPI
-AsciiPrint (
- IN CONST CHAR8 *Format,
- ...
- )
-{
- VA_LIST Marker;
- UINTN Return;
- ASSERT (Format != NULL);
-
- VA_START (Marker, Format);
-
- Return = AsciiInternalPrint( Format, gST->ConOut, Marker);
-
- VA_END (Marker);
-
- return Return;
-}
-
-/**
- Prints a formatted ASCII string to the console output device specified by
- StdErr defined in the EFI_SYSTEM_TABLE.
-
- This function prints a formatted ASCII string to the console output device
- specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
- characters that printed to StdErr. If the length of the formatted ASCII
- string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
- PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
- If Format is NULL, then ASSERT().
- If gST->StdErr is NULL, then ASSERT().
-
- @param Format Null-terminated ASCII format string.
- @param ... Variable argument list whose contents are accessed based
- on the format string specified by Format.
-
- @return Number of ASCII characters printed to ConErr.
-
-**/
-UINTN
-EFIAPI
-AsciiErrorPrint (
- IN CONST CHAR8 *Format,
- ...
- )
-{
- VA_LIST Marker;
- UINTN Return;
-
- ASSERT (Format != NULL);
-
- VA_START (Marker, Format);
-
- Return = AsciiInternalPrint( Format, gST->StdErr, Marker);
-
- VA_END (Marker);
-
- return Return;
-}
-
-/**
- Internal function to print a formatted Unicode string to a graphics console device specified by
- ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
-
- This function prints a formatted Unicode string to the graphics console device
- specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
- Unicode characters printed. The EFI_HII_FONT_PROTOCOL is used to convert the
- string to a bitmap using the glyphs registered with the
- HII database. No wrapping is performed, so any portions of the string the fall
- outside the active display region will not be displayed.
-
- If a graphics console device is not associated with the ConsoleOutputHandle
- defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
- If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
- string is printed, and 0 is returned.
-
- @param PointX X coordinate to print the string.
- @param PointY Y coordinate to print the string.
- @param Foreground The foreground color of the string being printed. This is
- an optional parameter that may be NULL. If it is NULL,
- then the foreground color of the current ConOut device
- in the EFI_SYSTEM_TABLE is used.
- @param Background The background color of the string being printed. This is
- an optional parameter that may be NULL. If it is NULL,
- then the background color of the current ConOut device
- in the EFI_SYSTEM_TABLE is used.
- @param Buffer Null-terminated Unicode formatted string.
- @param PrintNum The number of Unicode formatted string to be printed.
-
- @return Number of Unicode Characters printed. Zero means no any character
- displayed successfully.
-
-**/
-UINTN
-InternalPrintGraphic (
- IN UINTN PointX,
- IN UINTN PointY,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background,
- IN CHAR16 *Buffer,
- IN UINTN PrintNum
- )
-{
- EFI_STATUS Status;
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- EFI_HII_FONT_PROTOCOL *HiiFont;
- EFI_IMAGE_OUTPUT *Blt;
- EFI_FONT_DISPLAY_INFO FontInfo;
- EFI_HII_ROW_INFO *RowInfoArray;
- UINTN RowInfoArraySize;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto;
- EFI_HANDLE ConsoleHandle;
- UINTN Width;
- UINTN Height;
- UINTN Delta;
-
- HorizontalResolution = 0;
- VerticalResolution = 0;
- Blt = NULL;
- RowInfoArray = NULL;
-
- ConsoleHandle = gST->ConsoleOutHandle;
-
- ASSERT( ConsoleHandle != NULL);
-
- Status = gBS->HandleProtocol (
- ConsoleHandle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID **) &GraphicsOutput
- );
-
- UgaDraw = NULL;
- if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
- //
- // If no GOP available, try to open UGA Draw protocol if supported.
- //
- GraphicsOutput = NULL;
-
- Status = gBS->HandleProtocol (
- ConsoleHandle,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw
- );
- }
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- Status = gBS->HandleProtocol (
- ConsoleHandle,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID **) &Sto
- );
-
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- if (GraphicsOutput != NULL) {
- HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
- VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
- } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
- UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
- } else {
- goto Error;
- }
-
- ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
-
- Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont);
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- Blt = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
- ASSERT (Blt != NULL);
-
- Blt->Width = (UINT16) (HorizontalResolution);
- Blt->Height = (UINT16) (VerticalResolution);
-
- ZeroMem (&FontInfo, sizeof (EFI_FONT_DISPLAY_INFO));
-
- if (Foreground != NULL) {
- CopyMem (&FontInfo.ForegroundColor, Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- } else {
- CopyMem (
- &FontInfo.ForegroundColor,
- &mEfiColors[Sto->Mode->Attribute & 0x0f],
- sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- }
- if (Background != NULL) {
- CopyMem (&FontInfo.BackgroundColor, Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- } else {
- CopyMem (
- &FontInfo.BackgroundColor,
- &mEfiColors[Sto->Mode->Attribute >> 4],
- sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- }
-
- if (GraphicsOutput != NULL) {
- Blt->Image.Screen = GraphicsOutput;
-
- Status = HiiFont->StringToImage (
- HiiFont,
- EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_OUT_FLAG_CLIP |
- EFI_HII_OUT_FLAG_CLIP_CLEAN_X | EFI_HII_OUT_FLAG_CLIP_CLEAN_Y |
- EFI_HII_IGNORE_LINE_BREAK | EFI_HII_DIRECT_TO_SCREEN,
- Buffer,
- &FontInfo,
- &Blt,
- PointX,
- PointY,
- &RowInfoArray,
- &RowInfoArraySize,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
- ASSERT (UgaDraw!= NULL);
-
- Blt->Image.Bitmap = AllocateZeroPool (Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- ASSERT (Blt->Image.Bitmap != NULL);
-
- //
- // StringToImage only support blt'ing image to device using GOP protocol. If GOP is not supported in this platform,
- // we ask StringToImage to print the string to blt buffer, then blt to device using UgaDraw.
- //
- Status = HiiFont->StringToImage (
- HiiFont,
- EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_OUT_FLAG_CLIP |
- EFI_HII_OUT_FLAG_CLIP_CLEAN_X | EFI_HII_OUT_FLAG_CLIP_CLEAN_Y |
- EFI_HII_IGNORE_LINE_BREAK,
- Buffer,
- &FontInfo,
- &Blt,
- PointX,
- PointY,
- &RowInfoArray,
- &RowInfoArraySize,
- NULL
- );
-
- if (!EFI_ERROR (Status)) {
- ASSERT (RowInfoArray != NULL);
- //
- // Explicit Line break characters are ignored, so the updated parameter RowInfoArraySize by StringToImage will
- // always be 1 or 0 (if there is no valid Unicode Char can be printed). ASSERT here to make sure.
- //
- ASSERT (RowInfoArraySize <= 1);
-
- if (RowInfoArraySize != 0) {
- Width = RowInfoArray[0].LineWidth;
- Height = RowInfoArray[0].LineHeight;
- Delta = Blt->Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
- } else {
- Width = 0;
- Height = 0;
- Delta = 0;
- }
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) Blt->Image.Bitmap,
- EfiUgaBltBufferToVideo,
- PointX,
- PointY,
- PointX,
- PointY,
- Width,
- Height,
- Delta
- );
- } else {
- goto Error;
- }
- FreePool (Blt->Image.Bitmap);
- } else {
- goto Error;
- }
- //
- // Calculate the number of actual printed characters
- //
- if (RowInfoArraySize != 0) {
- PrintNum = RowInfoArray[0].EndIndex - RowInfoArray[0].StartIndex + 1;
- } else {
- PrintNum = 0;
- }
-
- FreePool (RowInfoArray);
- FreePool (Blt);
- return PrintNum;
-
-Error:
- if (Blt != NULL) {
- FreePool (Blt);
- }
- return 0;
-}
-
-/**
- Prints a formatted Unicode string to a graphics console device specified by
- ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
-
- This function prints a formatted Unicode string to the graphics console device
- specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
- Unicode characters displayed, not including partial characters that may be clipped
- by the right edge of the display. If the length of the formatted Unicode string is
- greater than PcdUefiLibMaxPrintBufferSize, then at most the first
- PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL
- StringToImage() service is used to convert the string to a bitmap using the glyphs
- registered with the HII database. No wrapping is performed, so any portions of the
- string the fall outside the active display region will not be displayed. Please see
- Section 27.2.6 of the UEFI Specification for a description of the supported string
- format including the set of control codes supported by the StringToImage() service.
-
- If a graphics console device is not associated with the ConsoleOutputHandle
- defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
- If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
- string is printed, and 0 is returned.
- If Format is NULL, then ASSERT().
- If Format is not aligned on a 16-bit boundary, then ASSERT().
- If gST->ConsoleOutputHandle is NULL, then ASSERT().
-
- @param PointX X coordinate to print the string.
- @param PointY Y coordinate to print the string.
- @param ForeGround The foreground color of the string being printed. This is
- an optional parameter that may be NULL. If it is NULL,
- then the foreground color of the current ConOut device
- in the EFI_SYSTEM_TABLE is used.
- @param BackGround The background color of the string being printed. This is
- an optional parameter that may be NULL. If it is NULL,
- then the background color of the current ConOut device
- in the EFI_SYSTEM_TABLE is used.
- @param Format Null-terminated Unicode format string. See Print Library
- for the supported format string syntax.
- @param ... Variable argument list whose contents are accessed based on
- the format string specified by Format.
-
- @return The number of Unicode characters printed.
-
-**/
-UINTN
-EFIAPI
-PrintXY (
- IN UINTN PointX,
- IN UINTN PointY,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
- IN CONST CHAR16 *Format,
- ...
- )
-{
- VA_LIST Marker;
- CHAR16 *Buffer;
- UINTN BufferSize;
- UINTN PrintNum;
- UINTN ReturnNum;
-
- ASSERT (Format != NULL);
- ASSERT (((UINTN) Format & BIT0) == 0);
-
- VA_START (Marker, Format);
-
- BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
-
- Buffer = (CHAR16 *) AllocatePool (BufferSize);
- ASSERT (Buffer != NULL);
-
- PrintNum = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);
-
- VA_END (Marker);
-
- ReturnNum = InternalPrintGraphic (PointX, PointY, ForeGround, BackGround, Buffer, PrintNum);
-
- FreePool (Buffer);
-
- return ReturnNum;
-}
-
-/**
- Prints a formatted ASCII string to a graphics console device specified by
- ConsoleOutputHandle defined in the EFI_SYSTEM_TABLE at the given (X,Y) coordinates.
-
- This function prints a formatted ASCII string to the graphics console device
- specified by ConsoleOutputHandle in EFI_SYSTEM_TABLE and returns the number of
- ASCII characters displayed, not including partial characters that may be clipped
- by the right edge of the display. If the length of the formatted ASCII string is
- greater than PcdUefiLibMaxPrintBufferSize, then at most the first
- PcdUefiLibMaxPrintBufferSize characters are printed.The EFI_HII_FONT_PROTOCOL
- StringToImage() service is used to convert the string to a bitmap using the glyphs
- registered with the HII database. No wrapping is performed, so any portions of the
- string the fall outside the active display region will not be displayed. Please see
- Section 27.2.6 of the UEFI Specification for a description of the supported string
- format including the set of control codes supported by the StringToImage() service.
-
- If a graphics console device is not associated with the ConsoleOutputHandle
- defined in the EFI_SYSTEM_TABLE then no string is printed, and 0 is returned.
- If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no
- string is printed, and 0 is returned.
- If Format is NULL, then ASSERT().
- If gST->ConsoleOutputHandle is NULL, then ASSERT().
-
- @param PointX X coordinate to print the string.
- @param PointY Y coordinate to print the string.
- @param ForeGround The foreground color of the string being printed. This is
- an optional parameter that may be NULL. If it is NULL,
- then the foreground color of the current ConOut device
- in the EFI_SYSTEM_TABLE is used.
- @param BackGround The background color of the string being printed. This is
- an optional parameter that may be NULL. If it is NULL,
- then the background color of the current ConOut device
- in the EFI_SYSTEM_TABLE is used.
- @param Format Null-terminated ASCII format string. See Print Library
- for the supported format string syntax.
- @param ... Variable argument list whose contents are accessed based on
- the format string specified by Format.
-
- @return The number of ASCII characters printed.
-
-**/
-UINTN
-EFIAPI
-AsciiPrintXY (
- IN UINTN PointX,
- IN UINTN PointY,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
- IN CONST CHAR8 *Format,
- ...
- )
-{
- VA_LIST Marker;
- CHAR16 *Buffer;
- UINTN BufferSize;
- UINTN PrintNum;
- UINTN ReturnNum;
-
- ASSERT (Format != NULL);
-
- VA_START (Marker, Format);
-
- BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
-
- Buffer = (CHAR16 *) AllocatePool (BufferSize);
- ASSERT (Buffer != NULL);
-
- PrintNum = UnicodeSPrintAsciiFormat (Buffer, BufferSize, Format, Marker);
-
- VA_END (Marker);
-
- ReturnNum = InternalPrintGraphic (PointX, PointY, ForeGround, BackGround, Buffer, PrintNum);
-
- FreePool (Buffer);
-
- return ReturnNum;
-}
-
-/**
- Appends a formatted Unicode string to a Null-terminated Unicode string
-
- This function appends a formatted Unicode string to the Null-terminated
- Unicode string specified by String. String is optional and may be NULL.
- Storage for the formatted Unicode string returned is allocated using
- AllocatePool(). The pointer to the appended string is returned. The caller
- is responsible for freeing the returned string.
-
- If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().
- If FormatString is NULL, then ASSERT().
- If FormatString is not aligned on a 16-bit boundary, then ASSERT().
-
- @param[in] String A Null-terminated Unicode string.
- @param[in] FormatString A Null-terminated Unicode format string.
- @param[in] Marker VA_LIST marker for the variable argument list.
-
- @retval NULL There was not enough available memory.
- @return Null-terminated Unicode string is that is the formatted
- string appended to String.
-**/
-CHAR16*
-EFIAPI
-CatVSPrint (
- IN CHAR16 *String, OPTIONAL
- IN CONST CHAR16 *FormatString,
- IN VA_LIST Marker
- )
-{
- UINTN CharactersRequired;
- UINTN SizeRequired;
- CHAR16 *BufferToReturn;
- VA_LIST ExtraMarker;
-
- VA_COPY (ExtraMarker, Marker);
- CharactersRequired = SPrintLength(FormatString, ExtraMarker);
- VA_END (ExtraMarker);
-
- if (String != NULL) {
- SizeRequired = StrSize(String) + (CharactersRequired * sizeof(CHAR16));
- } else {
- SizeRequired = sizeof(CHAR16) + (CharactersRequired * sizeof(CHAR16));
- }
-
- BufferToReturn = AllocatePool(SizeRequired);
-
- if (BufferToReturn == NULL) {
- return NULL;
- } else {
- BufferToReturn[0] = L'\0';
- }
-
- if (String != NULL) {
- StrCpyS(BufferToReturn, SizeRequired / sizeof(CHAR16), String);
- }
-
- UnicodeVSPrint(BufferToReturn + StrLen(BufferToReturn), (CharactersRequired+1) * sizeof(CHAR16), FormatString, Marker);
-
- ASSERT(StrSize(BufferToReturn)==SizeRequired);
-
- return (BufferToReturn);
-}
-
-/**
- Appends a formatted Unicode string to a Null-terminated Unicode string
-
- This function appends a formatted Unicode string to the Null-terminated
- Unicode string specified by String. String is optional and may be NULL.
- Storage for the formatted Unicode string returned is allocated using
- AllocatePool(). The pointer to the appended string is returned. The caller
- is responsible for freeing the returned string.
-
- If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().
- If FormatString is NULL, then ASSERT().
- If FormatString is not aligned on a 16-bit boundary, then ASSERT().
-
- @param[in] String A Null-terminated Unicode string.
- @param[in] FormatString A Null-terminated Unicode format string.
- @param[in] ... The variable argument list whose contents are
- accessed based on the format string specified by
- FormatString.
-
- @retval NULL There was not enough available memory.
- @return Null-terminated Unicode string is that is the formatted
- string appended to String.
-**/
-CHAR16 *
-EFIAPI
-CatSPrint (
- IN CHAR16 *String, OPTIONAL
- IN CONST CHAR16 *FormatString,
- ...
- )
-{
- VA_LIST Marker;
- CHAR16 *NewString;
-
- VA_START (Marker, FormatString);
- NewString = CatVSPrint(String, FormatString, Marker);
- VA_END (Marker);
- return NewString;
-}
-
diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiNotTiano.c b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiNotTiano.c deleted file mode 100644 index e641aba647..0000000000 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiNotTiano.c +++ /dev/null @@ -1,327 +0,0 @@ -/** @file
- Library functions that abstract areas of conflict between framework and UEFI 2.0.
-
- Help Port Framework code that has conflicts with UEFI 2.0 by hiding the
- old conflicts with library functions and supporting implementations of the old
- (EDK/EFI 1.10) and new (EDK II/UEFI 2.0) way. This module is a DXE driver as
- it contains DXE enum extensions for EFI event services.
-
-Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-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 "UefiLibInternal.h"
-
-/**
- Create a Legacy Boot Event.
-
- Tiano extended the CreateEvent Type enum to add a legacy boot event type.
- This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
- added and now it's possible to not voilate the UEFI specification by
- declaring a GUID for the legacy boot event class. This library supports
- the EDK/EFI 1.10 form and EDK II/UEFI 2.0 form and allows common code to
- work both ways.
-
- @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
-
- @retval EFI_SUCCESS Event was created.
- @retval Other Event was not created.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiCreateEventLegacyBoot (
- OUT EFI_EVENT *LegacyBootEvent
- )
-{
- return EfiCreateEventLegacyBootEx (
- TPL_CALLBACK,
- EfiEventEmptyFunction,
- NULL,
- LegacyBootEvent
- );
-}
-
-/**
- Create an EFI event in the Legacy Boot Event Group and allows
- the caller to specify a notification function.
-
- This function abstracts the creation of the Legacy Boot Event.
- The Framework moved from a proprietary to UEFI 2.0 based mechanism.
- This library abstracts the caller from how this event is created to prevent
- to code form having to change with the version of the specification supported.
- If LegacyBootEvent is NULL, then ASSERT().
-
- @param NotifyTpl The task priority level of the event.
- @param NotifyFunction The notification function to call when the event is signaled.
- @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
- @param LegacyBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
-
- @retval EFI_SUCCESS Event was created.
- @retval Other Event was not created.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiCreateEventLegacyBootEx (
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
- IN VOID *NotifyContext, OPTIONAL
- OUT EFI_EVENT *LegacyBootEvent
- )
-{
- EFI_STATUS Status;
-
- ASSERT (LegacyBootEvent != NULL);
-
- if (gST->Hdr.Revision < 0x00020000) {
- //
- // prior to UEFI 2.0 use Tiano extension to EFI
- //
- Status = gBS->CreateEvent (
- EFI_EVENT_SIGNAL_LEGACY_BOOT | EVT_NOTIFY_SIGNAL,
- NotifyTpl,
- NotifyFunction,
- NotifyContext,
- LegacyBootEvent
- );
- } else {
- //
- // For UEFI 2.0 and the future use an Event Group
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- NotifyTpl,
- NotifyFunction,
- NotifyContext,
- &gEfiEventLegacyBootGuid,
- LegacyBootEvent
- );
- }
-
- return Status;
-}
-
-/**
- Create a Read to Boot Event.
-
- Tiano extended the CreateEvent Type enum to add a ready to boot event type.
- This was bad as Tiano did not own the enum. In UEFI 2.0 CreateEventEx was
- added and now it's possible to not voilate the UEFI specification and use
- the ready to boot event class defined in UEFI 2.0. This library supports
- the EDK/EFI 1.10 form and EDK II/UEFI 2.0 form and allows common code to
- work both ways.
-
- @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
-
- @retval EFI_SUCCESS Event was created.
- @retval Other Event was not created.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiCreateEventReadyToBoot (
- OUT EFI_EVENT *ReadyToBootEvent
- )
-{
- return EfiCreateEventReadyToBootEx (
- TPL_CALLBACK,
- EfiEventEmptyFunction,
- NULL,
- ReadyToBootEvent
- );
-}
-
-/**
- Create an EFI event in the Ready To Boot Event Group and allows
- the caller to specify a notification function.
-
- This function abstracts the creation of the Ready to Boot Event.
- The Framework moved from a proprietary to UEFI 2.0 based mechanism.
- This library abstracts the caller from how this event is created to prevent
- to code form having to change with the version of the specification supported.
- If ReadyToBootEvent is NULL, then ASSERT().
-
- @param NotifyTpl The task priority level of the event.
- @param NotifyFunction The notification function to call when the event is signaled.
- @param NotifyContext The content to pass to NotifyFunction when the event is signaled.
- @param ReadyToBootEvent Returns the EFI event returned from gBS->CreateEvent(Ex).
-
- @retval EFI_SUCCESS Event was created.
- @retval Other Event was not created.
-
-**/
-EFI_STATUS
-EFIAPI
-EfiCreateEventReadyToBootEx (
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
- IN VOID *NotifyContext, OPTIONAL
- OUT EFI_EVENT *ReadyToBootEvent
- )
-{
- EFI_STATUS Status;
-
- ASSERT (ReadyToBootEvent != NULL);
-
- if (gST->Hdr.Revision < 0x00020000) {
- //
- // prior to UEFI 2.0 use Tiano extension to EFI
- //
- Status = gBS->CreateEvent (
- EFI_EVENT_SIGNAL_READY_TO_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,
- NotifyTpl,
- NotifyFunction,
- NotifyContext,
- ReadyToBootEvent
- );
- } else {
- //
- // For UEFI 2.0 and the future use an Event Group
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- NotifyTpl,
- NotifyFunction,
- NotifyContext,
- &gEfiEventReadyToBootGuid,
- ReadyToBootEvent
- );
- }
-
- return Status;
-}
-
-
-/**
- Signal a Ready to Boot Event.
-
- Create a Ready to Boot Event. Signal it and close it. This causes other
- events of the same event group to be signaled in other modules.
-
-**/
-VOID
-EFIAPI
-EfiSignalEventReadyToBoot (
- VOID
- )
-{
- EFI_STATUS Status;
- EFI_EVENT ReadyToBootEvent;
-
- Status = EfiCreateEventReadyToBoot (&ReadyToBootEvent);
- if (!EFI_ERROR (Status)) {
- gBS->SignalEvent (ReadyToBootEvent);
- gBS->CloseEvent (ReadyToBootEvent);
- }
-}
-
-/**
- Signal a Legacy Boot Event.
-
- Create a legacy Boot Event. Signal it and close it. This causes other
- events of the same event group to be signaled in other modules.
-
-**/
-VOID
-EFIAPI
-EfiSignalEventLegacyBoot (
- VOID
- )
-{
- EFI_STATUS Status;
- EFI_EVENT LegacyBootEvent;
-
- Status = EfiCreateEventLegacyBoot (&LegacyBootEvent);
- if (!EFI_ERROR (Status)) {
- gBS->SignalEvent (LegacyBootEvent);
- gBS->CloseEvent (LegacyBootEvent);
- }
-}
-
-
-/**
- Check to see if the Firmware Volume (FV) Media Device Path is valid
-
- Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum
- so as we move to UEFI 2.0 support we must use a mechanism that conforms with
- the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed
- device path is defined for Tiano extensions of device path. If the code
- is compiled to conform with the UEFI 2.0 specification use the new device path
- else use the old form for backwards compatability. The return value to this
- function points to a location in FvDevicePathNode and it does not allocate
- new memory for the GUID pointer that is returned.
-
- @param FvDevicePathNode Pointer to FV device path to check.
-
- @retval NULL FvDevicePathNode is not valid.
- @retval Other FvDevicePathNode is valid and pointer to NameGuid was returned.
-
-**/
-EFI_GUID *
-EFIAPI
-EfiGetNameGuidFromFwVolDevicePathNode (
- IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode
- )
-{
- ASSERT (FvDevicePathNode != NULL);
-
- //
- // EFI Specification extension on Media Device Path. MEDIA_FW_VOL_FILEPATH_DEVICE_PATH is adopted by UEFI later and added in UEFI2.10.
- // In EdkCompatibility Package, we only support MEDIA_FW_VOL_FILEPATH_DEVICE_PATH that complies with
- // EFI 1.10 and UEFI 2.10.
- //
- if (DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH &&
- DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_PIWG_FW_FILE_DP) {
- return (EFI_GUID *) &FvDevicePathNode->FvFileName;
- }
-
- return NULL;
-}
-
-
-/**
- Initialize a Firmware Volume (FV) Media Device Path node.
-
- Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum
- so as we move to UEFI 2.0 support we must use a mechanism that conforms with
- the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed
- device path is defined for Tiano extensions of device path. If the code
- is compiled to conform with the UEFI 2.0 specification use the new device path
- else use the old form for backwards compatability.
-
- @param FvDevicePathNode Pointer to a FV device path node to initialize
- @param NameGuid FV file name to use in FvDevicePathNode
-
-**/
-VOID
-EFIAPI
-EfiInitializeFwVolDevicepathNode (
- IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode,
- IN CONST EFI_GUID *NameGuid
- )
-{
- ASSERT (FvDevicePathNode != NULL);
- ASSERT (NameGuid != NULL);
-
- //
- // EFI Specification extension on Media Device Path. MEDIA_FW_VOL_FILEPATH_DEVICE_PATH is adopted by UEFI later and added in UEFI2.10.
- // In EdkCompatibility Package, we only support MEDIA_FW_VOL_FILEPATH_DEVICE_PATH that complies with
- // EFI 1.10 and UEFI 2.10.
- //
- FvDevicePathNode->Header.Type = MEDIA_DEVICE_PATH;
- FvDevicePathNode->Header.SubType = MEDIA_PIWG_FW_FILE_DP;
- SetDevicePathNodeLength (&FvDevicePathNode->Header, sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH));
-
- CopyGuid (&FvDevicePathNode->FvFileName, NameGuid);
-}
-
diff --git a/IntelFrameworkPkg/Library/PeiHobLibFramework/HobLib.c b/IntelFrameworkPkg/Library/PeiHobLibFramework/HobLib.c deleted file mode 100644 index 223e56a9db..0000000000 --- a/IntelFrameworkPkg/Library/PeiHobLibFramework/HobLib.c +++ /dev/null @@ -1,806 +0,0 @@ -/** @file
- Instance of HOB Library using PEI Services.
-
- HOB Library implementation that uses PEI Services to retrieve the HOB List.
- This library instance uses EFI_HOB_TYPE_CV defined in Intel framework HOB specification v0.9
- to implement HobLib BuildCvHob() API.
-
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-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 <FrameworkPei.h>
-
-#include <Guid/MemoryAllocationHob.h>
-
-#include <Library/HobLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/BaseMemoryLib.h>
-
-/**
- Returns the pointer to the HOB list.
-
- This function returns the pointer to first HOB in the list.
- For PEI phase, the PEI service GetHobList() can be used to retrieve the pointer
- to the HOB list. For the DXE phase, the HOB list pointer can be retrieved through
- the EFI System Table by looking up theHOB list GUID in the System Configuration Table.
- Since the System Configuration Table does not exist that the time the DXE Core is
- launched, the DXE Core uses a global variable from the DXE Core Entry Point Library
- to manage the pointer to the HOB list.
-
- If the pointer to the HOB list is NULL, then ASSERT().
-
- @return The pointer to the HOB list.
-
-**/
-VOID *
-EFIAPI
-GetHobList (
- VOID
- )
-{
- EFI_STATUS Status;
- VOID *HobList;
-
- Status = PeiServicesGetHobList (&HobList);
- ASSERT_EFI_ERROR (Status);
- ASSERT (HobList != NULL);
-
- return HobList;
-}
-
-/**
- Returns the next instance of a HOB type from the starting HOB.
-
- This function searches the first instance of a HOB type from the starting HOB pointer.
- If there does not exist such HOB type from the starting HOB pointer, it will return NULL.
- In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer
- unconditionally: it returns HobStart back if HobStart itself meets the requirement;
- caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.
-
- If HobStart is NULL, then ASSERT().
-
- @param Type The HOB type to return.
- @param HobStart The starting HOB pointer to search from.
-
- @return The next instance of a HOB type from the starting HOB.
-
-**/
-VOID *
-EFIAPI
-GetNextHob (
- IN UINT16 Type,
- IN CONST VOID *HobStart
- )
-{
- EFI_PEI_HOB_POINTERS Hob;
-
- ASSERT (HobStart != NULL);
-
- Hob.Raw = (UINT8 *) HobStart;
- //
- // Parse the HOB list until end of list or matching type is found.
- //
- while (!END_OF_HOB_LIST (Hob)) {
- if (Hob.Header->HobType == Type) {
- return Hob.Raw;
- }
- Hob.Raw = GET_NEXT_HOB (Hob);
- }
- return NULL;
-}
-
-/**
- Returns the first instance of a HOB type among the whole HOB list.
-
- This function searches the first instance of a HOB type among the whole HOB list.
- If there does not exist such HOB type in the HOB list, it will return NULL.
-
- If the pointer to the HOB list is NULL, then ASSERT().
-
- @param Type The HOB type to return.
-
- @return The next instance of a HOB type from the starting HOB.
-
-**/
-VOID *
-EFIAPI
-GetFirstHob (
- IN UINT16 Type
- )
-{
- VOID *HobList;
-
- HobList = GetHobList ();
- return GetNextHob (Type, HobList);
-}
-
-/**
- Returns the next instance of the matched GUID HOB from the starting HOB.
-
- This function searches the first instance of a HOB from the starting HOB pointer.
- Such HOB should satisfy two conditions:
- its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
- If there does not exist such HOB from the starting HOB pointer, it will return NULL.
- Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()
- to extract the data section and its size info respectively.
- In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer
- unconditionally: it returns HobStart back if HobStart itself meets the requirement;
- caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.
-
- If Guid is NULL, then ASSERT().
- If HobStart is NULL, then ASSERT().
-
- @param Guid The GUID to match with in the HOB list.
- @param HobStart A pointer to a Guid.
-
- @return The next instance of the matched GUID HOB from the starting HOB.
-
-**/
-VOID *
-EFIAPI
-GetNextGuidHob (
- IN CONST EFI_GUID *Guid,
- IN CONST VOID *HobStart
- )
-{
- EFI_PEI_HOB_POINTERS GuidHob;
-
- GuidHob.Raw = (UINT8 *) HobStart;
- while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) {
- if (CompareGuid (Guid, &GuidHob.Guid->Name)) {
- break;
- }
- GuidHob.Raw = GET_NEXT_HOB (GuidHob);
- }
- return GuidHob.Raw;
-}
-
-/**
- Returns the first instance of the matched GUID HOB among the whole HOB list.
-
- This function searches the first instance of a HOB among the whole HOB list.
- Such HOB should satisfy two conditions:
- its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
- If there does not exist such HOB from the starting HOB pointer, it will return NULL.
- Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()
- to extract the data section and its size info respectively.
-
- If the pointer to the HOB list is NULL, then ASSERT().
- If Guid is NULL, then ASSERT().
-
- @param Guid The GUID to match with in the HOB list.
-
- @return The first instance of the matched GUID HOB among the whole HOB list.
-
-**/
-VOID *
-EFIAPI
-GetFirstGuidHob (
- IN CONST EFI_GUID *Guid
- )
-{
- VOID *HobList;
-
- HobList = GetHobList ();
- return GetNextGuidHob (Guid, HobList);
-}
-
-/**
- Get the system boot mode from the HOB list.
-
- This function returns the system boot mode information from the
- PHIT HOB in HOB list.
-
- If the pointer to the HOB list is NULL, then ASSERT().
-
- @param VOID
-
- @return The Boot Mode.
-
-**/
-EFI_BOOT_MODE
-EFIAPI
-GetBootModeHob (
- VOID
- )
-{
- EFI_STATUS Status;
- EFI_BOOT_MODE BootMode;
-
- Status = PeiServicesGetBootMode (&BootMode);
- ASSERT_EFI_ERROR (Status);
-
- return BootMode;
-}
-
-/**
- Adds a new HOB to the HOB List.
-
- This internal function enables PEIMs to create various types of HOBs.
-
- @param Type Type of the new HOB.
- @param Length Length of the new HOB to allocate.
-
- @retval NULL The HOB could not be allocated.
- @retval others The address of new HOB.
-
-**/
-VOID *
-EFIAPI
-InternalPeiCreateHob (
- IN UINT16 Type,
- IN UINT16 Length
- )
-{
- EFI_STATUS Status;
- VOID *Hob;
-
- Status = PeiServicesCreateHob (Type, Length, &Hob);
- if (EFI_ERROR (Status)) {
- Hob = NULL;
- }
- //
- // Assume the process of HOB building is always successful.
- //
- ASSERT (Hob != NULL);
- return Hob;
-}
-
-/**
- Builds a HOB for a loaded PE32 module.
-
- This function builds a HOB for a loaded PE32 module.
- It can only be invoked during PEI phase;
- for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
-
- If ModuleName is NULL, then ASSERT().
- If there is no additional space for HOB creation, then ASSERT().
-
- @param ModuleName The GUID File Name of the module.
- @param MemoryAllocationModule The 64 bit physical address of the module.
- @param ModuleLength The length of the module in bytes.
- @param EntryPoint The 64 bit physical address of the module entry point.
-
-**/
-VOID
-EFIAPI
-BuildModuleHob (
- IN CONST EFI_GUID *ModuleName,
- IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,
- IN UINT64 ModuleLength,
- IN EFI_PHYSICAL_ADDRESS EntryPoint
- )
-{
- EFI_HOB_MEMORY_ALLOCATION_MODULE *Hob;
-
- ASSERT (((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) == 0) &&
- ((ModuleLength & (EFI_PAGE_SIZE - 1)) == 0));
-
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));
- if (Hob == NULL) {
- return;
- }
-
- CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModuleGuid);
- Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule;
- Hob->MemoryAllocationHeader.MemoryLength = ModuleLength;
- Hob->MemoryAllocationHeader.MemoryType = EfiBootServicesCode;
-
- //
- // Zero the reserved space to match HOB spec
- //
- ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob->MemoryAllocationHeader.Reserved));
-
- CopyGuid (&Hob->ModuleName, ModuleName);
- Hob->EntryPoint = EntryPoint;
-}
-
-/**
- Builds a HOB that describes a chunk of system memory with Owner GUID.
-
- This function builds a HOB that describes a chunk of system memory.
- It can only be invoked during PEI phase;
- for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
-
- If there is no additional space for HOB creation, then ASSERT().
-
- @param ResourceType The type of resource described by this HOB.
- @param ResourceAttribute The resource attributes of the memory described by this HOB.
- @param PhysicalStart The 64 bit physical address of memory described by this HOB.
- @param NumberOfBytes The length of the memory described by this HOB in bytes.
- @param OwnerGUID GUID for the owner of this resource.
-
-**/
-VOID
-EFIAPI
-BuildResourceDescriptorWithOwnerHob (
- IN EFI_RESOURCE_TYPE ResourceType,
- IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,
- IN EFI_PHYSICAL_ADDRESS PhysicalStart,
- IN UINT64 NumberOfBytes,
- IN EFI_GUID *OwnerGUID
- )
-{
- EFI_HOB_RESOURCE_DESCRIPTOR *Hob;
-
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16) sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
- if (Hob == NULL) {
- return;
- }
-
- Hob->ResourceType = ResourceType;
- Hob->ResourceAttribute = ResourceAttribute;
- Hob->PhysicalStart = PhysicalStart;
- Hob->ResourceLength = NumberOfBytes;
-
- CopyGuid (&Hob->Owner, OwnerGUID);
-}
-
-/**
- Builds a HOB that describes a chunk of system memory.
-
- This function builds a HOB that describes a chunk of system memory.
- It can only be invoked during PEI phase;
- for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
-
- If there is no additional space for HOB creation, then ASSERT().
-
- @param ResourceType The type of resource described by this HOB.
- @param ResourceAttribute The resource attributes of the memory described by this HOB.
- @param PhysicalStart The 64 bit physical address of memory described by this HOB.
- @param NumberOfBytes The length of the memory described by this HOB in bytes.
-
-**/
-VOID
-EFIAPI
-BuildResourceDescriptorHob (
- IN EFI_RESOURCE_TYPE ResourceType,
- IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,
- IN EFI_PHYSICAL_ADDRESS PhysicalStart,
- IN UINT64 NumberOfBytes
- )
-{
- EFI_HOB_RESOURCE_DESCRIPTOR *Hob;
-
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16) sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
- if (Hob == NULL) {
- return;
- }
-
- Hob->ResourceType = ResourceType;
- Hob->ResourceAttribute = ResourceAttribute;
- Hob->PhysicalStart = PhysicalStart;
- Hob->ResourceLength = NumberOfBytes;
- ZeroMem (&(Hob->Owner), sizeof (EFI_GUID));
-}
-
-/**
- Builds a customized HOB tagged with a GUID for identification and returns
- the start address of GUID HOB data.
-
- This function builds a customized HOB tagged with a GUID for identification
- and returns the start address of GUID HOB data so that caller can fill the customized data.
- The HOB Header and Name field is already stripped.
- It can only be invoked during PEI phase;
- for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
-
- If Guid is NULL, then ASSERT().
- If there is no additional space for HOB creation, then ASSERT().
- If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
-
- @param Guid The GUID to tag the customized HOB.
- @param DataLength The size of the data payload for the GUID HOB.
-
- @retval NULL The GUID HOB could not be allocated.
- @retval others The start address of GUID HOB data.
-
-**/
-VOID *
-EFIAPI
-BuildGuidHob (
- IN CONST EFI_GUID *Guid,
- IN UINTN DataLength
- )
-{
- EFI_HOB_GUID_TYPE *Hob;
-
- //
- // Make sure Guid is valid
- //
- ASSERT (Guid != NULL);
-
- //
- // Make sure that data length is not too long.
- //
- ASSERT (DataLength <= (0xffff - sizeof (EFI_HOB_GUID_TYPE)));
-
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16) (sizeof (EFI_HOB_GUID_TYPE) + DataLength));
- if (Hob == NULL) {
- return Hob;
- }
- CopyGuid (&Hob->Name, Guid);
- return Hob + 1;
-}
-
-/**
- Builds a customized HOB tagged with a GUID for identification, copies the input data to the HOB
- data field, and returns the start address of the GUID HOB data.
-
- This function builds a customized HOB tagged with a GUID for identification and copies the input
- data to the HOB data field and returns the start address of the GUID HOB data. It can only be
- invoked during PEI phase; for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
- The HOB Header and Name field is already stripped.
- It can only be invoked during PEI phase;
- for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
-
- If Guid is NULL, then ASSERT().
- If Data is NULL and DataLength > 0, then ASSERT().
- If there is no additional space for HOB creation, then ASSERT().
- If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
-
- @param Guid The GUID to tag the customized HOB.
- @param Data The data to be copied into the data field of the GUID HOB.
- @param DataLength The size of the data payload for the GUID HOB.
-
- @retval NULL The GUID HOB could not be allocated.
- @retval others The start address of GUID HOB data.
-
-**/
-VOID *
-EFIAPI
-BuildGuidDataHob (
- IN CONST EFI_GUID *Guid,
- IN VOID *Data,
- IN UINTN DataLength
- )
-{
- VOID *HobData;
-
- ASSERT (Data != NULL || DataLength == 0);
-
- HobData = BuildGuidHob (Guid, DataLength);
- if (HobData == NULL) {
- return HobData;
- }
-
- return CopyMem (HobData, Data, DataLength);
-}
-
-/**
- Check FV alignment.
-
- @param BaseAddress The base address of the Firmware Volume.
- @param Length The size of the Firmware Volume in bytes.
-
- @retval TRUE FvImage buffer is at its required alignment.
- @retval FALSE FvImage buffer is not at its required alignment.
-
-**/
-BOOLEAN
-InternalCheckFvAlignment (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-{
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- UINT32 FvAlignment;
-
- FvAlignment = 0;
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
-
- //
- // If EFI_FVB2_WEAK_ALIGNMENT is set in the volume header then the first byte of the volume
- // can be aligned on any power-of-two boundary. A weakly aligned volume can not be moved from
- // its initial linked location and maintain its alignment.
- //
- if ((FwVolHeader->Attributes & EFI_FVB2_WEAK_ALIGNMENT) != EFI_FVB2_WEAK_ALIGNMENT) {
- //
- // Get FvHeader alignment
- //
- FvAlignment = 1 << ((FwVolHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);
- //
- // FvAlignment must be greater than or equal to 8 bytes of the minimum FFS alignment value.
- //
- if (FvAlignment < 8) {
- FvAlignment = 8;
- }
- if ((UINTN)BaseAddress % FvAlignment != 0) {
- //
- // FvImage buffer is not at its required alignment.
- //
- DEBUG ((
- DEBUG_ERROR,
- "Unaligned FvImage found at 0x%lx:0x%lx, the required alignment is 0x%x\n",
- BaseAddress,
- Length,
- FvAlignment
- ));
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/**
- Builds a Firmware Volume HOB.
-
- This function builds a Firmware Volume HOB.
- It can only be invoked during PEI phase;
- for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
-
- If there is no additional space for HOB creation, then ASSERT().
- If the FvImage buffer is not at its required alignment, then ASSERT().
-
- @param BaseAddress The base address of the Firmware Volume.
- @param Length The size of the Firmware Volume in bytes.
-
-**/
-VOID
-EFIAPI
-BuildFvHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-{
- EFI_HOB_FIRMWARE_VOLUME *Hob;
-
- if (!InternalCheckFvAlignment (BaseAddress, Length)) {
- ASSERT (FALSE);
- return;
- }
-
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME));
- if (Hob == NULL) {
- return;
- }
-
- Hob->BaseAddress = BaseAddress;
- Hob->Length = Length;
-}
-
-/**
- Builds a EFI_HOB_TYPE_FV2 HOB.
-
- This function builds a EFI_HOB_TYPE_FV2 HOB.
- It can only be invoked during PEI phase;
- for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
-
- If there is no additional space for HOB creation, then ASSERT().
- If the FvImage buffer is not at its required alignment, then ASSERT().
-
- @param BaseAddress The base address of the Firmware Volume.
- @param Length The size of the Firmware Volume in bytes.
- @param FvName The name of the Firmware Volume.
- @param FileName The name of the file.
-
-**/
-VOID
-EFIAPI
-BuildFv2Hob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN CONST EFI_GUID *FvName,
- IN CONST EFI_GUID *FileName
- )
-{
- EFI_HOB_FIRMWARE_VOLUME2 *Hob;
-
- if (!InternalCheckFvAlignment (BaseAddress, Length)) {
- ASSERT (FALSE);
- return;
- }
-
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV2, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME2));
- if (Hob == NULL) {
- return;
- }
-
- Hob->BaseAddress = BaseAddress;
- Hob->Length = Length;
- CopyGuid (&Hob->FvName, FvName);
- CopyGuid (&Hob->FileName, FileName);
-}
-
-/**
- Builds a Capsule Volume HOB.
-
- This function builds a Capsule Volume HOB.
- It can only be invoked during PEI phase;
- for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
-
- If the platform does not support Capsule Volume HOBs, then ASSERT().
- If there is no additional space for HOB creation, then ASSERT().
-
- @param BaseAddress The base address of the Capsule Volume.
- @param Length The size of the Capsule Volume in bytes.
-
-**/
-VOID
-EFIAPI
-BuildCvHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-{
- EFI_HOB_CAPSULE_VOLUME *Hob;
-
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CV, (UINT16) sizeof (EFI_HOB_CAPSULE_VOLUME));
- if (Hob == NULL) {
- return;
- }
-
- Hob->BaseAddress = BaseAddress;
- Hob->Length = Length;
-}
-
-/**
- Builds a HOB for the CPU.
-
- This function builds a HOB for the CPU.
- It can only be invoked during PEI phase;
- for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
-
- If there is no additional space for HOB creation, then ASSERT().
-
- @param SizeOfMemorySpace The maximum physical memory addressability of the processor.
- @param SizeOfIoSpace The maximum physical I/O addressability of the processor.
-
-**/
-VOID
-EFIAPI
-BuildCpuHob (
- IN UINT8 SizeOfMemorySpace,
- IN UINT8 SizeOfIoSpace
- )
-{
- EFI_HOB_CPU *Hob;
-
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CPU, (UINT16) sizeof (EFI_HOB_CPU));
- if (Hob == NULL) {
- return;
- }
-
- Hob->SizeOfMemorySpace = SizeOfMemorySpace;
- Hob->SizeOfIoSpace = SizeOfIoSpace;
-
- //
- // Zero the reserved space to match HOB spec
- //
- ZeroMem (Hob->Reserved, sizeof (Hob->Reserved));
-}
-
-/**
- Builds a HOB for the Stack.
-
- This function builds a HOB for the stack.
- It can only be invoked during PEI phase;
- for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
-
- If there is no additional space for HOB creation, then ASSERT().
-
- @param BaseAddress The 64 bit physical address of the Stack.
- @param Length The length of the stack in bytes.
-
-**/
-VOID
-EFIAPI
-BuildStackHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-{
- EFI_HOB_MEMORY_ALLOCATION_STACK *Hob;
-
- ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
- ((Length & (EFI_PAGE_SIZE - 1)) == 0));
-
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK));
- if (Hob == NULL) {
- return;
- }
-
- CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocStackGuid);
- Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
- Hob->AllocDescriptor.MemoryLength = Length;
- Hob->AllocDescriptor.MemoryType = EfiBootServicesData;
-
- //
- // Zero the reserved space to match HOB spec
- //
- ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved));
-}
-
-/**
- Builds a HOB for the BSP store.
-
- This function builds a HOB for BSP store.
- It can only be invoked during PEI phase;
- for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
-
- If there is no additional space for HOB creation, then ASSERT().
-
- @param BaseAddress The 64 bit physical address of the BSP.
- @param Length The length of the BSP store in bytes.
- @param MemoryType Type of memory allocated by this HOB.
-
-**/
-VOID
-EFIAPI
-BuildBspStoreHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN EFI_MEMORY_TYPE MemoryType
- )
-{
- EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *Hob;
-
- ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
- ((Length & (EFI_PAGE_SIZE - 1)) == 0));
-
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE));
- if (Hob == NULL) {
- return;
- }
-
- CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocBspStoreGuid);
- Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
- Hob->AllocDescriptor.MemoryLength = Length;
- Hob->AllocDescriptor.MemoryType = MemoryType;
-
- //
- // Zero the reserved space to match HOB spec
- //
- ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved));
-}
-
-/**
- Builds a HOB for the memory allocation.
-
- This function builds a HOB for the memory allocation.
- It can only be invoked during PEI phase;
- for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
-
- If there is no additional space for HOB creation, then ASSERT().
-
- @param BaseAddress The 64 bit physical address of the memory.
- @param Length The length of the memory allocation in bytes.
- @param MemoryType Type of memory allocated by this HOB.
-
-**/
-VOID
-EFIAPI
-BuildMemoryAllocationHob (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN EFI_MEMORY_TYPE MemoryType
- )
-{
- EFI_HOB_MEMORY_ALLOCATION *Hob;
-
- ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
- ((Length & (EFI_PAGE_SIZE - 1)) == 0));
-
- Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION));
- if (Hob == NULL) {
- return;
- }
-
- ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID));
- Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
- Hob->AllocDescriptor.MemoryLength = Length;
- Hob->AllocDescriptor.MemoryType = MemoryType;
- //
- // Zero the reserved space to match HOB spec
- //
- ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved));
-}
diff --git a/IntelFrameworkPkg/Library/PeiHobLibFramework/PeiHobLib.uni b/IntelFrameworkPkg/Library/PeiHobLibFramework/PeiHobLib.uni deleted file mode 100644 index 6072750fd1..0000000000 --- a/IntelFrameworkPkg/Library/PeiHobLibFramework/PeiHobLib.uni +++ /dev/null @@ -1,23 +0,0 @@ -// /** @file
-// Instance of HOB Library using PEI Services.
-//
-// HOB Library implementation that uses PEI Services to retrieve the HOB List.
-// This library instance uses EFI_HOB_TYPE_CV defined in Intel framework HOB specification v0.9
-// to implement HobLib BuildCvHob() API.
-//
-// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "Instance of HOB Library using PEI Services"
-
-#string STR_MODULE_DESCRIPTION #language en-US "The HOB Library implementation that uses PEI Services to retrieve the HOB List. This library instance uses EFI_HOB_TYPE_CV defined in Intel Framework HOB Specification v0.9 to implement the HobLib BuildCvHob() API."
-
diff --git a/IntelFrameworkPkg/Library/PeiHobLibFramework/PeiHobLibFramework.inf b/IntelFrameworkPkg/Library/PeiHobLibFramework/PeiHobLibFramework.inf deleted file mode 100644 index b10be00685..0000000000 --- a/IntelFrameworkPkg/Library/PeiHobLibFramework/PeiHobLibFramework.inf +++ /dev/null @@ -1,58 +0,0 @@ -## @file
-# Instance of HOB Library using PEI Services.
-#
-# HOB Library implementation that uses PEI Services to retrieve the HOB List.
-# This library instance uses EFI_HOB_TYPE_CV defined in Intel framework HOB specification v0.9
-# to implement HobLib BuildCvHob() API.
-#
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PeiHobLib
- MODULE_UNI_FILE = PeiHobLib.uni
- FILE_GUID = B6684612-6F5D-425d-952C-F462792EC00B
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = HobLib|PEIM PEI_CORE SEC
-
-
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC (EBC is for build only)
-#
-
-[Sources]
- HobLib.c
-
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
-
-[LibraryClasses]
- BaseMemoryLib
- PeiServicesLib
- DebugLib
-
-[Guids]
- gEfiHobMemoryAllocStackGuid ## SOMETIMES_PRODUCES ## HOB # MemoryAllocation StackHob
- gEfiHobMemoryAllocBspStoreGuid ## SOMETIMES_PRODUCES ## HOB # MemoryAllocation BspStoreHob
- gEfiHobMemoryAllocModuleGuid ## SOMETIMES_PRODUCES ## HOB # MemoryAllocation ModuleHob
-
-#
-# [Hob]
-# MEMORY_ALLOCATION ## SOMETIMES_PRODUCES
-# RESOURCE_DESCRIPTOR ## SOMETIMES_PRODUCES
-# FIRMWARE_VOLUME ## SOMETIMES_PRODUCES
-#
-
diff --git a/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/InternalSmbusLib.h b/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/InternalSmbusLib.h deleted file mode 100644 index c6ea2dabf7..0000000000 --- a/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/InternalSmbusLib.h +++ /dev/null @@ -1,78 +0,0 @@ -/** @file
- Internal header file for Smbus library.
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _INTERNAL_SMBUS_LIB_H_
-#define _INTERNAL_SMBUS_LIB_H_
-
-
-#include <FrameworkPei.h>
-
-#include <Ppi/Smbus.h>
-
-#include <Library/SmbusLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/PeiServicesTablePointerLib.h>
-
-//
-// Declaration for internal functions
-//
-
-/**
- Gets Smbus PPIs.
-
- This internal function retrieves Smbus PPI from PPI database.
-
- @param VOID
-
- @return The pointer to Smbus PPI.
-
-**/
-EFI_PEI_SMBUS_PPI *
-InternalGetSmbusPpi (
- VOID
- );
-
-/**
- Executes an SMBus operation to an SMBus controller.
-
- This function provides a standard way to execute Smbus script
- as defined in the SmBus Specification. The data can either be of
- the Length byte, word, or a block of data.
-
- @param SmbusOperation Signifies which particular SMBus hardware protocol instance that it will use to
- execute the SMBus transactions.
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param Length Signifies the number of bytes that this operation will do. The maximum number of
- bytes can be revision specific and operation specific.
- @param Buffer Contains the value of data to execute to the SMBus slave device. Not all operations
- require this argument. The length of this buffer is identified by Length.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
- @return The actual number of bytes that are executed for this operation.
-
-**/
-UINTN
-InternalSmBusExec (
- IN EFI_SMBUS_OPERATION SmbusOperation,
- IN UINTN SmBusAddress,
- IN UINTN Length,
- IN OUT VOID *Buffer,
- OUT RETURN_STATUS *Status OPTIONAL
- );
-
-#endif
diff --git a/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/PeiSmbusLib.c b/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/PeiSmbusLib.c deleted file mode 100644 index 33d9096833..0000000000 --- a/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/PeiSmbusLib.c +++ /dev/null @@ -1,95 +0,0 @@ -/** @file
- Implementation of SmBusLib class library for PEI phase.
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-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 "InternalSmbusLib.h"
-
-/**
- Gets Smbus PPIs.
-
- This internal function retrieves Smbus PPI from PPI database.
- If gEfiPeiSmbusPpiGuid can not be located, then ASSERT()
-
- @return The pointer to Smbus PPI.
-
-**/
-EFI_PEI_SMBUS_PPI *
-InternalGetSmbusPpi (
- VOID
- )
-{
- EFI_STATUS Status;
- EFI_PEI_SMBUS_PPI *SmbusPpi;
-
- Status = PeiServicesLocatePpi (&gEfiPeiSmbusPpiGuid, 0, NULL, (VOID **) &SmbusPpi);
- ASSERT_EFI_ERROR (Status);
- ASSERT (SmbusPpi != NULL);
-
- return SmbusPpi;
-}
-
-/**
- Executes an SMBus operation to an SMBus controller.
-
- This function provides a standard way to execute Smbus script
- as defined in the SmBus Specification. The data can either be of
- the Length byte, word, or a block of data.
-
- @param SmbusOperation Signifies which particular SMBus hardware protocol instance that it will use to
- execute the SMBus transactions.
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param Length Signifies the number of bytes that this operation will do. The maximum number of
- bytes can be revision specific and operation specific.
- @param Buffer Contains the value of data to execute to the SMBus slave device. Not all operations
- require this argument. The length of this buffer is identified by Length.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
- @return The actual number of bytes that are executed for this operation..
-
-**/
-UINTN
-InternalSmBusExec (
- IN EFI_SMBUS_OPERATION SmbusOperation,
- IN UINTN SmBusAddress,
- IN UINTN Length,
- IN OUT VOID *Buffer,
- OUT RETURN_STATUS *Status OPTIONAL
- )
-{
- EFI_PEI_SMBUS_PPI *SmbusPpi;
- CONST EFI_PEI_SERVICES **PeiServices;
- RETURN_STATUS ReturnStatus;
- EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;
-
- PeiServices = GetPeiServicesTablePointer ();
- SmbusPpi = InternalGetSmbusPpi ();
- SmbusDeviceAddress.SmbusDeviceAddress = SMBUS_LIB_SLAVE_ADDRESS (SmBusAddress);
-
- ReturnStatus = SmbusPpi->Execute (
- (EFI_PEI_SERVICES **) PeiServices,
- SmbusPpi,
- SmbusDeviceAddress,
- SMBUS_LIB_COMMAND (SmBusAddress),
- SmbusOperation,
- SMBUS_LIB_PEC (SmBusAddress),
- &Length,
- Buffer
- );
- if (Status != NULL) {
- *Status = ReturnStatus;
- }
-
- return Length;
-}
diff --git a/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/PeiSmbusLibSmbusPpi.inf b/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/PeiSmbusLibSmbusPpi.inf deleted file mode 100644 index d56d4d3fa9..0000000000 --- a/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/PeiSmbusLibSmbusPpi.inf +++ /dev/null @@ -1,53 +0,0 @@ -## @file
-# SMBUS library that layers on top of the SMBUS PPI.
-#
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-#
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-##
-
-[Defines]
- INF_VERSION = 0x00010005
- BASE_NAME = PeiSmbusLibSmbusPpi
- MODULE_UNI_FILE = PeiSmbusLibSmbusPpi.uni
- FILE_GUID = 51C4C059-67F0-4e3c-9A55-FF42A8291C8C
- MODULE_TYPE = PEIM
- VERSION_STRING = 1.0
- LIBRARY_CLASS = SmbusLib|PEIM
-
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- SmbusLib.c
- PeiSmbusLib.c
- InternalSmbusLib.h
-
-
-[Packages]
- MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
-
-
-[LibraryClasses]
- BaseMemoryLib
- PeiServicesLib
- DebugLib
- PeiServicesTablePointerLib
-
-[Ppis]
- gEfiPeiSmbusPpiGuid ## CONSUMES
-
-[Depex]
- gEfiPeiSmbusPpiGuid
diff --git a/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/PeiSmbusLibSmbusPpi.uni b/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/PeiSmbusLibSmbusPpi.uni deleted file mode 100644 index 8f5d42630f..0000000000 --- a/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/PeiSmbusLibSmbusPpi.uni +++ /dev/null @@ -1,21 +0,0 @@ -// /** @file
-// SMBUS library that layers on top of the SMBUS PPI.
-//
-// The SMBUS library that layers on top of the SMBUS PPI.
-//
-// Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-//
-// This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "Layers on top of the SMBUS PPI"
-
-#string STR_MODULE_DESCRIPTION #language en-US "The SMBUS library that layers on top of the SMBUS PPI."
-
diff --git a/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/SmbusLib.c b/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/SmbusLib.c deleted file mode 100644 index 40b482e392..0000000000 --- a/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/SmbusLib.c +++ /dev/null @@ -1,470 +0,0 @@ -/** @file
-Implementation of SmBusLib class library for PEI phase.
-
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-Module Name: SmbusLib.c
-
-**/
-
-#include "InternalSmbusLib.h"
-
-/**
- Executes an SMBUS quick read command.
-
- Executes an SMBUS quick read command on the SMBUS device specified by SmBusAddress.
- Only the SMBUS slave address field of SmBusAddress is required.
- If Status is not NULL, then the status of the executed command is returned in Status.
- If PEC is set in SmBusAddress, then ASSERT().
- If Command in SmBusAddress is not zero, then ASSERT().
- If Length in SmBusAddress is not zero, then ASSERT().
- If any reserved bits of SmBusAddress are set, then ASSERT().
-
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
-**/
-VOID
-EFIAPI
-SmBusQuickRead (
- IN UINTN SmBusAddress,
- OUT RETURN_STATUS *Status OPTIONAL
- )
-{
- ASSERT (!SMBUS_LIB_PEC (SmBusAddress));
- ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
-
- InternalSmBusExec (EfiSmbusQuickRead, SmBusAddress, 0, NULL, Status);
-}
-
-/**
- Executes an SMBUS quick write command.
-
- Executes an SMBUS quick write command on the SMBUS device specified by SmBusAddress.
- Only the SMBUS slave address field of SmBusAddress is required.
- If Status is not NULL, then the status of the executed command is returned in Status.
- If PEC is set in SmBusAddress, then ASSERT().
- If Command in SmBusAddress is not zero, then ASSERT().
- If Length in SmBusAddress is not zero, then ASSERT().
- If any reserved bits of SmBusAddress are set, then ASSERT().
-
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
-**/
-VOID
-EFIAPI
-SmBusQuickWrite (
- IN UINTN SmBusAddress,
- OUT RETURN_STATUS *Status OPTIONAL
- )
-{
- ASSERT (!SMBUS_LIB_PEC (SmBusAddress));
- ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
-
- InternalSmBusExec (EfiSmbusQuickWrite, SmBusAddress, 0, NULL, Status);
-}
-
-/**
- Executes an SMBUS receive byte command.
-
- Executes an SMBUS receive byte command on the SMBUS device specified by SmBusAddress.
- Only the SMBUS slave address field of SmBusAddress is required.
- The byte received from the SMBUS is returned.
- If Status is not NULL, then the status of the executed command is returned in Status.
- If Command in SmBusAddress is not zero, then ASSERT().
- If Length in SmBusAddress is not zero, then ASSERT().
- If any reserved bits of SmBusAddress are set, then ASSERT().
-
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
- @return The byte received from the SMBUS.
-
-**/
-UINT8
-EFIAPI
-SmBusReceiveByte (
- IN UINTN SmBusAddress,
- OUT RETURN_STATUS *Status OPTIONAL
- )
-{
- UINT8 Byte;
-
- ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
-
- InternalSmBusExec (EfiSmbusReceiveByte, SmBusAddress, 1, &Byte, Status);
-
- return Byte;
-}
-
-/**
- Executes an SMBUS send byte command.
-
- Executes an SMBUS send byte command on the SMBUS device specified by SmBusAddress.
- The byte specified by Value is sent.
- Only the SMBUS slave address field of SmBusAddress is required. Value is returned.
- If Status is not NULL, then the status of the executed command is returned in Status.
- If Command in SmBusAddress is not zero, then ASSERT().
- If Length in SmBusAddress is not zero, then ASSERT().
- If any reserved bits of SmBusAddress are set, then ASSERT().
-
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param Value The 8-bit value to send.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
- @return The parameter of Value.
-
-**/
-UINT8
-EFIAPI
-SmBusSendByte (
- IN UINTN SmBusAddress,
- IN UINT8 Value,
- OUT RETURN_STATUS *Status OPTIONAL
- )
-{
- UINT8 Byte;
-
- ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
-
- Byte = Value;
- InternalSmBusExec (EfiSmbusSendByte, SmBusAddress, 1, &Byte, Status);
-
- return Value;
-}
-
-/**
- Executes an SMBUS read data byte command.
-
- Executes an SMBUS read data byte command on the SMBUS device specified by SmBusAddress.
- Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
- The 8-bit value read from the SMBUS is returned.
- If Status is not NULL, then the status of the executed command is returned in Status.
- If Length in SmBusAddress is not zero, then ASSERT().
- If any reserved bits of SmBusAddress are set, then ASSERT().
-
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
- @return The byte read from the SMBUS.
-
-**/
-UINT8
-EFIAPI
-SmBusReadDataByte (
- IN UINTN SmBusAddress,
- OUT RETURN_STATUS *Status OPTIONAL
- )
-{
- UINT8 Byte;
-
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
-
- InternalSmBusExec (EfiSmbusReadByte, SmBusAddress, 1, &Byte, Status);
-
- return Byte;
-}
-
-/**
- Executes an SMBUS write data byte command.
-
- Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress.
- The 8-bit value specified by Value is written.
- Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
- Value is returned.
- If Status is not NULL, then the status of the executed command is returned in Status.
- If Length in SmBusAddress is not zero, then ASSERT().
- If any reserved bits of SmBusAddress are set, then ASSERT().
-
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param Value The 8-bit value to write.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
- @return The parameter of Value.
-
-**/
-UINT8
-EFIAPI
-SmBusWriteDataByte (
- IN UINTN SmBusAddress,
- IN UINT8 Value,
- OUT RETURN_STATUS *Status OPTIONAL
- )
-{
- UINT8 Byte;
-
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
-
- Byte = Value;
- InternalSmBusExec (EfiSmbusWriteByte, SmBusAddress, 1, &Byte, Status);
-
- return Value;
-}
-
-/**
- Executes an SMBUS read data word command.
-
- Executes an SMBUS read data word command on the SMBUS device specified by SmBusAddress.
- Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
- The 16-bit value read from the SMBUS is returned.
- If Status is not NULL, then the status of the executed command is returned in Status.
- If Length in SmBusAddress is not zero, then ASSERT().
- If any reserved bits of SmBusAddress are set, then ASSERT().
-
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
- @return The byte read from the SMBUS.
-
-**/
-UINT16
-EFIAPI
-SmBusReadDataWord (
- IN UINTN SmBusAddress,
- OUT RETURN_STATUS *Status OPTIONAL
- )
-{
- UINT16 Word;
-
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
-
- InternalSmBusExec (EfiSmbusReadWord, SmBusAddress, 2, &Word, Status);
-
- return Word;
-}
-
-/**
- Executes an SMBUS write data word command.
-
- Executes an SMBUS write data word command on the SMBUS device specified by SmBusAddress.
- The 16-bit value specified by Value is written.
- Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
- Value is returned.
- If Status is not NULL, then the status of the executed command is returned in Status.
- If Length in SmBusAddress is not zero, then ASSERT().
- If any reserved bits of SmBusAddress are set, then ASSERT().
-
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param Value The 16-bit value to write.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
- @return The parameter of Value.
-
-**/
-UINT16
-EFIAPI
-SmBusWriteDataWord (
- IN UINTN SmBusAddress,
- IN UINT16 Value,
- OUT RETURN_STATUS *Status OPTIONAL
- )
-{
- UINT16 Word;
-
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
-
- Word = Value;
- InternalSmBusExec (EfiSmbusWriteWord, SmBusAddress, 2, &Word, Status);
-
- return Value;
-}
-
-/**
- Executes an SMBUS process call command.
-
- Executes an SMBUS process call command on the SMBUS device specified by SmBusAddress.
- The 16-bit value specified by Value is written.
- Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
- The 16-bit value returned by the process call command is returned.
- If Status is not NULL, then the status of the executed command is returned in Status.
- If Length in SmBusAddress is not zero, then ASSERT().
- If any reserved bits of SmBusAddress are set, then ASSERT().
-
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param Value The 16-bit value to write.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
- @return The 16-bit value returned by the process call command.
-
-**/
-UINT16
-EFIAPI
-SmBusProcessCall (
- IN UINTN SmBusAddress,
- IN UINT16 Value,
- OUT RETURN_STATUS *Status OPTIONAL
- )
-{
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
-
- InternalSmBusExec (EfiSmbusProcessCall, SmBusAddress, 2, &Value, Status);
-
- return Value;
-}
-
-/**
- Executes an SMBUS read block command.
-
- Executes an SMBUS read block command on the SMBUS device specified by SmBusAddress.
- Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.
- Bytes are read from the SMBUS and stored in Buffer.
- The number of bytes read is returned, and will never return a value larger than 32-bytes.
- If Status is not NULL, then the status of the executed command is returned in Status.
- It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read.
- SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.
- If Length in SmBusAddress is not zero, then ASSERT().
- If Buffer is NULL, then ASSERT().
- If any reserved bits of SmBusAddress are set, then ASSERT().
-
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param Buffer Pointer to the buffer to store the bytes read from the SMBUS.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
- @return The number of bytes read.
-
-**/
-UINTN
-EFIAPI
-SmBusReadBlock (
- IN UINTN SmBusAddress,
- OUT VOID *Buffer,
- OUT RETURN_STATUS *Status OPTIONAL
- )
-{
- ASSERT (Buffer != NULL);
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
- ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
-
- return InternalSmBusExec (EfiSmbusReadBlock, SmBusAddress, 0x20, Buffer, Status);
-}
-
-/**
- Executes an SMBUS write block command.
-
- Executes an SMBUS write block command on the SMBUS device specified by SmBusAddress.
- The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.
- Bytes are written to the SMBUS from Buffer.
- The number of bytes written is returned, and will never return a value larger than 32-bytes.
- If Status is not NULL, then the status of the executed command is returned in Status.
- If Length in SmBusAddress is zero or greater than 32, then ASSERT().
- If Buffer is NULL, then ASSERT().
- If any reserved bits of SmBusAddress are set, then ASSERT().
-
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param Buffer Pointer to the buffer to store the bytes read from the SMBUS.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
- @return The number of bytes written.
-
-**/
-UINTN
-EFIAPI
-SmBusWriteBlock (
- IN UINTN SmBusAddress,
- OUT VOID *Buffer,
- OUT RETURN_STATUS *Status OPTIONAL
- )
-{
- UINTN Length;
-
- ASSERT (Buffer != NULL);
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1);
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32);
- ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
-
- Length = SMBUS_LIB_LENGTH (SmBusAddress);
- return InternalSmBusExec (EfiSmbusWriteBlock, SmBusAddress, Length, Buffer, Status);
-}
-
-/**
- Executes an SMBUS block process call command.
-
- Executes an SMBUS block process call command on the SMBUS device specified by SmBusAddress.
- The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.
- Bytes are written to the SMBUS from WriteBuffer. Bytes are then read from the SMBUS into ReadBuffer.
- If Status is not NULL, then the status of the executed command is returned in Status.
- It is the caller's responsibility to make sure ReadBuffer is large enough for the total number of bytes read.
- SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.
- If Length in SmBusAddress is zero or greater than 32, then ASSERT().
- If WriteBuffer is NULL, then ASSERT().
- If ReadBuffer is NULL, then ASSERT().
- If any reserved bits of SmBusAddress are set, then ASSERT().
-
- @param SmBusAddress Address that encodes the SMBUS Slave Address,
- SMBUS Command, SMBUS Data Length, and PEC.
- @param WriteBuffer Pointer to the buffer of bytes to write to the SMBUS.
- @param ReadBuffer Pointer to the buffer of bytes to read from the SMBUS.
- @param Status Return status for the executed command.
- This is an optional parameter and may be NULL.
-
- @return The number of bytes written.
-
-**/
-UINTN
-EFIAPI
-SmBusBlockProcessCall (
- IN UINTN SmBusAddress,
- IN VOID *WriteBuffer,
- OUT VOID *ReadBuffer,
- OUT RETURN_STATUS *Status OPTIONAL
- )
-{
- UINTN Length;
-
- ASSERT (WriteBuffer != NULL);
- ASSERT (ReadBuffer != NULL);
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1);
- ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32);
- ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
-
- Length = SMBUS_LIB_LENGTH (SmBusAddress);
- //
- // Assuming that ReadBuffer is large enough to save another memory copy.
- //
- ReadBuffer = CopyMem (ReadBuffer, WriteBuffer, Length);
- return InternalSmBusExec (EfiSmbusBWBRProcessCall, SmBusAddress, Length, ReadBuffer, Status);
-}
|