TianoCore EDK2 master
Loading...
Searching...
No Matches
SmmIoLib.c File Reference

Go to the source code of this file.

Functions

VOID SmmIoLibInternalCalculateMaximumSupportAddress (VOID)
 
BOOLEAN EFIAPI SmmIsMmioValid (IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN EFI_GUID *Owner OPTIONAL)
 
STATIC VOID MergeGcdMmioEntry (IN OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *GcdMemoryMap, IN OUT UINTN *NumberOfDescriptors)
 
EFI_STATUS EFIAPI SmmIoLibInternalEndOfDxeNotify (IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
 
EFI_STATUS EFIAPI SmmIoLibInternalReadyToLockNotify (IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
 
EFI_STATUS EFIAPI SmmIoLibConstructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI SmmIoLibDestructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

EFI_GCD_MEMORY_SPACE_DESCRIPTORmSmmIoLibGcdMemSpace = NULL
 
UINTN mSmmIoLibGcdMemNumberOfDesc = 0
 
EFI_PHYSICAL_ADDRESS mSmmIoLibInternalMaximumSupportMemAddress = 0
 
VOID * mSmmIoLibRegistrationEndOfDxe
 
VOID * mSmmIoLibRegistrationReadyToLock
 
BOOLEAN mSmmIoLibReadyToLock = FALSE
 

Detailed Description

Instance of SMM IO check library.

SMM IO check library library implementation. This library consumes GCD to collect all valid IO space defined by a platform. A platform may have its own SmmIoLib instance to exclude more IO space.

Copyright (c) 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SmmIoLib.c.

Function Documentation

◆ MergeGcdMmioEntry()

STATIC VOID MergeGcdMmioEntry ( IN OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdMemoryMap,
IN OUT UINTN NumberOfDescriptors 
)

Merge continuous entries whose type is EfiGcdMemoryTypeMemoryMappedIo.

Parameters
[in,out]GcdMemoryMapA pointer to the buffer in which firmware places the current GCD memory map.
[in,out]NumberOfDescriptorsA pointer to the number of the GcdMemoryMap buffer. On input, this is the number of the current GCD memory map. On output, it is the number of new GCD memory map after merge.

Definition at line 167 of file SmmIoLib.c.

◆ SmmIoLibConstructor()

EFI_STATUS EFIAPI SmmIoLibConstructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

The constructor function initializes the Smm IO library

Parameters
ImageHandleThe firmware allocated handle for the EFI image.
SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe constructor always returns EFI_SUCCESS.

Definition at line 283 of file SmmIoLib.c.

◆ SmmIoLibDestructor()

EFI_STATUS EFIAPI SmmIoLibDestructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

The destructor function frees resource used in the Smm IO library

Parameters
[in]ImageHandleThe firmware allocated handle for the EFI image.
[in]SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe deconstructor always returns EFI_SUCCESS.

Definition at line 320 of file SmmIoLib.c.

◆ SmmIoLibInternalCalculateMaximumSupportAddress()

VOID SmmIoLibInternalCalculateMaximumSupportAddress ( VOID  )

Calculate and save the maximum support address.

Definition at line 41 of file SmmIoLib.c.

◆ SmmIoLibInternalEndOfDxeNotify()

EFI_STATUS EFIAPI SmmIoLibInternalEndOfDxeNotify ( IN CONST EFI_GUID Protocol,
IN VOID *  Interface,
IN EFI_HANDLE  Handle 
)

Notification for SMM EndOfDxe protocol.

Parameters
[in]ProtocolPoints to the protocol's unique identifier.
[in]InterfacePoints to the interface instance.
[in]HandleThe handle on which the interface was installed.
Return values
EFI_SUCCESSNotification runs successfully.
EFI_OUT_OF_RESOURCESNo enough resources to save GCD MMIO map.

Definition at line 223 of file SmmIoLib.c.

◆ SmmIoLibInternalReadyToLockNotify()

EFI_STATUS EFIAPI SmmIoLibInternalReadyToLockNotify ( IN CONST EFI_GUID Protocol,
IN VOID *  Interface,
IN EFI_HANDLE  Handle 
)

Notification for SMM ReadyToLock protocol.

Parameters
[in]ProtocolPoints to the protocol's unique identifier.
[in]InterfacePoints to the interface instance.
[in]HandleThe handle on which the interface was installed.
Return values
EFI_SUCCESSNotification runs successfully.

Definition at line 262 of file SmmIoLib.c.

◆ SmmIsMmioValid()

BOOLEAN EFIAPI SmmIsMmioValid ( IN EFI_PHYSICAL_ADDRESS  BaseAddress,
IN UINT64  Length,
IN EFI_GUID *Owner  OPTIONAL 
)

This function check if the MMIO resource is valid per processor architecture and valid per platform design.

Parameters
BaseAddressThe MMIO start address to be checked.
LengthThe MMIO length to be checked.
OwnerA GUID representing the owner of the resource. This GUID may be used by producer to correlate the device ownership of the resource. NULL means no specific owner.
Return values
TRUEThis MMIO resource is valid per processor architecture and valid per platform design.
FALSEThis MMIO resource is not valid per processor architecture or valid per platform design.

Definition at line 95 of file SmmIoLib.c.

Variable Documentation

◆ mSmmIoLibGcdMemNumberOfDesc

UINTN mSmmIoLibGcdMemNumberOfDesc = 0

Definition at line 27 of file SmmIoLib.c.

◆ mSmmIoLibGcdMemSpace

EFI_GCD_MEMORY_SPACE_DESCRIPTOR* mSmmIoLibGcdMemSpace = NULL

Definition at line 26 of file SmmIoLib.c.

◆ mSmmIoLibInternalMaximumSupportMemAddress

EFI_PHYSICAL_ADDRESS mSmmIoLibInternalMaximumSupportMemAddress = 0

Definition at line 29 of file SmmIoLib.c.

◆ mSmmIoLibReadyToLock

BOOLEAN mSmmIoLibReadyToLock = FALSE

Definition at line 34 of file SmmIoLib.c.

◆ mSmmIoLibRegistrationEndOfDxe

VOID* mSmmIoLibRegistrationEndOfDxe

Definition at line 31 of file SmmIoLib.c.

◆ mSmmIoLibRegistrationReadyToLock

VOID* mSmmIoLibRegistrationReadyToLock

Definition at line 32 of file SmmIoLib.c.