#define EFI_MM_USB_DISPATCH_PROTOCOL_GUID \
{ \
0xee9b8d90, 0xc5a6, 0x40a2, {0xbd, 0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 } \
}
///
/// USB MMI event types
///
typedef enum {
UsbLegacy,
UsbWake
} EFI_USB_MMI_TYPE;
///
/// The dispatch function's context.
///
typedef struct {
///
/// Describes whether this child handler will be invoked in response to a USB legacy
/// emulation event, such as port-trap on the PS/2* keyboard control registers, or to a
/// USB wake event, such as resumption from a sleep state.
///
EFI_USB_MMI_TYPE Type;
///
/// The device path is part of the context structure and describes the location of the
/// particular USB host controller in the system for which this register event will occur.
/// This location is important because of the possible integration of several USB host
/// controllers in a system.
///
EFI_DEVICE_PATH_PROTOCOL *Device;
} EFI_MM_USB_REGISTER_CONTEXT;
typedef struct _EFI_MM_USB_DISPATCH_PROTOCOL EFI_MM_USB_DISPATCH_PROTOCOL;
/**
Provides the parent dispatch service for the USB MMI source generator.
This service registers a function (DispatchFunction) which will be called when the USB-
related MMI specified by RegisterContext has occurred. On return, DispatchHandle
contains a unique handle which may be used later to unregister the function using UnRegister().
The DispatchFunction will be called with Context set to the same value as was passed into
this function in RegisterContext and with CommBuffer containing NULL and
CommBufferSize containing zero.
@param[in] This Pointer to the EFI_MM_USB_DISPATCH_PROTOCOL instance.
@param[in] DispatchFunction Function to register for handler when a USB-related MMI occurs.
@param[in] RegisterContext Pointer to the dispatch function's context.
The caller fills this context in before calling
the register function to indicate to the register
function the USB MMI types for which the dispatch
function should be invoked.
@param[out] DispatchHandle Handle generated by the dispatcher to track the function instance.
@retval EFI_SUCCESS The dispatch function has been successfully
registered and the MMI source has been enabled.
@retval EFI_DEVICE_ERROR The driver was unable to enable the MMI source.
@retval EFI_INVALID_PARAMETER RegisterContext is invalid. The USB MMI type
is not within valid range.
@retval EFI_OUT_OF_RESOURCES There is not enough memory (system or MM) to manage this child.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MM_USB_REGISTER)(
IN CONST EFI_MM_USB_DISPATCH_PROTOCOL *This,
IN EFI_MM_HANDLER_ENTRY_POINT DispatchFunction,
IN CONST EFI_MM_USB_REGISTER_CONTEXT *RegisterContext,
OUT EFI_HANDLE *DispatchHandle
);
/**
Unregisters a USB service.
This service removes the handler associated with DispatchHandle so that it will no longer be
called when the USB event occurs.
@param[in] This Pointer to the EFI_MM_USB_DISPATCH_PROTOCOL instance.
@param[in] DispatchHandle Handle of the service to remove.
@retval EFI_SUCCESS The dispatch function has been successfully
unregistered and the MMI source has been disabled
if there are no other registered child dispatch
functions for this MMI source.
@retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MM_USB_UNREGISTER)(
IN CONST EFI_MM_USB_DISPATCH_PROTOCOL *This,
IN EFI_HANDLE DispatchHandle
);
///
/// Interface structure for the MM USB MMI Dispatch Protocol
///
/// This protocol provides the parent dispatch service for the USB MMI source generator.
///
struct _EFI_MM_USB_DISPATCH_PROTOCOL {
EFI_MM_USB_REGISTER Register;
EFI_MM_USB_UNREGISTER UnRegister;
};
extern EFI_GUID gEfiMmUsbDispatchProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/MonotonicCounter.h
================================================
/** @file
Monotonic Counter Architectural Protocol as defined in PI SPEC VOLUME 2 DXE
This code provides the services required to access the system's monotonic counter
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
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 __ARCH_PROTOCOL_MONTONIC_COUNTER_H__
#define __ARCH_PROTOCOL_MONTONIC_COUNTER_H__
///
/// Global ID for the Monotonic Counter Architectural Protocol.
///
#define EFI_MONOTONIC_COUNTER_ARCH_PROTOCOL_GUID \
{0x1da97072, 0xbddc, 0x4b30, {0x99, 0xf1, 0x72, 0xa0, 0xb5, 0x6f, 0xff, 0x2a} }
extern EFI_GUID gEfiMonotonicCounterArchProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/MpService.h
================================================
/** @file
When installed, the MP Services Protocol produces a collection of services
that are needed for MP management.
The MP Services Protocol provides a generalized way of performing following tasks:
- Retrieving information of multi-processor environment and MP-related status of
specific processors.
- Dispatching user-provided function to APs.
- Maintain MP-related processor status.
The MP Services Protocol must be produced on any system with more than one logical
processor.
The Protocol is available only during boot time.
MP Services Protocol is hardware-independent. Most of the logic of this protocol
is architecturally neutral. It abstracts the multi-processor environment and
status of processors, and provides interfaces to retrieve information, maintain,
and dispatch.
MP Services Protocol may be consumed by ACPI module. The ACPI module may use this
protocol to retrieve data that are needed for an MP platform and report them to OS.
MP Services Protocol may also be used to program and configure processors, such
as MTRR synchronization for memory space attributes setting in DXE Services.
MP Services Protocol may be used by non-CPU DXE drivers to speed up platform boot
by taking advantage of the processing capabilities of the APs, for example, using
APs to help test system memory in parallel with other device initialization.
Diagnostics applications may also use this protocol for multi-processor.
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is defined in the UEFI Platform Initialization Specification 1.2,
Volume 2:Driver Execution Environment Core Interface.
**/
#ifndef _MP_SERVICE_PROTOCOL_H_
#define _MP_SERVICE_PROTOCOL_H_
///
/// Global ID for the EFI_MP_SERVICES_PROTOCOL.
///
#define EFI_MP_SERVICES_PROTOCOL_GUID \
{ \
0x3fdda605, 0xa76e, 0x4f46, {0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08} \
}
///
/// Forward declaration for the EFI_MP_SERVICES_PROTOCOL.
///
typedef struct _EFI_MP_SERVICES_PROTOCOL EFI_MP_SERVICES_PROTOCOL;
///
/// Terminator for a list of failed CPUs returned by StartAllAPs().
///
#define END_OF_CPU_LIST 0xffffffff
///
/// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and
/// indicates whether the processor is playing the role of BSP. If the bit is 1,
/// then the processor is BSP. Otherwise, it is AP.
///
#define PROCESSOR_AS_BSP_BIT 0x00000001
///
/// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and
/// indicates whether the processor is enabled. If the bit is 1, then the
/// processor is enabled. Otherwise, it is disabled.
///
#define PROCESSOR_ENABLED_BIT 0x00000002
///
/// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and
/// indicates whether the processor is healthy. If the bit is 1, then the
/// processor is healthy. Otherwise, some fault has been detected for the processor.
///
#define PROCESSOR_HEALTH_STATUS_BIT 0x00000004
///
/// Structure that describes the pyhiscal location of a logical CPU.
///
typedef struct {
///
/// Zero-based physical package number that identifies the cartridge of the processor.
///
UINT32 Package;
///
/// Zero-based physical core number within package of the processor.
///
UINT32 Core;
///
/// Zero-based logical thread number within core of the processor.
///
UINT32 Thread;
} EFI_CPU_PHYSICAL_LOCATION;
///
/// Structure that describes information about a logical CPU.
///
typedef struct {
///
/// The unique processor ID determined by system hardware. For IA32 and X64,
/// the processor ID is the same as the Local APIC ID. Only the lower 8 bits
/// are used, and higher bits are reserved. For IPF, the lower 16 bits contains
/// id/eid, and higher bits are reserved.
///
UINT64 ProcessorId;
///
/// Flags indicating if the processor is BSP or AP, if the processor is enabled
/// or disabled, and if the processor is healthy. Bits 3..31 are reserved and
/// must be 0.
///
///
/// BSP ENABLED HEALTH Description
/// === ======= ====== ===================================================
/// 0 0 0 Unhealthy Disabled AP.
/// 0 0 1 Healthy Disabled AP.
/// 0 1 0 Unhealthy Enabled AP.
/// 0 1 1 Healthy Enabled AP.
/// 1 0 0 Invalid. The BSP can never be in the disabled state.
/// 1 0 1 Invalid. The BSP can never be in the disabled state.
/// 1 1 0 Unhealthy Enabled BSP.
/// 1 1 1 Healthy Enabled BSP.
///
///
UINT32 StatusFlag;
///
/// The physical location of the processor, including the physical package number
/// that identifies the cartridge, the physical core number within package, and
/// logical thread number within core.
///
EFI_CPU_PHYSICAL_LOCATION Location;
} EFI_PROCESSOR_INFORMATION;
/**
This service retrieves the number of logical processor in the platform
and the number of those logical processors that are enabled on this boot.
This service may only be called from the BSP.
This function is used to retrieve the following information:
- The number of logical processors that are present in the system.
- The number of enabled logical processors in the system at the instant
this call is made.
Because MP Service Protocol provides services to enable and disable processors
dynamically, the number of enabled logical processors may vary during the
course of a boot session.
If this service is called from an AP, then EFI_DEVICE_ERROR is returned.
If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then
EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors
is returned in NumberOfProcessors, the number of currently enabled processor
is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned.
@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
instance.
@param[out] NumberOfProcessors Pointer to the total number of logical
processors in the system, including the BSP
and disabled APs.
@param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical
processors that exist in system, including
the BSP.
@retval EFI_SUCCESS The number of logical processors and enabled
logical processors was retrieved.
@retval EFI_DEVICE_ERROR The calling processor is an AP.
@retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.
@retval EFI_INVALID_PARAMETER NumberOfEnabledProcessors is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS)(
IN EFI_MP_SERVICES_PROTOCOL *This,
OUT UINTN *NumberOfProcessors,
OUT UINTN *NumberOfEnabledProcessors
);
/**
Gets detailed MP-related information on the requested processor at the
instant this call is made. This service may only be called from the BSP.
This service retrieves detailed MP-related information about any processor
on the platform. Note the following:
- The processor information may change during the course of a boot session.
- The information presented here is entirely MP related.
Information regarding the number of caches and their sizes, frequency of operation,
slot numbers is all considered platform-related information and is not provided
by this service.
@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
instance.
@param[in] ProcessorNumber The handle number of processor.
@param[out] ProcessorInfoBuffer A pointer to the buffer where information for
the requested processor is deposited.
@retval EFI_SUCCESS Processor information was returned.
@retval EFI_DEVICE_ERROR The calling processor is an AP.
@retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.
@retval EFI_NOT_FOUND The processor with the handle specified by
ProcessorNumber does not exist in the platform.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MP_SERVICES_GET_PROCESSOR_INFO)(
IN EFI_MP_SERVICES_PROTOCOL *This,
IN UINTN ProcessorNumber,
OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer
);
/**
This service executes a caller provided function on all enabled APs. APs can
run either simultaneously or one at a time in sequence. This service supports
both blocking and non-blocking requests. The non-blocking requests use EFI
events so the BSP can detect when the APs have finished. This service may only
be called from the BSP.
This function is used to dispatch all the enabled APs to the function specified
by Procedure. If any enabled AP is busy, then EFI_NOT_READY is returned
immediately and Procedure is not started on any AP.
If SingleThread is TRUE, all the enabled APs execute the function specified by
Procedure one by one, in ascending order of processor handle number. Otherwise,
all the enabled APs execute the function specified by Procedure simultaneously.
If WaitEvent is NULL, execution is in blocking mode. The BSP waits until all
APs finish or TimeoutInMicroSecs expires. Otherwise, execution is in non-blocking
mode, and the BSP returns from this service without waiting for APs. If a
non-blocking mode is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT
is signaled, then EFI_UNSUPPORTED must be returned.
If the timeout specified by TimeoutInMicroseconds expires before all APs return
from Procedure, then Procedure on the failed APs is terminated. All enabled APs
are always available for further calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
and EFI_MP_SERVICES_PROTOCOL.StartupThisAP(). If FailedCpuList is not NULL, its
content points to the list of processor handle numbers in which Procedure was
terminated.
Note: It is the responsibility of the consumer of the EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
to make sure that the nature of the code that is executed on the BSP and the
dispatched APs is well controlled. The MP Services Protocol does not guarantee
that the Procedure function is MP-safe. Hence, the tasks that can be run in
parallel are limited to certain independent tasks and well-controlled exclusive
code. EFI services and protocols may not be called by APs unless otherwise
specified.
In blocking execution mode, BSP waits until all APs finish or
TimeoutInMicroSeconds expires.
In non-blocking execution mode, BSP is freed to return to the caller and then
proceed to the next task without having to wait for APs. The following
sequence needs to occur in a non-blocking execution mode:
-# The caller that intends to use this MP Services Protocol in non-blocking
mode creates WaitEvent by calling the EFI CreateEvent() service. The caller
invokes EFI_MP_SERVICES_PROTOCOL.StartupAllAPs(). If the parameter WaitEvent
is not NULL, then StartupAllAPs() executes in non-blocking mode. It requests
the function specified by Procedure to be started on all the enabled APs,
and releases the BSP to continue with other tasks.
-# The caller can use the CheckEvent() and WaitForEvent() services to check
the state of the WaitEvent created in step 1.
-# When the APs complete their task or TimeoutInMicroSecondss expires, the MP
Service signals WaitEvent by calling the EFI SignalEvent() function. If
FailedCpuList is not NULL, its content is available when WaitEvent is
signaled. If all APs returned from Procedure prior to the timeout, then
FailedCpuList is set to NULL. If not all APs return from Procedure before
the timeout, then FailedCpuList is filled in with the list of the failed
APs. The buffer is allocated by MP Service Protocol using AllocatePool().
It is the caller's responsibility to free the buffer with FreePool() service.
-# This invocation of SignalEvent() function informs the caller that invoked
EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() that either all the APs completed
the specified task or a timeout occurred. The contents of FailedCpuList
can be examined to determine which APs did not complete the specified task
prior to the timeout.
@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
instance.
@param[in] Procedure A pointer to the function to be run on
enabled APs of the system. See type
EFI_AP_PROCEDURE.
@param[in] SingleThread If TRUE, then all the enabled APs execute
the function specified by Procedure one by
one, in ascending order of processor handle
number. If FALSE, then all the enabled APs
execute the function specified by Procedure
simultaneously.
@param[in] WaitEvent The event created by the caller with CreateEvent()
service. If it is NULL, then execute in
blocking mode. BSP waits until all APs finish
or TimeoutInMicroSeconds expires. If it's
not NULL, then execute in non-blocking mode.
BSP requests the function specified by
Procedure to be started on all the enabled
APs, and go on executing immediately. If
all return from Procedure, or TimeoutInMicroSeconds
expires, this event is signaled. The BSP
can use the CheckEvent() or WaitForEvent()
services to check the state of event. Type
EFI_EVENT is defined in CreateEvent() in
the Unified Extensible Firmware Interface
Specification.
@param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for
APs to return from Procedure, either for
blocking or non-blocking mode. Zero means
infinity. If the timeout expires before
all APs return from Procedure, then Procedure
on the failed APs is terminated. All enabled
APs are available for next function assigned
by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().
If the timeout expires in blocking mode,
BSP returns EFI_TIMEOUT. If the timeout
expires in non-blocking mode, WaitEvent
is signaled with SignalEvent().
@param[in] ProcedureArgument The parameter passed into Procedure for
all APs.
@param[out] FailedCpuList If NULL, this parameter is ignored. Otherwise,
if all APs finish successfully, then its
content is set to NULL. If not all APs
finish before timeout expires, then its
content is set to address of the buffer
holding handle numbers of the failed APs.
The buffer is allocated by MP Service Protocol,
and it's the caller's responsibility to
free the buffer with FreePool() service.
In blocking mode, it is ready for consumption
when the call returns. In non-blocking mode,
it is ready when WaitEvent is signaled. The
list of failed CPU is terminated by
END_OF_CPU_LIST.
@retval EFI_SUCCESS In blocking mode, all APs have finished before
the timeout expired.
@retval EFI_SUCCESS In non-blocking mode, function has been dispatched
to all enabled APs.
@retval EFI_UNSUPPORTED A non-blocking mode request was made after the
UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
signaled.
@retval EFI_DEVICE_ERROR Caller processor is AP.
@retval EFI_NOT_STARTED No enabled APs exist in the system.
@retval EFI_NOT_READY Any enabled APs are busy.
@retval EFI_TIMEOUT In blocking mode, the timeout expired before
all enabled APs have finished.
@retval EFI_INVALID_PARAMETER Procedure is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MP_SERVICES_STARTUP_ALL_APS)(
IN EFI_MP_SERVICES_PROTOCOL *This,
IN EFI_AP_PROCEDURE Procedure,
IN BOOLEAN SingleThread,
IN EFI_EVENT WaitEvent OPTIONAL,
IN UINTN TimeoutInMicroSeconds,
IN VOID *ProcedureArgument OPTIONAL,
OUT UINTN **FailedCpuList OPTIONAL
);
/**
This service lets the caller get one enabled AP to execute a caller-provided
function. The caller can request the BSP to either wait for the completion
of the AP or just proceed with the next task by using the EFI event mechanism.
See EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() for more details on non-blocking
execution support. This service may only be called from the BSP.
This function is used to dispatch one enabled AP to the function specified by
Procedure passing in the argument specified by ProcedureArgument. If WaitEvent
is NULL, execution is in blocking mode. The BSP waits until the AP finishes or
TimeoutInMicroSecondss expires. Otherwise, execution is in non-blocking mode.
BSP proceeds to the next task without waiting for the AP. If a non-blocking mode
is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled,
then EFI_UNSUPPORTED must be returned.
If the timeout specified by TimeoutInMicroseconds expires before the AP returns
from Procedure, then execution of Procedure by the AP is terminated. The AP is
available for subsequent calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() and
EFI_MP_SERVICES_PROTOCOL.StartupThisAP().
@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
instance.
@param[in] Procedure A pointer to the function to be run on the
designated AP of the system. See type
EFI_AP_PROCEDURE.
@param[in] ProcessorNumber The handle number of the AP. The range is
from 0 to the total number of logical
processors minus 1. The total number of
logical processors can be retrieved by
EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
@param[in] WaitEvent The event created by the caller with CreateEvent()
service. If it is NULL, then execute in
blocking mode. BSP waits until this AP finish
or TimeoutInMicroSeconds expires. If it's
not NULL, then execute in non-blocking mode.
BSP requests the function specified by
Procedure to be started on this AP,
and go on executing immediately. If this AP
return from Procedure or TimeoutInMicroSeconds
expires, this event is signaled. The BSP
can use the CheckEvent() or WaitForEvent()
services to check the state of event. Type
EFI_EVENT is defined in CreateEvent() in
the Unified Extensible Firmware Interface
Specification.
@param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for
this AP to finish this Procedure, either for
blocking or non-blocking mode. Zero means
infinity. If the timeout expires before
this AP returns from Procedure, then Procedure
on the AP is terminated. The
AP is available for next function assigned
by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().
If the timeout expires in blocking mode,
BSP returns EFI_TIMEOUT. If the timeout
expires in non-blocking mode, WaitEvent
is signaled with SignalEvent().
@param[in] ProcedureArgument The parameter passed into Procedure on the
specified AP.
@param[out] Finished If NULL, this parameter is ignored. In
blocking mode, this parameter is ignored.
In non-blocking mode, if AP returns from
Procedure before the timeout expires, its
content is set to TRUE. Otherwise, the
value is set to FALSE. The caller can
determine if the AP returned from Procedure
by evaluating this value.
@retval EFI_SUCCESS In blocking mode, specified AP finished before
the timeout expires.
@retval EFI_SUCCESS In non-blocking mode, the function has been
dispatched to specified AP.
@retval EFI_UNSUPPORTED A non-blocking mode request was made after the
UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
signaled.
@retval EFI_DEVICE_ERROR The calling processor is an AP.
@retval EFI_TIMEOUT In blocking mode, the timeout expired before
the specified AP has finished.
@retval EFI_NOT_READY The specified AP is busy.
@retval EFI_NOT_FOUND The processor with the handle specified by
ProcessorNumber does not exist.
@retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.
@retval EFI_INVALID_PARAMETER Procedure is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MP_SERVICES_STARTUP_THIS_AP)(
IN EFI_MP_SERVICES_PROTOCOL *This,
IN EFI_AP_PROCEDURE Procedure,
IN UINTN ProcessorNumber,
IN EFI_EVENT WaitEvent OPTIONAL,
IN UINTN TimeoutInMicroseconds,
IN VOID *ProcedureArgument OPTIONAL,
OUT BOOLEAN *Finished OPTIONAL
);
/**
This service switches the requested AP to be the BSP from that point onward.
This service changes the BSP for all purposes. This call can only be performed
by the current BSP.
This service switches the requested AP to be the BSP from that point onward.
This service changes the BSP for all purposes. The new BSP can take over the
execution of the old BSP and continue seamlessly from where the old one left
off. This service may not be supported after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT
is signaled.
If the BSP cannot be switched prior to the return from this service, then
EFI_UNSUPPORTED must be returned.
@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
@param[in] ProcessorNumber The handle number of AP that is to become the new
BSP. The range is from 0 to the total number of
logical processors minus 1. The total number of
logical processors can be retrieved by
EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
@param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an
enabled AP. Otherwise, it will be disabled.
@retval EFI_SUCCESS BSP successfully switched.
@retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to
this service returning.
@retval EFI_UNSUPPORTED Switching the BSP is not supported.
@retval EFI_DEVICE_ERROR The calling processor is an AP.
@retval EFI_NOT_FOUND The processor with the handle specified by
ProcessorNumber does not exist.
@retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or
a disabled AP.
@retval EFI_NOT_READY The specified AP is busy.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MP_SERVICES_SWITCH_BSP)(
IN EFI_MP_SERVICES_PROTOCOL *This,
IN UINTN ProcessorNumber,
IN BOOLEAN EnableOldBSP
);
/**
This service lets the caller enable or disable an AP from this point onward.
This service may only be called from the BSP.
This service allows the caller enable or disable an AP from this point onward.
The caller can optionally specify the health status of the AP by Health. If
an AP is being disabled, then the state of the disabled AP is implementation
dependent. If an AP is enabled, then the implementation must guarantee that a
complete initialization sequence is performed on the AP, so the AP is in a state
that is compatible with an MP operating system. This service may not be supported
after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled.
If the enable or disable AP operation cannot be completed prior to the return
from this service, then EFI_UNSUPPORTED must be returned.
@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
@param[in] ProcessorNumber The handle number of AP.
The range is from 0 to the total number of
logical processors minus 1. The total number of
logical processors can be retrieved by
EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
@param[in] EnableAP Specifies the new state for the processor for
enabled, FALSE for disabled.
@param[in] HealthFlag If not NULL, a pointer to a value that specifies
the new health status of the AP. This flag
corresponds to StatusFlag defined in
EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only
the PROCESSOR_HEALTH_STATUS_BIT is used. All other
bits are ignored. If it is NULL, this parameter
is ignored.
@retval EFI_SUCCESS The specified AP was enabled or disabled successfully.
@retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed
prior to this service returning.
@retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.
@retval EFI_DEVICE_ERROR The calling processor is an AP.
@retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber
does not exist.
@retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MP_SERVICES_ENABLEDISABLEAP)(
IN EFI_MP_SERVICES_PROTOCOL *This,
IN UINTN ProcessorNumber,
IN BOOLEAN EnableAP,
IN UINT32 *HealthFlag OPTIONAL
);
/**
This return the handle number for the calling processor. This service may be
called from the BSP and APs.
This service returns the processor handle number for the calling processor.
The returned value is in the range from 0 to the total number of logical
processors minus 1. The total number of logical processors can be retrieved
with EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors(). This service may be
called from the BSP and APs. If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER
is returned. Otherwise, the current processors handle number is returned in
ProcessorNumber, and EFI_SUCCESS is returned.
@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
@param[in] ProcessorNumber Pointer to the handle number of AP.
The range is from 0 to the total number of
logical processors minus 1. The total number of
logical processors can be retrieved by
EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
@retval EFI_SUCCESS The current processor handle number was returned
in ProcessorNumber.
@retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MP_SERVICES_WHOAMI)(
IN EFI_MP_SERVICES_PROTOCOL *This,
OUT UINTN *ProcessorNumber
);
///
/// When installed, the MP Services Protocol produces a collection of services
/// that are needed for MP management.
///
/// Before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, the module
/// that produces this protocol is required to place all APs into an idle state
/// whenever the APs are disabled or the APs are not executing code as requested
/// through the StartupAllAPs() or StartupThisAP() services. The idle state of
/// an AP before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled is
/// implementation dependent.
///
/// After the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, all the APs
/// must be placed in the OS compatible CPU state as defined by the UEFI
/// Specification. Implementations of this protocol may use the UEFI event
/// EFI_EVENT_GROUP_READY_TO_BOOT to force APs into the OS compatible state as
/// defined by the UEFI Specification. Modules that use this protocol must
/// guarantee that all non-blocking mode requests on all APs have been completed
/// before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled. Since the
/// order that event notification functions in the same event group are executed
/// is not deterministic, an event of type EFI_EVENT_GROUP_READY_TO_BOOT cannot
/// be used to guarantee that APs have completed their non-blocking mode requests.
///
/// When the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, the StartAllAPs()
/// and StartupThisAp() services must no longer support non-blocking mode requests.
/// The support for SwitchBSP() and EnableDisableAP() may no longer be supported
/// after this event is signaled. Since UEFI Applications and UEFI OS Loaders
/// execute after the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, these
/// UEFI images must be aware that the functionality of this protocol may be reduced.
///
struct _EFI_MP_SERVICES_PROTOCOL {
EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors;
EFI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;
EFI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;
EFI_MP_SERVICES_WHOAMI WhoAmI;
};
extern EFI_GUID gEfiMpServiceProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/Mtftp4.h
================================================
/** @file
EFI Multicast Trivial File Transfer Protocol Definition
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is introduced in UEFI Specification 2.0
**/
#ifndef __EFI_MTFTP4_PROTOCOL_H__
#define __EFI_MTFTP4_PROTOCOL_H__
#define EFI_MTFTP4_SERVICE_BINDING_PROTOCOL_GUID \
{ \
0x2FE800BE, 0x8F01, 0x4aa6, {0x94, 0x6B, 0xD7, 0x13, 0x88, 0xE1, 0x83, 0x3F } \
}
#define EFI_MTFTP4_PROTOCOL_GUID \
{ \
0x78247c57, 0x63db, 0x4708, {0x99, 0xc2, 0xa8, 0xb4, 0xa9, 0xa6, 0x1f, 0x6b } \
}
typedef struct _EFI_MTFTP4_PROTOCOL EFI_MTFTP4_PROTOCOL;
typedef struct _EFI_MTFTP4_TOKEN EFI_MTFTP4_TOKEN;
//
//MTFTP4 packet opcode definition
//
#define EFI_MTFTP4_OPCODE_RRQ 1
#define EFI_MTFTP4_OPCODE_WRQ 2
#define EFI_MTFTP4_OPCODE_DATA 3
#define EFI_MTFTP4_OPCODE_ACK 4
#define EFI_MTFTP4_OPCODE_ERROR 5
#define EFI_MTFTP4_OPCODE_OACK 6
#define EFI_MTFTP4_OPCODE_DIR 7
#define EFI_MTFTP4_OPCODE_DATA8 8
#define EFI_MTFTP4_OPCODE_ACK8 9
//
// MTFTP4 error code definition
//
#define EFI_MTFTP4_ERRORCODE_NOT_DEFINED 0
#define EFI_MTFTP4_ERRORCODE_FILE_NOT_FOUND 1
#define EFI_MTFTP4_ERRORCODE_ACCESS_VIOLATION 2
#define EFI_MTFTP4_ERRORCODE_DISK_FULL 3
#define EFI_MTFTP4_ERRORCODE_ILLEGAL_OPERATION 4
#define EFI_MTFTP4_ERRORCODE_UNKNOWN_TRANSFER_ID 5
#define EFI_MTFTP4_ERRORCODE_FILE_ALREADY_EXISTS 6
#define EFI_MTFTP4_ERRORCODE_NO_SUCH_USER 7
#define EFI_MTFTP4_ERRORCODE_REQUEST_DENIED 8
//
// MTFTP4 pacekt definitions
//
#pragma pack(1)
typedef struct {
UINT16 OpCode;
UINT8 Filename[1];
} EFI_MTFTP4_REQ_HEADER;
typedef struct {
UINT16 OpCode;
UINT8 Data[1];
} EFI_MTFTP4_OACK_HEADER;
typedef struct {
UINT16 OpCode;
UINT16 Block;
UINT8 Data[1];
} EFI_MTFTP4_DATA_HEADER;
typedef struct {
UINT16 OpCode;
UINT16 Block[1];
} EFI_MTFTP4_ACK_HEADER;
typedef struct {
UINT16 OpCode;
UINT64 Block;
UINT8 Data[1];
} EFI_MTFTP4_DATA8_HEADER;
typedef struct {
UINT16 OpCode;
UINT64 Block[1];
} EFI_MTFTP4_ACK8_HEADER;
typedef struct {
UINT16 OpCode;
UINT16 ErrorCode;
UINT8 ErrorMessage[1];
} EFI_MTFTP4_ERROR_HEADER;
typedef union {
///
/// Type of packets as defined by the MTFTPv4 packet opcodes.
///
UINT16 OpCode;
///
/// Read request packet header.
///
EFI_MTFTP4_REQ_HEADER Rrq;
///
/// Write request packet header.
///
EFI_MTFTP4_REQ_HEADER Wrq;
///
/// Option acknowledge packet header.
///
EFI_MTFTP4_OACK_HEADER Oack;
///
/// Data packet header.
///
EFI_MTFTP4_DATA_HEADER Data;
///
/// Acknowledgement packet header.
///
EFI_MTFTP4_ACK_HEADER Ack;
///
/// Data packet header with big block number.
///
EFI_MTFTP4_DATA8_HEADER Data8;
///
/// Acknowledgement header with big block num.
///
EFI_MTFTP4_ACK8_HEADER Ack8;
///
/// Error packet header.
///
EFI_MTFTP4_ERROR_HEADER Error;
} EFI_MTFTP4_PACKET;
#pragma pack()
///
/// MTFTP4 option definition.
///
typedef struct {
UINT8 *OptionStr;
UINT8 *ValueStr;
} EFI_MTFTP4_OPTION;
typedef struct {
BOOLEAN UseDefaultSetting;
EFI_IPv4_ADDRESS StationIp;
EFI_IPv4_ADDRESS SubnetMask;
UINT16 LocalPort;
EFI_IPv4_ADDRESS GatewayIp;
EFI_IPv4_ADDRESS ServerIp;
UINT16 InitialServerPort;
UINT16 TryCount;
UINT16 TimeoutValue;
} EFI_MTFTP4_CONFIG_DATA;
typedef struct {
EFI_MTFTP4_CONFIG_DATA ConfigData;
UINT8 SupportedOptionCount;
UINT8 **SupportedOptoins;
UINT8 UnsupportedOptionCount;
UINT8 **UnsupportedOptoins;
} EFI_MTFTP4_MODE_DATA;
typedef struct {
EFI_IPv4_ADDRESS GatewayIp;
EFI_IPv4_ADDRESS ServerIp;
UINT16 ServerPort;
UINT16 TryCount;
UINT16 TimeoutValue;
} EFI_MTFTP4_OVERRIDE_DATA;
//
// Protocol interfaces definition
//
/**
A callback function that is provided by the caller to intercept
the EFI_MTFTP4_OPCODE_DATA or EFI_MTFTP4_OPCODE_DATA8 packets processed in the
EFI_MTFTP4_PROTOCOL.ReadFile() function, and alternatively to intercept
EFI_MTFTP4_OPCODE_OACK or EFI_MTFTP4_OPCODE_ERROR packets during a call to
EFI_MTFTP4_PROTOCOL.ReadFile(), WriteFile() or ReadDirectory().
@param This The pointer to the EFI_MTFTP4_PROTOCOL instance.
@param Token The token that the caller provided in the
EFI_MTFTP4_PROTOCOL.ReadFile(), WriteFile()
or ReadDirectory() function.
@param PacketLen Indicates the length of the packet.
@param Packet The pointer to an MTFTPv4 packet.
@retval EFI_SUCCESS The operation was successful.
@retval Others Aborts the transfer process.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP4_CHECK_PACKET)(
IN EFI_MTFTP4_PROTOCOL *This,
IN EFI_MTFTP4_TOKEN *Token,
IN UINT16 PacketLen,
IN EFI_MTFTP4_PACKET *Paket
);
/**
Timeout callback function.
@param This The pointer to the EFI_MTFTP4_PROTOCOL instance.
@param Token The token that is provided in the
EFI_MTFTP4_PROTOCOL.ReadFile() or
EFI_MTFTP4_PROTOCOL.WriteFile() or
EFI_MTFTP4_PROTOCOL.ReadDirectory() functions
by the caller.
@retval EFI_SUCCESS The operation was successful.
@retval Others Aborts download process.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP4_TIMEOUT_CALLBACK)(
IN EFI_MTFTP4_PROTOCOL *This,
IN EFI_MTFTP4_TOKEN *Token
);
/**
A callback function that the caller provides to feed data to the
EFI_MTFTP4_PROTOCOL.WriteFile() function.
@param This The pointer to the EFI_MTFTP4_PROTOCOL instance.
@param Token The token provided in the
EFI_MTFTP4_PROTOCOL.WriteFile() by the caller.
@param Length Indicates the length of the raw data wanted on input, and the
length the data available on output.
@param Buffer The pointer to the buffer where the data is stored.
@retval EFI_SUCCESS The operation was successful.
@retval Others Aborts session.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP4_PACKET_NEEDED)(
IN EFI_MTFTP4_PROTOCOL *This,
IN EFI_MTFTP4_TOKEN *Token,
IN OUT UINT16 *Length,
OUT VOID **Buffer
);
/**
Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.
@param This The pointer to the EFI_MTFTP4_PROTOCOL instance.
@param ModeData The pointer to storage for the EFI MTFTPv4 Protocol driver mode data.
@retval EFI_SUCCESS The configuration data was successfully returned.
@retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.
@retval EFI_INVALID_PARAMETER This is NULL or ModeData is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP4_GET_MODE_DATA)(
IN EFI_MTFTP4_PROTOCOL *This,
OUT EFI_MTFTP4_MODE_DATA *ModeData
);
/**
Initializes, changes, or resets the default operational setting for this
EFI MTFTPv4 Protocol driver instance.
@param This The pointer to the EFI_MTFTP4_PROTOCOL instance.
@param MtftpConfigData The pointer to the configuration data structure.
@retval EFI_SUCCESS The EFI MTFTPv4 Protocol driver was configured successfully.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_ACCESS_DENIED The EFI configuration could not be changed at this time because
there is one MTFTP background operation in progress.
@retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
RARP, etc.) has not finished yet.
@retval EFI_UNSUPPORTED A configuration protocol (DHCP, BOOTP, RARP, etc.) could not
be located when clients choose to use the default address
settings.
@retval EFI_OUT_OF_RESOURCES The EFI MTFTPv4 Protocol driver instance data could not be
allocated.
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI
MTFTPv4 Protocol driver instance is not configured.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP4_CONFIGURE)(
IN EFI_MTFTP4_PROTOCOL *This,
IN EFI_MTFTP4_CONFIG_DATA *MtftpConfigData OPTIONAL
);
/**
Gets information about a file from an MTFTPv4 server.
@param This The pointer to the EFI_MTFTP4_PROTOCOL instance.
@param OverrideData Data that is used to override the existing parameters. If NULL,
the default parameters that were set in the
EFI_MTFTP4_PROTOCOL.Configure() function are used.
@param Filename The pointer to null-terminated ASCII file name string.
@param ModeStr The pointer to null-terminated ASCII mode string. If NULL, "octet" will be used.
@param OptionCount Number of option/value string pairs in OptionList.
@param OptionList The pointer to array of option/value string pairs. Ignored if
OptionCount is zero.
@param PacketLength The number of bytes in the returned packet.
@param Packet The pointer to the received packet. This buffer must be freed by
the caller.
@retval EFI_SUCCESS An MTFTPv4 OACK packet was received and is in the Packet.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
- This is NULL.
- Filename is NULL.
- OptionCount is not zero and OptionList is NULL.
- One or more options in OptionList have wrong format.
- PacketLength is NULL.
- One or more IPv4 addresses in OverrideData are not valid
unicast IPv4 addresses if OverrideData is not NULL.
@retval EFI_UNSUPPORTED One or more options in the OptionList are in the
unsupported list of structure EFI_MTFTP4_MODE_DATA.
@retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started.
@retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
RARP, etc.) has not finished yet.
@retval EFI_ACCESS_DENIED The previous operation has not completed yet.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
@retval EFI_TFTP_ERROR An MTFTPv4 ERROR packet was received and is in the Packet.
@retval EFI_NETWORK_UNREACHABLE An ICMP network unreachable error packet was received and the Packet is set to NULL.
@retval EFI_HOST_UNREACHABLE An ICMP host unreachable error packet was received and the Packet is set to NULL.
@retval EFI_PROTOCOL_UNREACHABLE An ICMP protocol unreachable error packet was received and the Packet is set to NULL.
@retval EFI_PORT_UNREACHABLE An ICMP port unreachable error packet was received and the Packet is set to NULL.
@retval EFI_ICMP_ERROR Some other ICMP ERROR packet was received and is in the Buffer.
@retval EFI_PROTOCOL_ERROR An unexpected MTFTPv4 packet was received and is in the Packet.
@retval EFI_TIMEOUT No responses were received from the MTFTPv4 server.
@retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.
@retval EFI_NO_MEDIA There was a media error.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP4_GET_INFO)(
IN EFI_MTFTP4_PROTOCOL *This,
IN EFI_MTFTP4_OVERRIDE_DATA *OverrideData OPTIONAL,
IN UINT8 *Filename,
IN UINT8 *ModeStr OPTIONAL,
IN UINT8 OptionCount,
IN EFI_MTFTP4_OPTION *OptionList,
OUT UINT32 *PacketLength,
OUT EFI_MTFTP4_PACKET **Packet OPTIONAL
);
/**
Parses the options in an MTFTPv4 OACK packet.
@param This The pointer to the EFI_MTFTP4_PROTOCOL instance.
@param PacketLen Length of the OACK packet to be parsed.
@param Packet The pointer to the OACK packet to be parsed.
@param OptionCount The pointer to the number of options in following OptionList.
@param OptionList The pointer to EFI_MTFTP4_OPTION storage. Call the EFI Boot
Service FreePool() to release the OptionList if the options
in this OptionList are not needed any more.
@retval EFI_SUCCESS The OACK packet was valid and the OptionCount and
OptionList parameters have been updated.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
- PacketLen is 0.
- Packet is NULL or Packet is not a valid MTFTPv4 packet.
- OptionCount is NULL.
@retval EFI_NOT_FOUND No options were found in the OACK packet.
@retval EFI_OUT_OF_RESOURCES Storage for the OptionList array cannot be allocated.
@retval EFI_PROTOCOL_ERROR One or more of the option fields is invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP4_PARSE_OPTIONS)(
IN EFI_MTFTP4_PROTOCOL *This,
IN UINT32 PacketLen,
IN EFI_MTFTP4_PACKET *Packet,
OUT UINT32 *OptionCount,
OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL
);
/**
Downloads a file from an MTFTPv4 server.
@param This The pointer to the EFI_MTFTP4_PROTOCOL instance.
@param Token The pointer to the token structure to provide the parameters that are
used in this operation.
@retval EFI_SUCCESS The data file has been transferred successfully.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
@retval EFI_BUFFER_TOO_SMALL BufferSize is not zero but not large enough to hold the
downloaded data in downloading process.
@retval EFI_ABORTED Current operation is aborted by user.
@retval EFI_NETWORK_UNREACHABLE An ICMP network unreachable error packet was received.
@retval EFI_HOST_UNREACHABLE An ICMP host unreachable error packet was received.
@retval EFI_PROTOCOL_UNREACHABLE An ICMP protocol unreachable error packet was received.
@retval EFI_PORT_UNREACHABLE An ICMP port unreachable error packet was received.
@retval EFI_ICMP_ERROR Some other ICMP ERROR packet was received.
@retval EFI_TIMEOUT No responses were received from the MTFTPv4 server.
@retval EFI_TFTP_ERROR An MTFTPv4 ERROR packet was received.
@retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.
@retval EFI_NO_MEDIA There was a media error.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP4_READ_FILE)(
IN EFI_MTFTP4_PROTOCOL *This,
IN EFI_MTFTP4_TOKEN *Token
);
/**
Sends a file to an MTFTPv4 server.
@param This The pointer to the EFI_MTFTP4_PROTOCOL instance.
@param Token The pointer to the token structure to provide the parameters that are
used in this operation.
@retval EFI_SUCCESS The upload session has started.
@retval EFI_UNSUPPORTED The operation is not supported by this implementation.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_UNSUPPORTED One or more options in the Token.OptionList are in
the unsupported list of structure EFI_MTFTP4_MODE_DATA.
@retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started.
@retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
RARP, etc.) is not finished yet.
@retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv4 session.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
@retval EFI_ACCESS_DENIED The previous operation has not completed yet.
@retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP4_WRITE_FILE)(
IN EFI_MTFTP4_PROTOCOL *This,
IN EFI_MTFTP4_TOKEN *Token
);
/**
Downloads a data file "directory" from an MTFTPv4 server. May be unsupported in some EFI
implementations.
@param This The pointer to the EFI_MTFTP4_PROTOCOL instance.
@param Token The pointer to the token structure to provide the parameters that are
used in this operation.
@retval EFI_SUCCESS The MTFTPv4 related file "directory" has been downloaded.
@retval EFI_UNSUPPORTED The operation is not supported by this implementation.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_UNSUPPORTED One or more options in the Token.OptionList are in
the unsupported list of structure EFI_MTFTP4_MODE_DATA.
@retval EFI_NOT_STARTED The EFI MTFTPv4 Protocol driver has not been started.
@retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
RARP, etc.) is not finished yet.
@retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv4 session.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
@retval EFI_ACCESS_DENIED The previous operation has not completed yet.
@retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP4_READ_DIRECTORY)(
IN EFI_MTFTP4_PROTOCOL *This,
IN EFI_MTFTP4_TOKEN *Token
);
/**
Polls for incoming data packets and processes outgoing data packets.
@param This The pointer to the EFI_MTFTP4_PROTOCOL instance.
@retval EFI_SUCCESS Incoming or outgoing data was processed.
@retval EFI_NOT_STARTED This EFI MTFTPv4 Protocol instance has not been started.
@retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
RARP, etc.) is not finished yet.
@retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
@retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
Consider increasing the polling rate.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP4_POLL)(
IN EFI_MTFTP4_PROTOCOL *This
);
///
/// The EFI_MTFTP4_PROTOCOL is designed to be used by UEFI drivers and applications
/// to transmit and receive data files. The EFI MTFTPv4 Protocol driver uses
/// the underlying EFI UDPv4 Protocol driver and EFI IPv4 Protocol driver.
///
struct _EFI_MTFTP4_PROTOCOL {
EFI_MTFTP4_GET_MODE_DATA GetModeData;
EFI_MTFTP4_CONFIGURE Configure;
EFI_MTFTP4_GET_INFO GetInfo;
EFI_MTFTP4_PARSE_OPTIONS ParseOptions;
EFI_MTFTP4_READ_FILE ReadFile;
EFI_MTFTP4_WRITE_FILE WriteFile;
EFI_MTFTP4_READ_DIRECTORY ReadDirectory;
EFI_MTFTP4_POLL Poll;
};
struct _EFI_MTFTP4_TOKEN {
///
/// The status that is returned to the caller at the end of the operation
/// to indicate whether this operation completed successfully.
///
EFI_STATUS Status;
///
/// The event that will be signaled when the operation completes. If
/// set to NULL, the corresponding function will wait until the read or
/// write operation finishes. The type of Event must be
/// EVT_NOTIFY_SIGNAL. The Task Priority Level (TPL) of
/// Event must be lower than or equal to TPL_CALLBACK.
///
EFI_EVENT Event;
///
/// If not NULL, the data that will be used to override the existing configure data.
///
EFI_MTFTP4_OVERRIDE_DATA *OverrideData;
///
/// The pointer to the null-terminated ASCII file name string.
///
UINT8 *Filename;
///
/// The pointer to the null-terminated ASCII mode string. If NULL, "octet" is used.
///
UINT8 *ModeStr;
///
/// Number of option/value string pairs.
///
UINT32 OptionCount;
///
/// The pointer to an array of option/value string pairs. Ignored if OptionCount is zero.
///
EFI_MTFTP4_OPTION *OptionList;
///
/// The size of the data buffer.
///
UINT64 BufferSize;
///
/// The pointer to the data buffer. Data that is downloaded from the
/// MTFTPv4 server is stored here. Data that is uploaded to the
/// MTFTPv4 server is read from here. Ignored if BufferSize is zero.
///
VOID *Buffer;
///
/// The pointer to the context that will be used by CheckPacket,
/// TimeoutCallback and PacketNeeded.
///
VOID *Context;
///
/// The pointer to the callback function to check the contents of the received packet.
///
EFI_MTFTP4_CHECK_PACKET CheckPacket;
///
/// The pointer to the function to be called when a timeout occurs.
///
EFI_MTFTP4_TIMEOUT_CALLBACK TimeoutCallback;
///
/// The pointer to the function to provide the needed packet contents.
///
EFI_MTFTP4_PACKET_NEEDED PacketNeeded;
};
extern EFI_GUID gEfiMtftp4ServiceBindingProtocolGuid;
extern EFI_GUID gEfiMtftp4ProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/Mtftp6.h
================================================
/** @file
UEFI Multicast Trivial File Transfer Protocol v6 Definition, which is built upon
the EFI UDPv6 Protocol and provides basic services for client-side unicast and/or
multicast TFTP operations.
Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is introduced in UEFI Specification 2.2
**/
#ifndef __EFI_MTFTP6_PROTOCOL_H__
#define __EFI_MTFTP6_PROTOCOL_H__
#define EFI_MTFTP6_SERVICE_BINDING_PROTOCOL_GUID \
{ \
0xd9760ff3, 0x3cca, 0x4267, {0x80, 0xf9, 0x75, 0x27, 0xfa, 0xfa, 0x42, 0x23 } \
}
#define EFI_MTFTP6_PROTOCOL_GUID \
{ \
0xbf0a78ba, 0xec29, 0x49cf, {0xa1, 0xc9, 0x7a, 0xe5, 0x4e, 0xab, 0x6a, 0x51 } \
}
typedef struct _EFI_MTFTP6_PROTOCOL EFI_MTFTP6_PROTOCOL;
typedef struct _EFI_MTFTP6_TOKEN EFI_MTFTP6_TOKEN;
///
/// MTFTP Packet OpCodes
///@{
#define EFI_MTFTP6_OPCODE_RRQ 1 ///< The MTFTPv6 packet is a read request.
#define EFI_MTFTP6_OPCODE_WRQ 2 ///< The MTFTPv6 packet is a write request.
#define EFI_MTFTP6_OPCODE_DATA 3 ///< The MTFTPv6 packet is a data packet.
#define EFI_MTFTP6_OPCODE_ACK 4 ///< The MTFTPv6 packet is an acknowledgement packet.
#define EFI_MTFTP6_OPCODE_ERROR 5 ///< The MTFTPv6 packet is an error packet.
#define EFI_MTFTP6_OPCODE_OACK 6 ///< The MTFTPv6 packet is an option acknowledgement packet.
#define EFI_MTFTP6_OPCODE_DIR 7 ///< The MTFTPv6 packet is a directory query packet.
#define EFI_MTFTP6_OPCODE_DATA8 8 ///< The MTFTPv6 packet is a data packet with a big block number.
#define EFI_MTFTP6_OPCODE_ACK8 9 ///< The MTFTPv6 packet is an acknowledgement packet with a big block number.
///@}
///
/// MTFTP ERROR Packet ErrorCodes
///@{
///
/// The error code is not defined. See the error message in the packet (if any) for details.
///
#define EFI_MTFTP6_ERRORCODE_NOT_DEFINED 0
///
/// The file was not found.
///
#define EFI_MTFTP6_ERRORCODE_FILE_NOT_FOUND 1
///
/// There was an access violation.
///
#define EFI_MTFTP6_ERRORCODE_ACCESS_VIOLATION 2
///
/// The disk was full or its allocation was exceeded.
///
#define EFI_MTFTP6_ERRORCODE_DISK_FULL 3
///
/// The MTFTPv6 operation was illegal.
///
#define EFI_MTFTP6_ERRORCODE_ILLEGAL_OPERATION 4
///
/// The transfer ID is unknown.
///
#define EFI_MTFTP6_ERRORCODE_UNKNOWN_TRANSFER_ID 5
///
/// The file already exists.
///
#define EFI_MTFTP6_ERRORCODE_FILE_ALREADY_EXISTS 6
///
/// There is no such user.
///
#define EFI_MTFTP6_ERRORCODE_NO_SUCH_USER 7
///
/// The request has been denied due to option negotiation.
///
#define EFI_MTFTP6_ERRORCODE_REQUEST_DENIED 8
///@}
#pragma pack(1)
///
/// EFI_MTFTP6_REQ_HEADER
///
typedef struct {
///
/// For this packet type, OpCode = EFI_MTFTP6_OPCODE_RRQ for a read request
/// or OpCode = EFI_MTFTP6_OPCODE_WRQ for a write request.
///
UINT16 OpCode;
///
/// The file name to be downloaded or uploaded.
///
UINT8 Filename[1];
} EFI_MTFTP6_REQ_HEADER;
///
/// EFI_MTFTP6_OACK_HEADER
///
typedef struct {
///
/// For this packet type, OpCode = EFI_MTFTP6_OPCODE_OACK.
///
UINT16 OpCode;
///
/// The option strings in the option acknowledgement packet.
///
UINT8 Data[1];
} EFI_MTFTP6_OACK_HEADER;
///
/// EFI_MTFTP6_DATA_HEADER
///
typedef struct {
///
/// For this packet type, OpCode = EFI_MTFTP6_OPCODE_DATA.
///
UINT16 OpCode;
///
/// Block number of this data packet.
///
UINT16 Block;
///
/// The content of this data packet.
///
UINT8 Data[1];
} EFI_MTFTP6_DATA_HEADER;
///
/// EFI_MTFTP6_ACK_HEADER
///
typedef struct {
///
/// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ACK.
///
UINT16 OpCode;
///
/// The block number of the data packet that is being acknowledged.
///
UINT16 Block[1];
} EFI_MTFTP6_ACK_HEADER;
///
/// EFI_MTFTP6_DATA8_HEADER
///
typedef struct {
///
/// For this packet type, OpCode = EFI_MTFTP6_OPCODE_DATA8.
///
UINT16 OpCode;
///
/// The block number of data packet.
///
UINT64 Block;
///
/// The content of this data packet.
///
UINT8 Data[1];
} EFI_MTFTP6_DATA8_HEADER;
///
/// EFI_MTFTP6_ACK8_HEADER
///
typedef struct {
///
/// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ACK8.
///
UINT16 OpCode;
///
/// The block number of the data packet that is being acknowledged.
///
UINT64 Block[1];
} EFI_MTFTP6_ACK8_HEADER;
///
/// EFI_MTFTP6_ERROR_HEADER
///
typedef struct {
///
/// For this packet type, OpCode = EFI_MTFTP6_OPCODE_ERROR.
///
UINT16 OpCode;
///
/// The error number as defined by the MTFTPv6 packet error codes.
///
UINT16 ErrorCode;
///
/// Error message string.
///
UINT8 ErrorMessage[1];
} EFI_MTFTP6_ERROR_HEADER;
///
/// EFI_MTFTP6_PACKET
///
typedef union {
UINT16 OpCode; ///< Type of packets as defined by the MTFTPv6 packet opcodes.
EFI_MTFTP6_REQ_HEADER Rrq; ///< Read request packet header.
EFI_MTFTP6_REQ_HEADER Wrq; ///< write request packet header.
EFI_MTFTP6_OACK_HEADER Oack; ///< Option acknowledge packet header.
EFI_MTFTP6_DATA_HEADER Data; ///< Data packet header.
EFI_MTFTP6_ACK_HEADER Ack; ///< Acknowledgement packet header.
EFI_MTFTP6_DATA8_HEADER Data8; ///< Data packet header with big block number.
EFI_MTFTP6_ACK8_HEADER Ack8; ///< Acknowledgement header with big block number.
EFI_MTFTP6_ERROR_HEADER Error; ///< Error packet header.
} EFI_MTFTP6_PACKET;
#pragma pack()
///
/// EFI_MTFTP6_CONFIG_DATA
///
typedef struct {
///
/// The local IP address to use. Set to zero to let the underlying IPv6
/// driver choose a source address. If not zero it must be one of the
/// configured IP addresses in the underlying IPv6 driver.
///
EFI_IPv6_ADDRESS StationIp;
///
/// Local port number. Set to zero to use the automatically assigned port number.
///
UINT16 LocalPort;
///
/// The IP address of the MTFTPv6 server.
///
EFI_IPv6_ADDRESS ServerIp;
///
/// The initial MTFTPv6 server port number. Request packets are
/// sent to this port. This number is almost always 69 and using zero
/// defaults to 69.
UINT16 InitialServerPort;
///
/// The number of times to transmit MTFTPv6 request packets and wait for a response.
///
UINT16 TryCount;
///
/// The number of seconds to wait for a response after sending the MTFTPv6 request packet.
///
UINT16 TimeoutValue;
} EFI_MTFTP6_CONFIG_DATA;
///
/// EFI_MTFTP6_MODE_DATA
///
typedef struct {
///
/// The configuration data of this instance.
///
EFI_MTFTP6_CONFIG_DATA ConfigData;
///
/// The number of option strings in the following SupportedOptions array.
///
UINT8 SupportedOptionCount;
///
/// An array of null-terminated ASCII option strings that are recognized and supported by
/// this EFI MTFTPv6 Protocol driver implementation. The buffer is
/// read only to the caller and the caller should NOT free the buffer.
///
UINT8 **SupportedOptions;
} EFI_MTFTP6_MODE_DATA;
///
/// EFI_MTFTP_OVERRIDE_DATA
///
typedef struct {
///
/// IP address of the MTFTPv6 server. If set to all zero, the value that
/// was set by the EFI_MTFTP6_PROTOCOL.Configure() function will be used.
///
EFI_IPv6_ADDRESS ServerIp;
///
/// MTFTPv6 server port number. If set to zero, it will use the value
/// that was set by the EFI_MTFTP6_PROTOCOL.Configure() function.
///
UINT16 ServerPort;
///
/// Number of times to transmit MTFTPv6 request packets and wait
/// for a response. If set to zero, the value that was set by
/// theEFI_MTFTP6_PROTOCOL.Configure() function will be used.
///
UINT16 TryCount;
///
/// Number of seconds to wait for a response after sending the
/// MTFTPv6 request packet. If set to zero, the value that was set by
/// the EFI_MTFTP6_PROTOCOL.Configure() function will be used.
///
UINT16 TimeoutValue;
} EFI_MTFTP6_OVERRIDE_DATA;
///
/// EFI_MTFTP6_OPTION
///
typedef struct {
UINT8 *OptionStr; ///< Pointer to the null-terminated ASCII MTFTPv6 option string.
UINT8 *ValueStr; ///< Pointer to the null-terminated ASCII MTFTPv6 value string.
} EFI_MTFTP6_OPTION;
/**
EFI_MTFTP6_TIMEOUT_CALLBACK is a callback function that the caller provides to capture the
timeout event in the EFI_MTFTP6_PROTOCOL.ReadFile(), EFI_MTFTP6_PROTOCOL.WriteFile() or
EFI_MTFTP6_PROTOCOL.ReadDirectory() functions.
Whenever a timeout occurs, the EFI MTFTPv6 Protocol driver will call the EFI_MTFTP6_TIMEOUT_CALLBACK
function to notify the caller of the timeout event. Any status code other than EFI_SUCCESS
that is returned from this function will abort the current download process.
@param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.
@param[in] Token The token that the caller provided in the EFI_MTFTP6_PROTOCOl.ReadFile(),
WriteFile() or ReadDirectory() function.
@param[in] PacketLen Indicates the length of the packet.
@param[in] Packet Pointer to an MTFTPv6 packet.
@retval EFI_SUCCESS Operation success.
@retval Others Aborts session.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP6_CHECK_PACKET)(
IN EFI_MTFTP6_PROTOCOL *This,
IN EFI_MTFTP6_TOKEN *Token,
IN UINT16 PacketLen,
IN EFI_MTFTP6_PACKET *Packet
);
/**
EFI_MTFTP6_TIMEOUT_CALLBACK is a callback function that the caller provides to capture the
timeout event in the EFI_MTFTP6_PROTOCOL.ReadFile(), EFI_MTFTP6_PROTOCOL.WriteFile() or
EFI_MTFTP6_PROTOCOL.ReadDirectory() functions.
Whenever a timeout occurs, the EFI MTFTPv6 Protocol driver will call the EFI_MTFTP6_TIMEOUT_CALLBACK
function to notify the caller of the timeout event. Any status code other than EFI_SUCCESS
that is returned from this function will abort the current download process.
@param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.
@param[in] Token The token that is provided in the EFI_MTFTP6_PROTOCOL.ReadFile() or
EFI_MTFTP6_PROTOCOL.WriteFile() or EFI_MTFTP6_PROTOCOL.ReadDirectory()
functions by the caller.
@retval EFI_SUCCESS Operation success.
@retval Others Aborts session.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP6_TIMEOUT_CALLBACK)(
IN EFI_MTFTP6_PROTOCOL *This,
IN EFI_MTFTP6_TOKEN *Token
);
/**
EFI_MTFTP6_PACKET_NEEDED is a callback function that the caller provides to feed data to the
EFI_MTFTP6_PROTOCOL.WriteFile() function.
EFI_MTFTP6_PACKET_NEEDED provides another mechanism for the caller to provide data to upload
other than a static buffer. The EFI MTFTP6 Protocol driver always calls EFI_MTFTP6_PACKET_NEEDED
to get packet data from the caller if no static buffer was given in the initial call to
EFI_MTFTP6_PROTOCOL.WriteFile() function. Setting *Length to zero signals the end of the session.
Returning a status code other than EFI_SUCCESS aborts the session.
@param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.
@param[in] Token The token provided in the EFI_MTFTP6_PROTOCOL.WriteFile() by the caller.
@param[in, out] Length Indicates the length of the raw data wanted on input, and the
length the data available on output.
@param[out] Buffer Pointer to the buffer where the data is stored.
@retval EFI_SUCCESS Operation success.
@retval Others Aborts session.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP6_PACKET_NEEDED)(
IN EFI_MTFTP6_PROTOCOL *This,
IN EFI_MTFTP6_TOKEN *Token,
IN OUT UINT16 *Length,
OUT VOID **Buffer
);
struct _EFI_MTFTP6_TOKEN {
///
/// The status that is returned to the caller at the end of the operation
/// to indicate whether this operation completed successfully.
/// Defined Status values are listed below.
///
EFI_STATUS Status;
///
/// The event that will be signaled when the operation completes. If
/// set to NULL, the corresponding function will wait until the read or
/// write operation finishes. The type of Event must be EVT_NOTIFY_SIGNAL.
///
EFI_EVENT Event;
///
/// If not NULL, the data that will be used to override the existing
/// configure data.
///
EFI_MTFTP6_OVERRIDE_DATA *OverrideData;
///
/// Pointer to the null-terminated ASCII file name string.
///
UINT8 *Filename;
///
/// Pointer to the null-terminated ASCII mode string. If NULL, octet is used.
///
UINT8 *ModeStr;
///
/// Number of option/value string pairs.
///
UINT32 OptionCount;
///
/// Pointer to an array of option/value string pairs. Ignored if
/// OptionCount is zero. Both a remote server and this driver
/// implementation should support these options. If one or more
/// options are unrecognized by this implementation, it is sent to the
/// remote server without being changed.
///
EFI_MTFTP6_OPTION *OptionList;
///
/// On input, the size, in bytes, of Buffer. On output, the number
/// of bytes transferred.
///
UINT64 BufferSize;
///
/// Pointer to the data buffer. Data that is downloaded from the
/// MTFTPv6 server is stored here. Data that is uploaded to the
/// MTFTPv6 server is read from here. Ignored if BufferSize is zero.
///
VOID *Buffer;
///
/// Pointer to the context that will be used by CheckPacket,
/// TimeoutCallback and PacketNeeded.
///
VOID *Context;
///
/// Pointer to the callback function to check the contents of the
/// received packet.
///
EFI_MTFTP6_CHECK_PACKET CheckPacket;
///
/// Pointer to the function to be called when a timeout occurs.
///
EFI_MTFTP6_TIMEOUT_CALLBACK TimeoutCallback;
///
/// Pointer to the function to provide the needed packet contents.
/// Only used in WriteFile() operation.
///
EFI_MTFTP6_PACKET_NEEDED PacketNeeded;
};
/**
Read the current operational settings.
The GetModeData() function reads the current operational settings of this EFI MTFTPv6
Protocol driver instance.
@param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.
@param[out] ModeData The buffer in which the EFI MTFTPv6 Protocol driver mode
data is returned.
@retval EFI_SUCCESS The configuration data was successfully returned.
@retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.
@retval EFI_INVALID_PARAMETER This is NULL or ModeData is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP6_GET_MODE_DATA)(
IN EFI_MTFTP6_PROTOCOL *This,
OUT EFI_MTFTP6_MODE_DATA *ModeData
);
/**
Initializes, changes, or resets the default operational setting for this EFI MTFTPv6
Protocol driver instance.
The Configure() function is used to set and change the configuration data for this EFI
MTFTPv6 Protocol driver instance. The configuration data can be reset to startup defaults by calling
Configure() with MtftpConfigData set to NULL. Whenever the instance is reset, any
pending operation is aborted. By changing the EFI MTFTPv6 Protocol driver instance configuration
data, the client can connect to different MTFTPv6 servers. The configuration parameters in
MtftpConfigData are used as the default parameters in later MTFTPv6 operations and can be
overridden in later operations.
@param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.
@param[in] MtftpConfigData Pointer to the configuration data structure.
@retval EFI_SUCCESS The EFI MTFTPv6 Protocol instance was configured successfully.
@retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:
- This is NULL.
- MtftpConfigData.StationIp is neither zero nor one
of the configured IP addresses in the underlying IPv6 driver.
- MtftpCofigData.ServerIp is not a valid IPv6 unicast address.
@retval EFI_ACCESS_DENIED - The configuration could not be changed at this time because there
is some MTFTP background operation in progress.
- MtftpCofigData.LocalPort is already in use.
@retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source
address for this instance, but no source address was available for use.
@retval EFI_OUT_OF_RESOURCES The EFI MTFTPv6 Protocol driver instance data could not be
allocated.
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI
MTFTPv6 Protocol driver instance is not configured.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP6_CONFIGURE)(
IN EFI_MTFTP6_PROTOCOL *This,
IN EFI_MTFTP6_CONFIG_DATA *MtftpConfigData OPTIONAL
);
/**
Get information about a file from an MTFTPv6 server.
The GetInfo() function assembles an MTFTPv6 request packet with options, sends it to the
MTFTPv6 server, and may return an MTFTPv6 OACK, MTFTPv6 ERROR, or ICMP ERROR packet.
Retries occur only if no response packets are received from the MTFTPv6 server before the
timeout expires.
@param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.
@param[in] OverrideData Data that is used to override the existing parameters. If NULL, the
default parameters that were set in the EFI_MTFTP6_PROTOCOL.Configure()
function are used.
@param[in] Filename Pointer to null-terminated ASCII file name string.
@param[in] ModeStr Pointer to null-terminated ASCII mode string. If NULL, octet will be used
@param[in] OptionCount Number of option/value string pairs in OptionList.
@param[in] OptionList Pointer to array of option/value string pairs. Ignored if
OptionCount is zero.
@param[out] PacketLength The number of bytes in the returned packet.
@param[out] Packet The pointer to the received packet. This buffer must be freed by
the caller.
@retval EFI_SUCCESS An MTFTPv6 OACK packet was received and is in the Packet.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
- This is NULL.
- Filename is NULL
- OptionCount is not zero and OptionList is NULL.
- One or more options in OptionList have wrong format.
- PacketLength is NULL.
- OverrideData.ServerIp is not valid unicast IPv6 addresses.
@retval EFI_UNSUPPORTED One or more options in the OptionList are unsupported by
this implementation.
@retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.
@retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source
address for this instance, but no source address was available for use.
@retval EFI_ACCESS_DENIED The previous operation has not completed yet.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
@retval EFI_TFTP_ERROR An MTFTPv6 ERROR packet was received and is in the Packet.
@retval EFI_NETWORK_UNREACHABLE An ICMP network unreachable error packet was received and the Packet is set to NULL.
@retval EFI_HOST_UNREACHABLE An ICMP host unreachable error packet was received and the Packet is set to NULL.
@retval EFI_PROTOCOL_UNREACHABLE An ICMP protocol unreachable error packet was received and the Packet is set to NULL.
@retval EFI_PORT_UNREACHABLE An ICMP port unreachable error packet was received and the Packet is set to NULL.
@retval EFI_ICMP_ERROR Some other ICMP ERROR packet was received and the Packet is set to NULL.
@retval EFI_PROTOCOL_ERROR An unexpected MTFTPv6 packet was received and is in the Packet.
@retval EFI_TIMEOUT No responses were received from the MTFTPv6 server.
@retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.
@retval EFI_NO_MEDIA There was a media error.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP6_GET_INFO)(
IN EFI_MTFTP6_PROTOCOL *This,
IN EFI_MTFTP6_OVERRIDE_DATA *OverrideData OPTIONAL,
IN UINT8 *Filename,
IN UINT8 *ModeStr OPTIONAL,
IN UINT8 OptionCount,
IN EFI_MTFTP6_OPTION *OptionList OPTIONAL,
OUT UINT32 *PacketLength,
OUT EFI_MTFTP6_PACKET **Packet OPTIONAL
);
/**
Parse the options in an MTFTPv6 OACK packet.
The ParseOptions() function parses the option fields in an MTFTPv6 OACK packet and
returns the number of options that were found and optionally a list of pointers to
the options in the packet.
If one or more of the option fields are not valid, then EFI_PROTOCOL_ERROR is returned
and *OptionCount and *OptionList stop at the last valid option.
@param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.
@param[in] PacketLen Length of the OACK packet to be parsed.
@param[in] Packet Pointer to the OACK packet to be parsed.
@param[out] OptionCount Pointer to the number of options in the following OptionList.
@param[out] OptionList Pointer to EFI_MTFTP6_OPTION storage. Each pointer in the
OptionList points to the corresponding MTFTP option buffer
in the Packet. Call the EFI Boot Service FreePool() to
release the OptionList if the options in this OptionList
are not needed any more.
@retval EFI_SUCCESS The OACK packet was valid and the OptionCount and
OptionList parameters have been updated.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
- PacketLen is 0.
- Packet is NULL or Packet is not a valid MTFTPv6 packet.
- OptionCount is NULL.
@retval EFI_NOT_FOUND No options were found in the OACK packet.
@retval EFI_OUT_OF_RESOURCES Storage for the OptionList array can not be allocated.
@retval EFI_PROTOCOL_ERROR One or more of the option fields is invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP6_PARSE_OPTIONS)(
IN EFI_MTFTP6_PROTOCOL *This,
IN UINT32 PacketLen,
IN EFI_MTFTP6_PACKET *Packet,
OUT UINT32 *OptionCount,
OUT EFI_MTFTP6_OPTION **OptionList OPTIONAL
);
/**
Download a file from an MTFTPv6 server.
The ReadFile() function is used to initialize and start an MTFTPv6 download process and
optionally wait for completion. When the download operation completes, whether successfully or
not, the Token.Status field is updated by the EFI MTFTPv6 Protocol driver and then
Token.Event is signaled if it is not NULL.
Data can be downloaded from the MTFTPv6 server into either of the following locations:
- A fixed buffer that is pointed to by Token.Buffer
- A download service function that is pointed to by Token.CheckPacket
If both Token.Buffer and Token.CheckPacket are used, then Token.CheckPacket
will be called first. If the call is successful, the packet will be stored in Token.Buffer.
@param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.
@param[in] Token Pointer to the token structure to provide the parameters that are
used in this operation.
@retval EFI_SUCCESS The data file has been transferred successfully.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
@retval EFI_BUFFER_TOO_SMALL BufferSize is not zero but not large enough to hold the
downloaded data in downloading process.
@retval EFI_ABORTED Current operation is aborted by user.
@retval EFI_NETWORK_UNREACHABLE An ICMP network unreachable error packet was received.
@retval EFI_HOST_UNREACHABLE An ICMP host unreachable error packet was received.
@retval EFI_PROTOCOL_UNREACHABLE An ICMP protocol unreachable error packet was received.
@retval EFI_PORT_UNREACHABLE An ICMP port unreachable error packet was received.
@retval EFI_ICMP_ERROR An ICMP ERROR packet was received.
@retval EFI_TIMEOUT No responses were received from the MTFTPv6 server.
@retval EFI_TFTP_ERROR An MTFTPv6 ERROR packet was received.
@retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.
@retval EFI_NO_MEDIA There was a media error.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP6_READ_FILE)(
IN EFI_MTFTP6_PROTOCOL *This,
IN EFI_MTFTP6_TOKEN *Token
);
/**
Send a file to an MTFTPv6 server. May be unsupported in some implementations.
The WriteFile() function is used to initialize an uploading operation with the given option list
and optionally wait for completion. If one or more of the options is not supported by the server, the
unsupported options are ignored and a standard TFTP process starts instead. When the upload
process completes, whether successfully or not, Token.Event is signaled, and the EFI MTFTPv6
Protocol driver updates Token.Status.
The caller can supply the data to be uploaded in the following two modes:
- Through the user-provided buffer
- Through a callback function
With the user-provided buffer, the Token.BufferSize field indicates the length of the buffer,
and the driver will upload the data in the buffer. With an EFI_MTFTP6_PACKET_NEEDED
callback function, the driver will call this callback function to get more data from the user to upload.
See the definition of EFI_MTFTP6_PACKET_NEEDED for more information. These two modes
cannot be used at the same time. The callback function will be ignored if the user provides the
buffer.
@param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.
@param[in] Token Pointer to the token structure to provide the parameters that are
used in this operation.
@retval EFI_SUCCESS The upload session has started.
@retval EFI_UNSUPPORTED The operation is not supported by this implementation.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
- This is NULL.
- Token is NULL.
- Token.Filename is NULL.
- Token.OptionCount is not zero and Token.OptionList is NULL.
- One or more options in Token.OptionList have wrong format.
- Token.Buffer and Token.PacketNeeded are both NULL.
- Token.OverrideData.ServerIp is not valid unicast IPv6 addresses.
@retval EFI_UNSUPPORTED One or more options in the Token.OptionList are not
supported by this implementation.
@retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.
@retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source
address for this instance, but no source address was available for use.
@retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv6 session.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
@retval EFI_ACCESS_DENIED The previous operation has not completed yet.
@retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP6_WRITE_FILE)(
IN EFI_MTFTP6_PROTOCOL *This,
IN EFI_MTFTP6_TOKEN *Token
);
/**
Download a data file directory from an MTFTPv6 server. May be unsupported in some implementations.
The ReadDirectory() function is used to return a list of files on the MTFTPv6 server that are
logically (or operationally) related to Token.Filename. The directory request packet that is sent
to the server is built with the option list that was provided by caller, if present.
The file information that the server returns is put into either of the following locations:
- A fixed buffer that is pointed to by Token.Buffer
- A download service function that is pointed to by Token.CheckPacket
If both Token.Buffer and Token.CheckPacket are used, then Token.CheckPacket
will be called first. If the call is successful, the packet will be stored in Token.Buffer.
The returned directory listing in the Token.Buffer or EFI_MTFTP6_PACKET consists of a list
of two or three variable-length ASCII strings, each terminated by a null character, for each file in the
directory. If the multicast option is involved, the first field of each directory entry is the static
multicast IP address and UDP port number that is associated with the file name. The format of the
field is ip:ip:ip:ip:port. If the multicast option is not involved, this field and its terminating
null character are not present.
The next field of each directory entry is the file name and the last field is the file information string.
The information string contains the file size and the create/modify timestamp. The format of the
information string is filesize yyyy-mm-dd hh:mm:ss:ffff. The timestamp is
Coordinated Universal Time (UTC; also known as Greenwich Mean Time [GMT]).
@param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.
@param[in] Token Pointer to the token structure to provide the parameters that are
used in this operation.
@retval EFI_SUCCESS The MTFTPv6 related file "directory" has been downloaded.
@retval EFI_UNSUPPORTED The EFI MTFTPv6 Protocol driver does not support this function.
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
- This is NULL.
- Token is NULL.
- Token.Filename is NULL.
- Token.OptionCount is not zero and Token.OptionList is NULL.
- One or more options in Token.OptionList have wrong format.
- Token.Buffer and Token.CheckPacket are both NULL.
- Token.OverrideData.ServerIp is not valid unicast IPv6 addresses.
@retval EFI_UNSUPPORTED One or more options in the Token.OptionList are not
supported by this implementation.
@retval EFI_NOT_STARTED The EFI MTFTPv6 Protocol driver has not been started.
@retval EFI_NO_MAPPING The underlying IPv6 driver was responsible for choosing a source
address for this instance, but no source address was available for use.
@retval EFI_ALREADY_STARTED This Token is already being used in another MTFTPv6 session.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
@retval EFI_ACCESS_DENIED The previous operation has not completed yet.
@retval EFI_DEVICE_ERROR An unexpected network error or system error occurred.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP6_READ_DIRECTORY)(
IN EFI_MTFTP6_PROTOCOL *This,
IN EFI_MTFTP6_TOKEN *Token
);
/**
Polls for incoming data packets and processes outgoing data packets.
The Poll() function can be used by network drivers and applications to increase the rate that data
packets are moved between the communications device and the transmit and receive queues.
In some systems, the periodic timer event in the managed network driver may not poll the
underlying communications device fast enough to transmit and/or receive all data packets without
missing incoming packets or dropping outgoing packets. Drivers and applications that are
experiencing packet loss should try calling the Poll() function more often.
@param[in] This Pointer to the EFI_MTFTP6_PROTOCOL instance.
@retval EFI_SUCCESS Incoming or outgoing data was processed.
@retval EFI_NOT_STARTED This EFI MTFTPv6 Protocol instance has not been started.
@retval EFI_INVALID_PARAMETER This is NULL.
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
@retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
Consider increasing the polling rate.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_MTFTP6_POLL)(
IN EFI_MTFTP6_PROTOCOL *This
);
///
/// The EFI_MTFTP6_PROTOCOL is designed to be used by UEFI drivers and applications to transmit
/// and receive data files. The EFI MTFTPv6 Protocol driver uses the underlying EFI UDPv6 Protocol
/// driver and EFI IPv6 Protocol driver.
///
struct _EFI_MTFTP6_PROTOCOL {
EFI_MTFTP6_GET_MODE_DATA GetModeData;
EFI_MTFTP6_CONFIGURE Configure;
EFI_MTFTP6_GET_INFO GetInfo;
EFI_MTFTP6_PARSE_OPTIONS ParseOptions;
EFI_MTFTP6_READ_FILE ReadFile;
EFI_MTFTP6_WRITE_FILE WriteFile;
EFI_MTFTP6_READ_DIRECTORY ReadDirectory;
EFI_MTFTP6_POLL Poll;
};
extern EFI_GUID gEfiMtftp6ServiceBindingProtocolGuid;
extern EFI_GUID gEfiMtftp6ProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h
================================================
/** @file
EFI Network Interface Identifier Protocol.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is introduced in EFI Specification 1.10.
**/
#ifndef __EFI_NETWORK_INTERFACE_IDENTIFER_H__
#define __EFI_NETWORK_INTERFACE_IDENTIFER_H__
//
// GUID retired from UEFI Specification 2.1b
//
#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID \
{ \
0xE18541CD, 0xF755, 0x4f73, {0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29 } \
}
//
// GUID intruduced in UEFI Specification 2.1b
//
#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID_31 \
{ \
0x1ACED566, 0x76ED, 0x4218, {0xBC, 0x81, 0x76, 0x7F, 0x1F, 0x97, 0x7A, 0x89 } \
}
//
// Revision defined in UEFI Specification 2.4
//
#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION 0x00020000
///
/// Revision defined in EFI1.1.
///
#define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION
///
/// Forward reference for pure ANSI compatability.
///
typedef struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL;
///
/// Protocol defined in EFI1.1.
///
typedef EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE;
///
/// An optional protocol that is used to describe details about the software
/// layer that is used to produce the Simple Network Protocol.
///
struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL {
UINT64 Revision; ///< The revision of the EFI_NETWORK_INTERFACE_IDENTIFIER protocol.
UINT64 Id; ///< The address of the first byte of the identifying structure for this network
///< interface. This is only valid when the network interface is started
///< (see Start()). When the network interface is not started, this field is set to zero.
UINT64 ImageAddr; ///< The address of the first byte of the identifying structure for this
///< network interface. This is set to zero if there is no structure.
UINT32 ImageSize; ///< The size of unrelocated network interface image.
CHAR8 StringId[4];///< A four-character ASCII string that is sent in the class identifier field of
///< option 60 in DHCP. For a Type of EfiNetworkInterfaceUndi, this field is UNDI.
UINT8 Type; ///< Network interface type. This will be set to one of the values
///< in EFI_NETWORK_INTERFACE_TYPE.
UINT8 MajorVer; ///< Major version number.
UINT8 MinorVer; ///< Minor version number.
BOOLEAN Ipv6Supported; ///< TRUE if the network interface supports IPv6; otherwise FALSE.
UINT16 IfNum; ///< The network interface number that is being identified by this Network
///< Interface Identifier Protocol. This field must be less than or
///< equal to the (IFcnt | IFcntExt <<8 ) fields in the !PXE structure.
};
///
///*******************************************************
/// EFI_NETWORK_INTERFACE_TYPE
///*******************************************************
///
typedef enum {
EfiNetworkInterfaceUndi = 1
} EFI_NETWORK_INTERFACE_TYPE;
///
/// Forward reference for pure ANSI compatability.
///
typedef struct undiconfig_table UNDI_CONFIG_TABLE;
///
/// The format of the configuration table for UNDI
///
struct undiconfig_table {
UINT32 NumberOfInterfaces; ///< The number of NIC devices
///< that this UNDI controls.
UINT32 reserved;
UNDI_CONFIG_TABLE *nextlink; ///< A pointer to the next UNDI
///< configuration table.
///
/// The length of this array is given in the NumberOfInterfaces field.
///
struct {
VOID *NII_InterfacePointer; ///< Pointer to the NII interface structure.
VOID *DevicePathPointer; ///< Pointer to the device path for this NIC.
} NII_entry[1];
};
extern EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid;
extern EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid_31;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/NvdimmLabel.h
================================================
/** @file
EFI NVDIMM Label Protocol Definition
The EFI NVDIMM Label Protocol is used to Provides services that allow management
of labels contained in a Label Storage Area that are associated with a specific
NVDIMM Device Path.
Copyright (c) 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol was introduced in UEFI Specification 2.7.
**/
#ifndef __EFI_NVDIMM_LABEL_PROTOCOL_H__
#define __EFI_NVDIMM_LABEL_PROTOCOL_H__
#define EFI_NVDIMM_LABEL_PROTOCOL_GUID \
{ \
0xd40b6b80, 0x97d5, 0x4282, {0xbb, 0x1d, 0x22, 0x3a, 0x16, 0x91, 0x80, 0x58 } \
}
typedef struct _EFI_NVDIMM_LABEL_PROTOCOL EFI_NVDIMM_LABEL_PROTOCOL;
#define EFI_NVDIMM_LABEL_INDEX_SIG_LEN 16
#define EFI_NVDIMM_LABEL_INDEX_ALIGN 256
typedef struct {
///
/// Signature of the Index Block data structure. Must be "NAMESPACE_INDEX\0".
///
CHAR8 Sig[EFI_NVDIMM_LABEL_INDEX_SIG_LEN];
///
/// Attributes of this Label Storage Area.
///
UINT8 Flags[3];
///
/// Size of each label in bytes, 128 bytes << LabelSize.
/// 1 means 256 bytes, 2 means 512 bytes, etc. Shall be 1 or greater.
///
UINT8 LabelSize;
///
/// Sequence number used to identify which of the two Index Blocks is current.
///
UINT32 Seq;
///
/// The offset of this Index Block in the Label Storage Area.
///
UINT64 MyOff;
///
/// The size of this Index Block in bytes.
/// This field must be a multiple of the EFI_NVDIMM_LABEL_INDEX_ALIGN.
///
UINT64 MySize;
///
/// The offset of the other Index Block paired with this one.
///
UINT64 OtherOff;
///
/// The offset of the first slot where labels are stored in this Label Storage Area.
///
UINT64 LabelOff;
///
/// The total number of slots for storing labels in this Label Storage Area.
///
UINT32 NSlot;
///
/// Major version number. Value shall be 1.
///
UINT16 Major;
///
/// Minor version number. Value shall be 2.
///
UINT16 Minor;
///
/// 64-bit Fletcher64 checksum of all fields in this Index Block.
///
UINT64 Checksum;
///
/// Array of unsigned bytes implementing a bitmask that tracks which label slots are free.
/// A bit value of 0 indicates in use, 1 indicates free.
/// The size of this field is the number of bytes required to hold the bitmask with NSlot bits,
/// padded with additional zero bytes to make the Index Block size a multiple of EFI_NVDIMM_LABEL_INDEX_ALIGN.
/// Any bits allocated beyond NSlot bits must be zero.
///
UINT8 Free[];
} EFI_NVDIMM_LABEL_INDEX_BLOCK;
#define EFI_NVDIMM_LABEL_NAME_LEN 64
///
/// The label is read-only.
///
#define EFI_NVDIMM_LABEL_FLAGS_ROLABEL 0x00000001
///
/// When set, the complete label set is local to a single NVDIMM Label Storage Area.
/// When clear, the complete label set is contained on multiple NVDIMM Label Storage Areas.
///
#define EFI_NVDIMM_LABEL_FLAGS_LOCAL 0x00000002
///
/// This reserved flag is utilized on older implementations and has been deprecated.
/// Do not use.
//
#define EFI_NVDIMM_LABEL_FLAGS_RESERVED 0x00000004
///
/// When set, the label set is being updated.
///
#define EFI_NVDIMM_LABEL_FLAGS_UPDATING 0x00000008
typedef struct {
///
/// Unique Label Identifier UUID per RFC 4122.
///
EFI_GUID Uuid;
///
/// NULL-terminated string using UTF-8 character formatting.
///
CHAR8 Name[EFI_NVDIMM_LABEL_NAME_LEN];
///
/// Attributes of this namespace.
///
UINT32 Flags;
///
/// Total number of labels describing this namespace.
///
UINT16 NLabel;
///
/// Position of this label in list of labels for this namespace.
///
UINT16 Position;
///
/// The SetCookie is utilized by SW to perform consistency checks on the Interleave Set to verify the current
/// physical device configuration matches the original physical configuration when the labels were created
/// for the set.The label is considered invalid if the actual label set cookie doesn't match the cookie stored here.
///
UINT64 SetCookie;
///
/// This is the default logical block size in bytes and may be superseded by a block size that is specified
/// in the AbstractionGuid.
///
UINT64 LbaSize;
///
/// The DPA is the DIMM Physical address where the NVM contributing to this namespace begins on this NVDIMM.
///
UINT64 Dpa;
///
/// The extent of the DPA contributed by this label.
///
UINT64 RawSize;
///
/// Current slot in the Label Storage Area where this label is stored.
///
UINT32 Slot;
///
/// Alignment hint used to advertise the preferred alignment of the data from within the namespace defined by this label.
///
UINT8 Alignment;
///
/// Shall be 0.
///
UINT8 Reserved[3];
///
/// Range Type GUID that describes the access mechanism for the specified DPA range.
///
EFI_GUID TypeGuid;
///
/// Identifies the address abstraction mechanism for this namespace. A value of 0 indicates no mechanism used.
///
EFI_GUID AddressAbstractionGuid;
///
/// Shall be 0.
///
UINT8 Reserved1[88];
///
/// 64-bit Fletcher64 checksum of all fields in this Label.
/// This field is considered zero when the checksum is computed.
///
UINT64 Checksum;
} EFI_NVDIMM_LABEL;
typedef struct {
///
/// The Region Offset field from the ACPI NFIT NVDIMM Region Mapping Structure for a given entry.
///
UINT64 RegionOffset;
///
/// The serial number of the NVDIMM, assigned by the module vendor.
///
UINT32 SerialNumber;
///
/// The identifier indicating the vendor of the NVDIMM.
///
UINT16 VendorId;
///
/// The manufacturing date of the NVDIMM, assigned by the module vendor.
///
UINT16 ManufacturingDate;
///
/// The manufacturing location from for the NVDIMM, assigned by the module vendor.
///
UINT8 ManufacturingLocation;
///
/// Shall be 0.
///
UINT8 Reserved[31];
} EFI_NVDIMM_LABEL_SET_COOKIE_MAP;
typedef struct {
///
/// Array size is 1 if EFI_NVDIMM_LABEL_FLAGS_LOCAL is set indicating a Local Namespaces.
///
EFI_NVDIMM_LABEL_SET_COOKIE_MAP Mapping[0];
} EFI_NVDIMM_LABEL_SET_COOKIE_INFO;
/**
Retrieves the Label Storage Area size and the maximum transfer size for the LabelStorageRead and
LabelStorageWrite methods.
@param This A pointer to the EFI_NVDIMM_LABEL_PROTOCOL instance.
@param SizeOfLabelStorageArea The size of the Label Storage Area for the NVDIMM in bytes.
@param MaxTransferLength The maximum number of bytes that can be transferred in a single call to
LabelStorageRead or LabelStorageWrite.
@retval EFI_SUCCESS The size of theLabel Storage Area and maximum transfer size returned are valid.
@retval EFI_ACCESS_DENIED The Label Storage Area for the NVDIMM device is not currently accessible.
@retval EFI_DEVICE_ERROR A physical device error occurred and the data transfer failed to complete.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_NVDIMM_LABEL_STORAGE_INFORMATION) (
IN EFI_NVDIMM_LABEL_PROTOCOL *This,
OUT UINT32 *SizeOfLabelStorageArea,
OUT UINT32 *MaxTransferLength
);
/**
Retrieves the label data for the requested offset and length from within the Label Storage Area for
the NVDIMM.
@param This A pointer to the EFI_NVDIMM_LABEL_PROTOCOL instance.
@param Offset The byte offset within the Label Storage Area to read from.
@param TransferLength Number of bytes to read from the Label Storage Area beginning at the byte
Offset specified. A TransferLength of 0 reads no data.
@param LabelData The return label data read at the requested offset and length from within
the Label Storage Area.
@retval EFI_SUCCESS The label data from the Label Storage Area for the NVDIMM was read successfully
at the specified Offset and TransferLength and LabelData contains valid data.
@retval EFI_INVALID_PARAMETER Any of the following are true:
- Offset > SizeOfLabelStorageArea reported in the LabelStorageInformation return data.
- Offset + TransferLength is > SizeOfLabelStorageArea reported in the
LabelStorageInformation return data.
- TransferLength is > MaxTransferLength reported in the LabelStorageInformation return
data.
@retval EFI_ACCESS_DENIED The Label Storage Area for the NVDIMM device is not currently accessible and labels
cannot be read at this time.
@retval EFI_DEVICE_ERROR A physical device error occurred and the data transfer failed to complete.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_NVDIMM_LABEL_STORAGE_READ) (
IN CONST EFI_NVDIMM_LABEL_PROTOCOL *This,
IN UINT32 Offset,
IN UINT32 TransferLength,
OUT UINT8 *LabelData
);
/**
Writes the label data for the requested offset and length in to the Label Storage Area for the NVDIMM.
@param This A pointer to the EFI_NVDIMM_LABEL_PROTOCOL instance.
@param Offset The byte offset within the Label Storage Area to write to.
@param TransferLength Number of bytes to write to the Label Storage Area beginning at the byte
Offset specified. A TransferLength of 0 writes no data.
@param LabelData The return label data write at the requested offset and length from within
the Label Storage Area.
@retval EFI_SUCCESS The label data from the Label Storage Area for the NVDIMM written read successfully
at the specified Offset and TransferLength.
@retval EFI_INVALID_PARAMETER Any of the following are true:
- Offset > SizeOfLabelStorageArea reported in the LabelStorageInformation return data.
- Offset + TransferLength is > SizeOfLabelStorageArea reported in the
LabelStorageInformation return data.
- TransferLength is > MaxTransferLength reported in the LabelStorageInformation return
data.
@retval EFI_ACCESS_DENIED The Label Storage Area for the NVDIMM device is not currently accessible and labels
cannot be written at this time.
@retval EFI_DEVICE_ERROR A physical device error occurred and the data transfer failed to complete.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_NVDIMM_LABEL_STORAGE_WRITE) (
IN CONST EFI_NVDIMM_LABEL_PROTOCOL *This,
IN UINT32 Offset,
IN UINT32 TransferLength,
IN UINT8 *LabelData
);
///
/// Provides services that allow management of labels contained in a Label Storage Area.
///
struct _EFI_NVDIMM_LABEL_PROTOCOL {
EFI_NVDIMM_LABEL_STORAGE_INFORMATION LabelStorageInformation;
EFI_NVDIMM_LABEL_STORAGE_READ LabelStorageRead;
EFI_NVDIMM_LABEL_STORAGE_WRITE LabelStorageWrite;
};
extern EFI_GUID gEfiNvdimmLabelProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/NvmExpressPassthru.h
================================================
/** @file
This protocol provides services that allow NVM Express commands to be sent to an
NVM Express controller or to a specific namespace in a NVM Express controller.
This protocol interface is optimized for storage.
Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol was introduced in UEFI Specification 2.5.
**/
#ifndef _UEFI_NVM_EXPRESS_PASS_THRU_H_
#define _UEFI_NVM_EXPRESS_PASS_THRU_H_
#define EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL_GUID \
{ \
0x52c78312, 0x8edc, 0x4233, { 0x98, 0xf2, 0x1a, 0x1a, 0xa5, 0xe3, 0x88, 0xa5 } \
}
typedef struct _EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL;
typedef struct {
UINT32 Attributes;
UINT32 IoAlign;
UINT32 NvmeVersion;
} EFI_NVM_EXPRESS_PASS_THRU_MODE;
//
// If this bit is set, then the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL interface is
// for directly addressable namespaces.
//
#define EFI_NVM_EXPRESS_PASS_THRU_ATTRIBUTES_PHYSICAL 0x0001
//
// If this bit is set, then the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL interface is
// for a single volume logical namespace comprised of multiple namespaces.
//
#define EFI_NVM_EXPRESS_PASS_THRU_ATTRIBUTES_LOGICAL 0x0002
//
// If this bit is set, then the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL interface
// supports non-blocking I/O.
//
#define EFI_NVM_EXPRESS_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004
//
// If this bit is set, then the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL interface
// supports NVM command set.
//
#define EFI_NVM_EXPRESS_PASS_THRU_ATTRIBUTES_CMD_SET_NVM 0x0008
//
// FusedOperation
//
#define NORMAL_CMD 0x00
#define FUSED_FIRST_CMD 0x01
#define FUSED_SECOND_CMD 0x02
typedef struct {
UINT32 Opcode:8;
UINT32 FusedOperation:2;
UINT32 Reserved:22;
} NVME_CDW0;
//
// Flags
//
#define CDW2_VALID 0x01
#define CDW3_VALID 0x02
#define CDW10_VALID 0x04
#define CDW11_VALID 0x08
#define CDW12_VALID 0x10
#define CDW13_VALID 0x20
#define CDW14_VALID 0x40
#define CDW15_VALID 0x80
//
// Queue Type
//
#define NVME_ADMIN_QUEUE 0x00
#define NVME_IO_QUEUE 0x01
typedef struct {
NVME_CDW0 Cdw0;
UINT8 Flags;
UINT32 Nsid;
UINT32 Cdw2;
UINT32 Cdw3;
UINT32 Cdw10;
UINT32 Cdw11;
UINT32 Cdw12;
UINT32 Cdw13;
UINT32 Cdw14;
UINT32 Cdw15;
} EFI_NVM_EXPRESS_COMMAND;
typedef struct {
UINT32 DW0;
UINT32 DW1;
UINT32 DW2;
UINT32 DW3;
} EFI_NVM_EXPRESS_COMPLETION;
typedef struct {
UINT64 CommandTimeout;
VOID *TransferBuffer;
UINT32 TransferLength;
VOID *MetadataBuffer;
UINT32 MetadataLength;
UINT8 QueueType;
EFI_NVM_EXPRESS_COMMAND *NvmeCmd;
EFI_NVM_EXPRESS_COMPLETION *NvmeCompletion;
} EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET;
//
// Protocol function prototypes
//
/**
Sends an NVM Express Command Packet to an NVM Express controller or namespace. This function supports
both blocking I/O and non-blocking I/O. The blocking I/O functionality is required, and the non-blocking
I/O functionality is optional.
@param[in] This A pointer to the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL instance.
@param[in] NamespaceId A 32 bit namespace ID as defined in the NVMe specification to which the NVM Express Command
Packet will be sent. A value of 0 denotes the NVM Express controller, a value of all 0xFF's
(all bytes are 0xFF) in the namespace ID specifies that the command packet should be sent to
all valid namespaces.
@param[in,out] Packet A pointer to the NVM Express Command Packet.
@param[in] Event If non-blocking I/O is not supported then Event is ignored, and blocking I/O is performed.
If Event is NULL, then blocking I/O is performed. If Event is not NULL and non-blocking I/O
is supported, then non-blocking I/O is performed, and Event will be signaled when the NVM
Express Command Packet completes.
@retval EFI_SUCCESS The NVM Express Command Packet was sent by the host. TransferLength bytes were transferred
to, or from DataBuffer.
@retval EFI_BAD_BUFFER_SIZE The NVM Express Command Packet was not executed. The number of bytes that could be transferred
is returned in TransferLength.
@retval EFI_NOT_READY The NVM Express Command Packet could not be sent because the controller is not ready. The caller
may retry again later.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send the NVM Express Command Packet.
@retval EFI_INVALID_PARAMETER NamespaceId or the contents of EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET are invalid. The NVM
Express Command Packet was not sent, so no additional status information is available.
@retval EFI_UNSUPPORTED The command described by the NVM Express Command Packet is not supported by the NVM Express
controller. The NVM Express Command Packet was not sent so no additional status information
is available.
@retval EFI_TIMEOUT A timeout occurred while waiting for the NVM Express Command Packet to execute.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_NVM_EXPRESS_PASS_THRU_PASSTHRU)(
IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL *This,
IN UINT32 NamespaceId,
IN OUT EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET *Packet,
IN EFI_EVENT Event OPTIONAL
);
/**
Used to retrieve the next namespace ID for this NVM Express controller.
The EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL.GetNextNamespace() function retrieves the next valid
namespace ID on this NVM Express controller.
If on input the value pointed to by NamespaceId is 0xFFFFFFFF, then the first valid namespace
ID defined on the NVM Express controller is returned in the location pointed to by NamespaceId
and a status of EFI_SUCCESS is returned.
If on input the value pointed to by NamespaceId is an invalid namespace ID other than 0xFFFFFFFF,
then EFI_INVALID_PARAMETER is returned.
If on input the value pointed to by NamespaceId is a valid namespace ID, then the next valid
namespace ID on the NVM Express controller is returned in the location pointed to by NamespaceId,
and EFI_SUCCESS is returned.
If the value pointed to by NamespaceId is the namespace ID of the last namespace on the NVM
Express controller, then EFI_NOT_FOUND is returned.
@param[in] This A pointer to the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL instance.
@param[in,out] NamespaceId On input, a pointer to a legal NamespaceId for an NVM Express
namespace present on the NVM Express controller. On output, a
pointer to the next NamespaceId of an NVM Express namespace on
an NVM Express controller. An input value of 0xFFFFFFFF retrieves
the first NamespaceId for an NVM Express namespace present on an
NVM Express controller.
@retval EFI_SUCCESS The Namespace ID of the next Namespace was returned.
@retval EFI_NOT_FOUND There are no more namespaces defined on this controller.
@retval EFI_INVALID_PARAMETER NamespaceId is an invalid value other than 0xFFFFFFFF.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_NVM_EXPRESS_PASS_THRU_GET_NEXT_NAMESPACE)(
IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL *This,
IN OUT UINT32 *NamespaceId
);
/**
Used to allocate and build a device path node for an NVM Express namespace on an NVM Express controller.
The EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL.BuildDevicePath() function allocates and builds a single device
path node for the NVM Express namespace specified by NamespaceId.
If the NamespaceId is not valid, then EFI_NOT_FOUND is returned.
If DevicePath is NULL, then EFI_INVALID_PARAMETER is returned.
If there are not enough resources to allocate the device path node, then EFI_OUT_OF_RESOURCES is returned.
Otherwise, DevicePath is allocated with the boot service AllocatePool(), the contents of DevicePath are
initialized to describe the NVM Express namespace specified by NamespaceId, and EFI_SUCCESS is returned.
@param[in] This A pointer to the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL instance.
@param[in] NamespaceId The NVM Express namespace ID for which a device path node is to be
allocated and built. Caller must set the NamespaceId to zero if the
device path node will contain a valid UUID.
@param[in,out] DevicePath A pointer to a single device path node that describes the NVM Express
namespace specified by NamespaceId. This function is responsible for
allocating the buffer DevicePath with the boot service AllocatePool().
It is the caller's responsibility to free DevicePath when the caller
is finished with DevicePath.
@retval EFI_SUCCESS The device path node that describes the NVM Express namespace specified
by NamespaceId was allocated and returned in DevicePath.
@retval EFI_NOT_FOUND The NamespaceId is not valid.
@retval EFI_INVALID_PARAMETER DevicePath is NULL.
@retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate the DevicePath node.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_NVM_EXPRESS_PASS_THRU_BUILD_DEVICE_PATH)(
IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL *This,
IN UINT32 NamespaceId,
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
);
/**
Used to translate a device path node to a namespace ID.
The EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL.GetNamespace() function determines the namespace ID associated with the
namespace described by DevicePath.
If DevicePath is a device path node type that the NVM Express Pass Thru driver supports, then the NVM Express
Pass Thru driver will attempt to translate the contents DevicePath into a namespace ID.
If this translation is successful, then that namespace ID is returned in NamespaceId, and EFI_SUCCESS is returned
@param[in] This A pointer to the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL instance.
@param[in] DevicePath A pointer to the device path node that describes an NVM Express namespace on
the NVM Express controller.
@param[out] NamespaceId The NVM Express namespace ID contained in the device path node.
@retval EFI_SUCCESS DevicePath was successfully translated to NamespaceId.
@retval EFI_INVALID_PARAMETER If DevicePath or NamespaceId are NULL, then EFI_INVALID_PARAMETER is returned.
@retval EFI_UNSUPPORTED If DevicePath is not a device path node type that the NVM Express Pass Thru driver
supports, then EFI_UNSUPPORTED is returned.
@retval EFI_NOT_FOUND If DevicePath is a device path node type that the NVM Express Pass Thru driver
supports, but there is not a valid translation from DevicePath to a namespace ID,
then EFI_NOT_FOUND is returned.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_NVM_EXPRESS_PASS_THRU_GET_NAMESPACE)(
IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
OUT UINT32 *NamespaceId
);
//
// Protocol Interface Structure
//
struct _EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL {
EFI_NVM_EXPRESS_PASS_THRU_MODE *Mode;
EFI_NVM_EXPRESS_PASS_THRU_PASSTHRU PassThru;
EFI_NVM_EXPRESS_PASS_THRU_GET_NEXT_NAMESPACE GetNextNamespace;
EFI_NVM_EXPRESS_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;
EFI_NVM_EXPRESS_PASS_THRU_GET_NAMESPACE GetNamespace;
};
extern EFI_GUID gEfiNvmExpressPassThruProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PartitionInfo.h
================================================
/** @file
This file defines the EFI Partition Information Protocol.
Copyright (c) 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is introduced in UEFI Specification 2.7
**/
#ifndef __PARTITION_INFO_PROTOCOL_H__
#define __PARTITION_INFO_PROTOCOL_H__
#include
#include
//
// EFI Partition Information Protocol GUID value
//
#define EFI_PARTITION_INFO_PROTOCOL_GUID \
{ 0x8cf2f62c, 0xbc9b, 0x4821, { 0x80, 0x8d, 0xec, 0x9e, 0xc4, 0x21, 0xa1, 0xa0 }};
#define EFI_PARTITION_INFO_PROTOCOL_REVISION 0x0001000
#define PARTITION_TYPE_OTHER 0x00
#define PARTITION_TYPE_MBR 0x01
#define PARTITION_TYPE_GPT 0x02
#pragma pack(1)
///
/// Partition Information Protocol structure.
///
typedef struct {
//
// Set to EFI_PARTITION_INFO_PROTOCOL_REVISION.
//
UINT32 Revision;
//
// Partition info type (PARTITION_TYPE_MBR, PARTITION_TYPE_GPT, or PARTITION_TYPE_OTHER).
//
UINT32 Type;
//
// If 1, partition describes an EFI System Partition.
//
UINT8 System;
UINT8 Reserved[7];
union {
///
/// MBR data
///
MBR_PARTITION_RECORD Mbr;
///
/// GPT data
///
EFI_PARTITION_ENTRY Gpt;
} Info;
} EFI_PARTITION_INFO_PROTOCOL;
#pragma pack()
///
/// Partition Information Protocol GUID variable.
///
extern EFI_GUID gEfiPartitionInfoProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/Pcd.h
================================================
/** @file
Native Platform Configuration Database (PCD) Protocol
Different with the EFI_PCD_PROTOCOL defined in PI 1.2 specification, the native
PCD protocol provide interfaces for dynamic and dynamic-ex type PCD.
The interfaces in dynamic type PCD do not require the token space guid as parameter,
but interfaces in dynamic-ex type PCD require token space guid as parameter.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol was introduced in PI Specification 1.2.
**/
#ifndef __PCD_H__
#define __PCD_H__
extern EFI_GUID gPcdProtocolGuid;
#define PCD_PROTOCOL_GUID \
{ 0x11b34006, 0xd85b, 0x4d0a, { 0xa2, 0x90, 0xd5, 0xa5, 0x71, 0x31, 0xe, 0xf7 } }
#define PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)
/**
Sets the SKU value for subsequent calls to set or get PCD token values.
SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
SetSku() is normally called only once by the system.
For each item (token), the database can hold a single value that applies to all SKUs,
or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
SKU-specific values are called SKU enabled.
The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
set for that Id, the results are unpredictable.
@param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
set values associated with a PCD token.
**/
typedef
VOID
(EFIAPI *PCD_PROTOCOL_SET_SKU)(
IN UINTN SkuId
);
/**
Retrieves an 8-bit value for a given PCD token.
Retrieves the current byte-sized value for a PCD token number.
If the TokenNumber is invalid, the results are unpredictable.
@param[in] TokenNumber The PCD token number.
@return The UINT8 value.
**/
typedef
UINT8
(EFIAPI *PCD_PROTOCOL_GET8)(
IN UINTN TokenNumber
);
/**
Retrieves a 16-bit value for a given PCD token.
Retrieves the current 16-bit value for a PCD token number.
If the TokenNumber is invalid, the results are unpredictable.
@param[in] TokenNumber The PCD token number.
@return The UINT16 value.
**/
typedef
UINT16
(EFIAPI *PCD_PROTOCOL_GET16)(
IN UINTN TokenNumber
);
/**
Retrieves a 32-bit value for a given PCD token.
Retrieves the current 32-bit value for a PCD token number.
If the TokenNumber is invalid, the results are unpredictable.
@param[in] TokenNumber The PCD token number.
@return The UINT32 value.
**/
typedef
UINT32
(EFIAPI *PCD_PROTOCOL_GET32)(
IN UINTN TokenNumber
);
/**
Retrieves a 64-bit value for a given PCD token.
Retrieves the current 64-bit value for a PCD token number.
If the TokenNumber is invalid, the results are unpredictable.
@param[in] TokenNumber The PCD token number.
@return The UINT64 value.
**/
typedef
UINT64
(EFIAPI *PCD_PROTOCOL_GET64)(
IN UINTN TokenNumber
);
/**
Retrieves a pointer to a value for a given PCD token.
Retrieves the current pointer to the buffer for a PCD token number.
Do not make any assumptions about the alignment of the pointer that
is returned by this function call. If the TokenNumber is invalid,
the results are unpredictable.
@param[in] TokenNumber The PCD token number.
@return The pointer to the buffer to be retrived.
**/
typedef
VOID *
(EFIAPI *PCD_PROTOCOL_GET_POINTER)(
IN UINTN TokenNumber
);
/**
Retrieves a Boolean value for a given PCD token.
Retrieves the current boolean value for a PCD token number.
Do not make any assumptions about the alignment of the pointer that
is returned by this function call. If the TokenNumber is invalid,
the results are unpredictable.
@param[in] TokenNumber The PCD token number.
@return The Boolean value.
**/
typedef
BOOLEAN
(EFIAPI *PCD_PROTOCOL_GET_BOOLEAN)(
IN UINTN TokenNumber
);
/**
Retrieves the size of the value for a given PCD token.
Retrieves the current size of a particular PCD token.
If the TokenNumber is invalid, the results are unpredictable.
@param[in] TokenNumber The PCD token number.
@return The size of the value for the PCD token.
**/
typedef
UINTN
(EFIAPI *PCD_PROTOCOL_GET_SIZE)(
IN UINTN TokenNumber
);
/**
Retrieves an 8-bit value for a given PCD token.
Retrieves the 8-bit value of a particular PCD token.
If the TokenNumber is invalid or the token space
specified by Guid does not exist, the results are
unpredictable.
@param[in] Guid The token space for the token number.
@param[in] TokenNumber The PCD token number.
@return The size 8-bit value for the PCD token.
**/
typedef
UINT8
(EFIAPI *PCD_PROTOCOL_GET_EX_8)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Retrieves a 16-bit value for a given PCD token.
Retrieves the 16-bit value of a particular PCD token.
If the TokenNumber is invalid or the token space
specified by Guid does not exist, the results are
unpredictable.
@param[in] Guid The token space for the token number.
@param[in] TokenNumber The PCD token number.
@return The size 16-bit value for the PCD token.
**/
typedef
UINT16
(EFIAPI *PCD_PROTOCOL_GET_EX_16)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Retrieves a 32-bit value for a given PCD token.
Retrieves the 32-bit value of a particular PCD token.
If the TokenNumber is invalid or the token space
specified by Guid does not exist, the results are
unpredictable.
@param[in] Guid The token space for the token number.
@param[in] TokenNumber The PCD token number.
@return The size 32-bit value for the PCD token.
**/
typedef
UINT32
(EFIAPI *PCD_PROTOCOL_GET_EX_32)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Retrieves an 64-bit value for a given PCD token.
Retrieves the 64-bit value of a particular PCD token.
If the TokenNumber is invalid or the token space
specified by Guid does not exist, the results are
unpredictable.
@param[in] Guid The token space for the token number.
@param[in] TokenNumber The PCD token number.
@return The size 64-bit value for the PCD token.
**/
typedef
UINT64
(EFIAPI *PCD_PROTOCOL_GET_EX_64)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Retrieves a pointer to a value for a given PCD token.
Retrieves the current pointer to the buffer for a PCD token number.
Do not make any assumptions about the alignment of the pointer that
is returned by this function call. If the TokenNumber is invalid,
the results are unpredictable.
@param[in] Guid The token space for the token number.
@param[in] TokenNumber The PCD token number.
@return The pointer to the buffer to be retrieved.
**/
typedef
VOID *
(EFIAPI *PCD_PROTOCOL_GET_EX_POINTER)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Retrieves a Boolean value for a given PCD token.
Retrieves the Boolean value of a particular PCD token.
If the TokenNumber is invalid or the token space
specified by Guid does not exist, the results are
unpredictable.
@param[in] Guid The token space for the token number.
@param[in] TokenNumber The PCD token number.
@return The size Boolean value for the PCD token.
**/
typedef
BOOLEAN
(EFIAPI *PCD_PROTOCOL_GET_EX_BOOLEAN)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Retrieves the size of the value for a given PCD token.
Retrieves the current size of a particular PCD token.
If the TokenNumber is invalid, the results are unpredictable.
@param[in] Guid The token space for the token number.
@param[in] TokenNumber The PCD token number.
@return The size of the value for the PCD token.
**/
typedef
UINTN
(EFIAPI *PCD_PROTOCOL_GET_EX_SIZE)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Sets an 8-bit value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the
size of the value being set is compatible with the Token's existing definition.
If it is not, an error will be returned.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The procedure returned successfully.
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
being set was incompatible with a call to this function.
Use GetSize() to retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET8)(
IN UINTN TokenNumber,
IN UINT8 Value
);
/**
Sets a 16-bit value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the
size of the value being set is compatible with the Token's existing definition.
If it is not, an error will be returned.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The procedure returned successfully.
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
being set was incompatible with a call to this function.
Use GetSize() to retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET16)(
IN UINTN TokenNumber,
IN UINT16 Value
);
/**
Sets a 32-bit value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the
size of the value being set is compatible with the Token's existing definition.
If it is not, an error will be returned.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The procedure returned successfully.
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
being set was incompatible with a call to this function.
Use GetSize() to retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET32)(
IN UINTN TokenNumber,
IN UINT32 Value
);
/**
Sets a 64-bit value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the
size of the value being set is compatible with the Token's existing definition.
If it is not, an error will be returned.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The procedure returned successfully.
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
being set was incompatible with a call to this function.
Use GetSize() to retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET64)(
IN UINTN TokenNumber,
IN UINT64 Value
);
/**
Sets a value of a specified size for a given PCD token.
When the PCD service sets a value, it will check to ensure that the
size of the value being set is compatible with the Token's existing definition.
If it is not, an error will be returned.
@param[in] TokenNumber The PCD token number.
@param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
On input, if the SizeOfValue is greater than the maximum size supported
for this TokenNumber then the output value of SizeOfValue will reflect
the maximum size supported for this TokenNumber.
@param[in] Buffer The buffer to set for the PCD token.
@retval EFI_SUCCESS The procedure returned successfully.
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
being set was incompatible with a call to this function.
Use GetSize() to retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_POINTER)(
IN UINTN TokenNumber,
IN OUT UINTN *SizeOfBuffer,
IN VOID *Buffer
);
/**
Sets a Boolean value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the
size of the value being set is compatible with the Token's existing definition.
If it is not, an error will be returned.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The procedure returned successfully.
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
being set was incompatible with a call to this function.
Use GetSize() to retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_BOOLEAN)(
IN UINTN TokenNumber,
IN BOOLEAN Value
);
/**
Sets an 8-bit value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the
size of the value being set is compatible with the Token's existing definition.
If it is not, an error will be returned.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The procedure returned successfully.
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
being set was incompatible with a call to this function.
Use GetSize() to retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_EX_8)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
IN UINT8 Value
);
/**
Sets an 16-bit value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the
size of the value being set is compatible with the Token's existing definition.
If it is not, an error will be returned.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The procedure returned successfully.
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
being set was incompatible with a call to this function.
Use GetSize() to retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_EX_16)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
IN UINT16 Value
);
/**
Sets a 32-bit value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the
size of the value being set is compatible with the Token's existing definition.
If it is not, an error will be returned.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The procedure returned successfully.
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
being set was incompatible with a call to this function.
Use GetSize() to retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_EX_32)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
IN UINT32 Value
);
/**
Sets a 64-bit value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the
size of the value being set is compatible with the Token's existing definition.
If it is not, an error will be returned.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The procedure returned successfully.
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
being set was incompatible with a call to this function.
Use GetSize() to retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_EX_64)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
IN UINT64 Value
);
/**
Sets a value of a specified size for a given PCD token.
When the PCD service sets a value, it will check to ensure that the
size of the value being set is compatible with the Token's existing definition.
If it is not, an error will be returned.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
On input, if the SizeOfValue is greater than the maximum size supported
for this TokenNumber then the output value of SizeOfValue will reflect
the maximum size supported for this TokenNumber.
@param[in] Buffer The buffer to set for the PCD token.
@retval EFI_SUCCESS The procedure returned successfully.
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
being set was incompatible with a call to this function.
Use GetSize() to retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_EX_POINTER)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
IN OUT UINTN *SizeOfBuffer,
IN VOID *Buffer
);
/**
Sets a Boolean value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the
size of the value being set is compatible with the Token's existing definition.
If it is not, an error will be returned.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The procedure returned successfully.
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
being set was incompatible with a call to this function.
Use GetSize() to retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_EX_BOOLEAN)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
IN BOOLEAN Value
);
/**
Callback on SET function prototype definition.
This notification function serves two purposes.
Firstly, it notifies the module which did the registration that the value
of this PCD token has been set. Secondly, it provides a mechanism for the
module that did the registration to intercept the set operation and override
the value that has been set, if necessary. After the invocation of the callback function,
TokenData will be used by PCD service DXE driver to modify the internal data in
PCD database.
@param[in] CallBackGuid The PCD token GUID being set.
@param[in] CallBackToken The PCD token number being set.
@param[in, out] TokenData A pointer to the token data being set.
@param[in] TokenDataSize The size, in bytes, of the data being set.
@retval VOID
**/
typedef
VOID
(EFIAPI *PCD_PROTOCOL_CALLBACK)(
IN CONST EFI_GUID *CallBackGuid, OPTIONAL
IN UINTN CallBackToken,
IN OUT VOID *TokenData,
IN UINTN TokenDataSize
);
/**
Specifies a function to be called anytime the value of a designated token is changed.
@param[in] TokenNumber The PCD token number.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
@retval EFI_SUCCESS The PCD service has successfully established a call event
for the CallBackToken requested.
@retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_CALLBACK_ONSET)(
IN CONST EFI_GUID *Guid, OPTIONAL
IN UINTN TokenNumber,
IN PCD_PROTOCOL_CALLBACK CallBackFunction
);
/**
Cancels a previously set callback function for a particular PCD token number.
@param[in] TokenNumber The PCD token number.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
@retval EFI_SUCCESS The PCD service has successfully established a call event
for the CallBackToken requested.
@retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_CANCEL_CALLBACK)(
IN CONST EFI_GUID *Guid, OPTIONAL
IN UINTN TokenNumber,
IN PCD_PROTOCOL_CALLBACK CallBackFunction
);
/**
Retrieves the next valid token number in a given namespace.
This is useful since the PCD infrastructure contains a sparse list of token numbers,
and one cannot a priori know what token numbers are valid in the database.
If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.
If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.
The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.
If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.
If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.
If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.
@param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.
This is an optional parameter that may be NULL. If this parameter is NULL, then a request is
being made to retrieve tokens from the default token space.
@param[in,out] TokenNumber
A pointer to the PCD token number to use to find the subsequent token number.
@retval EFI_SUCCESS The PCD service has retrieved the next valid token number.
@retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKEN)(
IN CONST EFI_GUID *Guid, OPTIONAL
IN OUT UINTN *TokenNumber
);
/**
Retrieves the next valid PCD token namespace for a given namespace.
Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
token namespaces on a platform.
@param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token namespace
from which the search will start. On output, it designates the next valid token
namespace on the platform. If *Guid is NULL, then the GUID of the first token
space of the current platform is returned. If the search cannot locate the next valid
token namespace, an error is returned and the value of *Guid is undefined.
@retval EFI_SUCCESS The PCD service retrieved the value requested.
@retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.
**/
typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKENSPACE)(
IN OUT CONST EFI_GUID **Guid
);
///
/// This service abstracts the ability to set/get Platform Configuration Database (PCD).
///
typedef struct {
PCD_PROTOCOL_SET_SKU SetSku;
PCD_PROTOCOL_GET8 Get8;
PCD_PROTOCOL_GET16 Get16;
PCD_PROTOCOL_GET32 Get32;
PCD_PROTOCOL_GET64 Get64;
PCD_PROTOCOL_GET_POINTER GetPtr;
PCD_PROTOCOL_GET_BOOLEAN GetBool;
PCD_PROTOCOL_GET_SIZE GetSize;
PCD_PROTOCOL_GET_EX_8 Get8Ex;
PCD_PROTOCOL_GET_EX_16 Get16Ex;
PCD_PROTOCOL_GET_EX_32 Get32Ex;
PCD_PROTOCOL_GET_EX_64 Get64Ex;
PCD_PROTOCOL_GET_EX_POINTER GetPtrEx;
PCD_PROTOCOL_GET_EX_BOOLEAN GetBoolEx;
PCD_PROTOCOL_GET_EX_SIZE GetSizeEx;
PCD_PROTOCOL_SET8 Set8;
PCD_PROTOCOL_SET16 Set16;
PCD_PROTOCOL_SET32 Set32;
PCD_PROTOCOL_SET64 Set64;
PCD_PROTOCOL_SET_POINTER SetPtr;
PCD_PROTOCOL_SET_BOOLEAN SetBool;
PCD_PROTOCOL_SET_EX_8 Set8Ex;
PCD_PROTOCOL_SET_EX_16 Set16Ex;
PCD_PROTOCOL_SET_EX_32 Set32Ex;
PCD_PROTOCOL_SET_EX_64 Set64Ex;
PCD_PROTOCOL_SET_EX_POINTER SetPtrEx;
PCD_PROTOCOL_SET_EX_BOOLEAN SetBoolEx;
PCD_PROTOCOL_CALLBACK_ONSET CallbackOnSet;
PCD_PROTOCOL_CANCEL_CALLBACK CancelCallback;
PCD_PROTOCOL_GET_NEXT_TOKEN GetNextToken;
PCD_PROTOCOL_GET_NEXT_TOKENSPACE GetNextTokenSpace;
} PCD_PROTOCOL;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PcdInfo.h
================================================
/** @file
Native Platform Configuration Database (PCD) INFO PROTOCOL.
The protocol that provides additional information about items that reside in the PCD database.
Different with the EFI_GET_PCD_INFO_PROTOCOL defined in PI 1.2.1 specification,
the native PCD INFO PROTOCOL provide interfaces for dynamic and dynamic-ex type PCD.
The interfaces for dynamic type PCD do not require the token space guid as parameter,
but interfaces for dynamic-ex type PCD require token space guid as parameter.
Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol was introduced in PI Specification 1.2.
**/
#ifndef __PCD_INFO_H__
#define __PCD_INFO_H__
extern EFI_GUID gGetPcdInfoProtocolGuid;
#define GET_PCD_INFO_PROTOCOL_GUID \
{ 0x5be40f57, 0xfa68, 0x4610, { 0xbb, 0xbf, 0xe9, 0xc5, 0xfc, 0xda, 0xd3, 0x65 } }
///
/// The forward declaration for GET_PCD_INFO_PROTOCOL.
///
typedef struct _GET_PCD_INFO_PROTOCOL GET_PCD_INFO_PROTOCOL;
/**
Retrieve additional information associated with a PCD token.
This includes information such as the type of value the TokenNumber is associated with as well as possible
human readable name that is associated with the token.
@param[in] TokenNumber The PCD token number.
@param[out] PcdInfo The returned information associated with the requested TokenNumber.
@retval EFI_SUCCESS The PCD information was returned successfully
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *GET_PCD_INFO_PROTOCOL_GET_INFO) (
IN UINTN TokenNumber,
OUT EFI_PCD_INFO *PcdInfo
);
/**
Retrieve additional information associated with a PCD token.
This includes information such as the type of value the TokenNumber is associated with as well as possible
human readable name that is associated with the token.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[out] PcdInfo The returned information associated with the requested TokenNumber.
@retval EFI_SUCCESS The PCD information was returned successfully
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *GET_PCD_INFO_PROTOCOL_GET_INFO_EX) (
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
OUT EFI_PCD_INFO *PcdInfo
);
/**
Retrieve the currently set SKU Id.
@return The currently set SKU Id. If the platform has not set at a SKU Id, then the
default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
Id is returned.
**/
typedef
UINTN
(EFIAPI *GET_PCD_INFO_PROTOCOL_GET_SKU) (
VOID
);
///
/// This is the PCD service to use when querying for some additional data that can be contained in the
/// PCD database.
///
struct _GET_PCD_INFO_PROTOCOL {
///
/// Retrieve additional information associated with a PCD.
///
GET_PCD_INFO_PROTOCOL_GET_INFO GetInfo;
GET_PCD_INFO_PROTOCOL_GET_INFO_EX GetInfoEx;
///
/// Retrieve the currently set SKU Id.
///
GET_PCD_INFO_PROTOCOL_GET_SKU GetSku;
};
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PciEnumerationComplete.h
================================================
/** @file
PCI Enumeration Complete Protocol as defined in the PI 1.1 specification.
This protocol indicates that pci enumeration complete
Copyright (c) 2009, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is defined in UEFI Platform Initialization Specification 1.2
Volume 5: Standards
**/
#ifndef _PCI_ENUMERATION_COMPLETE_H_
#define _PCI_ENUMERATION_COMPLETE_H_
#define EFI_PCI_ENUMERATION_COMPLETE_GUID \
{ \
0x30cfe3e7, 0x3de1, 0x4586, { 0xbe, 0x20, 0xde, 0xab, 0xa1, 0xb3, 0xb7, 0x93 } \
}
extern EFI_GUID gEfiPciEnumerationCompleteProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PciHostBridgeResourceAllocation.h
================================================
/** @file
This file declares PCI Host Bridge Resource Allocation Protocol which
provides the basic interfaces to abstract a PCI host bridge resource allocation.
This protocol is mandatory if the system includes PCI devices.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is defined in UEFI Platform Initialization Specification 1.2
Volume 5: Standards.
**/
#ifndef _PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_H_
#define _PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_H_
//
// This file must be included because EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
// uses EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS
//
#include
///
/// Global ID for the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
///
#define EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GUID \
{ \
0xCF8034BE, 0x6768, 0x4d8b, {0xB7,0x39,0x7C,0xCE,0x68,0x3A,0x9F,0xBE } \
}
///
/// Forward declaration for EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
///
typedef struct _EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL;
/// If this bit is set, then the PCI Root Bridge does not
/// support separate windows for Non-prefetchable and Prefetchable
/// memory. A PCI bus driver needs to include requests for Prefetchable
/// memory in the Non-prefetchable memory pool.
///
#define EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM 1
///
/// If this bit is set, then the PCI Root Bridge supports
/// 64 bit memory windows. If this bit is not set,
/// the PCI bus driver needs to include requests for 64 bit
/// memory address in the corresponding 32 bit memory pool.
///
#define EFI_PCI_HOST_BRIDGE_MEM64_DECODE 2
///
/// A UINT64 value that contains the status of a PCI resource requested
/// in the Configuration parameter returned by GetProposedResources()
/// The legal values are EFI_RESOURCE_SATISFIED and EFI_RESOURCE_NOT_SATISFIED
///
typedef UINT64 EFI_RESOURCE_ALLOCATION_STATUS;
///
/// The request of this resource type could be fulfilled. Used in the
/// Configuration parameter returned by GetProposedResources() to identify
/// a PCI resources request that can be satisfied.
///
#define EFI_RESOURCE_SATISFIED 0x0000000000000000ULL
///
/// The request of this resource type could not be fulfilled for its
/// absence in the host bridge resource pool. Used in the Configuration parameter
/// returned by GetProposedResources() to identify a PCI resources request that
/// can not be satisfied.
///
#define EFI_RESOURCE_NOT_SATISFIED 0xFFFFFFFFFFFFFFFFULL
///
/// This enum is used to specify the phase of the PCI enumaeration process.
///
typedef enum {
///
/// Reset the host bridge PCI apertures and internal data structures.
/// PCI enumerator should issue this notification before starting fresh
/// enumeration process. Enumeration cannot be restarted after sending
/// any other notification such as EfiPciHostBridgeBeginBusAllocation.
///
EfiPciHostBridgeBeginEnumeration,
///
/// The bus allocation phase is about to begin. No specific action
/// is required here. This notification can be used to perform any
/// chipset specific programming.
///
EfiPciHostBridgeBeginBusAllocation,
///
/// The bus allocation and bus programming phase is complete. No specific
/// action is required here. This notification can be used to perform any
/// chipset specific programming.
///
EfiPciHostBridgeEndBusAllocation,
///
/// The resource allocation phase is about to begin.No specific action is
/// required here. This notification can be used to perform any chipset specific programming.
///
EfiPciHostBridgeBeginResourceAllocation,
///
/// Allocate resources per previously submitted requests for all the PCI Root
/// Bridges. These resource settings are returned on the next call to
/// GetProposedResources().
///
EfiPciHostBridgeAllocateResources,
///
/// Program the Host Bridge hardware to decode previously allocated resources
/// (proposed resources) for all the PCI Root Bridges.
///
EfiPciHostBridgeSetResources,
///
/// De-allocate previously allocated resources previously for all the PCI
/// Root Bridges and reset the I/O and memory apertures to initial state.
///
EfiPciHostBridgeFreeResources,
///
/// The resource allocation phase is completed. No specific action is required
/// here. This notification can be used to perform any chipset specific programming.
///
EfiPciHostBridgeEndResourceAllocation,
///
/// The Host Bridge Enumeration is completed. No specific action is required here.
/// This notification can be used to perform any chipset specific programming.
///
EfiPciHostBridgeEndEnumeration,
EfiMaxPciHostBridgeEnumerationPhase
} EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE;
///
/// Definitions of 2 notification points.
///
typedef enum {
///
/// This notification is only applicable to PCI-PCI bridges and
/// indicates that the PCI enumerator is about to begin enumerating
/// the bus behind the PCI-PCI Bridge. This notification is sent after
/// the primary bus number, the secondary bus number and the subordinate
/// bus number registers in the PCI-PCI Bridge are programmed to valid
/// (not necessary final) values
///
EfiPciBeforeChildBusEnumeration,
///
/// This notification is sent before the PCI enumerator probes BAR registers
/// for every valid PCI function.
///
EfiPciBeforeResourceCollection
} EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE;
/**
These are the notifications from the PCI bus driver that it is about to enter a certain phase of the PCI
enumeration process.
@param[in] This The pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
instance.
@param[in] Phase The phase during enumeration.
@retval EFI_SUCCESS The notification was accepted without any errors.
@retval EFI_INVALID_PARAMETER The Phase is invalid.
@retval EFI_NOT_READY This phase cannot be entered at this time. For example, this error
is valid for a Phase of EfiPciHostBridgeAllocateResources if
SubmitResources() has not been called for one or more
PCI root bridges before this call.
@retval EFI_DEVICE_ERROR Programming failed due to a hardware error. This error is valid for
a Phase of EfiPciHostBridgeSetResources.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
This error is valid for a Phase of EfiPciHostBridgeAllocateResources
if the previously submitted resource requests cannot be fulfilled or were only
partially fulfilled
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_NOTIFY_PHASE)(
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
);
/**
Returns the device handle of the next PCI root bridge that is associated with this host bridge.
@param[in] This The pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
instance.
@param[in,out] RootBridgeHandle Returns the device handle of the next PCI root bridge. On input, it holds the
RootBridgeHandle that was returned by the most recent call to
GetNextRootBridge(). If RootBridgeHandle is NULL on input, the handle
for the first PCI root bridge is returned.
@retval EFI_SUCCESS The requested attribute information was returned.
@retval EFI_INVALID_PARAMETER RootBridgeHandle is not an EFI_HANDLE that was returned
on a previous call to GetNextRootBridge().
@retval EFI_NOT_FOUND There are no more PCI root bridge device handles.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_NEXT_ROOT_BRIDGE)(
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN OUT EFI_HANDLE *RootBridgeHandle
);
/**
Returns the allocation attributes of a PCI root bridge.
@param[in] This The pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
instance.
@param[in] RootBridgeHandle The device handle of the PCI root bridge in which the caller is interested.
@param[out] Attribute The pointer to attributes of the PCI root bridge.
@retval EFI_SUCCESS The requested attribute information was returned.
@retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
@retval EFI_INVALID_PARAMETER Attributes is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_ATTRIBUTES)(
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_HANDLE RootBridgeHandle,
OUT UINT64 *Attributes
);
/**
Sets up the specified PCI root bridge for the bus enumeration process.
@param[in] This The pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
instance.
@param[in] RootBridgeHandle The PCI root bridge to be set up.
@param[out] Configuration The pointer to the pointer to the PCI bus resource descriptor.
@retval EFI_SUCCESS The PCI root bridge was set up and the bus range was returned in
Configuration.
@retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
@retval EFI_DEVICE_ERROR Programming failed due to a hardware error.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_START_BUS_ENUMERATION)(
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_HANDLE RootBridgeHandle,
OUT VOID **Configuration
);
/**
Programs the PCI root bridge hardware so that it decodes the specified PCI bus range.
@param[in] This The pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
instance.
@param[in] RootBridgeHandle The PCI root bridge whose bus range is to be programmed.
@param[in] Configuration The pointer to the PCI bus resource descriptor.
@retval EFI_SUCCESS The bus range for the PCI root bridge was programmed.
@retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
@retval EFI_INVALID_PARAMETER Configuration is NULL
@retval EFI_INVALID_PARAMETER Configuration does not point to a valid ACPI (2.0 & 3.0)
resource descriptor.
@retval EFI_INVALID_PARAMETER Configuration does not include a valid ACPI 2.0 bus resource
descriptor.
@retval EFI_INVALID_PARAMETER Configuration includes valid ACPI (2.0 & 3.0) resource
descriptors other than bus descriptors.
@retval EFI_INVALID_PARAMETER Configuration contains one or more invalid ACPI resource
descriptors.
@retval EFI_INVALID_PARAMETER "Address Range Minimum" is invalid for this root bridge.
@retval EFI_INVALID_PARAMETER "Address Range Length" is invalid for this root bridge.
@retval EFI_DEVICE_ERROR Programming failed due to a hardware error.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_SET_BUS_NUMBERS)(
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_HANDLE RootBridgeHandle,
IN VOID *Configuration
);
/**
Submits the I/O and memory resource requirements for the specified PCI root bridge.
@param[in] This The pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
instance.
@param[in] RootBridgeHandle The PCI root bridge whose I/O and memory resource requirements are being
submitted.
@param[in] Configuration The pointer to the PCI I/O and PCI memory resource descriptor.
@retval EFI_SUCCESS The I/O and memory resource requests for a PCI root bridge were
accepted.
@retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
@retval EFI_INVALID_PARAMETER Configuration is NULL.
@retval EFI_INVALID_PARAMETER Configuration does not point to a valid ACPI (2.0 & 3.0)
resource descriptor.
@retval EFI_INVALID_PARAMETER Configuration includes requests for one or more resource
types that are not supported by this PCI root bridge. This error will
happen if the caller did not combine resources according to
Attributes that were returned by GetAllocAttributes().
@retval EFI_INVALID_PARAMETER "Address Range Maximum" is invalid.
@retval EFI_INVALID_PARAMETER "Address Range Length" is invalid for this PCI root bridge.
@retval EFI_INVALID_PARAMETER "Address Space Granularity" is invalid for this PCI root bridge.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_SUBMIT_RESOURCES)(
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_HANDLE RootBridgeHandle,
IN VOID *Configuration
);
/**
Returns the proposed resource settings for the specified PCI root bridge.
@param[in] This The pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
instance.
@param[in] RootBridgeHandle The PCI root bridge handle.
@param[out] Configuration The pointer to the pointer to the PCI I/O and memory resource descriptor.
@retval EFI_SUCCESS The requested parameters were returned.
@retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
@retval EFI_DEVICE_ERROR Programming failed due to a hardware error.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_PROPOSED_RESOURCES)(
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_HANDLE RootBridgeHandle,
OUT VOID **Configuration
);
/**
Provides the hooks from the PCI bus driver to every PCI controller (device/function) at various
stages of the PCI enumeration process that allow the host bridge driver to preinitialize individual
PCI controllers before enumeration.
@param[in] This The pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
@param[in] RootBridgeHandle The associated PCI root bridge handle.
@param[in] PciAddress The address of the PCI device on the PCI bus.
@param[in] Phase The phase of the PCI device enumeration.
@retval EFI_SUCCESS The requested parameters were returned.
@retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
@retval EFI_INVALID_PARAMETER Phase is not a valid phase that is defined in
EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE.
@retval EFI_DEVICE_ERROR Programming failed due to a hardware error. The PCI enumerator
should not enumerate this device, including its child devices if it is
a PCI-to-PCI bridge.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_PREPROCESS_CONTROLLER)(
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
IN EFI_HANDLE RootBridgeHandle,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
);
///
/// Provides the basic interfaces to abstract a PCI host bridge resource allocation.
///
struct _EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL {
///
/// The notification from the PCI bus enumerator that it is about to enter
/// a certain phase during the enumeration process.
///
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_NOTIFY_PHASE NotifyPhase;
///
/// Retrieves the device handle for the next PCI root bridge that is produced by the
/// host bridge to which this instance of the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL is attached.
///
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_NEXT_ROOT_BRIDGE GetNextRootBridge;
///
/// Retrieves the allocation-related attributes of a PCI root bridge.
///
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_ATTRIBUTES GetAllocAttributes;
///
/// Sets up a PCI root bridge for bus enumeration.
///
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_START_BUS_ENUMERATION StartBusEnumeration;
///
/// Sets up the PCI root bridge so that it decodes a specific range of bus numbers.
///
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_SET_BUS_NUMBERS SetBusNumbers;
///
/// Submits the resource requirements for the specified PCI root bridge.
///
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_SUBMIT_RESOURCES SubmitResources;
///
/// Returns the proposed resource assignment for the specified PCI root bridges.
///
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_PROPOSED_RESOURCES GetProposedResources;
///
/// Provides hooks from the PCI bus driver to every PCI controller
/// (device/function) at various stages of the PCI enumeration process that
/// allow the host bridge driver to preinitialize individual PCI controllers
/// before enumeration.
///
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_PREPROCESS_CONTROLLER PreprocessController;
};
extern EFI_GUID gEfiPciHostBridgeResourceAllocationProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PciHotPlugInit.h
================================================
/** @file
This file declares EFI PCI Hot Plug Init Protocol.
This protocol provides the necessary functionality to initialize the Hot Plug
Controllers (HPCs) and the buses that they control. This protocol also provides
information regarding resource padding.
@par Note:
This protocol is required only on platforms that support one or more PCI Hot
Plug* slots or CardBus sockets.
The EFI_PCI_HOT_PLUG_INIT_PROTOCOL provides a mechanism for the PCI bus enumerator
to properly initialize the HPCs and CardBus sockets that require initialization.
The HPC initialization takes place before the PCI enumeration process is complete.
There cannot be more than one instance of this protocol in a system. This protocol
is installed on its own separate handle.
Because the system may include multiple HPCs, one instance of this protocol
should represent all of them. The protocol functions use the device path of
the HPC to identify the HPC. When the PCI bus enumerator finds a root HPC, it
will call EFI_PCI_HOT_PLUG_INIT_PROTOCOL.InitializeRootHpc(). If InitializeRootHpc()
is unable to initialize a root HPC, the PCI enumerator will ignore that root HPC
and continue the enumeration process. If the HPC is not initialized, the devices
that it controls may not be initialized, and no resource padding will be provided.
From the standpoint of the PCI bus enumerator, HPCs are divided into the following
two classes:
- Root HPC:
These HPCs must be initialized by calling InitializeRootHpc() during the
enumeration process. These HPCs will also require resource padding. The
platform code must have a priori knowledge of these devices and must know
how to initialize them. There may not be any way to access their PCI
configuration space before the PCI enumerator programs all the upstream
bridges and thus enables the path to these devices. The PCI bus enumerator
is responsible for determining the PCI bus address of the HPC before it
calls InitializeRootHpc().
- Nonroot HPC:
These HPCs will not need explicit initialization during enumeration process.
These HPCs will require resource padding. The platform code does not have
to have a priori knowledge of these devices.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is defined in UEFI Platform Initialization Specification 1.2
Volume 5: Standards
**/
#ifndef _EFI_PCI_HOT_PLUG_INIT_H_
#define _EFI_PCI_HOT_PLUG_INIT_H_
///
/// Global ID for the EFI_PCI_HOT_PLUG_INIT_PROTOCOL
///
#define EFI_PCI_HOT_PLUG_INIT_PROTOCOL_GUID \
{ \
0xaa0e8bc1, 0xdabc, 0x46b0, {0xa8, 0x44, 0x37, 0xb8, 0x16, 0x9b, 0x2b, 0xea } \
}
///
/// Forward declaration for EFI_PCI_HOT_PLUG_INIT_PROTOCOL
///
typedef struct _EFI_PCI_HOT_PLUG_INIT_PROTOCOL EFI_PCI_HOT_PLUG_INIT_PROTOCOL;
///
/// Describes the current state of an HPC
///
typedef UINT16 EFI_HPC_STATE;
///
/// The HPC initialization function was called and the HPC completed
/// initialization, but it was not enabled for some reason. The HPC may be
/// disabled in hardware, or it may be disabled due to user preferences,
/// hardware failure, or other reasons. No resource padding is required.
///
#define EFI_HPC_STATE_INITIALIZED 0x01
///
/// The HPC initialization function was called, the HPC completed
/// initialization, and it was enabled. Resource padding is required.
///
#define EFI_HPC_STATE_ENABLED 0x02
///
/// Location definition for PCI Hot Plug Controller
///
typedef struct{
///
///
/// The device path to the root HPC. An HPC cannot control its parent buses.
/// The PCI bus driver requires this information so that it can pass the
/// correct HpcPciAddress to the InitializeRootHpc() and GetResourcePadding()
/// functions.
///
EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath;
///
/// The device path to the Hot Plug Bus (HPB) that is controlled by the root
/// HPC. The PCI bus driver uses this information to check if a particular PCI
/// bus has hot-plug slots. The device path of a PCI bus is the same as the
/// device path of its parent. For Standard(PCI) Hot Plug Controllers (SHPCs)
/// and PCI Express*, HpbDevicePath is the same as HpcDevicePath.
///
EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath;
} EFI_HPC_LOCATION;
///
/// Describes how resource padding should be applied
///
typedef enum {
///
/// Apply the padding at a PCI bus level. In other words, the resources
/// that are allocated to the bus containing hot-plug slots are padded by
/// the specified amount. If the hot-plug bus is behind a PCI-to-PCI
/// bridge, the PCI-to-PCI bridge apertures will indicate the padding
///
EfiPaddingPciBus,
///
/// Apply the padding at a PCI root bridge level. If a PCI root bridge
/// includes more than one hot-plug bus, the resource padding requests
/// for these buses are added together and the resources that are
/// allocated to the root bridge are padded by the specified amount. This
/// strategy may reduce the total amount of padding, but requires
/// reprogramming of PCI-to-PCI bridges in a hot-add event. If the hotplug
/// bus is behind a PCI-to-PCI bridge, the PCI-to-PCI bridge
/// apertures do not indicate the padding for that bus.
///
EfiPaddingPciRootBridge
} EFI_HPC_PADDING_ATTRIBUTES;
/**
Returns a list of root Hot Plug Controllers (HPCs) that require initialization
during the boot process.
This procedure returns a list of root HPCs. The PCI bus driver must initialize
these controllers during the boot process. The PCI bus driver may or may not be
able to detect these HPCs. If the platform includes a PCI-to-CardBus bridge, it
can be included in this list if it requires initialization. The HpcList must be
self consistent. An HPC cannot control any of its parent buses. Only one HPC can
control a PCI bus. Because this list includes only root HPCs, no HPC in the list
can be a child of another HPC. This policy must be enforced by the
EFI_PCI_HOT_PLUG_INIT_PROTOCOL. The PCI bus driver may not check for such
invalid conditions. The callee allocates the buffer HpcList
@param[in] This Pointer to the EFI_PCI_HOT_PLUG_INIT_PROTOCOL instance.
@param[out] HpcCount The number of root HPCs that were returned.
@param[out] HpcList The list of root HPCs. HpcCount defines the number of
elements in this list.
@retval EFI_SUCCESS HpcList was returned.
@retval EFI_OUT_OF_RESOURCES HpcList was not returned due to insufficient
resources.
@retval EFI_INVALID_PARAMETER HpcCount is NULL or HpcList is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_GET_ROOT_HPC_LIST)(
IN EFI_PCI_HOT_PLUG_INIT_PROTOCOL *This,
OUT UINTN *HpcCount,
OUT EFI_HPC_LOCATION **HpcList
);
/**
Initializes one root Hot Plug Controller (HPC). This process may causes
initialization of its subordinate buses.
This function initializes the specified HPC. At the end of initialization,
the hot-plug slots or sockets (controlled by this HPC) are powered and are
connected to the bus. All the necessary registers in the HPC are set up. For
a Standard (PCI) Hot Plug Controller (SHPC), the registers that must be set
up are defined in the PCI Standard Hot Plug Controller and Subsystem
Specification.
@param[in] This Pointer to the EFI_PCI_HOT_PLUG_INIT_PROTOCOL instance.
@param[in] HpcDevicePath The device path to the HPC that is being initialized.
@param[in] HpcPciAddress The address of the HPC function on the PCI bus.
@param[in] Event The event that should be signaled when the HPC
initialization is complete. Set to NULL if the
caller wants to wait until the entire initialization
process is complete.
@param[out] HpcState The state of the HPC hardware. The state is
EFI_HPC_STATE_INITIALIZED or EFI_HPC_STATE_ENABLED.
@retval EFI_SUCCESS If Event is NULL, the specific HPC was successfully
initialized. If Event is not NULL, Event will be
signaled at a later time when initialization is complete.
@retval EFI_UNSUPPORTED This instance of EFI_PCI_HOT_PLUG_INIT_PROTOCOL
does not support the specified HPC.
@retval EFI_OUT_OF_RESOURCES Initialization failed due to insufficient
resources.
@retval EFI_INVALID_PARAMETER HpcState is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_INITIALIZE_ROOT_HPC)(
IN EFI_PCI_HOT_PLUG_INIT_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
IN UINT64 HpcPciAddress,
IN EFI_EVENT Event, OPTIONAL
OUT EFI_HPC_STATE *HpcState
);
/**
Returns the resource padding that is required by the PCI bus that is controlled
by the specified Hot Plug Controller (HPC).
This function returns the resource padding that is required by the PCI bus that
is controlled by the specified HPC. This member function is called for all the
root HPCs and nonroot HPCs that are detected by the PCI bus enumerator. This
function will be called before PCI resource allocation is completed. This function
must be called after all the root HPCs, with the possible exception of a
PCI-to-CardBus bridge, have completed initialization.
@param[in] This Pointer to the EFI_PCI_HOT_PLUG_INIT_PROTOCOL instance.
@param[in] HpcDevicePath The device path to the HPC.
@param[in] HpcPciAddress The address of the HPC function on the PCI bus.
@param[in] HpcState The state of the HPC hardware.
@param[out] Padding The amount of resource padding that is required by the
PCI bus under the control of the specified HPC.
@param[out] Attributes Describes how padding is accounted for. The padding
is returned in the form of ACPI 2.0 resource descriptors.
@retval EFI_SUCCESS The resource padding was successfully returned.
@retval EFI_UNSUPPORTED This instance of the EFI_PCI_HOT_PLUG_INIT_PROTOCOL
does not support the specified HPC.
@retval EFI_NOT_READY This function was called before HPC initialization
is complete.
@retval EFI_INVALID_PARAMETER HpcState or Padding or Attributes is NULL.
@retval EFI_OUT_OF_RESOURCES ACPI 2.0 resource descriptors for Padding
cannot be allocated due to insufficient resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_GET_HOT_PLUG_PADDING)(
IN EFI_PCI_HOT_PLUG_INIT_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
IN UINT64 HpcPciAddress,
OUT EFI_HPC_STATE *HpcState,
OUT VOID **Padding,
OUT EFI_HPC_PADDING_ATTRIBUTES *Attributes
);
///
/// This protocol provides the necessary functionality to initialize the
/// Hot Plug Controllers (HPCs) and the buses that they control. This protocol
/// also provides information regarding resource padding.
///
struct _EFI_PCI_HOT_PLUG_INIT_PROTOCOL {
///
/// Returns a list of root HPCs and the buses that they control.
///
EFI_GET_ROOT_HPC_LIST GetRootHpcList;
///
/// Initializes the specified root HPC.
///
EFI_INITIALIZE_ROOT_HPC InitializeRootHpc;
///
/// Returns the resource padding that is required by the HPC.
///
EFI_GET_HOT_PLUG_PADDING GetResourcePadding;
};
extern EFI_GUID gEfiPciHotPlugInitProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PciHotPlugRequest.h
================================================
/** @file
Provides services to notify the PCI bus driver that some events have happened
in a hot-plug controller (such as a PC Card socket, or PHPC), and to ask the
PCI bus driver to create or destroy handles for PCI-like devices.
A hot-plug capable PCI bus driver should produce the EFI PCI Hot Plug Request
protocol. When a PCI device or a PCI-like device (for example, 32-bit PC Card)
is installed after PCI bus does the enumeration, the PCI bus driver can be
notified through this protocol. For example, when a 32-bit PC Card is inserted
into the PC Card socket, the PC Card bus driver can call interface of this
protocol to notify PCI bus driver to allocate resource and create handles for
this PC Card.
The EFI_PCI_HOTPLUG_REQUEST_PROTOCOL is installed by the PCI bus driver on a
separate handle when PCI bus driver starts up. There is only one instance in
the system. Any driver that wants to use this protocol must locate it globally.
The EFI_PCI_HOTPLUG_REQUEST_PROTOCOL allows the driver of hot-plug controller,
for example, PC Card Bus driver, to notify PCI bus driver that an event has
happened in the hot-plug controller, and the PCI bus driver is requested to
create (add) or destroy (remove) handles for the specified PCI-like devices.
For example, when a 32-bit PC Card is inserted, this protocol interface will
be called with an add operation, and the PCI bus driver will enumerate and
start the devices inserted; when a 32-bit PC Card is removed, this protocol
interface will be called with a remove operation, and the PCI bus driver will
stop the devices and destroy their handles. The existence of this protocol
represents the capability of the PCI bus driver. If this protocol exists in
system, it means PCI bus driver is hot-plug capable, thus together with the
effort of PC Card bus driver, hot-plug of PC Card can be supported. Otherwise,
the hot-plug capability is not provided.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is defined in UEFI Platform Initialization Specification 1.2
Volume 5: Standards
**/
#ifndef __PCI_HOTPLUG_REQUEST_H_
#define __PCI_HOTPLUG_REQUEST_H_
///
/// Global ID for EFI_PCI_HOTPLUG_REQUEST_PROTOCOL
///
#define EFI_PCI_HOTPLUG_REQUEST_PROTOCOL_GUID \
{ \
0x19cb87ab, 0x2cb9, 0x4665, {0x83, 0x60, 0xdd, 0xcf, 0x60, 0x54, 0xf7, 0x9d} \
}
///
/// Forward declaration for EFI_PCI_HOTPLUG_REQUEST_PROTOCOL
///
typedef struct _EFI_PCI_HOTPLUG_REQUEST_PROTOCOL EFI_PCI_HOTPLUG_REQUEST_PROTOCOL;
///
/// Enumeration of PCI hot plug operations
///
typedef enum {
///
/// The PCI bus driver is requested to create handles for the specified devices.
/// An array of EFI_HANDLE is returned, with a NULL element marking the end of
/// the array.
///
EfiPciHotPlugRequestAdd,
///
/// The PCI bus driver is requested to destroy handles for the specified devices.
///
EfiPciHotplugRequestRemove
} EFI_PCI_HOTPLUG_OPERATION;
/**
This function is used to notify PCI bus driver that some events happened in a
hot-plug controller, and the PCI bus driver is requested to start or stop
specified PCI-like devices.
This function allows the PCI bus driver to be notified to act as requested when
a hot-plug event has happened on the hot-plug controller. Currently, the
operations include add operation and remove operation. If it is a add operation,
the PCI bus driver will enumerate, allocate resources for devices behind the
hot-plug controller, and create handle for the device specified by RemainingDevicePath.
The RemainingDevicePath is an optional parameter. If it is not NULL, only the
specified device is started; if it is NULL, all devices behind the hot-plug
controller are started. The newly created handles of PC Card functions are
returned in the ChildHandleBuffer, together with the number of child handle in
NumberOfChildren. If it is a remove operation, when NumberOfChildren contains
a non-zero value, child handles specified in ChildHandleBuffer are stopped and
destroyed; otherwise, PCI bus driver is notified to stop managing the controller
handle.
@param[in] This A pointer to the EFI_PCI_HOTPLUG_REQUEST_PROTOCOL
instance.
@param[in] Operation The operation the PCI bus driver is requested
to make.
@param[in] Controller The handle of the hot-plug controller.
@param[in] RemainingDevicePath The remaining device path for the PCI-like
hot-plug device. It only contains device
path nodes behind the hot-plug controller.
It is an optional parameter and only valid
when the Operation is a add operation. If
it is NULL, all devices behind the PC Card
socket are started.
@param[in,out] NumberOfChildren The number of child handles. For an add
operation, it is an output parameter. For
a remove operation, it's an input parameter.
When it contains a non-zero value, children
handles specified in ChildHandleBuffer are
destroyed. Otherwise, PCI bus driver is
notified to stop managing the controller
handle.
@param[in,out] ChildHandleBuffer The buffer which contains the child handles.
For an add operation, it is an output
parameter and contains all newly created
child handles. For a remove operation, it
contains child handles to be destroyed when
NumberOfChildren contains a non-zero value.
It can be NULL when NumberOfChildren is 0.
It's the caller's responsibility to allocate
and free memory for this buffer.
@retval EFI_SUCCESS The handles for the specified device have been
created or destroyed as requested, and for an
add operation, the new handles are returned in
ChildHandleBuffer.
@retval EFI_INVALID_PARAMETER Operation is not a legal value.
@retval EFI_INVALID_PARAMETER Controller is NULL or not a valid handle.
@retval EFI_INVALID_PARAMETER NumberOfChildren is NULL.
@retval EFI_INVALID_PARAMETER ChildHandleBuffer is NULL while Operation is
remove and NumberOfChildren contains a non-zero
value.
@retval EFI_INVALID_PARAMETER ChildHandleBuffer is NULL while Operation is add.
@retval EFI_OUT_OF_RESOURCES There are no enough resources to start the
devices.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_HOTPLUG_REQUEST_NOTIFY)(
IN EFI_PCI_HOTPLUG_REQUEST_PROTOCOL *This,
IN EFI_PCI_HOTPLUG_OPERATION Operation,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,
IN OUT UINT8 *NumberOfChildren,
IN OUT EFI_HANDLE *ChildHandleBuffer
);
///
/// Provides services to notify PCI bus driver that some events have happened in
/// a hot-plug controller (for example, PC Card socket, or PHPC), and ask PCI bus
/// driver to create or destroy handles for the PCI-like devices.
///
struct _EFI_PCI_HOTPLUG_REQUEST_PROTOCOL {
///
/// Notify the PCI bus driver that some events have happened in a hot-plug
/// controller (for example, PC Card socket, or PHPC), and ask PCI bus driver
/// to create or destroy handles for the PCI-like devices. See Section 0 for
/// a detailed description.
///
EFI_PCI_HOTPLUG_REQUEST_NOTIFY Notify;
};
extern EFI_GUID gEfiPciHotPlugRequestProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PciIo.h
================================================
/** @file
EFI PCI I/O Protocol provides the basic Memory, I/O, PCI configuration,
and DMA interfaces that a driver uses to access its PCI controller.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __PCI_IO_H__
#define __PCI_IO_H__
///
/// Global ID for the PCI I/O Protocol
///
#define EFI_PCI_IO_PROTOCOL_GUID \
{ \
0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a } \
}
typedef struct _EFI_PCI_IO_PROTOCOL EFI_PCI_IO_PROTOCOL;
///
/// *******************************************************
/// EFI_PCI_IO_PROTOCOL_WIDTH
/// *******************************************************
///
typedef enum {
EfiPciIoWidthUint8 = 0,
EfiPciIoWidthUint16,
EfiPciIoWidthUint32,
EfiPciIoWidthUint64,
EfiPciIoWidthFifoUint8,
EfiPciIoWidthFifoUint16,
EfiPciIoWidthFifoUint32,
EfiPciIoWidthFifoUint64,
EfiPciIoWidthFillUint8,
EfiPciIoWidthFillUint16,
EfiPciIoWidthFillUint32,
EfiPciIoWidthFillUint64,
EfiPciIoWidthMaximum
} EFI_PCI_IO_PROTOCOL_WIDTH;
//
// Complete PCI address generater
//
#define EFI_PCI_IO_PASS_THROUGH_BAR 0xff ///< Special BAR that passes a memory or I/O cycle through unchanged
#define EFI_PCI_IO_ATTRIBUTE_MASK 0x077f ///< All the following I/O and Memory cycles
#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001 ///< I/O cycles 0x0000-0x00FF (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002 ///< I/O cycles 0x0100-0x03FF or greater (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004 ///< I/O cycles 0x3C6, 0x3C8, 0x3C9 (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008 ///< MEM cycles 0xA0000-0xBFFFF (24 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010 ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020 ///< I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040 ///< I/O cycles 0x170-0x177, 0x376, 0x377 (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080 ///< Map a memory range so writes are combined
#define EFI_PCI_IO_ATTRIBUTE_IO 0x0100 ///< Enable the I/O decode bit in the PCI Config Header
#define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200 ///< Enable the Memory decode bit in the PCI Config Header
#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400 ///< Enable the DMA bit in the PCI Config Header
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800 ///< Map a memory range so all r/w accesses are cached
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 ///< Disable a memory range
#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000 ///< Clear for an add-in PCI Device
#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000 ///< Clear for a physical PCI Option ROM accessed through ROM BAR
#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000 ///< Clear for PCI controllers that can not genrate a DAC
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000 ///< I/O cycles 0x0100-0x03FF or greater (16 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000 ///< I/O cycles 0x3C6, 0x3C8, 0x3C9 (16 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000 ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (16 bit decode)
#define EFI_PCI_DEVICE_ENABLE (EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY | EFI_PCI_IO_ATTRIBUTE_BUS_MASTER)
#define EFI_VGA_DEVICE_ENABLE (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_IO)
///
/// *******************************************************
/// EFI_PCI_IO_PROTOCOL_OPERATION
/// *******************************************************
///
typedef enum {
///
/// A read operation from system memory by a bus master.
///
EfiPciIoOperationBusMasterRead,
///
/// A write operation from system memory by a bus master.
///
EfiPciIoOperationBusMasterWrite,
///
/// Provides both read and write access to system memory by both the processor and a
/// bus master. The buffer is coherent from both the processor's and the bus master's point of view.
///
EfiPciIoOperationBusMasterCommonBuffer,
EfiPciIoOperationMaximum
} EFI_PCI_IO_PROTOCOL_OPERATION;
///
/// *******************************************************
/// EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION
/// *******************************************************
///
typedef enum {
///
/// Retrieve the PCI controller's current attributes, and return them in Result.
///
EfiPciIoAttributeOperationGet,
///
/// Set the PCI controller's current attributes to Attributes.
///
EfiPciIoAttributeOperationSet,
///
/// Enable the attributes specified by the bits that are set in Attributes for this PCI controller.
///
EfiPciIoAttributeOperationEnable,
///
/// Disable the attributes specified by the bits that are set in Attributes for this PCI controller.
///
EfiPciIoAttributeOperationDisable,
///
/// Retrieve the PCI controller's supported attributes, and return them in Result.
///
EfiPciIoAttributeOperationSupported,
EfiPciIoAttributeOperationMaximum
} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
/**
Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is
satisfied or after a defined duration.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
base address for the memory operation to perform.
@param Offset The offset within the selected BAR to start the memory operation.
@param Mask Mask used for the polling criteria.
@param Value The comparison value used for the polling exit criteria.
@param Delay The number of 100 ns units to poll.
@param Result Pointer to the last value read from the memory location.
@retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED Offset is not valid for the BarIndex of this PCI controller.
@retval EFI_TIMEOUT Delay expired before a match occurred.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_POLL_IO_MEM)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINT8 BarIndex,
IN UINT64 Offset,
IN UINT64 Mask,
IN UINT64 Value,
IN UINT64 Delay,
OUT UINT64 *Result
);
/**
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
base address for the memory or I/O operation to perform.
@param Offset The offset within the selected BAR to start the memory or I/O operation.
@param Count The number of memory or I/O operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
operations, the source buffer to write data from.
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
valid for the PCI BAR specified by BarIndex.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_IO_MEM)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINT8 BarIndex,
IN UINT64 Offset,
IN UINTN Count,
IN OUT VOID *Buffer
);
typedef struct {
///
/// Read PCI controller registers in the PCI memory or I/O space.
///
EFI_PCI_IO_PROTOCOL_IO_MEM Read;
///
/// Write PCI controller registers in the PCI memory or I/O space.
///
EFI_PCI_IO_PROTOCOL_IO_MEM Write;
} EFI_PCI_IO_PROTOCOL_ACCESS;
/**
Enable a PCI driver to access PCI controller registers in PCI configuration space.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory operations.
@param Offset The offset within the PCI configuration space for the PCI controller.
@param Count The number of PCI configuration operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
operations, the source buffer to write data from.
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
valid for the PCI configuration header of the PCI controller.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_CONFIG)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINT32 Offset,
IN UINTN Count,
IN OUT VOID *Buffer
);
typedef struct {
///
/// Read PCI controller registers in PCI configuration space.
///
EFI_PCI_IO_PROTOCOL_CONFIG Read;
///
/// Write PCI controller registers in PCI configuration space.
///
EFI_PCI_IO_PROTOCOL_CONFIG Write;
} EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;
/**
Enables a PCI driver to copy one region of PCI memory space to another region of PCI
memory space.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory operations.
@param DestBarIndex The BAR index in the standard PCI Configuration header to use as the
base address for the memory operation to perform.
@param DestOffset The destination offset within the BAR specified by DestBarIndex to
start the memory writes for the copy operation.
@param SrcBarIndex The BAR index in the standard PCI Configuration header to use as the
base address for the memory operation to perform.
@param SrcOffset The source offset within the BAR specified by SrcBarIndex to start
the memory reads for the copy operation.
@param Count The number of memory operations to perform. Bytes moved is Width
size * Count, starting at DestOffset and SrcOffset.
@retval EFI_SUCCESS The data was copied from one memory region to another memory region.
@retval EFI_UNSUPPORTED DestBarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED SrcBarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by DestOffset, Width, and Count
is not valid for the PCI BAR specified by DestBarIndex.
@retval EFI_UNSUPPORTED The address range specified by SrcOffset, Width, and Count is
not valid for the PCI BAR specified by SrcBarIndex.
@retval EFI_INVALID_PARAMETER Width is invalid.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_COPY_MEM)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINT8 DestBarIndex,
IN UINT64 DestOffset,
IN UINT8 SrcBarIndex,
IN UINT64 SrcOffset,
IN UINTN Count
);
/**
Provides the PCI controller-specific addresses needed to access system memory.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Operation Indicates if the bus master is going to read or write to system memory.
@param HostAddress The system memory address to map to the PCI controller.
@param NumberOfBytes On input the number of bytes to map. On output the number of bytes
that were mapped.
@param DeviceAddress The resulting map address for the bus master PCI controller to use to
access the hosts HostAddress.
@param Mapping A resulting value to pass to Unmap().
@retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
@retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_MAP)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_OPERATION Operation,
IN VOID *HostAddress,
IN OUT UINTN *NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
OUT VOID **Mapping
);
/**
Completes the Map() operation and releases any corresponding resources.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Mapping The mapping value returned from Map().
@retval EFI_SUCCESS The range was unmapped.
@retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_UNMAP)(
IN EFI_PCI_IO_PROTOCOL *This,
IN VOID *Mapping
);
/**
Allocates pages that are suitable for an EfiPciIoOperationBusMasterCommonBuffer
or EfiPciOperationBusMasterCommonBuffer64 mapping.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Type This parameter is not used and must be ignored.
@param MemoryType The type of memory to allocate, EfiBootServicesData or
EfiRuntimeServicesData.
@param Pages The number of pages to allocate.
@param HostAddress A pointer to store the base system memory address of the
allocated range.
@param Attributes The requested bit mask of attributes for the allocated range.
@retval EFI_SUCCESS The requested memory pages were allocated.
@retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
MEMORY_WRITE_COMBINE, MEMORY_CACHED and DUAL_ADDRESS_CYCLE.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_ALLOCATE_TYPE Type,
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages,
OUT VOID **HostAddress,
IN UINT64 Attributes
);
/**
Frees memory that was allocated with AllocateBuffer().
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Pages The number of pages to free.
@param HostAddress The base system memory address of the allocated range.
@retval EFI_SUCCESS The requested memory pages were freed.
@retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages
was not allocated with AllocateBuffer().
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_FREE_BUFFER)(
IN EFI_PCI_IO_PROTOCOL *This,
IN UINTN Pages,
IN VOID *HostAddress
);
/**
Flushes all PCI posted write transactions from a PCI host bridge to system memory.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@retval EFI_SUCCESS The PCI posted write transactions were flushed from the PCI host
bridge to system memory.
@retval EFI_DEVICE_ERROR The PCI posted write transactions were not flushed from the PCI
host bridge due to a hardware error.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_FLUSH)(
IN EFI_PCI_IO_PROTOCOL *This
);
/**
Retrieves this PCI controller's current PCI bus number, device number, and function number.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param SegmentNumber The PCI controller's current PCI segment number.
@param BusNumber The PCI controller's current PCI bus number.
@param DeviceNumber The PCI controller's current PCI device number.
@param FunctionNumber The PCI controller's current PCI function number.
@retval EFI_SUCCESS The PCI controller location was returned.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_LOCATION)(
IN EFI_PCI_IO_PROTOCOL *This,
OUT UINTN *SegmentNumber,
OUT UINTN *BusNumber,
OUT UINTN *DeviceNumber,
OUT UINTN *FunctionNumber
);
/**
Performs an operation on the attributes that this PCI controller supports. The operations include
getting the set of supported attributes, retrieving the current attributes, setting the current
attributes, enabling attributes, and disabling attributes.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Operation The operation to perform on the attributes for this PCI controller.
@param Attributes The mask of attributes that are used for Set, Enable, and Disable
operations.
@param Result A pointer to the result mask of attributes that are returned for the Get
and Supported operations.
@retval EFI_SUCCESS The operation on the PCI controller's attributes was completed.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_UNSUPPORTED one or more of the bits set in
Attributes are not supported by this PCI controller or one of
its parent bridges when Operation is Set, Enable or Disable.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_ATTRIBUTES)(
IN EFI_PCI_IO_PROTOCOL *This,
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
IN UINT64 Attributes,
OUT UINT64 *Result OPTIONAL
);
/**
Gets the attributes that this PCI controller supports setting on a BAR using
SetBarAttributes(), and retrieves the list of resource descriptors for a BAR.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
base address for resource range. The legal range for this field is 0..5.
@param Supports A pointer to the mask of attributes that this PCI controller supports
setting for this BAR with SetBarAttributes().
@param Resources A pointer to the resource descriptors that describe the current
configuration of this BAR of the PCI controller.
@retval EFI_SUCCESS If Supports is not NULL, then the attributes that the PCI
controller supports are returned in Supports. If Resources
is not NULL, then the resource descriptors that the PCI
controller is currently using are returned in Resources.
@retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate
Resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES)(
IN EFI_PCI_IO_PROTOCOL *This,
IN UINT8 BarIndex,
OUT UINT64 *Supports, OPTIONAL
OUT VOID **Resources OPTIONAL
);
/**
Sets the attributes for a range of a BAR on a PCI controller.
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Attributes The mask of attributes to set for the resource range specified by
BarIndex, Offset, and Length.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
base address for resource range. The legal range for this field is 0..5.
@param Offset A pointer to the BAR relative base address of the resource range to be
modified by the attributes specified by Attributes.
@param Length A pointer to the length of the resource range to be modified by the
attributes specified by Attributes.
@retval EFI_SUCCESS The set of attributes specified by Attributes for the resource
range specified by BarIndex, Offset, and Length were
set on the PCI controller, and the actual resource range is returned
in Offset and Length.
@retval EFI_INVALID_PARAMETER Offset or Length is NULL.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the attributes on the
resource range specified by BarIndex, Offset, and
Length.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES)(
IN EFI_PCI_IO_PROTOCOL *This,
IN UINT64 Attributes,
IN UINT8 BarIndex,
IN OUT UINT64 *Offset,
IN OUT UINT64 *Length
);
///
/// The EFI_PCI_IO_PROTOCOL provides the basic Memory, I/O, PCI configuration,
/// and DMA interfaces used to abstract accesses to PCI controllers.
/// There is one EFI_PCI_IO_PROTOCOL instance for each PCI controller on a PCI bus.
/// A device driver that wishes to manage a PCI controller in a system will have to
/// retrieve the EFI_PCI_IO_PROTOCOL instance that is associated with the PCI controller.
///
struct _EFI_PCI_IO_PROTOCOL {
EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollMem;
EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollIo;
EFI_PCI_IO_PROTOCOL_ACCESS Mem;
EFI_PCI_IO_PROTOCOL_ACCESS Io;
EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci;
EFI_PCI_IO_PROTOCOL_COPY_MEM CopyMem;
EFI_PCI_IO_PROTOCOL_MAP Map;
EFI_PCI_IO_PROTOCOL_UNMAP Unmap;
EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;
EFI_PCI_IO_PROTOCOL_FREE_BUFFER FreeBuffer;
EFI_PCI_IO_PROTOCOL_FLUSH Flush;
EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation;
EFI_PCI_IO_PROTOCOL_ATTRIBUTES Attributes;
EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES GetBarAttributes;
EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES SetBarAttributes;
///
/// The size, in bytes, of the ROM image.
///
UINT64 RomSize;
///
/// A pointer to the in memory copy of the ROM image. The PCI Bus Driver is responsible
/// for allocating memory for the ROM image, and copying the contents of the ROM to memory.
/// The contents of this buffer are either from the PCI option ROM that can be accessed
/// through the ROM BAR of the PCI controller, or it is from a platform-specific location.
/// The Attributes() function can be used to determine from which of these two sources
/// the RomImage buffer was initialized.
///
VOID *RomImage;
};
extern EFI_GUID gEfiPciIoProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PciOverride.h
================================================
/** @file
This file declares EFI PCI Override protocol which provides the interface between
the PCI bus driver/PCI Host Bridge Resource Allocation driver and an implementation's
driver to describe the unique features of a platform.
This protocol is optional.
Copyright (c) 2009, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is defined in UEFI Platform Initialization Specification 1.2
Volume 5: Standards
**/
#ifndef _PCI_OVERRIDE_H_
#define _PCI_OVERRIDE_H_
///
/// EFI_PCI_OVERRIDE_PROTOCOL has the same structure with EFI_PCI_PLATFORM_PROTOCOL
///
#include
///
/// Global ID for the EFI_PCI_OVERRIDE_PROTOCOL
///
#define EFI_PCI_OVERRIDE_GUID \
{ \
0xb5b35764, 0x460c, 0x4a06, {0x99, 0xfc, 0x77, 0xa1, 0x7c, 0x1b, 0x5c, 0xeb} \
}
///
/// Declaration for EFI_PCI_OVERRIDE_PROTOCOL
///
typedef EFI_PCI_PLATFORM_PROTOCOL EFI_PCI_OVERRIDE_PROTOCOL;
extern EFI_GUID gEfiPciOverrideProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PciPlatform.h
================================================
/** @file
This file declares PlatfromOpRom protocols that provide the interface between
the PCI bus driver/PCI Host Bridge Resource Allocation driver and a platform-specific
driver to describe the unique features of a platform.
This protocol is optional.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is defined in UEFI Platform Initialization Specification 1.2
Volume 5: Standards
**/
#ifndef _PCI_PLATFORM_H_
#define _PCI_PLATFORM_H_
///
/// This file must be included because the EFI_PCI_PLATFORM_PROTOCOL uses
/// EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE.
///
#include
///
/// Global ID for the EFI_PCI_PLATFORM_PROTOCOL.
///
#define EFI_PCI_PLATFORM_PROTOCOL_GUID \
{ \
0x7d75280, 0x27d4, 0x4d69, {0x90, 0xd0, 0x56, 0x43, 0xe2, 0x38, 0xb3, 0x41} \
}
///
/// Forward declaration for EFI_PCI_PLATFORM_PROTOCOL.
///
typedef struct _EFI_PCI_PLATFORM_PROTOCOL EFI_PCI_PLATFORM_PROTOCOL;
///
/// EFI_PCI_PLATFORM_POLICY that is a bitmask with the following legal combinations:
/// - EFI_RESERVE_NONE_IO_ALIAS:
/// Does not set aside either ISA or VGA I/O resources during PCI
/// enumeration. By using this selection, the platform indicates that it does
/// not want to support a PCI device that requires ISA or legacy VGA
/// resources. If a PCI device driver asks for these resources, the request
/// will be turned down.
/// - EFI_RESERVE_ISA_IO_ALIAS | EFI_RESERVE_VGA_IO_ALIAS:
/// Sets aside the ISA I/O range and all the aliases during PCI
/// enumeration. VGA I/O ranges and aliases are included in ISA alias
/// ranges. In this scheme, seventy-five percent of the I/O space remains unused.
/// By using this selection, the platform indicates that it wants to support
/// PCI devices that require the following, at the cost of wasted I/O space:
/// ISA range and its aliases
/// Legacy VGA range and its aliases
/// The PCI bus driver will not allocate I/O addresses out of the ISA I/O
/// range and its aliases. The following are the ISA I/O ranges:
/// - n100..n3FF
/// - n500..n7FF
/// - n900..nBFF
/// - nD00..nFFF
///
/// In this case, the PCI bus driver will ask the PCI host bridge driver for
/// larger I/O ranges. The PCI host bridge driver is not aware of the ISA
/// aliasing policy and merely attempts to allocate the requested ranges.
/// The first device that requests the legacy VGA range will get all the
/// legacy VGA range plus its aliased addresses forwarded to it. The first
/// device that requests the legacy ISA range will get all the legacy ISA
/// range, plus its aliased addresses, forwarded to it.
/// - EFI_RESERVE_ISA_IO_NO_ALIAS | EFI_RESERVE_VGA_IO_ALIAS:
/// Sets aside the ISA I/O range (0x100 - 0x3FF) during PCI enumeration
/// and the aliases of the VGA I/O ranges. By using this selection, the
/// platform indicates that it will support VGA devices that require VGA
/// ranges, including those that require VGA aliases. The platform further
/// wants to support non-VGA devices that ask for the ISA range (0x100 -
/// 3FF), but not if it also asks for the ISA aliases. The PCI bus driver will
/// not allocate I/O addresses out of the legacy ISA I/O range (0x100 -
/// 0x3FF) range or the aliases of the VGA I/O range. If a PCI device
/// driver asks for the ISA I/O ranges, including aliases, the request will be
/// turned down. The first device that requests the legacy VGA range will
/// get all the legacy VGA range plus its aliased addresses forwarded to
/// it. When the legacy VGA device asks for legacy VGA ranges and its
/// aliases, all the upstream PCI-to-PCI bridges must be set up to perform
/// 10-bit decode on legacy VGA ranges. To prevent two bridges from
/// positively decoding the same address, all PCI-to-PCI bridges that are
/// peers to this bridge will have to be set up to not decode ISA aliased
/// ranges. In that case, all the devices behind the peer bridges can
/// occupy only I/O addresses that are not ISA aliases. This is a limitation
/// of PCI-to-PCI bridges and is described in the white paper PCI-to-PCI
/// Bridges and Card Bus Controllers on Windows 2000, Windows XP,
/// and Windows Server 2003. The PCI enumeration process must be
/// cognizant of this restriction.
/// - EFI_RESERVE_ISA_IO_NO_ALIAS | EFI_RESERVE_VGA_IO_NO_ALIAS:
/// Sets aside the ISA I/O range (0x100 - 0x3FF) during PCI enumeration.
/// VGA I/O ranges are included in the ISA range. By using this selection,
/// the platform indicates that it wants to support PCI devices that require
/// the ISA range and legacy VGA range, but it does not want to support
/// devices that require ISA alias ranges or VGA alias ranges. The PCI
/// bus driver will not allocate I/O addresses out of the legacy ISA I/O
/// range (0x100-0x3FF). If a PCI device driver asks for the ISA I/O
/// ranges, including aliases, the request will be turned down. By using
/// this selection, the platform indicates that it will support VGA devices
/// that require VGA ranges, but it will not support VGA devices that
/// require VGA aliases. To truly support 16-bit VGA decode, all the PCIto-
/// PCI bridges that are upstream to a VGA device, as well as
/// upstream to the parent PCI root bridge, must support 16-bit VGA I/O
/// decode. See the PCI-to-PCI Bridge Architecture Specification for
/// information regarding the 16-bit VGA decode support. This
/// requirement must hold true for every VGA device in the system. If any
/// of these bridges does not support 16-bit VGA decode, it will positively
/// decode all the aliases of the VGA I/O ranges and this selection must
/// be treated like EFI_RESERVE_ISA_IO_NO_ALIAS |
/// EFI_RESERVE_VGA_IO_ALIAS.
///
typedef UINT32 EFI_PCI_PLATFORM_POLICY;
///
/// Does not set aside either ISA or VGA I/O resources during PCI
/// enumeration.
///
#define EFI_RESERVE_NONE_IO_ALIAS 0x0000
///
/// Sets aside ISA I/O range and all aliases:
/// - n100..n3FF
/// - n500..n7FF
/// - n900..nBFF
/// - nD00..nFFF.
///
#define EFI_RESERVE_ISA_IO_ALIAS 0x0001
///
/// Sets aside ISA I/O range 0x100-0x3FF.
///
#define EFI_RESERVE_ISA_IO_NO_ALIAS 0x0002
///
/// Sets aside VGA I/O ranges and all aliases.
///
#define EFI_RESERVE_VGA_IO_ALIAS 0x0004
///
/// Sets aside VGA I/O ranges
///
#define EFI_RESERVE_VGA_IO_NO_ALIAS 0x0008
///
/// EFI_PCI_EXECUTION_PHASE is used to call a platform protocol and execute
/// platform-specific code.
///
typedef enum {
///
/// The phase that indicates the entry point to the PCI Bus Notify phase. This
/// platform hook is called before the PCI bus driver calls the
/// EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL driver.
///
BeforePciHostBridge = 0,
///
/// The phase that indicates the entry point to the PCI Bus Notify phase. This
/// platform hook is called before the PCI bus driver calls the
/// EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL driver.
///
ChipsetEntry = 0,
///
/// The phase that indicates the exit point to the Chipset Notify phase before
/// returning to the PCI Bus Driver Notify phase. This platform hook is called after
/// the PCI bus driver calls the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
/// driver.
///
AfterPciHostBridge = 1,
///
/// The phase that indicates the exit point to the Chipset Notify phase before
/// returning to the PCI Bus Driver Notify phase. This platform hook is called after
/// the PCI bus driver calls the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
/// driver.
///
ChipsetExit = 1,
MaximumChipsetPhase
} EFI_PCI_EXECUTION_PHASE;
typedef EFI_PCI_EXECUTION_PHASE EFI_PCI_CHIPSET_EXECUTION_PHASE;
/**
The notification from the PCI bus enumerator to the platform that it is
about to enter a certain phase during the enumeration process.
The PlatformNotify() function can be used to notify the platform driver so that
it can perform platform-specific actions. No specific actions are required.
Eight notification points are defined at this time. More synchronization points
may be added as required in the future. The PCI bus driver calls the platform driver
twice for every Phase-once before the PCI Host Bridge Resource Allocation Protocol
driver is notified, and once after the PCI Host Bridge Resource Allocation Protocol
driver has been notified.
This member function may not perform any error checking on the input parameters. It
also does not return any error codes. If this member function detects any error condition,
it needs to handle those errors on its own because there is no way to surface any
errors to the caller.
@param[in] This The pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
@param[in] HostBridge The handle of the host bridge controller.
@param[in] Phase The phase of the PCI bus enumeration.
@param[in] ExecPhase Defines the execution phase of the PCI chipset driver.
@retval EFI_SUCCESS The function completed successfully.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_PLATFORM_PHASE_NOTIFY)(
IN EFI_PCI_PLATFORM_PROTOCOL *This,
IN EFI_HANDLE HostBridge,
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase,
IN EFI_PCI_EXECUTION_PHASE ExecPhase
);
/**
The notification from the PCI bus enumerator to the platform for each PCI
controller at several predefined points during PCI controller initialization.
The PlatformPrepController() function can be used to notify the platform driver so that
it can perform platform-specific actions. No specific actions are required.
Several notification points are defined at this time. More synchronization points may be
added as required in the future. The PCI bus driver calls the platform driver twice for
every PCI controller-once before the PCI Host Bridge Resource Allocation Protocol driver
is notified, and once after the PCI Host Bridge Resource Allocation Protocol driver has
been notified.
This member function may not perform any error checking on the input parameters. It also
does not return any error codes. If this member function detects any error condition, it
needs to handle those errors on its own because there is no way to surface any errors to
the caller.
@param[in] This The pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
@param[in] HostBridge The associated PCI host bridge handle.
@param[in] RootBridge The associated PCI root bridge handle.
@param[in] PciAddress The address of the PCI device on the PCI bus.
@param[in] Phase The phase of the PCI controller enumeration.
@param[in] ExecPhase Defines the execution phase of the PCI chipset driver.
@retval EFI_SUCCESS The function completed successfully.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_PLATFORM_PREPROCESS_CONTROLLER)(
IN EFI_PCI_PLATFORM_PROTOCOL *This,
IN EFI_HANDLE HostBridge,
IN EFI_HANDLE RootBridge,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase,
IN EFI_PCI_EXECUTION_PHASE ExecPhase
);
/**
Retrieves the platform policy regarding enumeration.
The GetPlatformPolicy() function retrieves the platform policy regarding PCI
enumeration. The PCI bus driver and the PCI Host Bridge Resource Allocation Protocol
driver can call this member function to retrieve the policy.
@param[in] This The pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
@param[out] PciPolicy The platform policy with respect to VGA and ISA aliasing.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER PciPolicy is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_PLATFORM_GET_PLATFORM_POLICY)(
IN CONST EFI_PCI_PLATFORM_PROTOCOL *This,
OUT EFI_PCI_PLATFORM_POLICY *PciPolicy
);
/**
Gets the PCI device's option ROM from a platform-specific location.
The GetPciRom() function gets the PCI device's option ROM from a platform-specific location.
The option ROM will be loaded into memory. This member function is used to return an image
that is packaged as a PCI 2.2 option ROM. The image may contain both legacy and EFI option
ROMs. See the UEFI 2.0 Specification for details. This member function can be used to return
option ROM images for embedded controllers. Option ROMs for embedded controllers are typically
stored in platform-specific storage, and this member function can retrieve it from that storage
and return it to the PCI bus driver. The PCI bus driver will call this member function before
scanning the ROM that is attached to any controller, which allows a platform to specify a ROM
image that is different from the ROM image on a PCI card.
@param[in] This The pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
@param[in] PciHandle The handle of the PCI device.
@param[out] RomImage If the call succeeds, the pointer to the pointer to the option ROM image.
Otherwise, this field is undefined. The memory for RomImage is allocated
by EFI_PCI_PLATFORM_PROTOCOL.GetPciRom() using the EFI Boot Service AllocatePool().
It is the caller's responsibility to free the memory using the EFI Boot Service
FreePool(), when the caller is done with the option ROM.
@param[out] RomSize If the call succeeds, a pointer to the size of the option ROM size. Otherwise,
this field is undefined.
@retval EFI_SUCCESS The option ROM was available for this device and loaded into memory.
@retval EFI_NOT_FOUND No option ROM was available for this device.
@retval EFI_OUT_OF_RESOURCES No memory was available to load the option ROM.
@retval EFI_DEVICE_ERROR An error occurred in obtaining the option ROM.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_PLATFORM_GET_PCI_ROM)(
IN CONST EFI_PCI_PLATFORM_PROTOCOL *This,
IN EFI_HANDLE PciHandle,
OUT VOID **RomImage,
OUT UINTN *RomSize
);
///
/// This protocol provides the interface between the PCI bus driver/PCI Host
/// Bridge Resource Allocation driver and a platform-specific driver to describe
/// the unique features of a platform.
///
struct _EFI_PCI_PLATFORM_PROTOCOL {
///
/// The notification from the PCI bus enumerator to the platform that it is about to
/// enter a certain phase during the enumeration process.
///
EFI_PCI_PLATFORM_PHASE_NOTIFY PlatformNotify;
///
/// The notification from the PCI bus enumerator to the platform for each PCI
/// controller at several predefined points during PCI controller initialization.
///
EFI_PCI_PLATFORM_PREPROCESS_CONTROLLER PlatformPrepController;
///
/// Retrieves the platform policy regarding enumeration.
///
EFI_PCI_PLATFORM_GET_PLATFORM_POLICY GetPlatformPolicy;
///
/// Gets the PCI device's option ROM from a platform-specific location.
///
EFI_PCI_PLATFORM_GET_PCI_ROM GetPciRom;
};
extern EFI_GUID gEfiPciPlatformProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PciRootBridgeIo.h
================================================
/** @file
PCI Root Bridge I/O protocol as defined in the UEFI 2.0 specification.
PCI Root Bridge I/O protocol is used by PCI Bus Driver to perform PCI Memory, PCI I/O,
and PCI Configuration cycles on a PCI Root Bridge. It also provides services to perform
defferent types of bus mastering DMA.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __PCI_ROOT_BRIDGE_IO_H__
#define __PCI_ROOT_BRIDGE_IO_H__
#include
#define EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID \
{ \
0x2f707ebb, 0x4a1a, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
}
typedef struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL;
///
/// *******************************************************
/// EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH
/// *******************************************************
///
typedef enum {
EfiPciWidthUint8,
EfiPciWidthUint16,
EfiPciWidthUint32,
EfiPciWidthUint64,
EfiPciWidthFifoUint8,
EfiPciWidthFifoUint16,
EfiPciWidthFifoUint32,
EfiPciWidthFifoUint64,
EfiPciWidthFillUint8,
EfiPciWidthFillUint16,
EfiPciWidthFillUint32,
EfiPciWidthFillUint64,
EfiPciWidthMaximum
} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH;
///
/// *******************************************************
/// EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION
/// *******************************************************
///
typedef enum {
///
/// A read operation from system memory by a bus master that is not capable of producing
/// PCI dual address cycles.
///
EfiPciOperationBusMasterRead,
///
/// A write operation from system memory by a bus master that is not capable of producing
/// PCI dual address cycles.
///
EfiPciOperationBusMasterWrite,
///
/// Provides both read and write access to system memory by both the processor and a bus
/// master that is not capable of producing PCI dual address cycles.
///
EfiPciOperationBusMasterCommonBuffer,
///
/// A read operation from system memory by a bus master that is capable of producing PCI
/// dual address cycles.
///
EfiPciOperationBusMasterRead64,
///
/// A write operation to system memory by a bus master that is capable of producing PCI
/// dual address cycles.
///
EfiPciOperationBusMasterWrite64,
///
/// Provides both read and write access to system memory by both the processor and a bus
/// master that is capable of producing PCI dual address cycles.
///
EfiPciOperationBusMasterCommonBuffer64,
EfiPciOperationMaximum
} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION;
#define EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001
#define EFI_PCI_ATTRIBUTE_ISA_IO 0x0002
#define EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO 0x0004
#define EFI_PCI_ATTRIBUTE_VGA_MEMORY 0x0008
#define EFI_PCI_ATTRIBUTE_VGA_IO 0x0010
#define EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO 0x0020
#define EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO 0x0040
#define EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080
#define EFI_PCI_ATTRIBUTE_MEMORY_CACHED 0x0800
#define EFI_PCI_ATTRIBUTE_MEMORY_DISABLE 0x1000
#define EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000
#define EFI_PCI_ATTRIBUTE_ISA_IO_16 0x10000
#define EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000
#define EFI_PCI_ATTRIBUTE_VGA_IO_16 0x40000
#define EFI_PCI_ATTRIBUTE_VALID_FOR_ALLOCATE_BUFFER (EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE | EFI_PCI_ATTRIBUTE_MEMORY_CACHED | EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE)
#define EFI_PCI_ATTRIBUTE_INVALID_FOR_ALLOCATE_BUFFER (~EFI_PCI_ATTRIBUTE_VALID_FOR_ALLOCATE_BUFFER)
#define EFI_PCI_ADDRESS(bus, dev, func, reg) \
(UINT64) ( \
(((UINTN) bus) << 24) | \
(((UINTN) dev) << 16) | \
(((UINTN) func) << 8) | \
(((UINTN) (reg)) < 256 ? ((UINTN) (reg)) : (UINT64) (LShiftU64 ((UINT64) (reg), 32))))
typedef struct {
UINT8 Register;
UINT8 Function;
UINT8 Device;
UINT8 Bus;
UINT32 ExtendedRegister;
} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS;
/**
Reads from the I/O space of a PCI Root Bridge. Returns when either the polling exit criteria is
satisfied or after a defined duration.
@param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
@param Width Signifies the width of the memory or I/O operations.
@param Address The base address of the memory or I/O operations.
@param Mask Mask used for the polling criteria.
@param Value The comparison value used for the polling exit criteria.
@param Delay The number of 100 ns units to poll.
@param Result Pointer to the last value read from the memory location.
@retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria.
@retval EFI_TIMEOUT Delay expired before a match occurred.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM)(
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 Address,
IN UINT64 Mask,
IN UINT64 Value,
IN UINT64 Delay,
OUT UINT64 *Result
);
/**
Enables a PCI driver to access PCI controller registers in the PCI root bridge memory space.
@param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
@param Width Signifies the width of the memory operations.
@param Address The base address of the memory operations.
@param Count The number of memory operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
operations, the source buffer to write data from.
@retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM)(
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
);
typedef struct {
///
/// Read PCI controller registers in the PCI root bridge memory space.
///
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM Read;
///
/// Write PCI controller registers in the PCI root bridge memory space.
///
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM Write;
} EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS;
/**
Enables a PCI driver to copy one region of PCI root bridge memory space to another region of PCI
root bridge memory space.
@param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.
@param Width Signifies the width of the memory operations.
@param DestAddress The destination address of the memory operation.
@param SrcAddress The source address of the memory operation.
@param Count The number of memory operations to perform.
@retval EFI_SUCCESS The data was copied from one memory region to another memory region.
@retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_COPY_MEM)(
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 DestAddress,
IN UINT64 SrcAddress,
IN UINTN Count
);
/**
Provides the PCI controller-specific addresses required to access system memory from a
DMA bus master.
@param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
@param Operation Indicates if the bus master is going to read or write to system memory.
@param HostAddress The system memory address to map to the PCI controller.
@param NumberOfBytes On input the number of bytes to map. On output the number of bytes
that were mapped.
@param DeviceAddress The resulting map address for the bus master PCI controller to use to
access the hosts HostAddress.
@param Mapping A resulting value to pass to Unmap().
@retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
@retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_MAP)(
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation,
IN VOID *HostAddress,
IN OUT UINTN *NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
OUT VOID **Mapping
);
/**
Completes the Map() operation and releases any corresponding resources.
@param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
@param Mapping The mapping value returned from Map().
@retval EFI_SUCCESS The range was unmapped.
@retval EFI_INVALID_PARAMETER Mapping is not a value that was returned by Map().
@retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_UNMAP)(
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN VOID *Mapping
);
/**
Allocates pages that are suitable for an EfiPciOperationBusMasterCommonBuffer or
EfiPciOperationBusMasterCommonBuffer64 mapping.
@param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
@param Type This parameter is not used and must be ignored.
@param MemoryType The type of memory to allocate, EfiBootServicesData or
EfiRuntimeServicesData.
@param Pages The number of pages to allocate.
@param HostAddress A pointer to store the base system memory address of the
allocated range.
@param Attributes The requested bit mask of attributes for the allocated range.
@retval EFI_SUCCESS The requested memory pages were allocated.
@retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
MEMORY_WRITE_COMBINE and MEMORY_CACHED.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ALLOCATE_BUFFER)(
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN EFI_ALLOCATE_TYPE Type,
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages,
IN OUT VOID **HostAddress,
IN UINT64 Attributes
);
/**
Frees memory that was allocated with AllocateBuffer().
@param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
@param Pages The number of pages to free.
@param HostAddress The base system memory address of the allocated range.
@retval EFI_SUCCESS The requested memory pages were freed.
@retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages
was not allocated with AllocateBuffer().
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FREE_BUFFER)(
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN UINTN Pages,
IN VOID *HostAddress
);
/**
Flushes all PCI posted write transactions from a PCI host bridge to system memory.
@param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
@retval EFI_SUCCESS The PCI posted write transactions were flushed from the PCI host
bridge to system memory.
@retval EFI_DEVICE_ERROR The PCI posted write transactions were not flushed from the PCI
host bridge due to a hardware error.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FLUSH)(
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This
);
/**
Gets the attributes that a PCI root bridge supports setting with SetAttributes(), and the
attributes that a PCI root bridge is currently using.
@param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
@param Supports A pointer to the mask of attributes that this PCI root bridge supports
setting with SetAttributes().
@param Attributes A pointer to the mask of attributes that this PCI root bridge is currently
using.
@retval EFI_SUCCESS If Supports is not NULL, then the attributes that the PCI root
bridge supports is returned in Supports. If Attributes is
not NULL, then the attributes that the PCI root bridge is currently
using is returned in Attributes.
@retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES)(
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
OUT UINT64 *Supports,
OUT UINT64 *Attributes
);
/**
Sets attributes for a resource range on a PCI root bridge.
@param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
@param Attributes The mask of attributes to set.
@param ResourceBase A pointer to the base address of the resource range to be modified by the
attributes specified by Attributes.
@param ResourceLength A pointer to the length of the resource range to be modified by the
attributes specified by Attributes.
@retval EFI_SUCCESS The set of attributes specified by Attributes for the resource
range specified by ResourceBase and ResourceLength
were set on the PCI root bridge, and the actual resource range is
returned in ResuourceBase and ResourceLength.
@retval EFI_UNSUPPORTED A bit is set in Attributes that is not supported by the PCI Root
Bridge.
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the attributes on the
resource range specified by BaseAddress and Length.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES)(
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
IN UINT64 Attributes,
IN OUT UINT64 *ResourceBase,
IN OUT UINT64 *ResourceLength
);
/**
Retrieves the current resource settings of this PCI root bridge in the form of a set of ACPI
resource descriptors.
@param This A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
@param Resources A pointer to the resource descriptors that describe the current
configuration of this PCI root bridge.
@retval EFI_SUCCESS The current configuration of this PCI root bridge was returned in
Resources.
@retval EFI_UNSUPPORTED The current configuration of this PCI root bridge could not be
retrieved.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_CONFIGURATION)(
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This,
OUT VOID **Resources
);
///
/// Provides the basic Memory, I/O, PCI configuration, and DMA interfaces that are
/// used to abstract accesses to PCI controllers behind a PCI Root Bridge Controller.
///
struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL {
///
/// The EFI_HANDLE of the PCI Host Bridge of which this PCI Root Bridge is a member.
///
EFI_HANDLE ParentHandle;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM PollMem;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM PollIo;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Mem;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Io;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Pci;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_COPY_MEM CopyMem;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_MAP Map;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_UNMAP Unmap;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FREE_BUFFER FreeBuffer;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FLUSH Flush;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES GetAttributes;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES SetAttributes;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_CONFIGURATION Configuration;
///
/// The segment number that this PCI root bridge resides.
///
UINT32 SegmentNumber;
};
extern EFI_GUID gEfiPciRootBridgeIoProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PiPcd.h
================================================
/** @file
Platform Configuration Database (PCD) Protocol defined in PI 1.2 Vol3
A platform database that contains a variety of current platform settings or
directives that can be accessed by a driver or application.
PI PCD protocol only provide the accessing interfaces for Dynamic-Ex type PCD.
Callers to this protocol must be at a TPL_APPLICATION task priority level.
This is the base PCD service API that provides an abstraction for accessing configuration content in
the platform. It a seamless mechanism for extracting information regardless of where the
information is stored (such as in Read-only data, or an EFI Variable).
This protocol allows access to data through size-granular APIs and provides a mechanism for a
firmware component to monitor specific settings and be alerted when a setting is changed.
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
PI Version 1.2 Vol 3.
**/
#ifndef __PI_PCD_H__
#define __PI_PCD_H__
extern EFI_GUID gEfiPcdProtocolGuid;
#define EFI_PCD_PROTOCOL_GUID \
{ 0x13a3f0f6, 0x264a, 0x3ef0, { 0xf2, 0xe0, 0xde, 0xc5, 0x12, 0x34, 0x2f, 0x34 } }
#define EFI_PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)
/**
SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. SetSku() is
normally called only once by the system.
For each item (token), the database can hold a single value that applies to all SKUs, or multiple
values, where each value is associated with a specific SKU Id. Items with multiple, SKU-specific
values are called SKU enabled.
The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. For tokens that are
not SKU enabled, the system ignores any set SKU Id and works with the single value for that token.
For SKU-enabled tokens, the system will use the SKU Id set by the last call to SetSku(). If no SKU
Id is set or the currently set SKU Id isn't valid for the specified token, the system uses the default
SKU Id. If the system attempts to use the default SKU Id and no value has been set for that Id, the
results are unpredictable.
@param[in] SkuId The SKU value to set.
**/
typedef
VOID
(EFIAPI *EFI_PCD_PROTOCOL_SET_SKU)(
IN UINTN SkuId
);
/**
Retrieves an 8-bit value for a given PCD token.
If the TokenNumber is invalid, the results are unpredictable.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@return 8-bit value for a given PCD token.
**/
typedef
UINT8
(EFIAPI *EFI_PCD_PROTOCOL_GET_8)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Retrieves the current word-sized value for a PCD token number.
If the TokenNumber is invalid, the results are unpredictable.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@return word-sized value for a given PCD token.
**/
typedef
UINT16
(EFIAPI *EFI_PCD_PROTOCOL_GET_16)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Retrieves the current 32-bit sized value for a PCD token number.
If the TokenNumber is invalid, the results are unpredictable.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@return 32-bit value for a given PCD token.
**/
typedef
UINT32
(EFIAPI *EFI_PCD_PROTOCOL_GET_32)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Retrieves the 64-bit sized value for a PCD token number.
If the TokenNumber is invalid, the results are unpredictable.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@return 64-bit value for a given PCD token.
**/
typedef
UINT64
(EFIAPI *EFI_PCD_PROTOCOL_GET_64)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Retrieves the current pointer to the value for a PCD token number. Do not make any assumptions
about the alignment of the pointer that is returned by this function call. If the TokenNumber is
invalid, the results are unpredictable.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@return pointer to a value for a given PCD token.
**/
typedef
VOID *
(EFIAPI *EFI_PCD_PROTOCOL_GET_POINTER)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Retrieves the current BOOLEAN-sized value for a PCD token number. If the TokenNumber is
invalid, the results are unpredictable.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@return Boolean value for a given PCD token.
**/
typedef
BOOLEAN
(EFIAPI *EFI_PCD_PROTOCOL_GET_BOOLEAN)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Retrieves the current size of a particular PCD token. If the TokenNumber is invalid, the results are
unpredictable.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@return the size of the value for a given PCD token.
**/
typedef
UINTN
(EFIAPI *EFI_PCD_PROTOCOL_GET_SIZE)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber
);
/**
Sets an 8-bit value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the size of the value being set is
compatible with the Token's existing definition. If it is not, an error will be returned.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The PCD service has set the value requested
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
incompatible with a call to this function. Use GetSizeEx() to
retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_8)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
IN UINT8 Value
);
/**
Sets an 16-bit value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the size of the value being set is
compatible with the Token's existing definition. If it is not, an error will be returned.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The PCD service has set the value requested
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
incompatible with a call to this function. Use GetSizeEx() to
retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_16)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
IN UINT16 Value
);
/**
Sets an 32-bit value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the size of the value being set is
compatible with the Token's existing definition. If it is not, an error will be returned.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The PCD service has set the value requested
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
incompatible with a call to this function. Use GetSizeEx() to
retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_32)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
IN UINT32 Value
);
/**
Sets an 64-bit value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the size of the value being set is
compatible with the Token's existing definition. If it is not, an error will be returned.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The PCD service has set the value requested
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
incompatible with a call to this function. Use GetSizeEx() to
retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_64)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
IN UINT64 Value
);
/**
Sets a value of a specified size for a given PCD token.
When the PCD service sets a value, it will check to ensure that the size of the value being set is
compatible with the Token's existing definition. If it is not, an error will be returned.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[in] SizeOfValue The length of the value being set for the PCD token. If too large of a length is
specified, upon return from this function the value of SizeOfValue will
reflect the maximum size for the PCD token.
@param[in] Buffer A pointer to the buffer containing the value to set for the PCD token.
@retval EFI_SUCCESS The PCD service has set the value requested
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
incompatible with a call to this function. Use GetSizeEx() to
retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_POINTER)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
IN OUT UINTN *SizeOfValue,
IN VOID *Buffer
);
/**
Sets a Boolean value for a given PCD token.
When the PCD service sets a value, it will check to ensure that the size of the value being set is
compatible with the Token's existing definition. If it is not, an error will be returned.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[in] Value The value to set for the PCD token.
@retval EFI_SUCCESS The PCD service has set the value requested
@retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was
incompatible with a call to this function. Use GetSizeEx() to
retrieve the size of the target data.
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_SET_BOOLEAN)(
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
IN BOOLEAN Value
);
typedef
VOID
(EFIAPI *EFI_PCD_PROTOCOL_CALLBACK)(
IN EFI_GUID *Guid OPTIONAL,
IN UINTN CallBackToken,
IN OUT VOID *TokenData,
IN UINTN TokenDataSize
);
/**
Specifies a function to be called anytime the value of a designated token is changed.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] CallBackToken The PCD token number to monitor.
@param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
@retval EFI_SUCCESS The PCD service has successfully established a call event for the CallBackToken requested.
@retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_CALLBACK_ON_SET)(
IN CONST EFI_GUID *Guid OPTIONAL,
IN UINTN CallBackToken,
IN EFI_PCD_PROTOCOL_CALLBACK CallBackFunction
);
/**
Cancels a callback function that was set through a previous call to the CallBackOnSet function.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] CallBackToken The PCD token number to monitor.
@param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
@retval EFI_SUCCESS The PCD service has successfully established a call event for the CallBackToken requested.
@retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_CANCEL_CALLBACK)(
IN CONST EFI_GUID *Guid OPTIONAL,
IN UINTN CallBackToken,
IN EFI_PCD_PROTOCOL_CALLBACK CallBackFunction
);
/**
Gets the next valid token number in a given namespace. This is useful since the PCD infrastructure
contains a sparse list of token numbers, and one cannot a priori know what token numbers are valid
in the database.
@param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.
@param[in] TokenNumber A pointer to the PCD token number to use to find the subsequent token number. To
retrieve the "first" token, have the pointer reference a TokenNumber value of 0.
@retval EFI_SUCCESS The PCD service has retrieved the value requested
@retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_GET_NEXT_TOKEN)(
IN CONST EFI_GUID *Guid, OPTIONAL
IN UINTN *TokenNumber
);
/**
Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
token namespaces on a platform.
@param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token namespace
from which the search will start. On output, it designates the next valid token
namespace on the platform. If *Guid is NULL, then the GUID of the first token
space of the current platform is returned. If the search cannot locate the next valid
token namespace, an error is returned and the value of *Guid is undefined.
@retval EFI_SUCCESS The PCD service retrieved the value requested.
@retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PCD_PROTOCOL_GET_NEXT_TOKEN_SPACE)(
IN OUT CONST EFI_GUID **Guid
);
typedef struct _EFI_PCD_PROTOCOL {
EFI_PCD_PROTOCOL_SET_SKU SetSku;
EFI_PCD_PROTOCOL_GET_8 Get8;
EFI_PCD_PROTOCOL_GET_16 Get16;
EFI_PCD_PROTOCOL_GET_32 Get32;
EFI_PCD_PROTOCOL_GET_64 Get64;
EFI_PCD_PROTOCOL_GET_POINTER GetPtr;
EFI_PCD_PROTOCOL_GET_BOOLEAN GetBool;
EFI_PCD_PROTOCOL_GET_SIZE GetSize;
EFI_PCD_PROTOCOL_SET_8 Set8;
EFI_PCD_PROTOCOL_SET_16 Set16;
EFI_PCD_PROTOCOL_SET_32 Set32;
EFI_PCD_PROTOCOL_SET_64 Set64;
EFI_PCD_PROTOCOL_SET_POINTER SetPtr;
EFI_PCD_PROTOCOL_SET_BOOLEAN SetBool;
EFI_PCD_PROTOCOL_CALLBACK_ON_SET CallbackOnSet;
EFI_PCD_PROTOCOL_CANCEL_CALLBACK CancelCallback;
EFI_PCD_PROTOCOL_GET_NEXT_TOKEN GetNextToken;
EFI_PCD_PROTOCOL_GET_NEXT_TOKEN_SPACE GetNextTokenSpace;
} EFI_PCD_PROTOCOL;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PiPcdInfo.h
================================================
/** @file
Platform Configuration Database (PCD) Info Protocol defined in PI 1.2.1 Vol3.
The protocol that provides additional information about items that reside in the PCD database.
Copyright (c) 2013, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
PI Version 1.2.1 Vol 3.
**/
#ifndef __PI_PCD_INFO_H__
#define __PI_PCD_INFO_H__
extern EFI_GUID gEfiGetPcdInfoProtocolGuid;
#define EFI_GET_PCD_INFO_PROTOCOL_GUID \
{ 0xfd0f4478, 0xefd, 0x461d, { 0xba, 0x2d, 0xe5, 0x8c, 0x45, 0xfd, 0x5f, 0x5e } }
///
/// The forward declaration for EFI_GET_PCD_INFO_PROTOCOL.
///
typedef struct _EFI_GET_PCD_INFO_PROTOCOL EFI_GET_PCD_INFO_PROTOCOL;
/**
Retrieve additional information associated with a PCD token.
This includes information such as the type of value the TokenNumber is associated with as well as possible
human readable name that is associated with the token.
@param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
@param[in] TokenNumber The PCD token number.
@param[out] PcdInfo The returned information associated with the requested TokenNumber.
@retval EFI_SUCCESS The PCD information was returned successfully
@retval EFI_NOT_FOUND The PCD service could not find the requested token number.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_GET_PCD_INFO_PROTOCOL_GET_INFO) (
IN CONST EFI_GUID *Guid,
IN UINTN TokenNumber,
OUT EFI_PCD_INFO *PcdInfo
);
/**
Retrieve the currently set SKU Id.
@return The currently set SKU Id. If the platform has not set at a SKU Id, then the
default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU
Id is returned.
**/
typedef
UINTN
(EFIAPI *EFI_GET_PCD_INFO_PROTOCOL_GET_SKU) (
VOID
);
///
/// Callers to this protocol must be at a TPL_APPLICATION task priority level.
/// This is the PCD service to use when querying for some additional data that can be contained in the
/// PCD database.
///
struct _EFI_GET_PCD_INFO_PROTOCOL {
///
/// Retrieve additional information associated with a PCD.
///
EFI_GET_PCD_INFO_PROTOCOL_GET_INFO GetInfo;
///
/// Retrieve the currently set SKU Id.
///
EFI_GET_PCD_INFO_PROTOCOL_GET_SKU GetSku;
};
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/Pkcs7Verify.h
================================================
/** @file
EFI_PKCS7_VERIFY_PROTOCOL as defined in UEFI 2.5.
The EFI_PKCS7_VERIFY_PROTOCOL is used to verify data signed using PKCS#7
formatted authentication. The PKCS#7 data to be verified must be binary
DER encoded.
PKCS#7 is a general-purpose cryptographic standard (defined by RFC2315,
available at http://tools.ietf.org/html/rfc2315).
Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
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 __EFI_PKCS7_VERIFY_PROTOCOL_H__
#define __EFI_PKCS7_VERIFY_PROTOCOL_H__
#include
///
/// Global ID for the PKCS7 Verification Protocol
///
#define EFI_PKCS7_VERIFY_PROTOCOL_GUID \
{ \
0x47889fb2, 0xd671, 0x4fab, {0xa0, 0xca, 0xdf, 0x0e, 0x44, 0xdf, 0x70, 0xd6 } \
}
typedef struct _EFI_PKCS7_VERIFY_PROTOCOL EFI_PKCS7_VERIFY_PROTOCOL;
/**
Processes a buffer containing binary DER-encoded PKCS7 signature.
The signed data content may be embedded within the buffer or separated. Funtion
verifies the signature of the content is valid and signing certificate was not
revoked and is contained within a list of trusted signers.
@param[in] This Pointer to EFI_PKCS7_VERIFY_PROTOCOL instance.
@param[in] SignedData Points to buffer containing ASN.1 DER-encoded PKCS7
signature.
@param[in] SignedDataSize The size of SignedData buffer in bytes.
@param[in] InData In case of detached signature, InData points to
buffer containing the raw message data previously
signed and to be verified by function. In case of
SignedData containing embedded data, InData must be
NULL.
@param[in] InDataSize When InData is used, the size of InData buffer in
bytes. When InData is NULL. This parameter must be
0.
@param[in] AllowedDb Pointer to a list of pointers to EFI_SIGNATURE_LIST
structures. The list is terminated by a null
pointer. The EFI_SIGNATURE_LIST structures contain
lists of X.509 certificates of approved signers.
Function recognizes signer certificates of type
EFI_CERT_X509_GUID. Any hash certificate in AllowedDb
list is ignored by this function. Function returns
success if signer of the buffer is within this list
(and not within RevokedDb). This parameter is
required.
@param[in] RevokedDb Optional pointer to a list of pointers to
EFI_SIGNATURE_LIST structures. The list is terminated
by a null pointer. List of X.509 certificates of
revoked signers and revoked file hashes. Except as
noted in description of TimeStampDb signature
verification will always fail if the signer of the
file or the hash of the data component of the buffer
is in RevokedDb list. This list is optional and
caller may pass Null or pointer to NULL if not
required.
@param[in] TimeStampDb Optional pointer to a list of pointers to
EFI_SIGNATURE_LIST structures. The list is terminated
by a null pointer. This parameter can be used to pass
a list of X.509 certificates of trusted time stamp
signers. This list is optional and caller must pass
Null or pointer to NULL if not required.
@param[out] Content On input, points to an optional caller-allocated
buffer into which the function will copy the content
portion of the file after verification succeeds.
This parameter is optional and if NULL, no copy of
content from file is performed.
@param[in,out] ContentSize On input, points to the size in bytes of the optional
buffer Content previously allocated by caller. On
output, if the verification succeeds, the value
referenced by ContentSize will contain the actual
size of the content from signed file. If ContentSize
indicates the caller-allocated buffer is too small
to contain content, an error is returned, and
ContentSize will be updated with the required size.
This parameter must be 0 if Content is Null.
@retval EFI_SUCCESS Content signature was verified against hash of
content, the signer's certificate was not found in
RevokedDb, and was found in AllowedDb or if in signer
is found in both AllowedDb and RevokedDb, the
signing was allowed by reference to TimeStampDb as
described above, and no hash matching content hash
was found in RevokedDb.
@retval EFI_SECURITY_VIOLATION The SignedData buffer was correctly formatted but
signer was in RevokedDb or not in AllowedDb. Also
returned if matching content hash found in RevokedDb.
@retval EFI_COMPROMISED_DATA Calculated hash differs from signed hash.
@retval EFI_INVALID_PARAMETER SignedData is NULL or SignedDataSize is zero.
AllowedDb is NULL.
@retval EFI_INVALID_PARAMETER Content is not NULL and ContentSize is NULL.
@retval EFI_ABORTED Unsupported or invalid format in TimeStampDb,
RevokedDb or AllowedDb list contents was detected.
@retval EFI_NOT_FOUND Content not found because InData is NULL and no
content embedded in SignedData.
@retval EFI_UNSUPPORTED The SignedData buffer was not correctly formatted
for processing by the function.
@retval EFI_UNSUPPORTED Signed data embedded in SignedData but InData is not
NULL.
@retval EFI_BUFFER_TOO_SMALL The size of buffer indicated by ContentSize is too
small to hold the content. ContentSize updated to
required size.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PKCS7_VERIFY_BUFFER) (
IN EFI_PKCS7_VERIFY_PROTOCOL *This,
IN VOID *SignedData,
IN UINTN SignedDataSize,
IN VOID *InData OPTIONAL,
IN UINTN InDataSize,
IN EFI_SIGNATURE_LIST **AllowedDb,
IN EFI_SIGNATURE_LIST **RevokedDb OPTIONAL,
IN EFI_SIGNATURE_LIST **TimeStampDb OPTIONAL,
OUT VOID *Content OPTIONAL,
IN OUT UINTN *ContentSize
);
/**
Processes a buffer containing binary DER-encoded detached PKCS7 signature.
The hash of the signed data content is calculated and passed by the caller. Function
verifies the signature of the content is valid and signing certificate was not revoked
and is contained within a list of trusted signers.
Note: because this function uses hashes and the specification contains a variety of
hash choices, you should be aware that the check against the RevokedDb list
will improperly succeed if the signature is revoked using a different hash
algorithm. For this reason, you should either cycle through all UEFI supported
hashes to see if one is forbidden, or rely on a single hash choice only if the
UEFI signature authority only signs and revokes with a single hash (at time
of writing, this hash choice is SHA256).
@param[in] This Pointer to EFI_PKCS7_VERIFY_PROTOCOL instance.
@param[in] Signature Points to buffer containing ASN.1 DER-encoded PKCS
detached signature.
@param[in] SignatureSize The size of Signature buffer in bytes.
@param[in] InHash InHash points to buffer containing the caller
calculated hash of the data. The parameter may not
be NULL.
@param[in] InHashSize The size in bytes of InHash buffer.
@param[in] AllowedDb Pointer to a list of pointers to EFI_SIGNATURE_LIST
structures. The list is terminated by a null
pointer. The EFI_SIGNATURE_LIST structures contain
lists of X.509 certificates of approved signers.
Function recognizes signer certificates of type
EFI_CERT_X509_GUID. Any hash certificate in AllowedDb
list is ignored by this function. Function returns
success if signer of the buffer is within this list
(and not within RevokedDb). This parameter is
required.
@param[in] RevokedDb Optional pointer to a list of pointers to
EFI_SIGNATURE_LIST structures. The list is terminated
by a null pointer. List of X.509 certificates of
revoked signers and revoked file hashes. Signature
verification will always fail if the signer of the
file or the hash of the data component of the buffer
is in RevokedDb list. This parameter is optional
and caller may pass Null if not required.
@param[in] TimeStampDb Optional pointer to a list of pointers to
EFI_SIGNATURE_LIST structures. The list is terminated
by a null pointer. This parameter can be used to pass
a list of X.509 certificates of trusted time stamp
counter-signers.
@retval EFI_SUCCESS Signed hash was verified against caller-provided
hash of content, the signer's certificate was not
found in RevokedDb, and was found in AllowedDb or
if in signer is found in both AllowedDb and
RevokedDb, the signing was allowed by reference to
TimeStampDb as described above, and no hash matching
content hash was found in RevokedDb.
@retval EFI_SECURITY_VIOLATION The SignedData buffer was correctly formatted but
signer was in RevokedDb or not in AllowedDb. Also
returned if matching content hash found in RevokedDb.
@retval EFI_COMPROMISED_DATA Caller provided hash differs from signed hash. Or,
caller and encrypted hash are different sizes.
@retval EFI_INVALID_PARAMETER Signature is NULL or SignatureSize is zero. InHash
is NULL or InHashSize is zero. AllowedDb is NULL.
@retval EFI_ABORTED Unsupported or invalid format in TimeStampDb,
RevokedDb or AllowedDb list contents was detected.
@retval EFI_UNSUPPORTED The Signature buffer was not correctly formatted
for processing by the function.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PKCS7_VERIFY_SIGNATURE) (
IN EFI_PKCS7_VERIFY_PROTOCOL *This,
IN VOID *Signature,
IN UINTN SignatureSize,
IN VOID *InHash,
IN UINTN InHashSize,
IN EFI_SIGNATURE_LIST **AllowedDb,
IN EFI_SIGNATURE_LIST **RevokedDb OPTIONAL,
IN EFI_SIGNATURE_LIST **TimeStampDb OPTIONAL
);
///
/// The EFI_PKCS7_VERIFY_PROTOCOL is used to verify data signed using PKCS7
/// structure. The PKCS7 data to be verified must be ASN.1 (DER) encoded.
/// SHA256 must be supported as digest algorithm with RSA digest encryption.
/// Support of other hash algorithms is optional.
///
struct _EFI_PKCS7_VERIFY_PROTOCOL {
EFI_PKCS7_VERIFY_BUFFER VerifyBuffer;
EFI_PKCS7_VERIFY_SIGNATURE VerifySignature;
};
extern EFI_GUID gEfiPkcs7VerifyProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PlatformDriverOverride.h
================================================
/** @file
Platform Driver Override protocol as defined in the UEFI 2.1 specification.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_H__
#define __EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_H__
///
/// Global ID for the Platform Driver Override Protocol
///
#define EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID \
{ \
0x6b30c738, 0xa391, 0x11d4, {0x9a, 0x3b, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
}
typedef struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL;
//
// Prototypes for the Platform Driver Override Protocol
//
/**
Retrieves the image handle of the platform override driver for a controller in the system.
@param This A pointer to the EFI_PLATFORM_DRIVER_OVERRIDE_
PROTOCOL instance.
@param ControllerHandle The device handle of the controller to check if a driver override
exists.
@param DriverImageHandle On input, a pointer to the previous driver image handle returned
by GetDriver(). On output, a pointer to the next driver
image handle.
@retval EFI_SUCCESS The driver override for ControllerHandle was returned in
DriverImageHandle.
@retval EFI_NOT_FOUND A driver override for ControllerHandle was not found.
@retval EFI_INVALID_PARAMETER The handle specified by ControllerHandle is NULL.
@retval EFI_INVALID_PARAMETER DriverImageHandle is not a handle that was returned on a
previous call to GetDriver().
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER)(
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN OUT EFI_HANDLE *DriverImageHandle
);
/**
Retrieves the device path of the platform override driver for a controller in the system.
@param This A pointer to the EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL instance.
@param ControllerHandle The device handle of the controller to check if a driver override
exists.
@param DriverImagePath On input, a pointer to the previous driver device path returned by
GetDriverPath(). On output, a pointer to the next driver
device path. Passing in a pointer to NULL will return the first
driver device path for ControllerHandle.
@retval EFI_SUCCESS The driver override for ControllerHandle was returned in
DriverImageHandle.
@retval EFI_UNSUPPORTED The operation is not supported.
@retval EFI_NOT_FOUND A driver override for ControllerHandle was not found.
@retval EFI_INVALID_PARAMETER The handle specified by ControllerHandle is NULL.
@retval EFI_INVALID_PARAMETER DriverImagePath is not a device path that was returned on a
previous call to GetDriverPath().
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH)(
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN OUT EFI_DEVICE_PATH_PROTOCOL **DriverImagePath
);
/**
Used to associate a driver image handle with a device path that was returned on a prior call to the
GetDriverPath() service. This driver image handle will then be available through the
GetDriver() service.
@param This A pointer to the EFI_PLATFORM_DRIVER_OVERRIDE_
PROTOCOL instance.
@param ControllerHandle The device handle of the controller.
@param DriverImagePath A pointer to the driver device path that was returned in a prior
call to GetDriverPath().
@param DriverImageHandle The driver image handle that was returned by LoadImage()
when the driver specified by DriverImagePath was loaded
into memory.
@retval EFI_SUCCESS The association between DriverImagePath and
DriverImageHandle was established for the controller specified
by ControllerHandle.
@retval EFI_UNSUPPORTED The operation is not supported.
@retval EFI_NOT_FOUND DriverImagePath is not a device path that was returned on a prior
call to GetDriverPath() for the controller specified by
ControllerHandle.
@retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
@retval EFI_INVALID_PARAMETER DriverImagePath is not a valid device path.
@retval EFI_INVALID_PARAMETER DriverImageHandle is not a valid image handle.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED)(
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *DriverImagePath,
IN EFI_HANDLE DriverImageHandle
);
///
/// This protocol matches one or more drivers to a controller. A platform driver
/// produces this protocol, and it is installed on a separate handle. This protocol
/// is used by the ConnectController() boot service to select the best driver
/// for a controller. All of the drivers returned by this protocol have a higher
/// precedence than drivers found from an EFI Bus Specific Driver Override Protocol
/// or drivers found from the general UEFI driver Binding search algorithm. If more
/// than one driver is returned by this protocol, then the drivers are returned in
/// order from highest precedence to lowest precedence.
///
struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL {
EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER GetDriver;
EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH GetDriverPath;
EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED DriverLoaded;
};
extern EFI_GUID gEfiPlatformDriverOverrideProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PlatformToDriverConfiguration.h
================================================
/** @file
UEFI Platform to Driver Configuration Protocol is defined in UEFI specification.
This is a protocol that is optionally produced by the platform and optionally consumed
by a UEFI Driver in its Start() function. This protocol allows the driver to receive
configuration information as part of being started.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __PLATFORM_TO_DRIVER_CONFIGUARTION_H__
#define __PLATFORM_TO_DRIVER_CONFIGUARTION_H__
#define EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL_GUID \
{ 0x642cd590, 0x8059, 0x4c0a, { 0xa9, 0x58, 0xc5, 0xec, 0x7, 0xd2, 0x3c, 0x4b } }
typedef struct _EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL;
/**
The UEFI driver must call Query early in the Start() function
before any time consuming operations are performed. If
ChildHandle is NULL the driver is requesting information from
the platform about the ControllerHandle that is being started.
Information returned from Query may lead to the drivers Start()
function failing.
If the UEFI driver is a bus driver and producing a ChildHandle,
the driver must call Query after the child handle has been created
and an EFI_DEVICE_PATH_PROTOCOL has been placed on that handle,
but before any time consuming operation is performed. If information
return by Query may lead the driver to decide to not create the
ChildHandle. The driver must then cleanup and remove the ChildHandle
from the system.
The UEFI driver repeatedly calls Query, processes the information
returned by the platform, and calls Response passing in the
arguments returned from Query. The Instance value passed into
Response must be the same value passed into the corresponding
call to Query. The UEFI driver must continuously call Query and
Response until EFI_NOT_FOUND is returned by Query.
If the UEFI driver does not recognize the ParameterTypeGuid, it
calls Response with a ConfigurationAction of
EfiPlatformConfigurationActionUnsupportedGuid. The UEFI driver
must then continue calling Query and Response until EFI_NOT_FOUND
is returned by Query. This gives the platform an opportunity to
pass additional configuration settings using a different
ParameterTypeGuid that may be supported by the driver.
An Instance value of zero means return the first ParameterBlock
in the set of unprocessed parameter blocks. The driver should
increment the Instance value by one for each successive call to Query.
@param This A pointer to the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL instance.
@param ControllerHandle The handle the platform will return
configuration information about.
@param ChildHandle The handle of the child controller to
return information on. This is an optional
parameter that may be NULL. It will be
NULL for device drivers and for bus
drivers that attempt to get options for
the bus controller. It will not be NULL
for a bus driver that attempts to get
options for one of its child controllers.
@param Instance Pointer to the Instance value. Zero means
return the first query data. The caller should
increment this value by one each time to retrieve
successive data.
@param ParameterTypeGuid An EFI_GUID that defines the contents
of ParameterBlock. UEFI drivers must
use the ParameterTypeGuid to determine
how to parse the ParameterBlock. The caller
should not attempt to free ParameterTypeGuid.
@param ParameterBlock The platform returns a pointer to the
ParameterBlock structure which
contains details about the
configuration parameters specific to
the ParameterTypeGuid. This structure
is defined based on the protocol and
may be different for different
protocols. UEFI driver decodes this
structure and its contents based on
ParameterTypeGuid. ParameterBlock is
allocated by the platform and the
platform is responsible for freeing
the ParameterBlock after Result is
called.
@param ParameterBlockSize The platform returns the size of
the ParameterBlock in bytes.
@retval EFI_SUCCESS The platform return parameter
information for ControllerHandle.
@retval EFI_NOT_FOUND No more unread Instance exists.
@retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
@retval EFI_INVALID_PARAMETER Instance is NULL.
@retval EFI_DEVICE_ERROR A device error occurred while
attempting to return parameter block
information for the controller
specified by ControllerHandle and
ChildHandle.
@retval EFI_OUT_RESOURCES There are not enough resources
available to set the configuration
options for the controller specified
by ControllerHandle and ChildHandle.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PLATFORM_TO_DRIVER_CONFIGURATION_QUERY)(
IN CONST EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL *This,
IN CONST EFI_HANDLE ControllerHandle,
IN CONST EFI_HANDLE ChildHandle OPTIONAL,
IN CONST UINTN *Instance,
OUT EFI_GUID **ParameterTypeGuid,
OUT VOID **ParameterBlock,
OUT UINTN *ParameterBlockSize
);
typedef enum {
///
/// The controller specified by ControllerHandle is still
/// in a usable state, and its configuration has been updated
/// via parsing the ParameterBlock. If required by the
/// parameter block, and the module supports an NVRAM store,
/// the configuration information from PB was successfully
/// saved to the NVRAM. No actions are required before
/// this controller can be used again with the updated
/// configuration settings.
///
EfiPlatformConfigurationActionNone = 0,
///
/// The driver has detected that the controller specified
/// by ControllerHandle is not in a usable state and
/// needs to be stopped. The calling agent can use the
/// DisconnectControservice to perform this operation, and
/// it should be performed as soon as possible.
///
EfiPlatformConfigurationActionStopController = 1,
///
/// This controller specified by ControllerHandle needs to
/// be stopped and restarted before it can be used again.
/// The calling agent can use the DisconnectController()
/// and ConnectController() services to perform this
/// operation. The restart operation can be delayed until
/// all of the configuration options have been set.
///
EfiPlatformConfigurationActionRestartController = 2,
///
/// A configuration change has been made that requires the
/// platform to be restarted before the controller
/// specified by ControllerHandle can be used again. The
/// calling agent can use the ResetSystem() services to
/// perform this operation. The restart operation can be
/// delayed until all of the configuration options have
/// been set.
///
EfiPlatformConfigurationActionRestartPlatform = 3,
///
/// The controller specified by ControllerHandle is still
/// in a usable state; its configuration has been updated
/// via parsing the ParameterBlock. The driver tried to
/// update the driver's private NVRAM store with
/// information from ParameterBlock and failed. No actions
/// are required before this controller can be used again
/// with the updated configuration settings, but these
/// configuration settings are not guaranteed to persist
/// after ControllerHandle is stopped.
///
EfiPlatformConfigurationActionNvramFailed = 4,
///
/// The controller specified by ControllerHandle is still
/// in a usable state; its configuration has not been updated
/// via parsing the ParameterBlock. The driver did not support
/// the ParameterBlock format identified by ParameterTypeGuid.
/// No actions are required before this controller can be used
/// again. On additional Query calls from this ControllerHandle,
/// the platform should stop returning a ParameterBlock
/// qualified by this same ParameterTypeGuid. If no other
/// ParameterTypeGuid is supported by the platform, Query
/// should return EFI_NOT_FOUND.
///
EfiPlatformConfigurationActionUnsupportedGuid = 5,
EfiPlatformConfigurationActionMaximum
} EFI_PLATFORM_CONFIGURATION_ACTION;
/**
The UEFI driver repeatedly calls Query, processes the
information returned by the platform, and calls Response passing
in the arguments returned from Query. The UEFI driver must
continuously call Query until EFI_NOT_FOUND is returned. For
every call to Query that returns EFI_SUCCESS a corrisponding
call to Response is required passing in the same
ContollerHandle, ChildHandle, Instance, ParameterTypeGuid,
ParameterBlock, and ParameterBlockSize. The UEFI driver may
update values in ParameterBlock based on rules defined by
ParameterTypeGuid. The platform is responsible for freeing
ParameterBlock and the UEFI driver must not try to free it.
@param This A pointer to the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL instance.
@param ControllerHandle The handle the driver is returning
configuration information about.
@param ChildHandle The handle of the child controller to
return information on. This is an optional
parameter that may be NULL. It will be
NULL for device drivers, and for bus
drivers that attempt to get options for
the bus controller. It will not be NULL
for a bus driver that attempts to get
options for one of its child controllers.
Instance Instance data returned from
Query().
@param Instance Instance data passed to Query().
@param ParameterTypeGuid ParameterTypeGuid returned from Query.
@param ParameterBlock ParameterBlock returned from Query.
@param ParameterBlockSize The ParameterBlock size returned from Query.
@param ConfigurationAction The driver tells the platform what
action is required for ParameterBlock to
take effect.
@retval EFI_SUCCESS The platform return parameter information
for ControllerHandle.
@retval EFI_NOT_FOUND Instance was not found.
@retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
@retval EFI_INVALID_PARAMETER Instance is zero.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PLATFORM_TO_DRIVER_CONFIGURATION_RESPONSE)(
IN CONST EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL *This,
IN CONST EFI_HANDLE ControllerHandle,
IN CONST EFI_HANDLE ChildHandle OPTIONAL,
IN CONST UINTN *Instance,
IN CONST EFI_GUID *ParameterTypeGuid,
IN CONST VOID *ParameterBlock,
IN CONST UINTN ParameterBlockSize ,
IN CONST EFI_PLATFORM_CONFIGURATION_ACTION ConfigurationAction
);
///
/// The EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL is used by the
/// UEFI driver to query the platform for configuration information.
/// The UEFI driver calls Query() multiple times to get
/// configuration information from the platform. For every call to
/// Query() there must be a matching call to Response() so the
/// UEFI driver can inform the platform how it used the
/// information passed in from Query(). It's legal for a UEFI
/// driver to use Response() to inform the platform it does not
/// understand the data returned via Query() and thus no action was
/// taken.
///
struct _EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL {
EFI_PLATFORM_TO_DRIVER_CONFIGURATION_QUERY Query;
EFI_PLATFORM_TO_DRIVER_CONFIGURATION_RESPONSE Response;
};
#define EFI_PLATFORM_TO_DRIVER_CONFIGURATION_CLP_GUID \
{0x345ecc0e, 0xcb6, 0x4b75, { 0xbb, 0x57, 0x1b, 0x12, 0x9c, 0x47, 0x33,0x3e } }
/**
ParameterTypeGuid provides the support for parameters
communicated through the DMTF SM CLP Specification 1.0 Final
Standard to be used to configure the UEFI driver. In this
section the producer of the
EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL is platform
firmware and the consumer is the UEFI driver. Note: if future
versions of the DMTF SM CLP Specification require changes to the
parameter block definition, a newer ParameterTypeGuid will be
used.
**/
typedef struct {
CHAR8 *CLPCommand; ///< A pointer to the null-terminated UTF-8 string that specifies the DMTF SM CLP command
///< line that the driver is required to parse and process when this function is called.
///< See the DMTF SM CLP Specification 1.0 Final Standard for details on the
///< format and syntax of the CLP command line string. CLPCommand buffer
///< is allocated by the producer of the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOOL.
UINT32 CLPCommandLength; ///< The length of the CLP Command in bytes.
CHAR8 *CLPReturnString; ///< A pointer to the null-terminated UTF-8 string that indicates the CLP return status
///< that the driver is required to provide to the calling agent.
///< The calling agent may parse and/ or pass
///< this for processing and user feedback. The SM CLP Command Response string
///< buffer is filled in by the UEFI driver in the "keyword=value" format
///< described in the SM CLP Specification, unless otherwise requested via the SM
///< CLP Coutput option in the Command Line string buffer. UEFI driver's support
///< for this default "keyword=value" output format is required if the UEFI
///< driver supports this protocol, while support for other SM CLP output
///< formats is optional (the UEFI Driver should return an EFI_UNSUPPORTED if
///< the SM CLP Coutput option requested by the caller is not supported by the
///< UEFI Driver). CLPReturnString buffer is allocated by the consumer of the
///< EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC OL and undefined prior to the call to
///< Response().
UINT32 CLPReturnStringLength; ///< The length of the CLP return status string in bytes.
UINT8 CLPCmdStatus; ///< SM CLP Command Status (see DMTF SM CLP Specification 1.0 Final Standard -
///< Table 4) CLPErrorValue SM CLP Processing Error Value (see DMTF SM
///< CLP Specification 1.0 Final Standard - Table 6). This field is filled in by
///< the consumer of the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC
///< OL and undefined prior to the call to Response().
UINT8 CLPErrorValue; ///< SM CLP Processing Error Value (see DMTF SM CLP Specification 1.0 Final Standard - Table 6).
///< This field is filled in by the consumer of the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL and undefined prior to the call to Response().
UINT16 CLPMsgCode; ///< Bit 15: OEM Message Code Flag 0 = Message Code is an SM CLP Probable
///< Cause Value. (see SM CLP Specification Table 11) 1 = Message Code is OEM
///< Specific Bits 14-0: Message Code This field is filled in by the consumer of
///< the EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOC OL and undefined prior to the call to
///< Response().
} EFI_CONFIGURE_CLP_PARAMETER_BLK;
extern EFI_GUID gEfiPlatformToDriverConfigurationClpGuid;
extern EFI_GUID gEfiPlatformToDriverConfigurationProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PxeBaseCode.h
================================================
/** @file
EFI PXE Base Code Protocol definitions, which is used to access PXE-compatible
devices for network access and network booting.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is introduced in EFI Specification 1.10.
**/
#ifndef __PXE_BASE_CODE_PROTOCOL_H__
#define __PXE_BASE_CODE_PROTOCOL_H__
///
/// PXE Base Code protocol.
///
#define EFI_PXE_BASE_CODE_PROTOCOL_GUID \
{ \
0x03c4e603, 0xac28, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
}
typedef struct _EFI_PXE_BASE_CODE_PROTOCOL EFI_PXE_BASE_CODE_PROTOCOL;
///
/// Protocol defined in EFI1.1.
///
typedef EFI_PXE_BASE_CODE_PROTOCOL EFI_PXE_BASE_CODE;
///
/// Default IP TTL and ToS.
///
#define DEFAULT_TTL 16
#define DEFAULT_ToS 0
///
/// ICMP error format.
///
typedef struct {
UINT8 Type;
UINT8 Code;
UINT16 Checksum;
union {
UINT32 reserved;
UINT32 Mtu;
UINT32 Pointer;
struct {
UINT16 Identifier;
UINT16 Sequence;
} Echo;
} u;
UINT8 Data[494];
} EFI_PXE_BASE_CODE_ICMP_ERROR;
///
/// TFTP error format.
///
typedef struct {
UINT8 ErrorCode;
CHAR8 ErrorString[127];
} EFI_PXE_BASE_CODE_TFTP_ERROR;
///
/// IP Receive Filter definitions.
///
#define EFI_PXE_BASE_CODE_MAX_IPCNT 8
///
/// IP Receive Filter structure.
///
typedef struct {
UINT8 Filters;
UINT8 IpCnt;
UINT16 reserved;
EFI_IP_ADDRESS IpList[EFI_PXE_BASE_CODE_MAX_IPCNT];
} EFI_PXE_BASE_CODE_IP_FILTER;
#define EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP 0x0001
#define EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST 0x0002
#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS 0x0004
#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST 0x0008
///
/// ARP cache entries.
///
typedef struct {
EFI_IP_ADDRESS IpAddr;
EFI_MAC_ADDRESS MacAddr;
} EFI_PXE_BASE_CODE_ARP_ENTRY;
///
/// ARP route table entries.
///
typedef struct {
EFI_IP_ADDRESS IpAddr;
EFI_IP_ADDRESS SubnetMask;
EFI_IP_ADDRESS GwAddr;
} EFI_PXE_BASE_CODE_ROUTE_ENTRY;
//
// UDP definitions
//
typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT;
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP 0x0001
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT 0x0002
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP 0x0004
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT 0x0008
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER 0x0010
#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT 0x0020
//
// Discover() definitions
//
#define EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP 0
#define EFI_PXE_BASE_CODE_BOOT_TYPE_MS_WINNT_RIS 1
#define EFI_PXE_BASE_CODE_BOOT_TYPE_INTEL_LCM 2
#define EFI_PXE_BASE_CODE_BOOT_TYPE_DOSUNDI 3
#define EFI_PXE_BASE_CODE_BOOT_TYPE_NEC_ESMPRO 4
#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_WSoD 5
#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_LCCM 6
#define EFI_PXE_BASE_CODE_BOOT_TYPE_CA_UNICENTER_TNG 7
#define EFI_PXE_BASE_CODE_BOOT_TYPE_HP_OPENVIEW 8
#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_9 9
#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_10 10
#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_11 11
#define EFI_PXE_BASE_CODE_BOOT_TYPE_NOT_USED_12 12
#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_INSTALL 13
#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_BOOT 14
#define EFI_PXE_BASE_CODE_BOOT_TYPE_REMBO 15
#define EFI_PXE_BASE_CODE_BOOT_TYPE_BEOBOOT 16
//
// 17 through 32767 are reserved
// 32768 through 65279 are for vendor use
// 65280 through 65534 are reserved
//
#define EFI_PXE_BASE_CODE_BOOT_TYPE_PXETEST 65535
#define EFI_PXE_BASE_CODE_BOOT_LAYER_MASK 0x7FFF
#define EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL 0x0000
//
// PXE Tag definition that identifies the processor
// and programming environment of the client system.
// These identifiers are defined by IETF:
// http://www.ietf.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml
//
#if defined (MDE_CPU_IA32)
#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x0006
#elif defined (MDE_CPU_X64)
#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x0007
#elif defined (MDE_CPU_ARM)
#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x000A
#elif defined (MDE_CPU_AARCH64)
#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE 0x000B
#endif
///
/// Discover() server list structure.
///
typedef struct {
UINT16 Type;
BOOLEAN AcceptAnyResponse;
UINT8 Reserved;
EFI_IP_ADDRESS IpAddr;
} EFI_PXE_BASE_CODE_SRVLIST;
///
/// Discover() information override structure.
///
typedef struct {
BOOLEAN UseMCast;
BOOLEAN UseBCast;
BOOLEAN UseUCast;
BOOLEAN MustUseList;
EFI_IP_ADDRESS ServerMCastIp;
UINT16 IpCnt;
EFI_PXE_BASE_CODE_SRVLIST SrvList[1];
} EFI_PXE_BASE_CODE_DISCOVER_INFO;
///
/// TFTP opcode definitions.
///
typedef enum {
EFI_PXE_BASE_CODE_TFTP_FIRST,
EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
EFI_PXE_BASE_CODE_TFTP_READ_FILE,
EFI_PXE_BASE_CODE_TFTP_WRITE_FILE,
EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY,
EFI_PXE_BASE_CODE_MTFTP_GET_FILE_SIZE,
EFI_PXE_BASE_CODE_MTFTP_READ_FILE,
EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY,
EFI_PXE_BASE_CODE_MTFTP_LAST
} EFI_PXE_BASE_CODE_TFTP_OPCODE;
///
/// MTFTP information. This information is required
/// to start or join a multicast TFTP session. It is also required to
/// perform the "get file size" and "read directory" operations of MTFTP.
///
typedef struct {
EFI_IP_ADDRESS MCastIp;
EFI_PXE_BASE_CODE_UDP_PORT CPort;
EFI_PXE_BASE_CODE_UDP_PORT SPort;
UINT16 ListenTimeout;
UINT16 TransmitTimeout;
} EFI_PXE_BASE_CODE_MTFTP_INFO;
///
/// DHCPV4 Packet structure.
///
typedef struct {
UINT8 BootpOpcode;
UINT8 BootpHwType;
UINT8 BootpHwAddrLen;
UINT8 BootpGateHops;
UINT32 BootpIdent;
UINT16 BootpSeconds;
UINT16 BootpFlags;
UINT8 BootpCiAddr[4];
UINT8 BootpYiAddr[4];
UINT8 BootpSiAddr[4];
UINT8 BootpGiAddr[4];
UINT8 BootpHwAddr[16];
UINT8 BootpSrvName[64];
UINT8 BootpBootFile[128];
UINT32 DhcpMagik;
UINT8 DhcpOptions[56];
} EFI_PXE_BASE_CODE_DHCPV4_PACKET;
///
/// DHCPV6 Packet structure.
///
typedef struct {
UINT32 MessageType:8;
UINT32 TransactionId:24;
UINT8 DhcpOptions[1024];
} EFI_PXE_BASE_CODE_DHCPV6_PACKET;
///
/// Packet structure.
///
typedef union {
UINT8 Raw[1472];
EFI_PXE_BASE_CODE_DHCPV4_PACKET Dhcpv4;
EFI_PXE_BASE_CODE_DHCPV6_PACKET Dhcpv6;
} EFI_PXE_BASE_CODE_PACKET;
//
// PXE Base Code Mode structure
//
#define EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8
#define EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8
///
/// EFI_PXE_BASE_CODE_MODE.
/// The data values in this structure are read-only and
/// are updated by the code that produces the
/// EFI_PXE_BASE_CODE_PROTOCOL functions.
///
typedef struct {
BOOLEAN Started;
BOOLEAN Ipv6Available;
BOOLEAN Ipv6Supported;
BOOLEAN UsingIpv6;
BOOLEAN BisSupported;
BOOLEAN BisDetected;
BOOLEAN AutoArp;
BOOLEAN SendGUID;
BOOLEAN DhcpDiscoverValid;
BOOLEAN DhcpAckReceived;
BOOLEAN ProxyOfferReceived;
BOOLEAN PxeDiscoverValid;
BOOLEAN PxeReplyReceived;
BOOLEAN PxeBisReplyReceived;
BOOLEAN IcmpErrorReceived;
BOOLEAN TftpErrorReceived;
BOOLEAN MakeCallbacks;
UINT8 TTL;
UINT8 ToS;
EFI_IP_ADDRESS StationIp;
EFI_IP_ADDRESS SubnetMask;
EFI_PXE_BASE_CODE_PACKET DhcpDiscover;
EFI_PXE_BASE_CODE_PACKET DhcpAck;
EFI_PXE_BASE_CODE_PACKET ProxyOffer;
EFI_PXE_BASE_CODE_PACKET PxeDiscover;
EFI_PXE_BASE_CODE_PACKET PxeReply;
EFI_PXE_BASE_CODE_PACKET PxeBisReply;
EFI_PXE_BASE_CODE_IP_FILTER IpFilter;
UINT32 ArpCacheEntries;
EFI_PXE_BASE_CODE_ARP_ENTRY ArpCache[EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES];
UINT32 RouteTableEntries;
EFI_PXE_BASE_CODE_ROUTE_ENTRY RouteTable[EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES];
EFI_PXE_BASE_CODE_ICMP_ERROR IcmpError;
EFI_PXE_BASE_CODE_TFTP_ERROR TftpError;
} EFI_PXE_BASE_CODE_MODE;
//
// PXE Base Code Interface Function definitions
//
/**
Enables the use of the PXE Base Code Protocol functions.
This function enables the use of the PXE Base Code Protocol functions. If the
Started field of the EFI_PXE_BASE_CODE_MODE structure is already TRUE, then
EFI_ALREADY_STARTED will be returned. If UseIpv6 is TRUE, then IPv6 formatted
addresses will be used in this session. If UseIpv6 is FALSE, then IPv4 formatted
addresses will be used in this session. If UseIpv6 is TRUE, and the Ipv6Supported
field of the EFI_PXE_BASE_CODE_MODE structure is FALSE, then EFI_UNSUPPORTED will
be returned. If there is not enough memory or other resources to start the PXE
Base Code Protocol, then EFI_OUT_OF_RESOURCES will be returned. Otherwise, the
PXE Base Code Protocol will be started, and all of the fields of the EFI_PXE_BASE_CODE_MODE
structure will be initialized as follows:
StartedSet to TRUE.
Ipv6SupportedUnchanged.
Ipv6AvailableUnchanged.
UsingIpv6Set to UseIpv6.
BisSupportedUnchanged.
BisDetectedUnchanged.
AutoArpSet to TRUE.
SendGUIDSet to FALSE.
TTLSet to DEFAULT_TTL.
ToSSet to DEFAULT_ToS.
DhcpCompletedSet to FALSE.
ProxyOfferReceivedSet to FALSE.
StationIpSet to an address of all zeros.
SubnetMaskSet to a subnet mask of all zeros.
DhcpDiscoverZero-filled.
DhcpAckZero-filled.
ProxyOfferZero-filled.
PxeDiscoverValidSet to FALSE.
PxeDiscoverZero-filled.
PxeReplyValidSet to FALSE.
PxeReplyZero-filled.
PxeBisReplyValidSet to FALSE.
PxeBisReplyZero-filled.
IpFilterSet the Filters field to 0 and the IpCnt field to 0.
ArpCacheEntriesSet to 0.
ArpCacheZero-filled.
RouteTableEntriesSet to 0.
RouteTableZero-filled.
IcmpErrorReceivedSet to FALSE.
IcmpErrorZero-filled.
TftpErroReceivedSet to FALSE.
TftpErrorZero-filled.
MakeCallbacksSet to TRUE if the PXE Base Code Callback Protocol is available.
Set to FALSE if the PXE Base Code Callback Protocol is not available.
@param This The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param UseIpv6 Specifies the type of IP addresses that are to be used during the session
that is being started. Set to TRUE for IPv6 addresses, and FALSE for
IPv4 addresses.
@retval EFI_SUCCESS The PXE Base Code Protocol was started.
@retval EFI_DEVICE_ERROR The network device encountered an error during this oper
@retval EFI_UNSUPPORTED UseIpv6 is TRUE, but the Ipv6Supported field of the
EFI_PXE_BASE_CODE_MODE structure is FALSE.
@retval EFI_ALREADY_STARTED The PXE Base Code Protocol is already in the started state.
@retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid
EFI_PXE_BASE_CODE_PROTOCOL structure.
@retval EFI_OUT_OF_RESOURCES Could not allocate enough memory or other resources to start the
PXE Base Code Protocol.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_START)(
IN EFI_PXE_BASE_CODE_PROTOCOL *This,
IN BOOLEAN UseIpv6
);
/**
Disables the use of the PXE Base Code Protocol functions.
This function stops all activity on the network device. All the resources allocated
in Start() are released, the Started field of the EFI_PXE_BASE_CODE_MODE structure is
set to FALSE and EFI_SUCCESS is returned. If the Started field of the EFI_PXE_BASE_CODE_MODE
structure is already FALSE, then EFI_NOT_STARTED will be returned.
@param This The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@retval EFI_SUCCESS The PXE Base Code Protocol was stopped.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is already in the stopped state.
@retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid
EFI_PXE_BASE_CODE_PROTOCOL structure.
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_STOP)(
IN EFI_PXE_BASE_CODE_PROTOCOL *This
);
/**
Attempts to complete a DHCPv4 D.O.R.A. (discover / offer / request / acknowledge) or DHCPv6
S.A.R.R (solicit / advertise / request / reply) sequence.
This function attempts to complete the DHCP sequence. If this sequence is completed,
then EFI_SUCCESS is returned, and the DhcpCompleted, ProxyOfferReceived, StationIp,
SubnetMask, DhcpDiscover, DhcpAck, and ProxyOffer fields of the EFI_PXE_BASE_CODE_MODE
structure are filled in.
If SortOffers is TRUE, then the cached DHCP offer packets will be sorted before
they are tried. If SortOffers is FALSE, then the cached DHCP offer packets will
be tried in the order in which they are received. Please see the Preboot Execution
Environment (PXE) Specification for additional details on the implementation of DHCP.
This function can take at least 31 seconds to timeout and return control to the
caller. If the DHCP sequence does not complete, then EFI_TIMEOUT will be returned.
If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
then the DHCP sequence will be stopped and EFI_ABORTED will be returned.
@param This The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param SortOffers TRUE if the offers received should be sorted. Set to FALSE to try the
offers in the order that they are received.
@retval EFI_SUCCESS Valid DHCP has completed.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
@retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid
EFI_PXE_BASE_CODE_PROTOCOL structure.
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
@retval EFI_OUT_OF_RESOURCES Could not allocate enough memory to complete the DHCP Protocol.
@retval EFI_ABORTED The callback function aborted the DHCP Protocol.
@retval EFI_TIMEOUT The DHCP Protocol timed out.
@retval EFI_ICMP_ERROR An ICMP error packet was received during the DHCP session.
@retval EFI_NO_RESPONSE Valid PXE offer was not received.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_DHCP)(
IN EFI_PXE_BASE_CODE_PROTOCOL *This,
IN BOOLEAN SortOffers
);
/**
Attempts to complete the PXE Boot Server and/or boot image discovery sequence.
This function attempts to complete the PXE Boot Server and/or boot image discovery
sequence. If this sequence is completed, then EFI_SUCCESS is returned, and the
PxeDiscoverValid, PxeDiscover, PxeReplyReceived, and PxeReply fields of the
EFI_PXE_BASE_CODE_MODE structure are filled in. If UseBis is TRUE, then the
PxeBisReplyReceived and PxeBisReply fields of the EFI_PXE_BASE_CODE_MODE structure
will also be filled in. If UseBis is FALSE, then PxeBisReplyValid will be set to FALSE.
In the structure referenced by parameter Info, the PXE Boot Server list, SrvList[],
has two uses: It is the Boot Server IP address list used for unicast discovery
(if the UseUCast field is TRUE), and it is the list used for Boot Server verification
(if the MustUseList field is TRUE). Also, if the MustUseList field in that structure
is TRUE and the AcceptAnyResponse field in the SrvList[] array is TRUE, any Boot
Server reply of that type will be accepted. If the AcceptAnyResponse field is
FALSE, only responses from Boot Servers with matching IP addresses will be accepted.
This function can take at least 10 seconds to timeout and return control to the
caller. If the Discovery sequence does not complete, then EFI_TIMEOUT will be
returned. Please see the Preboot Execution Environment (PXE) Specification for
additional details on the implementation of the Discovery sequence.
If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
then the Discovery sequence is stopped and EFI_ABORTED will be returned.
@param This The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param Type The type of bootstrap to perform.
@param Layer The pointer to the boot server layer number to discover, which must be
PXE_BOOT_LAYER_INITIAL when a new server type is being
discovered.
@param UseBis TRUE if Boot Integrity Services are to be used. FALSE otherwise.
@param Info The pointer to a data structure that contains additional information on the
type of discovery operation that is to be performed.
@retval EFI_SUCCESS The Discovery sequence has been completed.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
@retval EFI_OUT_OF_RESOURCES Could not allocate enough memory to complete Discovery.
@retval EFI_ABORTED The callback function aborted the Discovery sequence.
@retval EFI_TIMEOUT The Discovery sequence timed out.
@retval EFI_ICMP_ERROR An ICMP error packet was received during the PXE discovery
session.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_DISCOVER)(
IN EFI_PXE_BASE_CODE_PROTOCOL *This,
IN UINT16 Type,
IN UINT16 *Layer,
IN BOOLEAN UseBis,
IN EFI_PXE_BASE_CODE_DISCOVER_INFO *Info OPTIONAL
);
/**
Used to perform TFTP and MTFTP services.
This function is used to perform TFTP and MTFTP services. This includes the
TFTP operations to get the size of a file, read a directory, read a file, and
write a file. It also includes the MTFTP operations to get the size of a file,
read a directory, and read a file. The type of operation is specified by Operation.
If the callback function that is invoked during the TFTP/MTFTP operation does
not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then EFI_ABORTED will
be returned.
For read operations, the return data will be placed in the buffer specified by
BufferPtr. If BufferSize is too small to contain the entire downloaded file,
then EFI_BUFFER_TOO_SMALL will be returned and BufferSize will be set to zero
or the size of the requested file (the size of the requested file is only returned
if the TFTP server supports TFTP options). If BufferSize is large enough for the
read operation, then BufferSize will be set to the size of the downloaded file,
and EFI_SUCCESS will be returned. Applications using the PxeBc.Mtftp() services
should use the get-file-size operations to determine the size of the downloaded
file prior to using the read-file operations--especially when downloading large
(greater than 64 MB) files--instead of making two calls to the read-file operation.
Following this recommendation will save time if the file is larger than expected
and the TFTP server does not support TFTP option extensions. Without TFTP option
extension support, the client has to download the entire file, counting and discarding
the received packets, to determine the file size.
For write operations, the data to be sent is in the buffer specified by BufferPtr.
BufferSize specifies the number of bytes to send. If the write operation completes
successfully, then EFI_SUCCESS will be returned.
For TFTP "get file size" operations, the size of the requested file or directory
is returned in BufferSize, and EFI_SUCCESS will be returned. If the TFTP server
does not support options, the file will be downloaded into a bit bucket and the
length of the downloaded file will be returned. For MTFTP "get file size" operations,
if the MTFTP server does not support the "get file size" option, EFI_UNSUPPORTED
will be returned.
This function can take up to 10 seconds to timeout and return control to the caller.
If the TFTP sequence does not complete, EFI_TIMEOUT will be returned.
If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
then the TFTP sequence is stopped and EFI_ABORTED will be returned.
The format of the data returned from a TFTP read directory operation is a null-terminated
filename followed by a null-terminated information string, of the form
"size year-month-day hour:minute:second" (i.e. %d %d-%d-%d %d:%d:%f - note that
the seconds field can be a decimal number), where the date and time are UTC. For
an MTFTP read directory command, there is additionally a null-terminated multicast
IP address preceding the filename of the form %d.%d.%d.%d for IP v4. The final
entry is itself null-terminated, so that the final information string is terminated
with two null octets.
@param This The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param Operation The type of operation to perform.
@param BufferPtr A pointer to the data buffer.
@param Overwrite Only used on write file operations. TRUE if a file on a remote server can
be overwritten.
@param BufferSize For get-file-size operations, *BufferSize returns the size of the
requested file.
@param BlockSize The requested block size to be used during a TFTP transfer.
@param ServerIp The TFTP / MTFTP server IP address.
@param Filename A Null-terminated ASCII string that specifies a directory name or a file
name.
@param Info The pointer to the MTFTP information.
@param DontUseBuffer Set to FALSE for normal TFTP and MTFTP read file operation.
@retval EFI_SUCCESS The TFTP/MTFTP operation was completed.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
@retval EFI_BUFFER_TOO_SMALL The buffer is not large enough to complete the read operation.
@retval EFI_ABORTED The callback function aborted the TFTP/MTFTP operation.
@retval EFI_TIMEOUT The TFTP/MTFTP operation timed out.
@retval EFI_ICMP_ERROR An ICMP error packet was received during the MTFTP session.
@retval EFI_TFTP_ERROR A TFTP error packet was received during the MTFTP session.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_MTFTP)(
IN EFI_PXE_BASE_CODE_PROTOCOL *This,
IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation,
IN OUT VOID *BufferPtr OPTIONAL,
IN BOOLEAN Overwrite,
IN OUT UINT64 *BufferSize,
IN UINTN *BlockSize OPTIONAL,
IN EFI_IP_ADDRESS *ServerIp,
IN UINT8 *Filename OPTIONAL,
IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL,
IN BOOLEAN DontUseBuffer
);
/**
Writes a UDP packet to the network interface.
This function writes a UDP packet specified by the (optional HeaderPtr and)
BufferPtr parameters to the network interface. The UDP header is automatically
built by this routine. It uses the parameters OpFlags, DestIp, DestPort, GatewayIp,
SrcIp, and SrcPort to build this header. If the packet is successfully built and
transmitted through the network interface, then EFI_SUCCESS will be returned.
If a timeout occurs during the transmission of the packet, then EFI_TIMEOUT will
be returned. If an ICMP error occurs during the transmission of the packet, then
the IcmpErrorReceived field is set to TRUE, the IcmpError field is filled in and
EFI_ICMP_ERROR will be returned. If the Callback Protocol does not return
EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then EFI_ABORTED will be returned.
@param This The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param OpFlags The UDP operation flags.
@param DestIp The destination IP address.
@param DestPort The destination UDP port number.
@param GatewayIp The gateway IP address.
@param SrcIp The source IP address.
@param SrcPort The source UDP port number.
@param HeaderSize An optional field which may be set to the length of a header at
HeaderPtr to be prefixed to the data at BufferPtr.
@param HeaderPtr If HeaderSize is not NULL, a pointer to a header to be prefixed to the
data at BufferPtr.
@param BufferSize A pointer to the size of the data at BufferPtr.
@param BufferPtr A pointer to the data to be written.
@retval EFI_SUCCESS The UDP Write operation was completed.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_BAD_BUFFER_SIZE The buffer is too long to be transmitted.
@retval EFI_ABORTED The callback function aborted the UDP Write operation.
@retval EFI_TIMEOUT The UDP Write operation timed out.
@retval EFI_ICMP_ERROR An ICMP error packet was received during the UDP write session.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_UDP_WRITE)(
IN EFI_PXE_BASE_CODE_PROTOCOL *This,
IN UINT16 OpFlags,
IN EFI_IP_ADDRESS *DestIp,
IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort,
IN EFI_IP_ADDRESS *GatewayIp, OPTIONAL
IN EFI_IP_ADDRESS *SrcIp, OPTIONAL
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
IN UINTN *HeaderSize, OPTIONAL
IN VOID *HeaderPtr, OPTIONAL
IN UINTN *BufferSize,
IN VOID *BufferPtr
);
/**
Reads a UDP packet from the network interface.
This function reads a UDP packet from a network interface. The data contents
are returned in (the optional HeaderPtr and) BufferPtr, and the size of the
buffer received is returned in BufferSize. If the input BufferSize is smaller
than the UDP packet received (less optional HeaderSize), it will be set to the
required size, and EFI_BUFFER_TOO_SMALL will be returned. In this case, the
contents of BufferPtr are undefined, and the packet is lost. If a UDP packet is
successfully received, then EFI_SUCCESS will be returned, and the information
from the UDP header will be returned in DestIp, DestPort, SrcIp, and SrcPort if
they are not NULL.
Depending on the values of OpFlags and the DestIp, DestPort, SrcIp, and SrcPort
input values, different types of UDP packet receive filtering will be performed.
The following tables summarize these receive filter operations.
@param This The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param OpFlags The UDP operation flags.
@param DestIp The destination IP address.
@param DestPort The destination UDP port number.
@param SrcIp The source IP address.
@param SrcPort The source UDP port number.
@param HeaderSize An optional field which may be set to the length of a header at
HeaderPtr to be prefixed to the data at BufferPtr.
@param HeaderPtr If HeaderSize is not NULL, a pointer to a header to be prefixed to the
data at BufferPtr.
@param BufferSize A pointer to the size of the data at BufferPtr.
@param BufferPtr A pointer to the data to be read.
@retval EFI_SUCCESS The UDP Read operation was completed.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
@retval EFI_BUFFER_TOO_SMALL The packet is larger than Buffer can hold.
@retval EFI_ABORTED The callback function aborted the UDP Read operation.
@retval EFI_TIMEOUT The UDP Read operation timed out.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_UDP_READ)(
IN EFI_PXE_BASE_CODE_PROTOCOL *This,
IN UINT16 OpFlags,
IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort, OPTIONAL
IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL
IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
IN UINTN *HeaderSize, OPTIONAL
IN VOID *HeaderPtr, OPTIONAL
IN OUT UINTN *BufferSize,
IN VOID *BufferPtr
);
/**
Updates the IP receive filters of a network device and enables software filtering.
The NewFilter field is used to modify the network device's current IP receive
filter settings and to enable a software filter. This function updates the IpFilter
field of the EFI_PXE_BASE_CODE_MODE structure with the contents of NewIpFilter.
The software filter is used when the USE_FILTER in OpFlags is set to UdpRead().
The current hardware filter remains in effect no matter what the settings of OpFlags
are, so that the meaning of ANY_DEST_IP set in OpFlags to UdpRead() is from those
packets whose reception is enabled in hardware - physical NIC address (unicast),
broadcast address, logical address or addresses (multicast), or all (promiscuous).
UdpRead() does not modify the IP filter settings.
Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP receive
filter list emptied and the filter set to EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP.
If an application or driver wishes to preserve the IP receive filter settings,
it will have to preserve the IP receive filter settings before these calls, and
use SetIpFilter() to restore them after the calls. If incompatible filtering is
requested (for example, PROMISCUOUS with anything else), or if the device does not
support a requested filter setting and it cannot be accommodated in software
(for example, PROMISCUOUS not supported), EFI_INVALID_PARAMETER will be returned.
The IPlist field is used to enable IPs other than the StationIP. They may be
multicast or unicast. If IPcnt is set as well as EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP,
then both the StationIP and the IPs from the IPlist will be used.
@param This The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param NewFilter The pointer to the new set of IP receive filters.
@retval EFI_SUCCESS The IP receive filter settings were updated.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_SET_IP_FILTER)(
IN EFI_PXE_BASE_CODE_PROTOCOL *This,
IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter
);
/**
Uses the ARP protocol to resolve a MAC address.
This function uses the ARP protocol to resolve a MAC address. The UsingIpv6 field
of the EFI_PXE_BASE_CODE_MODE structure is used to determine if IPv4 or IPv6
addresses are being used. The IP address specified by IpAddr is used to resolve
a MAC address. If the ARP protocol succeeds in resolving the specified address,
then the ArpCacheEntries and ArpCache fields of the EFI_PXE_BASE_CODE_MODE structure
are updated, and EFI_SUCCESS is returned. If MacAddr is not NULL, the resolved
MAC address is placed there as well.
If the PXE Base Code protocol is in the stopped state, then EFI_NOT_STARTED is
returned. If the ARP protocol encounters a timeout condition while attempting
to resolve an address, then EFI_TIMEOUT is returned. If the Callback Protocol
does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then EFI_ABORTED is
returned.
@param This The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param IpAddr The pointer to the IP address that is used to resolve a MAC address.
@param MacAddr If not NULL, a pointer to the MAC address that was resolved with the
ARP protocol.
@retval EFI_SUCCESS The IP or MAC address was resolved.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
@retval EFI_ABORTED The callback function aborted the ARP Protocol.
@retval EFI_TIMEOUT The ARP Protocol encountered a timeout condition.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_ARP)(
IN EFI_PXE_BASE_CODE_PROTOCOL *This,
IN EFI_IP_ADDRESS *IpAddr,
IN EFI_MAC_ADDRESS *MacAddr OPTIONAL
);
/**
Updates the parameters that affect the operation of the PXE Base Code Protocol.
This function sets parameters that affect the operation of the PXE Base Code Protocol.
The parameter specified by NewAutoArp is used to control the generation of ARP
protocol packets. If NewAutoArp is TRUE, then ARP Protocol packets will be generated
as required by the PXE Base Code Protocol. If NewAutoArp is FALSE, then no ARP
Protocol packets will be generated. In this case, the only mappings that are
available are those stored in the ArpCache of the EFI_PXE_BASE_CODE_MODE structure.
If there are not enough mappings in the ArpCache to perform a PXE Base Code Protocol
service, then the service will fail. This function updates the AutoArp field of
the EFI_PXE_BASE_CODE_MODE structure to NewAutoArp.
The SetParameters() call must be invoked after a Callback Protocol is installed
to enable the use of callbacks.
@param This The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param NewAutoArp If not NULL, a pointer to a value that specifies whether to replace the
current value of AutoARP.
@param NewSendGUID If not NULL, a pointer to a value that specifies whether to replace the
current value of SendGUID.
@param NewTTL If not NULL, a pointer to be used in place of the current value of TTL,
the "time to live" field of the IP header.
@param NewToS If not NULL, a pointer to be used in place of the current value of ToS,
the "type of service" field of the IP header.
@param NewMakeCallback If not NULL, a pointer to a value that specifies whether to replace the
current value of the MakeCallback field of the Mode structure.
@retval EFI_SUCCESS The new parameters values were updated.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_SET_PARAMETERS)(
IN EFI_PXE_BASE_CODE_PROTOCOL *This,
IN BOOLEAN *NewAutoArp, OPTIONAL
IN BOOLEAN *NewSendGUID, OPTIONAL
IN UINT8 *NewTTL, OPTIONAL
IN UINT8 *NewToS, OPTIONAL
IN BOOLEAN *NewMakeCallback OPTIONAL
);
/**
Updates the station IP address and/or subnet mask values of a network device.
This function updates the station IP address and/or subnet mask values of a network
device.
The NewStationIp field is used to modify the network device's current IP address.
If NewStationIP is NULL, then the current IP address will not be modified. Otherwise,
this function updates the StationIp field of the EFI_PXE_BASE_CODE_MODE structure
with NewStationIp.
The NewSubnetMask field is used to modify the network device's current subnet
mask. If NewSubnetMask is NULL, then the current subnet mask will not be modified.
Otherwise, this function updates the SubnetMask field of the EFI_PXE_BASE_CODE_MODE
structure with NewSubnetMask.
@param This The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param NewStationIp The pointer to the new IP address to be used by the network device.
@param NewSubnetMask The pointer to the new subnet mask to be used by the network device.
@retval EFI_SUCCESS The new station IP address and/or subnet mask were updated.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_SET_STATION_IP)(
IN EFI_PXE_BASE_CODE_PROTOCOL *This,
IN EFI_IP_ADDRESS *NewStationIp, OPTIONAL
IN EFI_IP_ADDRESS *NewSubnetMask OPTIONAL
);
/**
Updates the contents of the cached DHCP and Discover packets.
The pointers to the new packets are used to update the contents of the cached
packets in the EFI_PXE_BASE_CODE_MODE structure.
@param This The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param NewDhcpDiscoverValid The pointer to a value that will replace the current
DhcpDiscoverValid field.
@param NewDhcpAckReceived The pointer to a value that will replace the current
DhcpAckReceived field.
@param NewProxyOfferReceived The pointer to a value that will replace the current
ProxyOfferReceived field.
@param NewPxeDiscoverValid The pointer to a value that will replace the current
ProxyOfferReceived field.
@param NewPxeReplyReceived The pointer to a value that will replace the current
PxeReplyReceived field.
@param NewPxeBisReplyReceived The pointer to a value that will replace the current
PxeBisReplyReceived field.
@param NewDhcpDiscover The pointer to the new cached DHCP Discover packet contents.
@param NewDhcpAck The pointer to the new cached DHCP Ack packet contents.
@param NewProxyOffer The pointer to the new cached Proxy Offer packet contents.
@param NewPxeDiscover The pointer to the new cached PXE Discover packet contents.
@param NewPxeReply The pointer to the new cached PXE Reply packet contents.
@param NewPxeBisReply The pointer to the new cached PXE BIS Reply packet contents.
@retval EFI_SUCCESS The cached packet contents were updated.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
@retval EFI_INVALID_PARAMETER This is NULL or not point to a valid EFI_PXE_BASE_CODE_PROTOCOL structure.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_PXE_BASE_CODE_SET_PACKETS)(
IN EFI_PXE_BASE_CODE_PROTOCOL *This,
BOOLEAN *NewDhcpDiscoverValid, OPTIONAL
BOOLEAN *NewDhcpAckReceived, OPTIONAL
BOOLEAN *NewProxyOfferReceived, OPTIONAL
BOOLEAN *NewPxeDiscoverValid, OPTIONAL
BOOLEAN *NewPxeReplyReceived, OPTIONAL
BOOLEAN *NewPxeBisReplyReceived, OPTIONAL
IN EFI_PXE_BASE_CODE_PACKET *NewDhcpDiscover, OPTIONAL
IN EFI_PXE_BASE_CODE_PACKET *NewDhcpAck, OPTIONAL
IN EFI_PXE_BASE_CODE_PACKET *NewProxyOffer, OPTIONAL
IN EFI_PXE_BASE_CODE_PACKET *NewPxeDiscover, OPTIONAL
IN EFI_PXE_BASE_CODE_PACKET *NewPxeReply, OPTIONAL
IN EFI_PXE_BASE_CODE_PACKET *NewPxeBisReply OPTIONAL
);
//
// PXE Base Code Protocol structure
//
#define EFI_PXE_BASE_CODE_PROTOCOL_REVISION 0x00010000
//
// Revision defined in EFI1.1
//
#define EFI_PXE_BASE_CODE_INTERFACE_REVISION EFI_PXE_BASE_CODE_PROTOCOL_REVISION
///
/// The EFI_PXE_BASE_CODE_PROTOCOL is used to control PXE-compatible devices.
/// An EFI_PXE_BASE_CODE_PROTOCOL will be layered on top of an
/// EFI_MANAGED_NETWORK_PROTOCOL protocol in order to perform packet level transactions.
/// The EFI_PXE_BASE_CODE_PROTOCOL handle also supports the
/// EFI_LOAD_FILE_PROTOCOL protocol. This provides a clean way to obtain control from the
/// boot manager if the boot path is from the remote device.
///
struct _EFI_PXE_BASE_CODE_PROTOCOL {
///
/// The revision of the EFI_PXE_BASE_CODE_PROTOCOL. All future revisions must
/// be backwards compatible. If a future version is not backwards compatible
/// it is not the same GUID.
///
UINT64 Revision;
EFI_PXE_BASE_CODE_START Start;
EFI_PXE_BASE_CODE_STOP Stop;
EFI_PXE_BASE_CODE_DHCP Dhcp;
EFI_PXE_BASE_CODE_DISCOVER Discover;
EFI_PXE_BASE_CODE_MTFTP Mtftp;
EFI_PXE_BASE_CODE_UDP_WRITE UdpWrite;
EFI_PXE_BASE_CODE_UDP_READ UdpRead;
EFI_PXE_BASE_CODE_SET_IP_FILTER SetIpFilter;
EFI_PXE_BASE_CODE_ARP Arp;
EFI_PXE_BASE_CODE_SET_PARAMETERS SetParameters;
EFI_PXE_BASE_CODE_SET_STATION_IP SetStationIp;
EFI_PXE_BASE_CODE_SET_PACKETS SetPackets;
///
/// The pointer to the EFI_PXE_BASE_CODE_MODE data for this device.
///
EFI_PXE_BASE_CODE_MODE *Mode;
};
extern EFI_GUID gEfiPxeBaseCodeProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/PxeBaseCodeCallBack.h
================================================
/** @file
It is invoked when the PXE Base Code Protocol is about to transmit, has received,
or is waiting to receive a packet.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is introduced in EFI Specification 1.10
**/
#ifndef _PXE_BASE_CODE_CALLBACK_H_
#define _PXE_BASE_CODE_CALLBACK_H_
///
/// Call Back Definitions.
///
#define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID \
{ \
0x245dca21, 0xfb7b, 0x11d3, {0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
}
///
/// UEFI Revision Number Definition.
///
#define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION 0x00010000
///
/// EFI 1.1 Revision Number defintion.
///
#define EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION \
EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION
///
/// UEFI Protocol name.
///
typedef struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL;
///
/// EFI1.1 Protocol name.
///
typedef EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK;
///
/// Event type list for PXE Base Code Protocol function.
///
typedef enum {
EFI_PXE_BASE_CODE_FUNCTION_FIRST,
EFI_PXE_BASE_CODE_FUNCTION_DHCP,
EFI_PXE_BASE_CODE_FUNCTION_DISCOVER,
EFI_PXE_BASE_CODE_FUNCTION_MTFTP,
EFI_PXE_BASE_CODE_FUNCTION_UDP_WRITE,
EFI_PXE_BASE_CODE_FUNCTION_UDP_READ,
EFI_PXE_BASE_CODE_FUNCTION_ARP,
EFI_PXE_BASE_CODE_FUNCTION_IGMP,
EFI_PXE_BASE_CODE_PXE_FUNCTION_LAST
} EFI_PXE_BASE_CODE_FUNCTION;
///
/// Callback status type.
///
typedef enum {
EFI_PXE_BASE_CODE_CALLBACK_STATUS_FIRST,
EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT,
EFI_PXE_BASE_CODE_CALLBACK_STATUS_LAST
} EFI_PXE_BASE_CODE_CALLBACK_STATUS;
/**
Callback function that is invoked when the PXE Base Code Protocol is about to transmit, has
received, or is waiting to receive a packet.
This function is invoked when the PXE Base Code Protocol is about to transmit, has received,
or is waiting to receive a packet. Parameters Function and Received specify the type of event.
Parameters PacketLen and Packet specify the packet that generated the event. If these fields
are zero and NULL respectively, then this is a status update callback. If the operation specified
by Function is to continue, then CALLBACK_STATUS_CONTINUE should be returned. If the operation
specified by Function should be aborted, then CALLBACK_STATUS_ABORT should be returned. Due to
the polling nature of UEFI device drivers, a callback function should not execute for more than 5 ms.
The SetParameters() function must be called after a Callback Protocol is installed to enable the
use of callbacks.
@param This The pointer to the EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL instance.
@param Function The PXE Base Code Protocol function that is waiting for an event.
@param Received TRUE if the callback is being invoked due to a receive event. FALSE if
the callback is being invoked due to a transmit event.
@param PacketLen The length, in bytes, of Packet. This field will have a value of zero if
this is a wait for receive event.
@param Packet If Received is TRUE, a pointer to the packet that was just received;
otherwise a pointer to the packet that is about to be transmitted.
@retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE if Function specifies a continue operation
@retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT if Function specifies an abort operation
**/
typedef
EFI_PXE_BASE_CODE_CALLBACK_STATUS
(EFIAPI *EFI_PXE_CALLBACK)(
IN EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *This,
IN EFI_PXE_BASE_CODE_FUNCTION Function,
IN BOOLEAN Received,
IN UINT32 PacketLen,
IN EFI_PXE_BASE_CODE_PACKET *Packet OPTIONAL
);
///
/// Protocol that is invoked when the PXE Base Code Protocol is about
/// to transmit, has received, or is waiting to receive a packet.
///
struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL {
///
/// The revision of the EFI_PXE_BASE_CODE_PROTOCOL. All future revisions must
/// be backwards compatible. If a future version is not backwards compatible
/// it is not the same GUID.
///
UINT64 Revision;
EFI_PXE_CALLBACK Callback;
};
extern EFI_GUID gEfiPxeBaseCodeCallbackProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/RamDisk.h
================================================
/** @file
This file defines the EFI RAM Disk Protocol.
Copyright (c) 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is introduced in UEFI Specification 2.6
**/
#ifndef __RAM_DISK_PROTOCOL_H__
#define __RAM_DISK_PROTOCOL_H__
//
// EFI RAM Disk Protocol GUID value
//
#define EFI_RAM_DISK_PROTOCOL_GUID \
{ 0xab38a0df, 0x6873, 0x44a9, { 0x87, 0xe6, 0xd4, 0xeb, 0x56, 0x14, 0x84, 0x49 }};
//
// Forward reference for pure ANSI compatability
//
typedef struct _EFI_RAM_DISK_PROTOCOL EFI_RAM_DISK_PROTOCOL;
/**
Register a RAM disk with specified address, size and type.
@param[in] RamDiskBase The base address of registered RAM disk.
@param[in] RamDiskSize The size of registered RAM disk.
@param[in] RamDiskType The type of registered RAM disk. The GUID can be
any of the values defined in section 9.3.6.9, or a
vendor defined GUID.
@param[in] ParentDevicePath
Pointer to the parent device path. If there is no
parent device path then ParentDevicePath is NULL.
@param[out] DevicePath On return, points to a pointer to the device path
of the RAM disk device.
If ParentDevicePath is not NULL, the returned
DevicePath is created by appending a RAM disk node
to the parent device path. If ParentDevicePath is
NULL, the returned DevicePath is a RAM disk device
path without appending. This function is
responsible for allocating the buffer DevicePath
with the boot service AllocatePool().
@retval EFI_SUCCESS The RAM disk is registered successfully.
@retval EFI_INVALID_PARAMETER DevicePath or RamDiskType is NULL.
RamDiskSize is 0.
@retval EFI_ALREADY_STARTED A Device Path Protocol instance to be created
is already present in the handle database.
@retval EFI_OUT_OF_RESOURCES The RAM disk register operation fails due to
resource limitation.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_RAM_DISK_REGISTER_RAMDISK) (
IN UINT64 RamDiskBase,
IN UINT64 RamDiskSize,
IN EFI_GUID *RamDiskType,
IN EFI_DEVICE_PATH *ParentDevicePath OPTIONAL,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
);
/**
Unregister a RAM disk specified by DevicePath.
@param[in] DevicePath A pointer to the device path that describes a RAM
Disk device.
@retval EFI_SUCCESS The RAM disk is unregistered successfully.
@retval EFI_INVALID_PARAMETER DevicePath is NULL.
@retval EFI_UNSUPPORTED The device specified by DevicePath is not a
valid ramdisk device path and not supported
by the driver.
@retval EFI_NOT_FOUND The RAM disk pointed by DevicePath doesn't
exist.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_RAM_DISK_UNREGISTER_RAMDISK) (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
///
/// RAM Disk Protocol structure.
///
struct _EFI_RAM_DISK_PROTOCOL {
EFI_RAM_DISK_REGISTER_RAMDISK Register;
EFI_RAM_DISK_UNREGISTER_RAMDISK Unregister;
};
///
/// RAM Disk Protocol GUID variable.
///
extern EFI_GUID gEfiRamDiskProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/RealTimeClock.h
================================================
/** @file
Real Time clock Architectural Protocol as defined in PI Specification VOLUME 2 DXE
This code abstracts time and data functions. Used to provide
Time and date related EFI runtime services.
The GetTime (), SetTime (), GetWakeupTime (), and SetWakeupTime () UEFI 2.0
services are added to the EFI system table and the
EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL_GUID protocol is registered with a NULL
pointer.
No CRC of the EFI system table is required, since that is done in the DXE core.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __ARCH_PROTOCOL_REAL_TIME_CLOCK_H__
#define __ARCH_PROTOCOL_REAL_TIME_CLOCK_H__
///
/// Global ID for the Real Time Clock Architectural Protocol
///
#define EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL_GUID \
{ 0x27CFAC87, 0x46CC, 0x11d4, {0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } }
extern EFI_GUID gEfiRealTimeClockArchProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/RegularExpressionProtocol.h
================================================
/** @file
This section defines the Regular Expression Protocol. This protocol isused to match
Unicode strings against Regular Expression patterns.
Copyright (c) 2015-2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol was introduced in UEFI Specification 2.5.
**/
#ifndef __REGULAR_EXPRESSION_PROTOCOL_H__
#define __REGULAR_EXPRESSION_PROTOCOL_H__
#define EFI_REGULAR_EXPRESSION_PROTOCOL_GUID \
{ \
0xB3F79D9A, 0x436C, 0xDC11, {0xB0, 0x52, 0xCD, 0x85, 0xDF, 0x52, 0x4C, 0xE6 } \
}
#define EFI_REGEX_SYNTAX_TYPE_POSIX_EXTENDED_GUID \
{ \
0x5F05B20F, 0x4A56, 0xC231, {0xFA, 0x0B, 0xA7, 0xB1, 0xF1, 0x10, 0x04, 0x1D } \
}
#define EFI_REGEX_SYNTAX_TYPE_PERL_GUID \
{ \
0x63E60A51, 0x497D, 0xD427, {0xC4, 0xA5, 0xB8, 0xAB, 0xDC, 0x3A, 0xAE, 0xB6 } \
}
#define EFI_REGEX_SYNTAX_TYPE_ECMA_262_GUID \
{ \
0x9A473A4A, 0x4CEB, 0xB95A, {0x41, 0x5E, 0x5B, 0xA0, 0xBC, 0x63, 0x9B, 0x2E } \
}
typedef struct _EFI_REGULAR_EXPRESSION_PROTOCOL EFI_REGULAR_EXPRESSION_PROTOCOL;
typedef struct {
CONST CHAR16 *CapturePtr; // Pointer to the start of the captured sub-expression
// within matched String.
UINTN Length; // Length of captured sub-expression.
} EFI_REGEX_CAPTURE;
typedef EFI_GUID EFI_REGEX_SYNTAX_TYPE;
//
// Protocol member functions
//
/**
Returns information about the regular expression syntax types supported
by the implementation.
This A pointer to the EFI_REGULAR_EXPRESSION_PROTOCOL
instance.
RegExSyntaxTypeListSize On input, the size in bytes of RegExSyntaxTypeList.
On output with a return code of EFI_SUCCESS, the
size in bytes of the data returned in
RegExSyntaxTypeList. On output with a return code
of EFI_BUFFER_TOO_SMALL, the size of
RegExSyntaxTypeListrequired to obtain the list.
RegExSyntaxTypeList A caller-allocated memory buffer filled by the
driver with one EFI_REGEX_SYNTAX_TYPEelement
for each supported Regular expression syntax
type. The list must not change across multiple
calls to the same driver. The first syntax
type in the list is the default type for the
driver.
@retval EFI_SUCCESS The regular expression syntax types list
was returned successfully.
@retval EFI_UNSUPPORTED The service is not supported by this driver.
@retval EFI_DEVICE_ERROR The list of syntax types could not be
retrieved due to a hardware or firmware error.
@retval EFI_BUFFER_TOO_SMALL The buffer RegExSyntaxTypeList is too small
to hold the result.
@retval EFI_INVALID_PARAMETER RegExSyntaxTypeListSize is NULL
**/
typedef
EFI_STATUS
(EFIAPI *EFI_REGULAR_EXPRESSION_GET_INFO) (
IN EFI_REGULAR_EXPRESSION_PROTOCOL *This,
IN OUT UINTN *RegExSyntaxTypeListSize,
OUT EFI_REGEX_SYNTAX_TYPE *RegExSyntaxTypeList
);
/**
Checks if the input string matches to the regular expression pattern.
This A pointer to the EFI_REGULAR_EXPRESSION_PROTOCOL instance.
Type EFI_REGULAR_EXPRESSION_PROTOCOL is defined in Section
XYZ.
String A pointer to a NULL terminated string to match against the
regular expression string specified by Pattern.
Pattern A pointer to a NULL terminated string that represents the
regular expression.
SyntaxType A pointer to the EFI_REGEX_SYNTAX_TYPE that identifies the
regular expression syntax type to use. May be NULL in which
case the function will use its default regular expression
syntax type.
Result On return, points to TRUE if String fully matches against
the regular expression Pattern using the regular expression
SyntaxType. Otherwise, points to FALSE.
Captures A Pointer to an array of EFI_REGEX_CAPTURE objects to receive
the captured groups in the event of a match. The full
sub-string match is put in Captures[0], and the results of N
capturing groups are put in Captures[1:N]. If Captures is
NULL, then this function doesn't allocate the memory for the
array and does not build up the elements. It only returns the
number of matching patterns in CapturesCount. If Captures is
not NULL, this function returns a pointer to an array and
builds up the elements in the array. CapturesCount is also
updated to the number of matching patterns found. It is the
caller's responsibility to free the memory pool in Captures
and in each CapturePtr in the array elements.
CapturesCount On output, CapturesCount is the number of matching patterns
found in String. Zero means no matching patterns were found
in the string.
@retval EFI_SUCCESS The regular expression string matching
completed successfully.
@retval EFI_UNSUPPORTED The regular expression syntax specified by
SyntaxTypeis not supported by this driver.
@retval EFI_DEVICE_ERROR The regular expression string matching
failed due to a hardware or firmware error.
@retval EFI_INVALID_PARAMETER String, Pattern, Result, or CapturesCountis
NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_REGULAR_EXPRESSION_MATCH) (
IN EFI_REGULAR_EXPRESSION_PROTOCOL *This,
IN CHAR16 *String,
IN CHAR16 *Pattern,
IN EFI_REGEX_SYNTAX_TYPE *SyntaxType, OPTIONAL
OUT BOOLEAN *Result,
OUT EFI_REGEX_CAPTURE **Captures, OPTIONAL
OUT UINTN *CapturesCount
);
struct _EFI_REGULAR_EXPRESSION_PROTOCOL {
EFI_REGULAR_EXPRESSION_MATCH MatchString;
EFI_REGULAR_EXPRESSION_GET_INFO GetInfo;
} ;
extern EFI_GUID gEfiRegularExpressionProtocolGuid;
//
// For regular expression rules specified in the POSIX Extended Regular
// Expression (ERE) Syntax:
//
extern EFI_GUID gEfiRegexSyntaxTypePosixExtendedGuid;
//
// For regular expression rules specifiedin the ECMA 262 Specification
//
extern EFI_GUID gEfiRegexSyntaxTypeEcma262Guid;
//
// For regular expression rules specified in the Perl standard:
//
extern EFI_GUID gEfiRegexSyntaxTypePerlGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/ReportStatusCodeHandler.h
================================================
/** @file
This protocol provide registering and unregistering services to status code
consumers while in DXE.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol was introduced in PI Specification 1.2.
**/
#ifndef __REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
#define __REPORT_STATUS_CODE_HANDLER_PROTOCOL_H__
#define EFI_RSC_HANDLER_PROTOCOL_GUID \
{ \
0x86212936, 0xe76, 0x41c8, {0xa0, 0x3a, 0x2a, 0xf2, 0xfc, 0x1c, 0x39, 0xe2} \
}
typedef
EFI_STATUS
(EFIAPI *EFI_RSC_HANDLER_CALLBACK)(
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID *CallerId,
IN EFI_STATUS_CODE_DATA *Data
);
/**
Register the callback function for ReportStatusCode() notification.
When this function is called the function pointer is added to an internal list and any future calls to
ReportStatusCode() will be forwarded to the Callback function. During the bootservices,
this is the callback for which this service can be invoked. The report status code router
will create an event such that the callback function is only invoked at the TPL for which it was
registered. The entity that registers for the callback should also register for an event upon
generation of exit boot services and invoke the unregister service.
If the handler does not have a TPL dependency, it should register for a callback at TPL high. The
router infrastructure will support making callbacks at runtime, but the caller for runtime invocation
must meet the following criteria:
1. must be a runtime driver type so that its memory is not reclaimed
2. not unregister at exit boot services so that the router will still have its callback address
3. the caller must be self-contained (eg. Not call out into any boot-service interfaces) and be
runtime safe, in general.
@param[in] Callback A pointer to a function of type EFI_RSC_HANDLER_CALLBACK that is called when
a call to ReportStatusCode() occurs.
@param[in] Tpl TPL at which callback can be safely invoked.
@retval EFI_SUCCESS Function was successfully registered.
@retval EFI_INVALID_PARAMETER The callback function was NULL.
@retval EFI_OUT_OF_RESOURCES The internal buffer ran out of space. No more functions can be
registered.
@retval EFI_ALREADY_STARTED The function was already registered. It can't be registered again.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_RSC_HANDLER_REGISTER)(
IN EFI_RSC_HANDLER_CALLBACK Callback,
IN EFI_TPL Tpl
);
/**
Remove a previously registered callback function from the notification list.
A callback function must be unregistered before it is deallocated. It is important that any registered
callbacks that are not runtime complaint be unregistered when ExitBootServices() is called.
@param[in] Callback A pointer to a function of type EFI_RSC_HANDLER_CALLBACK that is to be
unregistered.
@retval EFI_SUCCESS The function was successfully unregistered.
@retval EFI_INVALID_PARAMETER The callback function was NULL.
@retval EFI_NOT_FOUND The callback function was not found to be unregistered.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_RSC_HANDLER_UNREGISTER)(
IN EFI_RSC_HANDLER_CALLBACK Callback
);
typedef struct {
EFI_RSC_HANDLER_REGISTER Register;
EFI_RSC_HANDLER_UNREGISTER Unregister;
} EFI_RSC_HANDLER_PROTOCOL;
extern EFI_GUID gEfiRscHandlerProtocolGuid;
#endif // __REPORT_STATUS_CODE_HANDLER_H__
================================================
FILE: edk2/MdePkg/Include/Protocol/Reset.h
================================================
/** @file
Reset Architectural Protocol as defined in PI Specification VOLUME 2 DXE
Used to provide ResetSystem runtime services
The ResetSystem () UEFI 2.0 service is added to the EFI system table and the
EFI_RESET_ARCH_PROTOCOL_GUID protocol is registered with a NULL pointer.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __ARCH_PROTOCOL_RESET_H__
#define __ARCH_PROTOCOL_RESET_H__
///
/// Global ID for the Reset Architectural Protocol
///
#define EFI_RESET_ARCH_PROTOCOL_GUID \
{ 0x27CFAC88, 0x46CC, 0x11d4, {0x9A, 0x38, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } }
extern EFI_GUID gEfiResetArchProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/ResetNotification.h
================================================
/** @file
EFI Reset Notification Protocol as defined in UEFI 2.7.
This protocol provides services to register for a notification when ResetSystem is called.
Copyright (c) 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is introduced in UEFI Specification 2.7
**/
#ifndef __EFI_RESET_NOTIFICATION_H__
#define __EFI_RESET_NOTIFICATION_H__
#define EFI_RESET_NOTIFICATION_PROTOCOL_GUID \
{ 0x9da34ae0, 0xeaf9, 0x4bbf, { 0x8e, 0xc3, 0xfd, 0x60, 0x22, 0x6c, 0x44, 0xbe } }
typedef struct _EFI_RESET_NOTIFICATION_PROTOCOL EFI_RESET_NOTIFICATION_PROTOCOL;
/**
Register a notification function to be called when ResetSystem() is called.
The RegisterResetNotify() function registers a notification function that is called when
ResetSystem()is called and prior to completing the reset of the platform.
The registered functions must not perform a platform reset themselves. These
notifications are intended only for the notification of components which may need some
special-purpose maintenance prior to the platform resetting.
The list of registered reset notification functions are processed if ResetSystem()is called
before ExitBootServices(). The list of registered reset notification functions is ignored if
ResetSystem()is called after ExitBootServices().
@param[in] This A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
@param[in] ResetFunction Points to the function to be called when a ResetSystem() is executed.
@retval EFI_SUCCESS The reset notification function was successfully registered.
@retval EFI_INVALID_PARAMETER ResetFunction is NULL.
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to register the reset notification function.
@retval EFI_ALREADY_STARTED The reset notification function specified by ResetFunction has already been registered.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_REGISTER_RESET_NOTIFY) (
IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
IN EFI_RESET_SYSTEM ResetFunction
);
/**
Unregister a notification function.
The UnregisterResetNotify() function removes the previously registered
notification using RegisterResetNotify().
@param[in] This A pointer to the EFI_RESET_NOTIFICATION_PROTOCOL instance.
@param[in] ResetFunction The pointer to the ResetFunction being unregistered.
@retval EFI_SUCCESS The reset notification function was unregistered.
@retval EFI_INVALID_PARAMETER ResetFunction is NULL.
@retval EFI_INVALID_PARAMETER The reset notification function specified by ResetFunction was not previously
registered using RegisterResetNotify().
**/
typedef
EFI_STATUS
(EFIAPI *EFI_UNREGISTER_RESET_NOTIFY) (
IN EFI_RESET_NOTIFICATION_PROTOCOL *This,
IN EFI_RESET_SYSTEM ResetFunction
);
typedef struct _EFI_RESET_NOTIFICATION_PROTOCOL {
EFI_REGISTER_RESET_NOTIFY RegisterResetNotify;
EFI_UNREGISTER_RESET_NOTIFY UnregisterResetNotify;
} EFI_RESET_NOTIFICATION_PROTOCOL;
extern EFI_GUID gEfiResetNotificationProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/Rest.h
================================================
/** @file
This file defines the EFI REST Protocol interface.
Copyright (c) 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This Protocol is introduced in UEFI Specification 2.5
**/
#ifndef __EFI_REST_PROTOCOL_H__
#define __EFI_REST_PROTOCOL_H__
#include
#define EFI_REST_PROTOCOL_GUID \
{ \
0x0db48a36, 0x4e54, 0xea9c, {0x9b, 0x09, 0x1e, 0xa5, 0xbe, 0x3a, 0x66, 0x0b } \
}
typedef struct _EFI_REST_PROTOCOL EFI_REST_PROTOCOL;
/**
Provides a simple HTTP-like interface to send and receive resources from a REST
service.
The SendReceive() function sends an HTTP request to this REST service, and returns a
response when the data is retrieved from the service. RequestMessage contains the HTTP
request to the REST resource identified by RequestMessage.Request.Url. The
ResponseMessage is the returned HTTP response for that request, including any HTTP
status.
@param[in] This Pointer to EFI_REST_PROTOCOL instance for a particular
REST service.
@param[in] RequestMessage Pointer to the HTTP request data for this resource.
@param[out] ResponseMessage Pointer to the HTTP response data obtained for this
requested.
@retval EFI_SUCCESS Operation succeeded.
@retval EFI_INVALID_PARAMETER This, RequestMessage, or ResponseMessage are NULL.
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_REST_SEND_RECEIVE) (
IN EFI_REST_PROTOCOL *This,
IN EFI_HTTP_MESSAGE *RequestMessage,
OUT EFI_HTTP_MESSAGE *ResponseMessage
);
/**
The GetServiceTime() function is an optional interface to obtain the current time from
this REST service instance. If this REST service does not support retrieving the time,
this function returns EFI_UNSUPPORTED.
@param[in] This Pointer to EFI_REST_PROTOCOL instance.
@param[out] Time A pointer to storage to receive a snapshot of the
current time of the REST service.
@retval EFI_SUCCESS Operation succeeded
@retval EFI_INVALID_PARAMETER This or Time are NULL.
@retval EFI_UNSUPPORTED The RESTful service does not support returning the
time.
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_REST_GET_TIME) (
IN EFI_REST_PROTOCOL *This,
OUT EFI_TIME *Time
);
///
/// The EFI REST protocol is designed to be used by EFI drivers and applications to send
/// and receive resources from a RESTful service. This protocol abstracts REST
/// (Representational State Transfer) client functionality. This EFI protocol could be
/// implemented to use an underlying EFI HTTP protocol, or it could rely on other
/// interfaces that abstract HTTP access to the resources.
///
struct _EFI_REST_PROTOCOL {
EFI_REST_SEND_RECEIVE SendReceive;
EFI_REST_GET_TIME GetServiceTime;
};
extern EFI_GUID gEfiRestProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/Rng.h
================================================
/** @file
EFI_RNG_PROTOCOL as defined in UEFI 2.4.
The UEFI Random Number Generator Protocol is used to provide random bits for use
in applications, or entropy for seeding other random number generators.
Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
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 __EFI_RNG_PROTOCOL_H__
#define __EFI_RNG_PROTOCOL_H__
///
/// Global ID for the Random Number Generator Protocol
///
#define EFI_RNG_PROTOCOL_GUID \
{ \
0x3152bca5, 0xeade, 0x433d, {0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 } \
}
typedef struct _EFI_RNG_PROTOCOL EFI_RNG_PROTOCOL;
///
/// A selection of EFI_RNG_PROTOCOL algorithms.
/// The algorithms listed are optional, not meant to be exhaustive and be argmented by
/// vendors or other industry standards.
///
typedef EFI_GUID EFI_RNG_ALGORITHM;
///
/// The algorithms corresponds to SP800-90 as defined in
/// NIST SP 800-90, "Recommendation for Random Number Generation Using Deterministic Random
/// Bit Generators", March 2007.
///
#define EFI_RNG_ALGORITHM_SP800_90_HASH_256_GUID \
{ \
0xa7af67cb, 0x603b, 0x4d42, {0xba, 0x21, 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96 } \
}
#define EFI_RNG_ALGORITHM_SP800_90_HMAC_256_GUID \
{ \
0xc5149b43, 0xae85, 0x4f53, {0x99, 0x82, 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7 } \
}
#define EFI_RNG_ALGORITHM_SP800_90_CTR_256_GUID \
{ \
0x44f0de6e, 0x4d8c, 0x4045, {0xa8, 0xc7, 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e } \
}
///
/// The algorithms correspond to X9.31 as defined in
/// NIST, "Recommended Random Number Generator Based on ANSI X9.31 Appendix A.2.4 Using
/// the 3-Key Triple DES and AES Algorithm", January 2005.
///
#define EFI_RNG_ALGORITHM_X9_31_3DES_GUID \
{ \
0x63c4785a, 0xca34, 0x4012, {0xa3, 0xc8, 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46 } \
}
#define EFI_RNG_ALGORITHM_X9_31_AES_GUID \
{ \
0xacd03321, 0x777e, 0x4d3d, {0xb1, 0xc8, 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9 } \
}
///
/// The "raw" algorithm, when supported, is intended to provide entropy directly from
/// the source, without it going through some deterministic random bit generator.
///
#define EFI_RNG_ALGORITHM_RAW \
{ \
0xe43176d7, 0xb6e8, 0x4827, {0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61 } \
}
/**
Returns information about the random number generation implementation.
@param[in] This A pointer to the EFI_RNG_PROTOCOL instance.
@param[in,out] RNGAlgorithmListSize On input, the size in bytes of RNGAlgorithmList.
On output with a return code of EFI_SUCCESS, the size
in bytes of the data returned in RNGAlgorithmList. On output
with a return code of EFI_BUFFER_TOO_SMALL,
the size of RNGAlgorithmList required to obtain the list.
@param[out] RNGAlgorithmList A caller-allocated memory buffer filled by the driver
with one EFI_RNG_ALGORITHM element for each supported
RNG algorithm. The list must not change across multiple
calls to the same driver. The first algorithm in the list
is the default algorithm for the driver.
@retval EFI_SUCCESS The RNG algorithm list was returned successfully.
@retval EFI_UNSUPPORTED The services is not supported by this driver.
@retval EFI_DEVICE_ERROR The list of algorithms could not be retrieved due to a
hardware or firmware error.
@retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
@retval EFI_BUFFER_TOO_SMALL The buffer RNGAlgorithmList is too small to hold the result.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_RNG_GET_INFO) (
IN EFI_RNG_PROTOCOL *This,
IN OUT UINTN *RNGAlgorithmListSize,
OUT EFI_RNG_ALGORITHM *RNGAlgorithmList
);
/**
Produces and returns an RNG value using either the default or specified RNG algorithm.
@param[in] This A pointer to the EFI_RNG_PROTOCOL instance.
@param[in] RNGAlgorithm A pointer to the EFI_RNG_ALGORITHM that identifies the RNG
algorithm to use. May be NULL in which case the function will
use its default RNG algorithm.
@param[in] RNGValueLength The length in bytes of the memory buffer pointed to by
RNGValue. The driver shall return exactly this numbers of bytes.
@param[out] RNGValue A caller-allocated memory buffer filled by the driver with the
resulting RNG value.
@retval EFI_SUCCESS The RNG value was returned successfully.
@retval EFI_UNSUPPORTED The algorithm specified by RNGAlgorithm is not supported by
this driver.
@retval EFI_DEVICE_ERROR An RNG value could not be retrieved due to a hardware or
firmware error.
@retval EFI_NOT_READY There is not enough random data available to satisfy the length
requested by RNGValueLength.
@retval EFI_INVALID_PARAMETER RNGValue is NULL or RNGValueLength is zero.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_RNG_GET_RNG) (
IN EFI_RNG_PROTOCOL *This,
IN EFI_RNG_ALGORITHM *RNGAlgorithm, OPTIONAL
IN UINTN RNGValueLength,
OUT UINT8 *RNGValue
);
///
/// The Random Number Generator (RNG) protocol provides random bits for use in
/// applications, or entropy for seeding other random number generators.
///
struct _EFI_RNG_PROTOCOL {
EFI_RNG_GET_INFO GetInfo;
EFI_RNG_GET_RNG GetRNG;
};
extern EFI_GUID gEfiRngProtocolGuid;
extern EFI_GUID gEfiRngAlgorithmSp80090Hash256Guid;
extern EFI_GUID gEfiRngAlgorithmSp80090Hmac256Guid;
extern EFI_GUID gEfiRngAlgorithmSp80090Ctr256Guid;
extern EFI_GUID gEfiRngAlgorithmX9313DesGuid;
extern EFI_GUID gEfiRngAlgorithmX931AesGuid;
extern EFI_GUID gEfiRngAlgorithmRaw;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/Runtime.h
================================================
/** @file
Runtime Architectural Protocol as defined in PI Specification VOLUME 2 DXE
Allows the runtime functionality of the DXE Foundation to be contained
in a separate driver. It also provides hooks for the DXE Foundation to
export information that is needed at runtime. As such, this protocol allows
services to the DXE Foundation to manage runtime drivers and events.
This protocol also implies that the runtime services required to transition
to virtual mode, SetVirtualAddressMap() and ConvertPointer(), have been
registered into the UEFI Runtime Table in the UEFI System Table. This protocol
must be produced by a runtime DXE driver and may only be consumed by the DXE Foundation.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __ARCH_PROTOCOL_RUNTIME_H__
#define __ARCH_PROTOCOL_RUNTIME_H__
///
/// Global ID for the Runtime Architectural Protocol
///
#define EFI_RUNTIME_ARCH_PROTOCOL_GUID \
{ 0xb7dfb4e1, 0x52f, 0x449f, {0x87, 0xbe, 0x98, 0x18, 0xfc, 0x91, 0xb7, 0x33 } }
typedef struct _EFI_RUNTIME_ARCH_PROTOCOL EFI_RUNTIME_ARCH_PROTOCOL;
///
/// LIST_ENTRY from BaseType
///
typedef LIST_ENTRY EFI_LIST_ENTRY;
typedef struct _EFI_RUNTIME_IMAGE_ENTRY EFI_RUNTIME_IMAGE_ENTRY;
///
/// EFI_RUNTIME_IMAGE_ENTRY
///
struct _EFI_RUNTIME_IMAGE_ENTRY {
///
/// Start of image that has been loaded in memory. It is a pointer
/// to either the DOS header or PE header of the image.
///
VOID *ImageBase;
///
/// Size in bytes of the image represented by ImageBase.
///
UINT64 ImageSize;
///
/// Information about the fix-ups that were performed on ImageBase when it was
/// loaded into memory.
///
VOID *RelocationData;
///
/// The ImageHandle passed into ImageBase when it was loaded.
///
EFI_HANDLE Handle;
///
/// Entry for this node in the EFI_RUNTIME_ARCHITECTURE_PROTOCOL.ImageHead list.
///
EFI_LIST_ENTRY Link;
};
typedef struct _EFI_RUNTIME_EVENT_ENTRY EFI_RUNTIME_EVENT_ENTRY;
///
/// EFI_RUNTIME_EVENT_ENTRY
///
struct _EFI_RUNTIME_EVENT_ENTRY {
///
/// The same as Type passed into CreateEvent().
///
UINT32 Type;
///
/// The same as NotifyTpl passed into CreateEvent().
///
EFI_TPL NotifyTpl;
///
/// The same as NotifyFunction passed into CreateEvent().
///
EFI_EVENT_NOTIFY NotifyFunction;
///
/// The same as NotifyContext passed into CreateEvent().
///
VOID *NotifyContext;
///
/// The EFI_EVENT returned by CreateEvent(). Event must be in runtime memory.
///
EFI_EVENT *Event;
///
/// Entry for this node in the
/// EFI_RUNTIME_ARCHITECTURE_PROTOCOL.EventHead list.
///
EFI_LIST_ENTRY Link;
};
///
/// Allows the runtime functionality of the DXE Foundation to be contained in a
/// separate driver. It also provides hooks for the DXE Foundation to export
/// information that is needed at runtime. As such, this protocol allows the DXE
/// Foundation to manage runtime drivers and events. This protocol also implies
/// that the runtime services required to transition to virtual mode,
/// SetVirtualAddressMap() and ConvertPointer(), have been registered into the
/// EFI Runtime Table in the EFI System Partition. This protocol must be produced
/// by a runtime DXE driver and may only be consumed by the DXE Foundation.
///
struct _EFI_RUNTIME_ARCH_PROTOCOL {
EFI_LIST_ENTRY ImageHead; ///< A list of type EFI_RUNTIME_IMAGE_ENTRY.
EFI_LIST_ENTRY EventHead; ///< A list of type EFI_RUNTIME_EVENT_ENTRY.
UINTN MemoryDescriptorSize; ///< Size of a memory descriptor that is returned by GetMemoryMap().
UINT32 MemoryDesciptorVersion; ///< Version of a memory descriptor that is returned by GetMemoryMap().
UINTN MemoryMapSize;///< Size of the memory map in bytes contained in MemoryMapPhysical and MemoryMapVirtual.
EFI_MEMORY_DESCRIPTOR *MemoryMapPhysical; ///< Pointer to a runtime buffer that contains a copy of
///< the memory map returned via GetMemoryMap().
EFI_MEMORY_DESCRIPTOR *MemoryMapVirtual; ///< Pointer to MemoryMapPhysical that is updated to virtual mode after SetVirtualAddressMap().
BOOLEAN VirtualMode; ///< Boolean that is TRUE if SetVirtualAddressMap() has been called.
BOOLEAN AtRuntime; ///< Boolean that is TRUE if ExitBootServices () has been called.
};
extern EFI_GUID gEfiRuntimeArchProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/S3SaveState.h
================================================
/** @file
S3 Save State Protocol as defined in PI 1.6(Errata A) Specification VOLUME 5 Standard.
This protocol is used by DXE PI module to store or record various IO operations
to be replayed during an S3 resume.
This protocol is not required for all platforms.
Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This PPI is defined in UEFI Platform Initialization Specification 1.2 Volume 5:
Standards
**/
#ifndef __S3_SAVE_STATE_H__
#define __S3_SAVE_STATE_H__
#define EFI_S3_SAVE_STATE_PROTOCOL_GUID \
{ 0xe857caf6, 0xc046, 0x45dc, { 0xbe, 0x3f, 0xee, 0x7, 0x65, 0xfb, 0xa8, 0x87 }}
typedef VOID *EFI_S3_BOOT_SCRIPT_POSITION;
typedef struct _EFI_S3_SAVE_STATE_PROTOCOL EFI_S3_SAVE_STATE_PROTOCOL;
/**
Record operations that need to be replayed during an S3 resume.
This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is
assumed this protocol has platform specific mechanism to store the OpCode set and replay them
during the S3 resume.
@param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
@param[in] OpCode The operation code (opcode) number.
@param[in] ... Argument list that is specific to each opcode. See the following subsections for the
definition of each opcode.
@retval EFI_SUCCESS The operation succeeded. A record was added into the specified
script table.
@retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
@retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_S3_SAVE_STATE_WRITE)(
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN UINTN OpCode,
...
);
/**
Record operations that need to be replayed during an S3 resume.
This function is used to store an OpCode to be replayed as part of the S3 resume boot path. It is
assumed this protocol has platform specific mechanism to store the OpCode set and replay them
during the S3 resume.
The opcode is inserted before or after the specified position in the boot script table. If Position is
NULL then that position is after the last opcode in the table (BeforeOrAfter is TRUE) or before
the first opcode in the table (BeforeOrAfter is FALSE). The position which is pointed to by
Position upon return can be used for subsequent insertions.
This function has a variable parameter list. The exact parameter list depends on the OpCode that is
passed into the function. If an unsupported OpCode or illegal parameter list is passed in, this
function returns EFI_INVALID_PARAMETER.
If there are not enough resources available for storing more scripts, this function returns
EFI_OUT_OF_RESOURCES.
OpCode values of 0x80 - 0xFE are reserved for implementation specific functions.
@param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
@param[in] BeforeOrAfter Specifies whether the opcode is stored before (TRUE) or after (FALSE) the position
in the boot script table specified by Position. If Position is NULL or points to
NULL then the new opcode is inserted at the beginning of the table (if TRUE) or end
of the table (if FALSE).
@param[in, out] Position On entry, specifies the position in the boot script table where the opcode will be
inserted, either before or after, depending on BeforeOrAfter. On exit, specifies
the position of the inserted opcode in the boot script table.
@param[in] OpCode The operation code (opcode) number. See "Related Definitions" in Write() for the
defined opcode types.
@param[in] ... Argument list that is specific to each opcode. See the following subsections for the
definition of each opcode.
@retval EFI_SUCCESS The operation succeeded. An opcode was added into the script.
@retval EFI_INVALID_PARAMETER The Opcode is an invalid opcode value.
@retval EFI_INVALID_PARAMETER The Position is not a valid position in the boot script table.
@retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script table.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_S3_SAVE_STATE_INSERT)(
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN UINTN OpCode,
...
);
/**
Find a label within the boot script table and, if not present, optionally create it.
If the label Label is already exists in the boot script table, then no new label is created, the
position of the Label is returned in *Position and EFI_SUCCESS is returned.
If the label Label does not already exist and CreateIfNotFound is TRUE, then it will be
created before or after the specified position and EFI_SUCCESS is returned.
If the label Label does not already exist and CreateIfNotFound is FALSE, then
EFI_NOT_FOUND is returned.
@param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
@param[in] BeforeOrAfter Specifies whether the label is stored before (TRUE) or after (FALSE) the position in
the boot script table specified by Position. If Position is NULL or points to
NULL then the new label is inserted at the beginning of the table (if TRUE) or end of
the table (if FALSE).
@param[in] CreateIfNotFound Specifies whether the label will be created if the label does not exists (TRUE) or not (FALSE).
@param[in, out] Position On entry, specifies the position in the boot script table where the label will be inserted,
either before or after, depending on BeforeOrAfter. On exit, specifies the position
of the inserted label in the boot script table.
@param[in] Label Points to the label which will be inserted in the boot script table.
@retval EFI_SUCCESS The label already exists or was inserted.
@retval EFI_NOT_FOUND The label did not already exist and CreateifNotFound was FALSE.
@retval EFI_INVALID_PARAMETER The Label is NULL or points to an empty string.
@retval EFI_INVALID_PARAMETER The Position is not a valid position in the boot script table.
@retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_S3_SAVE_STATE_LABEL)(
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN BOOLEAN CreateIfNotFound,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN CONST CHAR8 *Label
);
/**
Compare two positions in the boot script table and return their relative position.
This function compares two positions in the boot script table and returns their relative positions. If
Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2,
then 0 is returned. If Position1 is after Position2, then 1 is returned.
@param[in] This A pointer to the EFI_S3_SAVE_STATE_PROTOCOL instance.
@param[in] Position1 The positions in the boot script table to compare.
@param[in] Position2 The positions in the boot script table to compare.
@param[out] RelativePosition On return, points to the result of the comparison.
@retval EFI_SUCCESS The operation succeeded.
@retval EFI_INVALID_PARAMETER The Position1 or Position2 is not a valid position in the boot script table.
@retval EFI_INVALID_PARAMETER The RelativePosition is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_S3_SAVE_STATE_COMPARE)(
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN EFI_S3_BOOT_SCRIPT_POSITION Position1,
IN EFI_S3_BOOT_SCRIPT_POSITION Position2,
OUT UINTN *RelativePosition
);
struct _EFI_S3_SAVE_STATE_PROTOCOL {
EFI_S3_SAVE_STATE_WRITE Write;
EFI_S3_SAVE_STATE_INSERT Insert;
EFI_S3_SAVE_STATE_LABEL Label;
EFI_S3_SAVE_STATE_COMPARE Compare;
};
extern EFI_GUID gEfiS3SaveStateProtocolGuid;
#endif // __S3_SAVE_STATE_H__
================================================
FILE: edk2/MdePkg/Include/Protocol/S3SmmSaveState.h
================================================
/** @file
S3 SMM Save State Protocol as defined in PI1.2 Specification VOLUME 5 Standard.
The EFI_S3_SMM_SAVE_STATE_PROTOCOL publishes the PI SMMboot script abstractions
On an S3 resume boot path the data stored via this protocol is replayed in the order it was stored.
The order of replay is the order either of the S3 Save State Protocol or S3 SMM Save State Protocol
Write() functions were called during the boot process. Insert(), Label(), and
Compare() operations are ordered relative other S3 SMM Save State Protocol write() operations
and the order relative to S3 State Save Write() operations is not defined. Due to these ordering
restrictions it is recommended that the S3 State Save Protocol be used during the DXE phase when
every possible.
The EFI_S3_SMM_SAVE_STATE_PROTOCOL can be called at runtime and
EFI_OUT_OF_RESOURCES may be returned from a runtime call. It is the responsibility of the
platform to ensure enough memory resource exists to save the system state. It is recommended that
runtime calls be minimized by the caller.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This PPI is defined in UEFI Platform Initialization Specification 1.2 Volume 5:
Standards
**/
#ifndef __S3_SMM_SAVE_STATE_H__
#define __S3_SMM_SAVE_STATE_H__
#include
#define EFI_S3_SMM_SAVE_STATE_PROTOCOL_GUID \
{0x320afe62, 0xe593, 0x49cb, { 0xa9, 0xf1, 0xd4, 0xc2, 0xf4, 0xaf, 0x1, 0x4c }}
typedef EFI_S3_SAVE_STATE_PROTOCOL EFI_S3_SMM_SAVE_STATE_PROTOCOL;
extern EFI_GUID gEfiS3SmmSaveStateProtocolGuid;
#endif // __S3_SMM_SAVE_STATE_H__
================================================
FILE: edk2/MdePkg/Include/Protocol/ScsiIo.h
================================================
/** @file
EFI_SCSI_IO_PROTOCOL as defined in UEFI 2.0.
This protocol is used by code, typically drivers, running in the EFI boot
services environment to access SCSI devices. In particular, functions for
managing devices on SCSI buses are defined here.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __EFI_SCSI_IO_PROTOCOL_H__
#define __EFI_SCSI_IO_PROTOCOL_H__
#define EFI_SCSI_IO_PROTOCOL_GUID \
{ \
0x932f47e6, 0x2362, 0x4002, {0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \
}
///
/// Forward reference for pure ANSI compatability
///
typedef struct _EFI_SCSI_IO_PROTOCOL EFI_SCSI_IO_PROTOCOL;
//
// SCSI Device type information, defined in the SCSI Primary Commands standard (e.g., SPC-4)
//
#define EFI_SCSI_IO_TYPE_DISK 0x00 ///< Disk device
#define EFI_SCSI_IO_TYPE_TAPE 0x01 ///< Tape device
#define EFI_SCSI_IO_TYPE_PRINTER 0x02 ///< Printer
#define EFI_SCSI_IO_TYPE_PROCESSOR 0x03 ///< Processor
#define EFI_SCSI_IO_TYPE_WORM 0x04 ///< Write-once read-multiple
#define EFI_SCSI_IO_TYPE_CDROM 0x05 ///< CD or DVD device
#define EFI_SCSI_IO_TYPE_SCANNER 0x06 ///< Scanner device
#define EFI_SCSI_IO_TYPE_OPTICAL 0x07 ///< Optical memory device
#define EFI_SCSI_IO_TYPE_MEDIUMCHANGER 0x08 ///< Medium Changer device
#define EFI_SCSI_IO_TYPE_COMMUNICATION 0x09 ///< Communications device
#define MFI_SCSI_IO_TYPE_A 0x0A ///< Obsolete
#define MFI_SCSI_IO_TYPE_B 0x0B ///< Obsolete
#define MFI_SCSI_IO_TYPE_RAID 0x0C ///< Storage array controller device (e.g., RAID)
#define MFI_SCSI_IO_TYPE_SES 0x0D ///< Enclosure services device
#define MFI_SCSI_IO_TYPE_RBC 0x0E ///< Simplified direct-access device (e.g., magnetic disk)
#define MFI_SCSI_IO_TYPE_OCRW 0x0F ///< Optical card reader/writer device
#define MFI_SCSI_IO_TYPE_BRIDGE 0x10 ///< Bridge Controller Commands
#define MFI_SCSI_IO_TYPE_OSD 0x11 ///< Object-based Storage Device
#define EFI_SCSI_IO_TYPE_RESERVED_LOW 0x12 ///< Reserved (low)
#define EFI_SCSI_IO_TYPE_RESERVED_HIGH 0x1E ///< Reserved (high)
#define EFI_SCSI_IO_TYPE_UNKNOWN 0x1F ///< Unknown no device type
//
// SCSI Data Direction definition
//
#define EFI_SCSI_IO_DATA_DIRECTION_READ 0
#define EFI_SCSI_IO_DATA_DIRECTION_WRITE 1
#define EFI_SCSI_IO_DATA_DIRECTION_BIDIRECTIONAL 2
//
// SCSI Host Adapter Status definition
//
#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OK 0x00
#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09 ///< timeout when processing the command
#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT 0x0b ///< timeout when waiting for the command processing
#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d ///< a message reject was received when processing command
#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_RESET 0x0e ///< a bus reset was detected
#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f
#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10 ///< the adapter failed in issuing request sense command
#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11 ///< selection timeout
#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12 ///< data overrun or data underrun
#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_FREE 0x13 ///< Unexepected bus free
#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14 ///< Target bus phase sequence failure
#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OTHER 0x7f
//
// SCSI Target Status definition
//
#define EFI_SCSI_IO_STATUS_TARGET_GOOD 0x00
#define EFI_SCSI_IO_STATUS_TARGET_CHECK_CONDITION 0x02 ///< check condition
#define EFI_SCSI_IO_STATUS_TARGET_CONDITION_MET 0x04 ///< condition met
#define EFI_SCSI_IO_STATUS_TARGET_BUSY 0x08 ///< busy
#define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE 0x10 ///< intermediate
#define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14 ///< intermediate-condition met
#define EFI_SCSI_IO_STATUS_TARGET_RESERVATION_CONFLICT 0x18 ///< reservation conflict
#define EFI_SCSI_IO_STATUS_TARGET_COMMOND_TERMINATED 0x22 ///< command terminated
#define EFI_SCSI_IO_STATUS_TARGET_QUEUE_FULL 0x28 ///< queue full
typedef struct {
///
/// The timeout, in 100 ns units, to use for the execution of this SCSI
/// Request Packet. A Timeout value of 0 means that this function
/// will wait indefinitely for the SCSI Request Packet to execute. If
/// Timeout is greater than zero, then this function will return
/// EFI_TIMEOUT if the time required to execute the SCSI Request
/// Packet is greater than Timeout.
///
UINT64 Timeout;
///
/// A pointer to the data buffer to transfer between the SCSI
/// controller and the SCSI device for SCSI READ command
///
VOID *InDataBuffer;
///
/// A pointer to the data buffer to transfer between the SCSI
/// controller and the SCSI device for SCSI WRITE command.
///
VOID *OutDataBuffer;
///
/// A pointer to the sense data that was generated by the execution of
/// the SCSI Request Packet.
///
VOID *SenseData;
///
/// A pointer to buffer that contains the Command Data Block to
/// send to the SCSI device.
///
VOID *Cdb;
///
/// On Input, the size, in bytes, of InDataBuffer. On output, the
/// number of bytes transferred between the SCSI controller and the SCSI device.
///
UINT32 InTransferLength;
///
/// On Input, the size, in bytes of OutDataBuffer. On Output, the
/// Number of bytes transferred between SCSI Controller and the SCSI device.
///
UINT32 OutTransferLength;
///
/// The length, in bytes, of the buffer Cdb. The standard values are
/// 6, 10, 12, and 16, but other values are possible if a variable length CDB is used.
///
UINT8 CdbLength;
///
/// The direction of the data transfer. 0 for reads, 1 for writes. A
/// value of 2 is Reserved for Bi-Directional SCSI commands.
///
UINT8 DataDirection;
///
/// The status of the SCSI Host Controller that produces the SCSI
/// bus where the SCSI device attached when the SCSI Request
/// Packet was executed on the SCSI Controller.
///
UINT8 HostAdapterStatus;
///
/// The status returned by the SCSI device when the SCSI Request
/// Packet was executed.
///
UINT8 TargetStatus;
///
/// On input, the length in bytes of the SenseData buffer. On
/// output, the number of bytes written to the SenseData buffer.
///
UINT8 SenseDataLength;
} EFI_SCSI_IO_SCSI_REQUEST_PACKET;
/**
Retrieves the device type information of the SCSI Controller.
@param This Protocol instance pointer.
@param DeviceType A pointer to the device type information
retrieved from the SCSI Controller.
@retval EFI_SUCCESS Retrieved the device type information successfully.
@retval EFI_INVALID_PARAMETER The DeviceType is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE)(
IN EFI_SCSI_IO_PROTOCOL *This,
OUT UINT8 *DeviceType
);
/**
Retrieves the device location in the SCSI channel.
@param This Protocol instance pointer.
@param Target A pointer to the Target ID of a SCSI device
on the SCSI channel.
@param Lun A pointer to the LUN of the SCSI device on
the SCSI channel.
@retval EFI_SUCCESS Retrieves the device location successfully.
@retval EFI_INVALID_PARAMETER The Target or Lun is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION)(
IN EFI_SCSI_IO_PROTOCOL *This,
IN OUT UINT8 **Target,
OUT UINT64 *Lun
);
/**
Resets the SCSI Bus that the SCSI Controller is attached to.
@param This Protocol instance pointer.
@retval EFI_SUCCESS The SCSI bus is reset successfully.
@retval EFI_DEVICE_ERROR Errors encountered when resetting the SCSI bus.
@retval EFI_UNSUPPORTED The bus reset operation is not supported by the
SCSI Host Controller.
@retval EFI_TIMEOUT A timeout occurred while attempting to reset
the SCSI bus.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_BUS)(
IN EFI_SCSI_IO_PROTOCOL *This
);
/**
Resets the SCSI Controller that the device handle specifies.
@param This Protocol instance pointer.
@retval EFI_SUCCESS Reset the SCSI controller successfully.
@retval EFI_DEVICE_ERROR Errors were encountered when resetting the
SCSI Controller.
@retval EFI_UNSUPPORTED The SCSI bus does not support a device
reset operation.
@retval EFI_TIMEOUT A timeout occurred while attempting to
reset the SCSI Controller.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_DEVICE)(
IN EFI_SCSI_IO_PROTOCOL *This
);
/**
Sends a SCSI Request Packet to the SCSI Controller for execution.
@param This Protocol instance pointer.
@param Packet The SCSI request packet to send to the SCSI
Controller specified by the device handle.
@param Event If the SCSI bus to which the SCSI device is attached
does not support non-blocking I/O, then Event is
ignored, and blocking I/O is performed.
If Event is NULL, then blocking I/O is performed.
If Event is not NULL and non-blocking I/O is
supported, then non-blocking I/O is performed,
and Event will be signaled when the SCSI Request
Packet completes.
@retval EFI_SUCCESS The SCSI Request Packet was sent by the host
successfully, and TransferLength bytes were
transferred to/from DataBuffer. See
HostAdapterStatus, TargetStatus,
SenseDataLength, and SenseData in that order
for additional status information.
@retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed,
but the entire DataBuffer could not be transferred.
The actual number of bytes transferred is returned
in TransferLength. See HostAdapterStatus,
TargetStatus, SenseDataLength, and SenseData in
that order for additional status information.
@retval EFI_NOT_READY The SCSI Request Packet could not be sent because
there are too many SCSI Command Packets already
queued.The caller may retry again later.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send
the SCSI Request Packet. See HostAdapterStatus,
TargetStatus, SenseDataLength, and SenseData in
that order for additional status information.
@retval EFI_INVALID_PARAMETER The contents of CommandPacket are invalid.
The SCSI Request Packet was not sent, so no
additional status information is available.
@retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
is not supported by the SCSI initiator(i.e., SCSI
Host Controller). The SCSI Request Packet was not
sent, so no additional status information is
available.
@retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI
Request Packet to execute. See HostAdapterStatus,
TargetStatus, SenseDataLength, and SenseData in
that order for additional status information.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND)(
IN EFI_SCSI_IO_PROTOCOL *This,
IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet,
IN EFI_EVENT Event OPTIONAL
);
///
/// Provides services to manage and communicate with SCSI devices.
///
struct _EFI_SCSI_IO_PROTOCOL {
EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE GetDeviceType;
EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION GetDeviceLocation;
EFI_SCSI_IO_PROTOCOL_RESET_BUS ResetBus;
EFI_SCSI_IO_PROTOCOL_RESET_DEVICE ResetDevice;
EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_COMMAND ExecuteScsiCommand;
///
/// Supplies the alignment requirement for any buffer used in a data transfer.
/// IoAlign values of 0 and 1 mean that the buffer can be placed anywhere in memory.
/// Otherwise, IoAlign must be a power of 2, and the requirement is that the
/// start address of a buffer must be evenly divisible by IoAlign with no remainder.
///
UINT32 IoAlign;
};
extern EFI_GUID gEfiScsiIoProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/ScsiPassThru.h
================================================
/** @file
SCSI Pass Through protocol as defined in EFI 1.1.
This protocol allows information about a SCSI channel to be collected,
and allows SCSI Request Packets to be sent to any SCSI devices on a SCSI
channel even if those devices are not boot devices. This protocol is attached
to the device handle of each SCSI channel in a system that the protocol
supports, and can be used for diagnostics. It may also be used to build
a Block I/O driver for SCSI hard drives and SCSI CD-ROM or DVD drives to
allow those devices to become boot devices.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __SCSI_PASS_THROUGH_H__
#define __SCSI_PASS_THROUGH_H__
#define EFI_SCSI_PASS_THRU_PROTOCOL_GUID \
{ \
0xa59e8fcf, 0xbda0, 0x43bb, {0x90, 0xb1, 0xd3, 0x73, 0x2e, 0xca, 0xa8, 0x77 } \
}
///
/// Forward reference for pure ANSI compatability
///
typedef struct _EFI_SCSI_PASS_THRU_PROTOCOL EFI_SCSI_PASS_THRU_PROTOCOL;
#define EFI_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL 0x0001
#define EFI_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL 0x0002
#define EFI_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004
//
// SCSI Host Adapter Status definition
//
#define EFI_SCSI_STATUS_HOST_ADAPTER_OK 0x00
#define EFI_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09 // timeout when processing the command
#define EFI_SCSI_STATUS_HOST_ADAPTER_TIMEOUT 0x0b // timeout when waiting for the command processing
#define EFI_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d // a message reject was received when processing command
#define EFI_SCSI_STATUS_HOST_ADAPTER_BUS_RESET 0x0e // a bus reset was detected
#define EFI_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f
#define EFI_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10 // the adapter failed in issuing request sense command
#define EFI_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11 // selection timeout
#define EFI_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12 // data overrun or data underrun
#define EFI_SCSI_STATUS_HOST_ADAPTER_BUS_FREE 0x13 // Unexepected bus free
#define EFI_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14 // Target bus phase sequence failure
#define EFI_SCSI_STATUS_HOST_ADAPTER_OTHER 0x7f
//
// SCSI Target Status definition
//
#define EFI_SCSI_STATUS_TARGET_GOOD 0x00
#define EFI_SCSI_STATUS_TARGET_CHECK_CONDITION 0x02 // check condition
#define EFI_SCSI_STATUS_TARGET_CONDITION_MET 0x04 // condition met
#define EFI_SCSI_STATUS_TARGET_BUSY 0x08 // busy
#define EFI_SCSI_STATUS_TARGET_INTERMEDIATE 0x10 // intermediate
#define EFI_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14 // intermediate-condition met
#define EFI_SCSI_STATUS_TARGET_RESERVATION_CONFLICT 0x18 // reservation conflict
#define EFI_SCSI_STATUS_TARGET_COMMOND_TERMINATED 0x22 // command terminated
#define EFI_SCSI_STATUS_TARGET_QUEUE_FULL 0x28 // queue full
typedef struct {
///
/// The timeout, in 100 ns units, to use for the execution of this SCSI
/// Request Packet. A Timeout value of 0 means that this function
/// will wait indefinitely for the SCSI Request Packet to execute. If
/// Timeout is greater than zero, then this function will return
/// EFI_TIMEOUT if the time required to execute the SCSI Request
/// Packet is greater than Timeout.
///
UINT64 Timeout;
///
/// A pointer to the data buffer to transfer between the SCSI
/// controller and the SCSI device. Must be aligned to the boundary
/// specified in the IoAlign field of the
/// EFI_SCSI_PASS_THRU_MODE structure.
///
VOID *DataBuffer;
///
/// A pointer to the sense data that was generated by the execution of
/// the SCSI Request Packet.
///
VOID *SenseData;
///
/// A pointer to buffer that contains the Command Data Block to
/// send to the SCSI device.
///
VOID *Cdb;
///
/// On Input, the size, in bytes, of InDataBuffer. On output, the
/// number of bytes transferred between the SCSI controller and the SCSI device.
///
UINT32 TransferLength;
///
/// The length, in bytes, of the buffer Cdb. The standard values are
/// 6, 10, 12, and 16, but other values are possible if a variable length CDB is used.
///
UINT8 CdbLength;
///
/// The direction of the data transfer. 0 for reads, 1 for writes. A
/// value of 2 is Reserved for Bi-Directional SCSI commands.
///
UINT8 DataDirection;
///
/// The status of the SCSI Host Controller that produces the SCSI
/// bus where the SCSI device attached when the SCSI Request
/// Packet was executed on the SCSI Controller.
///
UINT8 HostAdapterStatus;
///
/// The status returned by the SCSI device when the SCSI Request
/// Packet was executed.
///
UINT8 TargetStatus;
///
/// On input, the length in bytes of the SenseData buffer. On
/// output, the number of bytes written to the SenseData buffer.
///
UINT8 SenseDataLength;
} EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;
typedef struct {
///
/// A Null-terminated Unicode string that represents the printable name of the SCSI controller.
///
CHAR16 *ControllerName;
///
/// A Null-terminated Unicode string that represents the printable name of the SCSI channel.
///
CHAR16 *ChannelName;
///
/// The Target ID of the host adapter on the SCSI channel.
///
UINT32 AdapterId;
///
/// Additional information on the attributes of the SCSI channel.
///
UINT32 Attributes;
///
/// Supplies the alignment requirement for any buffer used in a data transfer.
///
UINT32 IoAlign;
} EFI_SCSI_PASS_THRU_MODE;
/**
Sends a SCSI Request Packet to a SCSI device that is attached to
the SCSI channel. This function supports both blocking I/O and
non-blocking I/O. The blocking I/O functionality is required,
and the non-blocking I/O functionality is optional.
@param This Protocol instance pointer.
@param Target The Target ID of the SCSI device to
send the SCSI Request Packet.
@param Lun The LUN of the SCSI device to send the
SCSI Request Packet.
@param Packet A pointer to the SCSI Request Packet to send
to the SCSI device specified by Target and Lun.
@param Event If non-blocking I/O is not supported then Event
is ignored, and blocking I/O is performed.
If Event is NULL, then blocking I/O is performed.
If Event is not NULL and non blocking I/O is
supported, then non-blocking I/O is performed,
and Event will be signaled when the SCSI Request
Packet completes
@retval EFI_SUCCESS The SCSI Request Packet was sent by the host, and
TransferLength bytes were transferred to/from
DataBuffer. See HostAdapterStatus, TargetStatus,
SenseDataLength, and SenseData in that order
for additional status information.
@retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was executed, but the
entire DataBuffer could not be transferred.
The actual number of bytes transferred is returned
in TransferLength. See HostAdapterStatus,
TargetStatus, SenseDataLength, and SenseData in
that order for additional status information.
@retval EFI_NOT_READY The SCSI Request Packet could not be sent because
there are too many SCSI Request Packets already
queued. The caller may retry again later.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send
the SCSI Request Packet. See HostAdapterStatus,
TargetStatus, SenseDataLength, and SenseData in
that order for additional status information.
@retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket
are invalid. The SCSI Request Packet was not sent,
so no additional status information is available.
@retval EFI_UNSUPPORTED The command described by the SCSI Request Packet
is not supported by the host adapter. The SCSI
Request Packet was not sent, so no additional
status information is available.
@retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI
Request Packet to execute. See HostAdapterStatus,
TargetStatus, SenseDataLength, and SenseData in
that order for additional status information.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SCSI_PASS_THRU_PASSTHRU)(
IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT32 Target,
IN UINT64 Lun,
IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
IN EFI_EVENT Event OPTIONAL
);
/**
Used to retrieve the list of legal Target IDs for SCSI devices
on a SCSI channel.
@param This Protocol instance pointer.
@param Target On input, a pointer to the Target ID of a
SCSI device present on the SCSI channel.
On output, a pointer to the Target ID of
the next SCSI device present on a SCSI channel.
An input value of 0xFFFFFFFF retrieves the
Target ID of the first SCSI device present on
a SCSI channel.
@param Lun On input, a pointer to the LUN of a SCSI device
present on the SCSI channel. On output, a pointer
to the LUN of the next SCSI device present on a
SCSI channel.
@retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI
channel was returned in Target and Lun.
@retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.
@retval EFI_INVALID_PARAMETER Target is not 0xFFFFFFFF, and Target and Lun were
not returned on a previous call to GetNextDevice().
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE)(
IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
IN OUT UINT32 *Target,
IN OUT UINT64 *Lun
);
/**
Used to allocate and build a device path node for a SCSI device
on a SCSI channel.
@param This Protocol instance pointer.
@param Target The Target ID of the SCSI device for which
a device path node is to be allocated and built.
@param Lun The LUN of the SCSI device for which a device
path node is to be allocated and built.
@param DevicePath A pointer to a single device path node that
describes the SCSI device specified by
Target and Lun. This function is responsible
for allocating the buffer DevicePath with the boot
service AllocatePool(). It is the caller's
responsibility to free DevicePath when the caller
is finished with DevicePath.
@retval EFI_SUCCESS The device path node that describes the SCSI device
specified by Target and Lun was allocated and
returned in DevicePath.
@retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does
not exist on the SCSI channel.
@retval EFI_INVALID_PARAMETER DevicePath is NULL.
@retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate
DevicePath.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH)(
IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT32 Target,
IN UINT64 Lun,
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
);
/**
Used to translate a device path node to a Target ID and LUN.
@param This Protocol instance pointer.
@param DevicePath A pointer to the device path node that
describes a SCSI device on the SCSI channel.
@param Target A pointer to the Target ID of a SCSI device
on the SCSI channel.
@param Lun A pointer to the LUN of a SCSI device on
the SCSI channel.
@retval EFI_SUCCESS DevicePath was successfully translated to a
Target ID and LUN, and they were returned
in Target and Lun.
@retval EFI_INVALID_PARAMETER DevicePath is NULL.
@retval EFI_INVALID_PARAMETER Target is NULL.
@retval EFI_INVALID_PARAMETER Lun is NULL.
@retval EFI_UNSUPPORTED This driver does not support the device path
node type in DevicePath.
@retval EFI_NOT_FOUND A valid translation from DevicePath to a
Target ID and LUN does not exist.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SCSI_PASS_THRU_GET_TARGET_LUN)(
IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
OUT UINT32 *Target,
OUT UINT64 *Lun
);
/**
Resets a SCSI channel.This operation resets all the
SCSI devices connected to the SCSI channel.
@param This Protocol instance pointer.
@retval EFI_SUCCESS The SCSI channel was reset.
@retval EFI_UNSUPPORTED The SCSI channel does not support
a channel reset operation.
@retval EFI_DEVICE_ERROR A device error occurred while
attempting to reset the SCSI channel.
@retval EFI_TIMEOUT A timeout occurred while attempting
to reset the SCSI channel.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SCSI_PASS_THRU_RESET_CHANNEL)(
IN EFI_SCSI_PASS_THRU_PROTOCOL *This
);
/**
Resets a SCSI device that is connected to a SCSI channel.
@param This Protocol instance pointer.
@param Target The Target ID of the SCSI device to reset.
@param Lun The LUN of the SCSI device to reset.
@retval EFI_SUCCESS The SCSI device specified by Target and
Lun was reset.
@retval EFI_UNSUPPORTED The SCSI channel does not support a target
reset operation.
@retval EFI_INVALID_PARAMETER Target or Lun are invalid.
@retval EFI_DEVICE_ERROR A device error occurred while attempting
to reset the SCSI device specified by Target
and Lun.
@retval EFI_TIMEOUT A timeout occurred while attempting to reset
the SCSI device specified by Target and Lun.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SCSI_PASS_THRU_RESET_TARGET)(
IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT32 Target,
IN UINT64 Lun
);
///
/// The EFI_SCSI_PASS_THRU_PROTOCOL provides information about a SCSI channel and
/// the ability to send SCSI Request Packets to any SCSI device attached to that SCSI channel. The
/// information includes the Target ID of the host controller on the SCSI channel, the attributes of
/// the SCSI channel, the printable name for the SCSI controller, and the printable name of the
/// SCSI channel.
///
struct _EFI_SCSI_PASS_THRU_PROTOCOL {
///
/// A pointer to the EFI_SCSI_PASS_THRU_MODE data for this SCSI channel.
///
EFI_SCSI_PASS_THRU_MODE *Mode;
EFI_SCSI_PASS_THRU_PASSTHRU PassThru;
EFI_SCSI_PASS_THRU_GET_NEXT_DEVICE GetNextDevice;
EFI_SCSI_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;
EFI_SCSI_PASS_THRU_GET_TARGET_LUN GetTargetLun;
EFI_SCSI_PASS_THRU_RESET_CHANNEL ResetChannel;
EFI_SCSI_PASS_THRU_RESET_TARGET ResetTarget;
};
extern EFI_GUID gEfiScsiPassThruProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/ScsiPassThruExt.h
================================================
/** @file
EFI_EXT_SCSI_PASS_THRU_PROTOCOL as defined in UEFI 2.0.
This protocol provides services that allow SCSI Pass Thru commands
to be sent to SCSI devices attached to a SCSI channel.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__
#define __EXT_SCSI_PASS_THROUGH_PROTOCOL_H__
#define EFI_EXT_SCSI_PASS_THRU_PROTOCOL_GUID \
{ \
0x143b7632, 0xb81b, 0x4cb7, {0xab, 0xd3, 0xb6, 0x25, 0xa5, 0xb9, 0xbf, 0xfe } \
}
typedef struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL EFI_EXT_SCSI_PASS_THRU_PROTOCOL;
#define TARGET_MAX_BYTES 0x10
#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL 0x0001
#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL 0x0002
#define EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004
//
// DataDirection
//
#define EFI_EXT_SCSI_DATA_DIRECTION_READ 0
#define EFI_EXT_SCSI_DATA_DIRECTION_WRITE 1
#define EFI_EXT_SCSI_DATA_DIRECTION_BIDIRECTIONAL 2
//
// HostAdapterStatus
//
#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK 0x00
#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09
#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT 0x0b
#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d
#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_RESET 0x0e
#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f
#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10
#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11
#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12
#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_FREE 0x13
#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14
#define EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER 0x7f
//
// TargetStatus
//
#define EFI_EXT_SCSI_STATUS_TARGET_GOOD 0x00
#define EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION 0x02
#define EFI_EXT_SCSI_STATUS_TARGET_CONDITION_MET 0x04
#define EFI_EXT_SCSI_STATUS_TARGET_BUSY 0x08
#define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE 0x10
#define EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14
#define EFI_EXT_SCSI_STATUS_TARGET_RESERVATION_CONFLICT 0x18
#define EFI_EXT_SCSI_STATUS_TARGET_TASK_SET_FULL 0x28
#define EFI_EXT_SCSI_STATUS_TARGET_ACA_ACTIVE 0x30
#define EFI_EXT_SCSI_STATUS_TARGET_TASK_ABORTED 0x40
typedef struct {
///
/// The Target ID of the host adapter on the SCSI channel.
///
UINT32 AdapterId;
///
/// Additional information on the attributes of the SCSI channel.
///
UINT32 Attributes;
///
/// Supplies the alignment requirement for any buffer used in a data transfer.
///
UINT32 IoAlign;
} EFI_EXT_SCSI_PASS_THRU_MODE;
typedef struct {
///
/// The timeout, in 100 ns units, to use for the execution of this SCSI
/// Request Packet. A Timeout value of 0 means that this function
/// will wait indefinitely for the SCSI Request Packet to execute. If
/// Timeout is greater than zero, then this function will return
/// EFI_TIMEOUT if the time required to execute the SCSI
/// Request Packet is greater than Timeout.
///
UINT64 Timeout;
///
/// A pointer to the data buffer to transfer between the SCSI
/// controller and the SCSI device for read and bidirectional commands.
///
VOID *InDataBuffer;
///
/// A pointer to the data buffer to transfer between the SCSI
/// controller and the SCSI device for write or bidirectional commands.
///
VOID *OutDataBuffer;
///
/// A pointer to the sense data that was generated by the execution of
/// the SCSI Request Packet.
///
VOID *SenseData;
///
/// A pointer to buffer that contains the Command Data Block to
/// send to the SCSI device specified by Target and Lun.
///
VOID *Cdb;
///
/// On Input, the size, in bytes, of InDataBuffer. On output, the
/// number of bytes transferred between the SCSI controller and the SCSI device.
///
UINT32 InTransferLength;
///
/// On Input, the size, in bytes of OutDataBuffer. On Output, the
/// Number of bytes transferred between SCSI Controller and the SCSI device.
///
UINT32 OutTransferLength;
///
/// The length, in bytes, of the buffer Cdb. The standard values are 6,
/// 10, 12, and 16, but other values are possible if a variable length CDB is used.
///
UINT8 CdbLength;
///
/// The direction of the data transfer. 0 for reads, 1 for writes. A
/// value of 2 is Reserved for Bi-Directional SCSI commands.
///
UINT8 DataDirection;
///
/// The status of the host adapter specified by This when the SCSI
/// Request Packet was executed on the target device.
///
UINT8 HostAdapterStatus;
///
/// The status returned by the device specified by Target and Lun
/// when the SCSI Request Packet was executed.
///
UINT8 TargetStatus;
///
/// On input, the length in bytes of the SenseData buffer. On
/// output, the number of bytes written to the SenseData buffer.
///
UINT8 SenseDataLength;
} EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET;
/**
Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function
supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the
nonblocking I/O functionality is optional.
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
@param Target The Target is an array of size TARGET_MAX_BYTES and it represents
the id of the SCSI device to send the SCSI Request Packet. Each
transport driver may choose to utilize a subset of this size to suit the needs
of transport target representation. For example, a Fibre Channel driver
may use only 8 bytes (WWN) to represent an FC target.
@param Lun The LUN of the SCSI device to send the SCSI Request Packet.
@param Packet A pointer to the SCSI Request Packet to send to the SCSI device
specified by Target and Lun.
@param Event If nonblocking I/O is not supported then Event is ignored, and blocking
I/O is performed. If Event is NULL, then blocking I/O is performed. If
Event is not NULL and non blocking I/O is supported, then
nonblocking I/O is performed, and Event will be signaled when the
SCSI Request Packet completes.
@retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For bi-directional
commands, InTransferLength bytes were transferred from
InDataBuffer. For write and bi-directional commands,
OutTransferLength bytes were transferred by
OutDataBuffer.
@retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was not executed. The number of bytes that
could be transferred is returned in InTransferLength. For write
and bi-directional commands, OutTransferLength bytes were
transferred by OutDataBuffer.
@retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many
SCSI Request Packets already queued. The caller may retry again later.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request
Packet.
@retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket are invalid.
@retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported
by the host adapter. This includes the case of Bi-directional SCSI
commands not supported by the implementation. The SCSI Request
Packet was not sent, so no additional status information is available.
@retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_EXT_SCSI_PASS_THRU_PASSTHRU)(
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT8 *Target,
IN UINT64 Lun,
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
IN EFI_EVENT Event OPTIONAL
);
/**
Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These
can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal
Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the
Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI
channel.
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
@param Target On input, a pointer to the Target ID (an array of size
TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.
On output, a pointer to the Target ID (an array of
TARGET_MAX_BYTES) of the next SCSI device present on a SCSI
channel. An input value of 0xF(all bytes in the array are 0xF) in the
Target array retrieves the Target ID of the first SCSI device present on a
SCSI channel.
@param Lun On input, a pointer to the LUN of a SCSI device present on the SCSI
channel. On output, a pointer to the LUN of the next SCSI device present
on a SCSI channel.
@retval EFI_SUCCESS The Target ID and LUN of the next SCSI device on the SCSI
channel was returned in Target and Lun.
@retval EFI_INVALID_PARAMETER Target array is not all 0xF, and Target and Lun were
not returned on a previous call to GetNextTargetLun().
@retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN)(
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN OUT UINT8 **Target,
IN OUT UINT64 *Lun
);
/**
Used to allocate and build a device path node for a SCSI device on a SCSI channel.
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
@param Target The Target is an array of size TARGET_MAX_BYTES and it specifies the
Target ID of the SCSI device for which a device path node is to be
allocated and built. Transport drivers may chose to utilize a subset of
this size to suit the representation of targets. For example, a Fibre
Channel driver may use only 8 bytes (WWN) in the array to represent a
FC target.
@param Lun The LUN of the SCSI device for which a device path node is to be
allocated and built.
@param DevicePath A pointer to a single device path node that describes the SCSI device
specified by Target and Lun. This function is responsible for
allocating the buffer DevicePath with the boot service
AllocatePool(). It is the caller's responsibility to free
DevicePath when the caller is finished with DevicePath.
@retval EFI_SUCCESS The device path node that describes the SCSI device specified by
Target and Lun was allocated and returned in
DevicePath.
@retval EFI_INVALID_PARAMETER DevicePath is NULL.
@retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does not exist
on the SCSI channel.
@retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH)(
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT8 *Target,
IN UINT64 Lun,
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
);
/**
Used to translate a device path node to a Target ID and LUN.
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
@param DevicePath A pointer to a single device path node that describes the SCSI device
on the SCSI channel.
@param Target A pointer to the Target Array which represents the ID of a SCSI device
on the SCSI channel.
@param Lun A pointer to the LUN of a SCSI device on the SCSI channel.
@retval EFI_SUCCESS DevicePath was successfully translated to a Target ID and
LUN, and they were returned in Target and Lun.
@retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL.
@retval EFI_NOT_FOUND A valid translation from DevicePath to a Target ID and LUN
does not exist.
@retval EFI_UNSUPPORTED This driver does not support the device path node type in
DevicePath.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN)(
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
OUT UINT8 **Target,
OUT UINT64 *Lun
);
/**
Resets a SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel.
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
@retval EFI_SUCCESS The SCSI channel was reset.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI channel.
@retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI channel.
@retval EFI_UNSUPPORTED The SCSI channel does not support a channel reset operation.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL)(
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This
);
/**
Resets a SCSI logical unit that is connected to a SCSI channel.
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
@param Target The Target is an array of size TARGET_MAX_BYTE and it represents the
target port ID of the SCSI device containing the SCSI logical unit to
reset. Transport drivers may chose to utilize a subset of this array to suit
the representation of their targets.
@param Lun The LUN of the SCSI device to reset.
@retval EFI_SUCCESS The SCSI device specified by Target and Lun was reset.
@retval EFI_INVALID_PARAMETER Target or Lun is NULL.
@retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI device
specified by Target and Lun.
@retval EFI_UNSUPPORTED The SCSI channel does not support a target reset operation.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI device
specified by Target and Lun.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN)(
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN UINT8 *Target,
IN UINT64 Lun
);
/**
Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either
be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs
for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to
see if a SCSI device is actually present at that location on the SCSI channel.
@param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.
@param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.
On output, a pointer to the Target ID (an array of
TARGET_MAX_BYTES) of the next SCSI device present on a SCSI
channel. An input value of 0xF(all bytes in the array are 0xF) in the
Target array retrieves the Target ID of the first SCSI device present on a
SCSI channel.
@retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI
channel was returned in Target.
@retval EFI_INVALID_PARAMETER Target or Lun is NULL.
@retval EFI_TIMEOUT Target array is not all 0xF, and Target was not
returned on a previous call to GetNextTarget().
@retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET)(
IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,
IN OUT UINT8 **Target
);
///
/// The EFI_EXT_SCSI_PASS_THRU_PROTOCOL provides information about a SCSI channel
/// and the ability to send SCI Request Packets to any SCSI device attached to
/// that SCSI channel. The information includes the Target ID of the host controller
/// on the SCSI channel and the attributes of the SCSI channel.
///
struct _EFI_EXT_SCSI_PASS_THRU_PROTOCOL {
///
/// A pointer to the EFI_EXT_SCSI_PASS_THRU_MODE data for this SCSI channel.
///
EFI_EXT_SCSI_PASS_THRU_MODE *Mode;
EFI_EXT_SCSI_PASS_THRU_PASSTHRU PassThru;
EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET_LUN GetNextTargetLun;
EFI_EXT_SCSI_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;
EFI_EXT_SCSI_PASS_THRU_GET_TARGET_LUN GetTargetLun;
EFI_EXT_SCSI_PASS_THRU_RESET_CHANNEL ResetChannel;
EFI_EXT_SCSI_PASS_THRU_RESET_TARGET_LUN ResetTargetLun;
EFI_EXT_SCSI_PASS_THRU_GET_NEXT_TARGET GetNextTarget;
};
extern EFI_GUID gEfiExtScsiPassThruProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/SdMmcPassThru.h
================================================
/** @file
The EFI_SD_MMC_PASS_THRU_PROTOCOL provides the ability to send SD/MMC Commands
to any SD/MMC device attached to the SD compatible pci host controller.
Copyright (c) 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __SD_MMC_PASS_THRU_H__
#define __SD_MMC_PASS_THRU_H__
#define EFI_SD_MMC_PASS_THRU_PROTOCOL_GUID \
{ \
0x716ef0d9, 0xff83, 0x4f69, {0x81, 0xe9, 0x51, 0x8b, 0xd3, 0x9a, 0x8e, 0x70 } \
}
typedef struct _EFI_SD_MMC_PASS_THRU_PROTOCOL EFI_SD_MMC_PASS_THRU_PROTOCOL;
typedef enum {
SdMmcCommandTypeBc, // Broadcast commands, no response
SdMmcCommandTypeBcr, // Broadcast commands with response
SdMmcCommandTypeAc, // Addressed(point-to-point) commands
SdMmcCommandTypeAdtc // Addressed(point-to-point) data transfer commands
} EFI_SD_MMC_COMMAND_TYPE;
typedef enum {
SdMmcResponseTypeR1,
SdMmcResponseTypeR1b,
SdMmcResponseTypeR2,
SdMmcResponseTypeR3,
SdMmcResponseTypeR4,
SdMmcResponseTypeR5,
SdMmcResponseTypeR5b,
SdMmcResponseTypeR6,
SdMmcResponseTypeR7
} EFI_SD_MMC_RESPONSE_TYPE;
typedef struct _EFI_SD_MMC_COMMAND_BLOCK {
UINT16 CommandIndex;
UINT32 CommandArgument;
UINT32 CommandType; // One of the EFI_SD_MMC_COMMAND_TYPE values
UINT32 ResponseType; // One of the EFI_SD_MMC_RESPONSE_TYPE values
} EFI_SD_MMC_COMMAND_BLOCK;
typedef struct _EFI_SD_MMC_STATUS_BLOCK {
UINT32 Resp0;
UINT32 Resp1;
UINT32 Resp2;
UINT32 Resp3;
} EFI_SD_MMC_STATUS_BLOCK;
typedef struct _EFI_SD_MMC_PASS_THRU_COMMAND_PACKET {
UINT64 Timeout;
EFI_SD_MMC_COMMAND_BLOCK *SdMmcCmdBlk;
EFI_SD_MMC_STATUS_BLOCK *SdMmcStatusBlk;
VOID *InDataBuffer;
VOID *OutDataBuffer;
UINT32 InTransferLength;
UINT32 OutTransferLength;
EFI_STATUS TransactionStatus;
} EFI_SD_MMC_PASS_THRU_COMMAND_PACKET;
/**
Sends SD command to an SD card that is attached to the SD controller.
The PassThru() function sends the SD command specified by Packet to the SD card
specified by Slot.
If Packet is successfully sent to the SD card, then EFI_SUCCESS is returned.
If a device error occurs while sending the Packet, then EFI_DEVICE_ERROR is returned.
If Slot is not in a valid range for the SD controller, then EFI_INVALID_PARAMETER
is returned.
If Packet defines a data command but both InDataBuffer and OutDataBuffer are NULL,
EFI_INVALID_PARAMETER is returned.
@param[in] This A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
@param[in] Slot The slot number of the SD card to send the command to.
@param[in,out] Packet A pointer to the SD command data structure.
@param[in] Event If Event is NULL, blocking I/O is performed. If Event is
not NULL, then nonblocking I/O is performed, and Event
will be signaled when the Packet completes.
@retval EFI_SUCCESS The SD Command Packet was sent by the host.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SD
command Packet.
@retval EFI_INVALID_PARAMETER Packet, Slot, or the contents of the Packet is invalid.
@retval EFI_INVALID_PARAMETER Packet defines a data command but both InDataBuffer and
OutDataBuffer are NULL.
@retval EFI_NO_MEDIA SD Device not present in the Slot.
@retval EFI_UNSUPPORTED The command described by the SD Command Packet is not
supported by the host controller.
@retval EFI_BAD_BUFFER_SIZE The InTransferLength or OutTransferLength exceeds the
limit supported by SD card ( i.e. if the number of bytes
exceed the Last LBA).
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SD_MMC_PASS_THRU_PASSTHRU) (
IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
IN UINT8 Slot,
IN OUT EFI_SD_MMC_PASS_THRU_COMMAND_PACKET *Packet,
IN EFI_EVENT Event OPTIONAL
);
/**
Used to retrieve next slot numbers supported by the SD controller. The function
returns information about all available slots (populated or not-populated).
The GetNextSlot() function retrieves the next slot number on an SD controller.
If on input Slot is 0xFF, then the slot number of the first slot on the SD controller
is returned.
If Slot is a slot number that was returned on a previous call to GetNextSlot(), then
the slot number of the next slot on the SD controller is returned.
If Slot is not 0xFF and Slot was not returned on a previous call to GetNextSlot(),
EFI_INVALID_PARAMETER is returned.
If Slot is the slot number of the last slot on the SD controller, then EFI_NOT_FOUND
is returned.
@param[in] This A pointer to the EFI_SD_MMMC_PASS_THRU_PROTOCOL instance.
@param[in,out] Slot On input, a pointer to a slot number on the SD controller.
On output, a pointer to the next slot number on the SD controller.
An input value of 0xFF retrieves the first slot number on the SD
controller.
@retval EFI_SUCCESS The next slot number on the SD controller was returned in Slot.
@retval EFI_NOT_FOUND There are no more slots on this SD controller.
@retval EFI_INVALID_PARAMETER Slot is not 0xFF and Slot was not returned on a previous call
to GetNextSlot().
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SD_MMC_PASS_THRU_GET_NEXT_SLOT) (
IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
IN OUT UINT8 *Slot
);
/**
Used to allocate and build a device path node for an SD card on the SD controller.
The BuildDevicePath() function allocates and builds a single device node for the SD
card specified by Slot.
If the SD card specified by Slot is not present on the SD controller, then EFI_NOT_FOUND
is returned.
If DevicePath is NULL, then EFI_INVALID_PARAMETER is returned.
If there are not enough resources to allocate the device path node, then EFI_OUT_OF_RESOURCES
is returned.
Otherwise, DevicePath is allocated with the boot service AllocatePool(), the contents of
DevicePath are initialized to describe the SD card specified by Slot, and EFI_SUCCESS is
returned.
@param[in] This A pointer to the EFI_SD_MMMC_PASS_THRU_PROTOCOL instance.
@param[in] Slot Specifies the slot number of the SD card for which a device
path node is to be allocated and built.
@param[in,out] DevicePath A pointer to a single device path node that describes the SD
card specified by Slot. This function is responsible for
allocating the buffer DevicePath with the boot service
AllocatePool(). It is the caller's responsibility to free
DevicePath when the caller is finished with DevicePath.
@retval EFI_SUCCESS The device path node that describes the SD card specified by
Slot was allocated and returned in DevicePath.
@retval EFI_NOT_FOUND The SD card specified by Slot does not exist on the SD controller.
@retval EFI_INVALID_PARAMETER DevicePath is NULL.
@retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SD_MMC_PASS_THRU_BUILD_DEVICE_PATH) (
IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
IN UINT8 Slot,
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
);
/**
This function retrieves an SD card slot number based on the input device path.
The GetSlotNumber() function retrieves slot number for the SD card specified by
the DevicePath node. If DevicePath is NULL, EFI_INVALID_PARAMETER is returned.
If DevicePath is not a device path node type that the SD Pass Thru driver supports,
EFI_UNSUPPORTED is returned.
@param[in] This A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
@param[in] DevicePath A pointer to the device path node that describes a SD
card on the SD controller.
@param[out] Slot On return, points to the slot number of an SD card on
the SD controller.
@retval EFI_SUCCESS SD card slot number is returned in Slot.
@retval EFI_INVALID_PARAMETER Slot or DevicePath is NULL.
@retval EFI_UNSUPPORTED DevicePath is not a device path node type that the SD
Pass Thru driver supports.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SD_MMC_PASS_THRU_GET_SLOT_NUMBER) (
IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
OUT UINT8 *Slot
);
/**
Resets an SD card that is connected to the SD controller.
The ResetDevice() function resets the SD card specified by Slot.
If this SD controller does not support a device reset operation, EFI_UNSUPPORTED is
returned.
If Slot is not in a valid slot number for this SD controller, EFI_INVALID_PARAMETER
is returned.
If the device reset operation is completed, EFI_SUCCESS is returned.
@param[in] This A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
@param[in] Slot Specifies the slot number of the SD card to be reset.
@retval EFI_SUCCESS The SD card specified by Slot was reset.
@retval EFI_UNSUPPORTED The SD controller does not support a device reset operation.
@retval EFI_INVALID_PARAMETER Slot number is invalid.
@retval EFI_NO_MEDIA SD Device not present in the Slot.
@retval EFI_DEVICE_ERROR The reset command failed due to a device error
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SD_MMC_PASS_THRU_RESET_DEVICE) (
IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
IN UINT8 Slot
);
struct _EFI_SD_MMC_PASS_THRU_PROTOCOL {
UINT32 IoAlign;
EFI_SD_MMC_PASS_THRU_PASSTHRU PassThru;
EFI_SD_MMC_PASS_THRU_GET_NEXT_SLOT GetNextSlot;
EFI_SD_MMC_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;
EFI_SD_MMC_PASS_THRU_GET_SLOT_NUMBER GetSlotNumber;
EFI_SD_MMC_PASS_THRU_RESET_DEVICE ResetDevice;
};
extern EFI_GUID gEfiSdMmcPassThruProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/Security.h
================================================
/** @file
Security Architectural Protocol as defined in PI Specification VOLUME 2 DXE
Used to provide Security services. Specifically, dependening upon the
authentication state of a discovered driver in a Firmware Volume, the
portable DXE Core Dispatcher will call into the Security Architectural
Protocol (SAP) with the authentication state of the driver.
This call-out allows for OEM-specific policy decisions to be made, such
as event logging for attested boots, locking flash in response to discovering
an unsigned driver or failed signature check, or other exception response.
The SAP can also change system behavior by having the DXE core put a driver
in the Schedule-On-Request (SOR) state. This will allow for later disposition
of the driver by platform agent, such as Platform BDS.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __ARCH_PROTOCOL_SECURITY_H__
#define __ARCH_PROTOCOL_SECURITY_H__
///
/// Global ID for the Security Code Architectural Protocol
///
#define EFI_SECURITY_ARCH_PROTOCOL_GUID \
{ 0xA46423E3, 0x4617, 0x49f1, {0xB9, 0xFF, 0xD1, 0xBF, 0xA9, 0x11, 0x58, 0x39 } }
typedef struct _EFI_SECURITY_ARCH_PROTOCOL EFI_SECURITY_ARCH_PROTOCOL;
/**
The EFI_SECURITY_ARCH_PROTOCOL (SAP) is used to abstract platform-specific
policy from the DXE core response to an attempt to use a file that returns a
given status for the authentication check from the section extraction protocol.
The possible responses in a given SAP implementation may include locking
flash upon failure to authenticate, attestation logging for all signed drivers,
and other exception operations. The File parameter allows for possible logging
within the SAP of the driver.
If File is NULL, then EFI_INVALID_PARAMETER is returned.
If the file specified by File with an authentication status specified by
AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.
If the file specified by File with an authentication status specified by
AuthenticationStatus is not safe for the DXE Core to use under any circumstances,
then EFI_ACCESS_DENIED is returned.
If the file specified by File with an authentication status specified by
AuthenticationStatus is not safe for the DXE Core to use right now, but it
might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is
returned.
@param This The EFI_SECURITY_ARCH_PROTOCOL instance.
@param AuthenticationStatus
This is the authentication type returned from the Section
Extraction protocol. See the Section Extraction Protocol
Specification for details on this type.
@param File This is a pointer to the device path of the file that is
being dispatched. This will optionally be used for logging.
@retval EFI_SUCCESS The file specified by File did authenticate, and the
platform policy dictates that the DXE Core may use File.
@retval EFI_INVALID_PARAMETER Driver is NULL.
@retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and
the platform policy dictates that File should be placed
in the untrusted state. A file may be promoted from
the untrusted to the trusted state at a future time
with a call to the Trust() DXE Service.
@retval EFI_ACCESS_DENIED The file specified by File did not authenticate, and
the platform policy dictates that File should not be
used for any purpose.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SECURITY_FILE_AUTHENTICATION_STATE)(
IN CONST EFI_SECURITY_ARCH_PROTOCOL *This,
IN UINT32 AuthenticationStatus,
IN CONST EFI_DEVICE_PATH_PROTOCOL *File
);
///
/// The EFI_SECURITY_ARCH_PROTOCOL is used to abstract platform-specific policy
/// from the DXE core. This includes locking flash upon failure to authenticate,
/// attestation logging, and other exception operations.
///
struct _EFI_SECURITY_ARCH_PROTOCOL {
EFI_SECURITY_FILE_AUTHENTICATION_STATE FileAuthenticationState;
};
extern EFI_GUID gEfiSecurityArchProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/Security2.h
================================================
/** @file
Security2 Architectural Protocol as defined in PI Specification1.2.1 VOLUME 2 DXE
Abstracts security-specific functions from the DXE Foundation of UEFI Image Verification,
Trusted Computing Group (TCG) measured boot, and User Identity policy for image loading and
consoles. This protocol must be produced by a boot service or runtime DXE driver.
This protocol is optional and must be published prior to the EFI_SECURITY_ARCH_PROTOCOL.
As a result, the same driver must publish both of these interfaces.
When both Security and Security2 Architectural Protocols are published, LoadImage must use
them in accordance with the following rules:
The Security2 protocol must be used on every image being loaded.
The Security protocol must be used after the Securiy2 protocol and only on images that
have been read using Firmware Volume protocol.
When only Security architectural protocol is published, LoadImage must use it on every image
being loaded.
Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __ARCH_PROTOCOL_SECURITY2_H__
#define __ARCH_PROTOCOL_SECURITY2_H__
///
/// Global ID for the Security2 Code Architectural Protocol
///
#define EFI_SECURITY2_ARCH_PROTOCOL_GUID \
{ 0x94ab2f58, 0x1438, 0x4ef1, {0x91, 0x52, 0x18, 0x94, 0x1a, 0x3a, 0x0e, 0x68 } }
typedef struct _EFI_SECURITY2_ARCH_PROTOCOL EFI_SECURITY2_ARCH_PROTOCOL;
/**
The DXE Foundation uses this service to measure and/or verify a UEFI image.
This service abstracts the invocation of Trusted Computing Group (TCG) measured boot, UEFI
Secure boot, and UEFI User Identity infrastructure. For the former two, the DXE Foundation
invokes the FileAuthentication() with a DevicePath and corresponding image in
FileBuffer memory. The TCG measurement code will record the FileBuffer contents into the
appropriate PCR. The image verification logic will confirm the integrity and provenance of the
image in FileBuffer of length FileSize . The origin of the image will be DevicePath in
these cases.
If the FileBuffer is NULL, the interface will determine if the DevicePath can be connected
in order to support the User Identification policy.
@param This The EFI_SECURITY2_ARCH_PROTOCOL instance.
@param File A pointer to the device path of the file that is
being dispatched. This will optionally be used for logging.
@param FileBuffer A pointer to the buffer with the UEFI file image.
@param FileSize The size of the file.
@param BootPolicy A boot policy that was used to call LoadImage() UEFI service. If
FileAuthentication() is invoked not from the LoadImage(),
BootPolicy must be set to FALSE.
@retval EFI_SUCCESS The file specified by DevicePath and non-NULL
FileBuffer did authenticate, and the platform policy dictates
that the DXE Foundation may use the file.
@retval EFI_SUCCESS The device path specified by NULL device path DevicePath
and non-NULL FileBuffer did authenticate, and the platform
policy dictates that the DXE Foundation may execute the image in
FileBuffer.
@retval EFI_SUCCESS FileBuffer is NULL and current user has permission to start
UEFI device drivers on the device path specified by DevicePath.
@retval EFI_SECURITY_VIOLATION The file specified by DevicePath and FileBuffer did not
authenticate, and the platform policy dictates that the file should be
placed in the untrusted state. The image has been added to the file
execution table.
@retval EFI_ACCESS_DENIED The file specified by File and FileBuffer did not
authenticate, and the platform policy dictates that the DXE
Foundation may not use File.
@retval EFI_SECURITY_VIOLATION FileBuffer is NULL and the user has no
permission to start UEFI device drivers on the device path specified
by DevicePath.
@retval EFI_SECURITY_VIOLATION FileBuffer is not NULL and the user has no permission to load
drivers from the device path specified by DevicePath. The
image has been added into the list of the deferred images.
**/
typedef EFI_STATUS (EFIAPI *EFI_SECURITY2_FILE_AUTHENTICATION) (
IN CONST EFI_SECURITY2_ARCH_PROTOCOL *This,
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN VOID *FileBuffer,
IN UINTN FileSize,
IN BOOLEAN BootPolicy
);
///
/// The EFI_SECURITY2_ARCH_PROTOCOL is used to abstract platform-specific policy from the
/// DXE Foundation. This includes measuring the PE/COFF image prior to invoking, comparing the
/// image against a policy (whether a white-list/black-list of public image verification keys
/// or registered hashes).
///
struct _EFI_SECURITY2_ARCH_PROTOCOL {
EFI_SECURITY2_FILE_AUTHENTICATION FileAuthentication;
};
extern EFI_GUID gEfiSecurity2ArchProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/SecurityPolicy.h
================================================
/** @file
Security Policy protocol as defined in PI Specification VOLUME 2 DXE
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 _SECURITY_POLICY_H_
#define _SECURITY_POLICY_H_
///
/// Security policy protocol GUID definition
///
#define EFI_SECURITY_POLICY_PROTOCOL_GUID \
{0x78E4D245, 0xCD4D, 0x4a05, {0xA2, 0xBA, 0x47, 0x43, 0xE8, 0x6C, 0xFC, 0xAB} }
extern EFI_GUID gEfiSecurityPolicyProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/SerialIo.h
================================================
/** @file
Serial IO protocol as defined in the UEFI 2.0 specification.
Abstraction of a basic serial device. Targeted at 16550 UART, but
could be much more generic.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __SERIAL_IO_PROTOCOL_H__
#define __SERIAL_IO_PROTOCOL_H__
#define EFI_SERIAL_IO_PROTOCOL_GUID \
{ \
0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD } \
}
///
/// Protocol GUID defined in EFI1.1.
///
#define SERIAL_IO_PROTOCOL EFI_SERIAL_IO_PROTOCOL_GUID
typedef struct _EFI_SERIAL_IO_PROTOCOL EFI_SERIAL_IO_PROTOCOL;
///
/// Backward-compatible with EFI1.1.
///
typedef EFI_SERIAL_IO_PROTOCOL SERIAL_IO_INTERFACE;
///
/// Parity type that is computed or checked as each character is transmitted or received. If the
/// device does not support parity, the value is the default parity value.
///
typedef enum {
DefaultParity,
NoParity,
EvenParity,
OddParity,
MarkParity,
SpaceParity
} EFI_PARITY_TYPE;
///
/// Stop bits type
///
typedef enum {
DefaultStopBits,
OneStopBit,
OneFiveStopBits,
TwoStopBits
} EFI_STOP_BITS_TYPE;
//
// define for Control bits, grouped by read only, write only, and read write
//
//
// Read Only
//
#define EFI_SERIAL_CLEAR_TO_SEND 0x00000010
#define EFI_SERIAL_DATA_SET_READY 0x00000020
#define EFI_SERIAL_RING_INDICATE 0x00000040
#define EFI_SERIAL_CARRIER_DETECT 0x00000080
#define EFI_SERIAL_INPUT_BUFFER_EMPTY 0x00000100
#define EFI_SERIAL_OUTPUT_BUFFER_EMPTY 0x00000200
//
// Write Only
//
#define EFI_SERIAL_REQUEST_TO_SEND 0x00000002
#define EFI_SERIAL_DATA_TERMINAL_READY 0x00000001
//
// Read Write
//
#define EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE 0x00001000
#define EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE 0x00002000
#define EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE 0x00004000
//
// Serial IO Member Functions
//
/**
Reset the serial device.
@param This Protocol instance pointer.
@retval EFI_SUCCESS The device was reset.
@retval EFI_DEVICE_ERROR The serial device could not be reset.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SERIAL_RESET)(
IN EFI_SERIAL_IO_PROTOCOL *This
);
/**
Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
data bits, and stop bits on a serial device.
@param This Protocol instance pointer.
@param BaudRate The requested baud rate. A BaudRate value of 0 will use the
device's default interface speed.
@param ReveiveFifoDepth The requested depth of the FIFO on the receive side of the
serial interface. A ReceiveFifoDepth value of 0 will use
the device's default FIFO depth.
@param Timeout The requested time out for a single character in microseconds.
This timeout applies to both the transmit and receive side of the
interface. A Timeout value of 0 will use the device's default time
out value.
@param Parity The type of parity to use on this serial device. A Parity value of
DefaultParity will use the device's default parity value.
@param DataBits The number of data bits to use on the serial device. A DataBits
vaule of 0 will use the device's default data bit setting.
@param StopBits The number of stop bits to use on this serial device. A StopBits
value of DefaultStopBits will use the device's default number of
stop bits.
@retval EFI_SUCCESS The device was reset.
@retval EFI_INVALID_PARAMETER One or more attributes has an unsupported value.
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SERIAL_SET_ATTRIBUTES)(
IN EFI_SERIAL_IO_PROTOCOL *This,
IN UINT64 BaudRate,
IN UINT32 ReceiveFifoDepth,
IN UINT32 Timeout,
IN EFI_PARITY_TYPE Parity,
IN UINT8 DataBits,
IN EFI_STOP_BITS_TYPE StopBits
);
/**
Set the control bits on a serial device
@param This Protocol instance pointer.
@param Control Set the bits of Control that are settable.
@retval EFI_SUCCESS The new control bits were set on the serial device.
@retval EFI_UNSUPPORTED The serial device does not support this operation.
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SERIAL_SET_CONTROL_BITS)(
IN EFI_SERIAL_IO_PROTOCOL *This,
IN UINT32 Control
);
/**
Retrieves the status of thecontrol bits on a serial device
@param This Protocol instance pointer.
@param Control A pointer to return the current Control signals from the serial device.
@retval EFI_SUCCESS The control bits were read from the serial device.
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SERIAL_GET_CONTROL_BITS)(
IN EFI_SERIAL_IO_PROTOCOL *This,
OUT UINT32 *Control
);
/**
Writes data to a serial device.
@param This Protocol instance pointer.
@param BufferSize On input, the size of the Buffer. On output, the amount of
data actually written.
@param Buffer The buffer of data to write
@retval EFI_SUCCESS The data was written.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_TIMEOUT The data write was stopped due to a timeout.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SERIAL_WRITE)(
IN EFI_SERIAL_IO_PROTOCOL *This,
IN OUT UINTN *BufferSize,
IN VOID *Buffer
);
/**
Writes data to a serial device.
@param This Protocol instance pointer.
@param BufferSize On input, the size of the Buffer. On output, the amount of
data returned in Buffer.
@param Buffer The buffer to return the data into.
@retval EFI_SUCCESS The data was read.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_TIMEOUT The data write was stopped due to a timeout.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SERIAL_READ)(
IN EFI_SERIAL_IO_PROTOCOL *This,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
);
/**
@par Data Structure Description:
The data values in SERIAL_IO_MODE are read-only and are updated by the code
that produces the SERIAL_IO_PROTOCOL member functions.
@param ControlMask
A mask for the Control bits that the device supports. The device
must always support the Input Buffer Empty control bit.
@param TimeOut
If applicable, the number of microseconds to wait before timing out
a Read or Write operation.
@param BaudRate
If applicable, the current baud rate setting of the device; otherwise,
baud rate has the value of zero to indicate that device runs at the
device's designed speed.
@param ReceiveFifoDepth
The number of characters the device will buffer on input
@param DataBits
The number of characters the device will buffer on input
@param Parity
If applicable, this is the EFI_PARITY_TYPE that is computed or
checked as each character is transmitted or reveived. If the device
does not support parity the value is the default parity value.
@param StopBits
If applicable, the EFI_STOP_BITS_TYPE number of stop bits per
character. If the device does not support stop bits the value is
the default stop bit values.
**/
typedef struct {
UINT32 ControlMask;
//
// current Attributes
//
UINT32 Timeout;
UINT64 BaudRate;
UINT32 ReceiveFifoDepth;
UINT32 DataBits;
UINT32 Parity;
UINT32 StopBits;
} EFI_SERIAL_IO_MODE;
#define EFI_SERIAL_IO_PROTOCOL_REVISION 0x00010000
#define SERIAL_IO_INTERFACE_REVISION EFI_SERIAL_IO_PROTOCOL_REVISION
///
/// The Serial I/O protocol is used to communicate with UART-style serial devices.
/// These can be standard UART serial ports in PC-AT systems, serial ports attached
/// to a USB interface, or potentially any character-based I/O device.
///
struct _EFI_SERIAL_IO_PROTOCOL {
///
/// The revision to which the EFI_SERIAL_IO_PROTOCOL adheres. All future revisions
/// must be backwards compatible. If a future version is not backwards compatible,
/// it is not the same GUID.
///
UINT32 Revision;
EFI_SERIAL_RESET Reset;
EFI_SERIAL_SET_ATTRIBUTES SetAttributes;
EFI_SERIAL_SET_CONTROL_BITS SetControl;
EFI_SERIAL_GET_CONTROL_BITS GetControl;
EFI_SERIAL_WRITE Write;
EFI_SERIAL_READ Read;
///
/// Pointer to SERIAL_IO_MODE data.
///
EFI_SERIAL_IO_MODE *Mode;
};
extern EFI_GUID gEfiSerialIoProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/ServiceBinding.h
================================================
/** @file
UEFI Service Binding Protocol is defined in UEFI specification.
The file defines the generic Service Binding Protocol functions.
It provides services that are required to create and destroy child
handles that support a given set of protocols.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __EFI_SERVICE_BINDING_H__
#define __EFI_SERVICE_BINDING_H__
///
/// Forward reference for pure ANSI compatability
///
typedef struct _EFI_SERVICE_BINDING_PROTOCOL EFI_SERVICE_BINDING_PROTOCOL;
/**
Creates a child handle and installs a protocol.
The CreateChild() function installs a protocol on ChildHandle.
If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
@param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
@param ChildHandle Pointer to the handle of the child to create. If it is NULL,
then a new handle is created. If it is a pointer to an existing UEFI handle,
then the protocol is added to the existing UEFI handle.
@retval EFI_SUCCES The protocol was added to ChildHandle.
@retval EFI_INVALID_PARAMETER ChildHandle is NULL.
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to create
the child
@retval other The child handle was not created
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SERVICE_BINDING_CREATE_CHILD)(
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN OUT EFI_HANDLE *ChildHandle
);
/**
Destroys a child handle with a protocol installed on it.
The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
that was installed by CreateChild() from ChildHandle. If the removed protocol is the
last protocol on ChildHandle, then ChildHandle is destroyed.
@param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
@param ChildHandle Handle of the child to destroy
@retval EFI_SUCCES The protocol was removed from ChildHandle.
@retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.
@retval EFI_INVALID_PARAMETER Child handle is NULL.
@retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle
because its services are being used.
@retval other The child handle was not destroyed
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SERVICE_BINDING_DESTROY_CHILD)(
IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE ChildHandle
);
///
/// The EFI_SERVICE_BINDING_PROTOCOL provides member functions to create and destroy
/// child handles. A driver is responsible for adding protocols to the child handle
/// in CreateChild() and removing protocols in DestroyChild(). It is also required
/// that the CreateChild() function opens the parent protocol BY_CHILD_CONTROLLER
/// to establish the parent-child relationship, and closes the protocol in DestroyChild().
/// The pseudo code for CreateChild() and DestroyChild() is provided to specify the
/// required behavior, not to specify the required implementation. Each consumer of
/// a software protocol is responsible for calling CreateChild() when it requires the
/// protocol and calling DestroyChild() when it is finished with that protocol.
///
struct _EFI_SERVICE_BINDING_PROTOCOL {
EFI_SERVICE_BINDING_CREATE_CHILD CreateChild;
EFI_SERVICE_BINDING_DESTROY_CHILD DestroyChild;
};
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/Shell.h
================================================
/** @file
EFI Shell protocol as defined in the UEFI Shell 2.0 specification including errata.
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __EFI_SHELL_PROTOCOL_H__
#define __EFI_SHELL_PROTOCOL_H__
#include
#define EFI_SHELL_PROTOCOL_GUID \
{ \
0x6302d008, 0x7f9b, 0x4f30, { 0x87, 0xac, 0x60, 0xc9, 0xfe, 0xf5, 0xda, 0x4e } \
}
typedef VOID *SHELL_FILE_HANDLE;
typedef enum {
///
/// The operation completed successfully.
///
SHELL_SUCCESS = 0,
///
/// The image failed to load.
///
SHELL_LOAD_ERROR = 1,
///
/// The parameter was incorrect.
///
SHELL_INVALID_PARAMETER = 2,
///
/// The operation is not supported.
///
SHELL_UNSUPPORTED = 3,
///
/// The buffer was not the proper size for the request.
///
SHELL_BAD_BUFFER_SIZE = 4,
///
/// The buffer was not large enough to hold the requested data.
/// The required buffer size is returned in the appropriate
/// parameter when this error occurs.
///
SHELL_BUFFER_TOO_SMALL = 5,
///
/// There is no data pending upon return.
///
SHELL_NOT_READY = 6,
///
/// The physical device reported an error while attempting the
/// operation.
///
SHELL_DEVICE_ERROR = 7,
///
/// The device cannot be written to.
///
SHELL_WRITE_PROTECTED = 8,
///
/// The resource has run out.
///
SHELL_OUT_OF_RESOURCES = 9,
///
/// An inconsistency was detected on the file system causing the
/// operation to fail.
///
SHELL_VOLUME_CORRUPTED = 10,
///
/// There is no more space on the file system.
///
SHELL_VOLUME_FULL = 11,
///
/// The device does not contain any medium to perform the
/// operation.
///
SHELL_NO_MEDIA = 12,
///
/// The medium in the device has changed since the last
/// access.
///
SHELL_MEDIA_CHANGED = 13,
///
/// The item was not found.
///
SHELL_NOT_FOUND = 14,
///
/// Access was denied.
///
SHELL_ACCESS_DENIED = 15,
// note the skipping of 16 and 17
///
/// A timeout time expired.
///
SHELL_TIMEOUT = 18,
///
/// The protocol has not been started.
///
SHELL_NOT_STARTED = 19,
///
/// The protocol has already been started.
///
SHELL_ALREADY_STARTED = 20,
///
/// The operation was aborted.
///
SHELL_ABORTED = 21,
// note the skipping of 22, 23, and 24
///
/// A function encountered an internal version that was
/// incompatible with a version requested by the caller.
///
SHELL_INCOMPATIBLE_VERSION = 25,
///
/// The function was not performed due to a security violation.
///
SHELL_SECURITY_VIOLATION = 26,
///
/// The function was performed and resulted in an unequal
/// comparison..
///
SHELL_NOT_EQUAL = 27
} SHELL_STATUS;
// replaced EFI_LIST_ENTRY with LIST_ENTRY for simplicity.
// they are identical outside of the name.
typedef struct {
LIST_ENTRY Link; ///< Linked list members.
EFI_STATUS Status; ///< Status of opening the file. Valid only if Handle != NULL.
CONST CHAR16 *FullName; ///< Fully qualified filename.
CONST CHAR16 *FileName; ///< name of this file.
SHELL_FILE_HANDLE Handle; ///< Handle for interacting with the opened file or NULL if closed.
EFI_FILE_INFO *Info; ///< Pointer to the FileInfo struct for this file or NULL.
} EFI_SHELL_FILE_INFO;
/**
Returns whether any script files are currently being processed.
@retval TRUE There is at least one script file active.
@retval FALSE No script files are active now.
**/
typedef
BOOLEAN
(EFIAPI *EFI_SHELL_BATCH_IS_ACTIVE) (
VOID
);
/**
Closes the file handle.
This function closes a specified file handle. All 'dirty' cached file data is
flushed to the device, and the file is closed. In all cases, the handle is
closed.
@param[in] FileHandle The file handle to be closed.
@retval EFI_SUCCESS The file closed sucessfully.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_CLOSE_FILE)(
IN SHELL_FILE_HANDLE FileHandle
);
/**
Creates a file or directory by name.
This function creates an empty new file or directory with the specified attributes and
returns the new file's handle. If the file already exists and is read-only, then
EFI_INVALID_PARAMETER will be returned.
If the file already existed, it is truncated and its attributes updated. If the file is
created successfully, the FileHandle is the file's handle, else, the FileHandle is NULL.
If the file name begins with >v, then the file handle which is returned refers to the
shell environment variable with the specified name. If the shell environment variable
already exists and is non-volatile then EFI_INVALID_PARAMETER is returned.
@param[in] FileName Pointer to NULL-terminated file path.
@param[in] FileAttribs The new file's attrbiutes. The different attributes are
described in EFI_FILE_PROTOCOL.Open().
@param[out] FileHandle On return, points to the created file handle or directory's handle.
@retval EFI_SUCCESS The file was opened. FileHandle points to the new file's handle.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
@retval EFI_UNSUPPORTED The file path could not be opened.
@retval EFI_NOT_FOUND The specified file could not be found on the device, or could not
file the file system on the device.
@retval EFI_NO_MEDIA The device has no medium.
@retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no
longer supported.
@retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according
the DirName.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write
when the media is write-protected.
@retval EFI_ACCESS_DENIED The service denied access to the file.
@retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.
@retval EFI_VOLUME_FULL The volume is full.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_CREATE_FILE)(
IN CONST CHAR16 *FileName,
IN UINT64 FileAttribs,
OUT SHELL_FILE_HANDLE *FileHandle
);
/**
Deletes the file specified by the file handle.
This function closes and deletes a file. In all cases, the file handle is closed. If the file
cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is returned, but the
handle is still closed.
@param[in] FileHandle The file handle to delete.
@retval EFI_SUCCESS The file was closed and deleted and the handle was closed.
@retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_DELETE_FILE)(
IN SHELL_FILE_HANDLE FileHandle
);
/**
Deletes the file specified by the file name.
This function deletes a file.
@param[in] FileName Points to the NULL-terminated file name.
@retval EFI_SUCCESS The file was deleted.
@retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_DELETE_FILE_BY_NAME)(
IN CONST CHAR16 *FileName
);
/**
Disables the page break output mode.
**/
typedef
VOID
(EFIAPI *EFI_SHELL_DISABLE_PAGE_BREAK) (
VOID
);
/**
Enables the page break output mode.
**/
typedef
VOID
(EFIAPI *EFI_SHELL_ENABLE_PAGE_BREAK) (
VOID
);
/**
Execute the command line.
This function creates a nested instance of the shell and executes the specified
command (CommandLine) with the specified environment (Environment). Upon return,
the status code returned by the specified command is placed in StatusCode.
If Environment is NULL, then the current environment is used and all changes made
by the commands executed will be reflected in the current environment. If the
Environment is non-NULL, then the changes made will be discarded.
The CommandLine is executed from the current working directory on the current
device.
@param[in] ParentImageHandle A handle of the image that is executing the specified
command line.
@param[in] CommandLine Points to the NULL-terminated UCS-2 encoded string
containing the command line. If NULL then the command-
line will be empty.
@param[in] Environment Points to a NULL-terminated array of environment
variables with the format 'x=y', where x is the
environment variable name and y is the value. If this
is NULL, then the current shell environment is used.
@param[out] ErrorCode Points to the status code returned by the command.
@retval EFI_SUCCESS The command executed successfully. The status code
returned by the command is pointed to by StatusCode.
@retval EFI_INVALID_PARAMETER The parameters are invalid.
@retval EFI_OUT_OF_RESOURCES Out of resources.
@retval EFI_UNSUPPORTED Nested shell invocations are not allowed.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_EXECUTE) (
IN EFI_HANDLE *ParentImageHandle,
IN CHAR16 *CommandLine OPTIONAL,
IN CHAR16 **Environment OPTIONAL,
OUT EFI_STATUS *StatusCode OPTIONAL
);
/**
Find files that match a specified pattern.
This function searches for all files and directories that match the specified
FilePattern. The FilePattern can contain wild-card characters. The resulting file
information is placed in the file list FileList.
The files in the file list are not opened. The OpenMode field is set to 0 and the FileInfo
field is set to NULL.
@param[in] FilePattern Points to a NULL-terminated shell file path, including wildcards.
@param[out] FileList On return, points to the start of a file list containing the names
of all matching files or else points to NULL if no matching files
were found.
@retval EFI_SUCCESS Files found.
@retval EFI_NOT_FOUND No files found.
@retval EFI_NO_MEDIA The device has no media.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_FIND_FILES)(
IN CONST CHAR16 *FilePattern,
OUT EFI_SHELL_FILE_INFO **FileList
);
/**
Find all files in a specified directory.
@param[in] FileDirHandle Handle of the directory to search.
@param[out] FileList On return, points to the list of files in the directory
or NULL if there are no files in the directory.
@retval EFI_SUCCESS File information was returned successfully.
@retval EFI_VOLUME_CORRUPTED The file system structures have been corrupted.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_NO_MEDIA The device media is not present.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_FIND_FILES_IN_DIR)(
IN SHELL_FILE_HANDLE FileDirHandle,
OUT EFI_SHELL_FILE_INFO **FileList
);
/**
Flushes data back to a device.
This function flushes all modified data associated with a file to a device.
@param[in] FileHandle The handle of the file to flush.
@retval EFI_SUCCESS The data was flushed.
@retval EFI_NO_MEDIA The device has no medium.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@retval EFI_WRITE_PROTECTED The file or medium is write-protected.
@retval EFI_ACCESS_DENIED The file was opened read-only.
@retval EFI_VOLUME_FULL The volume is full.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_FLUSH_FILE)(
IN SHELL_FILE_HANDLE FileHandle
);
/**
Frees the file list.
This function cleans up the file list and any related data structures. It has no
impact on the files themselves.
@param[in] FileList The file list to free. Type EFI_SHELL_FILE_INFO is
defined in OpenFileList().
@retval EFI_SUCCESS Free the file list successfully.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_FREE_FILE_LIST) (
IN EFI_SHELL_FILE_INFO **FileList
);
/**
Returns the current directory on the specified device.
If FileSystemMapping is NULL, it returns the current working directory. If the
FileSystemMapping is not NULL, it returns the current directory associated with the
FileSystemMapping. In both cases, the returned name includes the file system
mapping (i.e. fs0:\current-dir).
Note that the current directory string should exclude the tailing backslash character.
@param[in] FileSystemMapping A pointer to the file system mapping. If NULL,
then the current working directory is returned.
@retval !=NULL The current directory.
@retval NULL Current directory does not exist.
**/
typedef
CONST CHAR16 *
(EFIAPI *EFI_SHELL_GET_CUR_DIR) (
IN CONST CHAR16 *FileSystemMapping OPTIONAL
);
typedef UINT32 EFI_SHELL_DEVICE_NAME_FLAGS;
#define EFI_DEVICE_NAME_USE_COMPONENT_NAME 0x00000001
#define EFI_DEVICE_NAME_USE_DEVICE_PATH 0x00000002
/**
Gets the name of the device specified by the device handle.
This function gets the user-readable name of the device specified by the device
handle. If no user-readable name could be generated, then *BestDeviceName will be
NULL and EFI_NOT_FOUND will be returned.
If EFI_DEVICE_NAME_USE_COMPONENT_NAME is set, then the function will return the
device's name using the EFI_COMPONENT_NAME2_PROTOCOL, if present on
DeviceHandle.
If EFI_DEVICE_NAME_USE_DEVICE_PATH is set, then the function will return the
device's name using the EFI_DEVICE_PATH_PROTOCOL, if present on DeviceHandle.
If both EFI_DEVICE_NAME_USE_COMPONENT_NAME and
EFI_DEVICE_NAME_USE_DEVICE_PATH are set, then
EFI_DEVICE_NAME_USE_COMPONENT_NAME will have higher priority.
@param[in] DeviceHandle The handle of the device.
@param[in] Flags Determines the possible sources of component names.
@param[in] Language A pointer to the language specified for the device
name, in the same format as described in the UEFI
specification, Appendix M.
@param[out] BestDeviceName On return, points to the callee-allocated NULL-
terminated name of the device. If no device name
could be found, points to NULL. The name must be
freed by the caller...
@retval EFI_SUCCESS Get the name successfully.
@retval EFI_NOT_FOUND Fail to get the device name.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_GET_DEVICE_NAME) (
IN EFI_HANDLE DeviceHandle,
IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,
IN CHAR8 *Language,
OUT CHAR16 **BestDeviceName
);
/**
Gets the device path from the mapping.
This function gets the device path associated with a mapping.
@param[in] Mapping A pointer to the mapping
@retval !=NULL Pointer to the device path that corresponds to the
device mapping. The returned pointer does not need
to be freed.
@retval NULL There is no device path associated with the
specified mapping.
**/
typedef
CONST EFI_DEVICE_PATH_PROTOCOL *
(EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_MAP) (
IN CONST CHAR16 *Mapping
);
/**
Converts a file system style name to a device path.
This function converts a file system style name to a device path, by replacing any
mapping references to the associated device path.
@param[in] Path The pointer to the path.
@return The pointer of the file path. The file path is callee
allocated and should be freed by the caller.
**/
typedef
EFI_DEVICE_PATH_PROTOCOL *
(EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH) (
IN CONST CHAR16 *Path
);
/**
Gets either a single or list of environment variables.
If name is not NULL then this function returns the current value of the specified
environment variable.
If Name is NULL than a list of all environment variable names is returned. Each a
NULL terminated string with a double NULL terminating the list.
@param[in] Name A pointer to the environment variable name. If
Name is NULL, then the function will return all
of the defined shell environment variables. In
the case where multiple environment variables are
being returned, each variable will be terminated by
a NULL, and the list will be terminated by a double
NULL.
@return A pointer to the returned string.
The returned pointer does not need to be freed by the caller.
@retval NULL The environment variable doesn't exist or there are
no environment variables.
**/
typedef
CONST CHAR16 *
(EFIAPI *EFI_SHELL_GET_ENV) (
IN CONST CHAR16 *Name OPTIONAL
);
/**
Gets the environment variable and Attributes, or list of environment variables. Can be
used instead of GetEnv().
This function returns the current value of the specified environment variable and
the Attributes. If no variable name was specified, then all of the known
variables will be returned.
@param[in] Name A pointer to the environment variable name. If Name is NULL,
then the function will return all of the defined shell
environment variables. In the case where multiple environment
variables are being returned, each variable will be terminated
by a NULL, and the list will be terminated by a double NULL.
@param[out] Attributes If not NULL, a pointer to the returned attributes bitmask for
the environment variable. In the case where Name is NULL, and
multiple environment variables are being returned, Attributes
is undefined.
@retval NULL The environment variable doesn't exist.
@return The environment variable's value. The returned pointer does not
need to be freed by the caller.
**/
typedef
CONST CHAR16 *
(EFIAPI *EFI_SHELL_GET_ENV_EX) (
IN CONST CHAR16 *Name,
OUT UINT32 *Attributes OPTIONAL
);
/**
Gets the file information from an open file handle.
This function allocates a buffer to store the file's information. It's the caller's
responsibility to free the buffer.
@param[in] FileHandle A File Handle.
@retval NULL Cannot get the file info.
@return A pointer to a buffer with file information.
**/
typedef
EFI_FILE_INFO *
(EFIAPI *EFI_SHELL_GET_FILE_INFO)(
IN SHELL_FILE_HANDLE FileHandle
);
/**
Converts a device path to a file system-style path.
This function converts a device path to a file system path by replacing part, or all, of
the device path with the file-system mapping. If there are more than one application
file system mappings, the one that most closely matches Path will be used.
@param[in] Path The pointer to the device path.
@return The pointer of the NULL-terminated file path. The path
is callee-allocated and should be freed by the caller.
**/
typedef
CHAR16 *
(EFIAPI *EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH) (
IN CONST EFI_DEVICE_PATH_PROTOCOL *Path
);
/**
Gets a file's current position.
This function returns the current file position for the file handle. For directories, the
current file position has no meaning outside of the file system driver and as such, the
operation is not supported.
@param[in] FileHandle The file handle on which to get the current position.
@param[out] Position Byte position from the start of the file.
@retval EFI_SUCCESS Data was accessed.
@retval EFI_UNSUPPORTED The request is not valid on open directories.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_GET_FILE_POSITION)(
IN SHELL_FILE_HANDLE FileHandle,
OUT UINT64 *Position
);
/**
Gets the size of a file.
This function returns the size of the file specified by FileHandle.
@param[in] FileHandle The handle of the file.
@param[out] Size The size of this file.
@retval EFI_SUCCESS Get the file's size.
@retval EFI_DEVICE_ERROR Can't access the file.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_GET_FILE_SIZE)(
IN SHELL_FILE_HANDLE FileHandle,
OUT UINT64 *Size
);
/**
Get the GUID value from a human readable name.
If GuidName is a known GUID name, then update Guid to have the correct value for
that GUID.
This function is only available when the major and minor versions in the
EfiShellProtocol are greater than or equal to 2 and 1, respectively.
@param[in] GuidName A pointer to the localized name for the GUID being queried.
@param[out] Guid A pointer to the GUID structure to be filled in.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_INVALID_PARAMETER Guid was NULL.
@retval EFI_INVALID_PARAMETER GuidName was NULL.
@retval EFI_NOT_FOUND GuidName is not a known GUID Name.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_GET_GUID_FROM_NAME)(
IN CONST CHAR16 *GuidName,
OUT EFI_GUID *Guid
);
/**
Get the human readable name for a GUID from the value.
If Guid is assigned a name, then update *GuidName to point to the name. The callee
should not modify the value.
This function is only available when the major and minor versions in the
EfiShellProtocol are greater than or equal to 2 and 1, respectively.
@param[in] Guid A pointer to the GUID being queried.
@param[out] GuidName A pointer to a pointer the localized to name for the GUID being requested
@retval EFI_SUCCESS The operation was successful.
@retval EFI_INVALID_PARAMETER Guid was NULL.
@retval EFI_INVALID_PARAMETER GuidName was NULL.
@retval EFI_NOT_FOUND Guid is not assigned a name.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_GET_GUID_NAME)(
IN CONST EFI_GUID *Guid,
OUT CONST CHAR16 **GuidName
);
/**
Return help information about a specific command.
This function returns the help information for the specified command. The help text
can be internal to the shell or can be from a UEFI Shell manual page.
If Sections is specified, then each section name listed will be compared in a casesensitive
manner, to the section names described in Appendix B. If the section exists,
it will be appended to the returned help text. If the section does not exist, no
information will be returned. If Sections is NULL, then all help text information
available will be returned.
@param[in] Command Points to the NULL-terminated UEFI Shell command name.
@param[in] Sections Points to the NULL-terminated comma-delimited
section names to return. If NULL, then all
sections will be returned.
@param[out] HelpText On return, points to a callee-allocated buffer
containing all specified help text.
@retval EFI_SUCCESS The help text was returned.
@retval EFI_OUT_OF_RESOURCES The necessary buffer could not be allocated to hold the
returned help text.
@retval EFI_INVALID_PARAMETER HelpText is NULL.
@retval EFI_NOT_FOUND There is no help text available for Command.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_GET_HELP_TEXT) (
IN CONST CHAR16 *Command,
IN CONST CHAR16 *Sections OPTIONAL,
OUT CHAR16 **HelpText
);
/**
Gets the mapping(s) that most closely matches the device path.
This function gets the mapping which corresponds to the device path *DevicePath. If
there is no exact match, then the mapping which most closely matches *DevicePath
is returned, and *DevicePath is updated to point to the remaining portion of the
device path. If there is an exact match, the mapping is returned and *DevicePath
points to the end-of-device-path node.
If there are multiple map names they will be semi-colon seperated in the
NULL-terminated string.
@param[in, out] DevicePath On entry, points to a device path pointer. On
exit, updates the pointer to point to the
portion of the device path after the mapping.
@retval NULL No mapping was found.
@retval !=NULL Pointer to NULL-terminated mapping. The buffer
is callee allocated and should be freed by the caller.
**/
typedef
CONST CHAR16 *
(EFIAPI *EFI_SHELL_GET_MAP_FROM_DEVICE_PATH) (
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
);
/**
Gets the enable status of the page break output mode.
User can use this function to determine current page break mode.
@retval TRUE The page break output mode is enabled.
@retval FALSE The page break output mode is disabled.
**/
typedef
BOOLEAN
(EFIAPI *EFI_SHELL_GET_PAGE_BREAK) (
VOID
);
/**
Judges whether the active shell is the root shell.
This function makes the user to know that whether the active Shell is the root shell.
@retval TRUE The active Shell is the root Shell.
@retval FALSE The active Shell is NOT the root Shell.
**/
typedef
BOOLEAN
(EFIAPI *EFI_SHELL_IS_ROOT_SHELL) (
VOID
);
/**
Opens a file or a directory by file name.
This function opens the specified file in the specified OpenMode and returns a file
handle.
If the file name begins with '>v', then the file handle which is returned refers to the
shell environment variable with the specified name. If the shell environment variable
exists, is non-volatile and the OpenMode indicates EFI_FILE_MODE_WRITE, then
EFI_INVALID_PARAMETER is returned.
If the file name is '>i', then the file handle which is returned refers to the standard
input. If the OpenMode indicates EFI_FILE_MODE_WRITE, then EFI_INVALID_PARAMETER
is returned.
If the file name is '>o', then the file handle which is returned refers to the standard
output. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER
is returned.
If the file name is '>e', then the file handle which is returned refers to the standard
error. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER
is returned.
If the file name is 'NUL', then the file handle that is returned refers to the standard NUL
file. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER is
returned.
If return EFI_SUCCESS, the FileHandle is the opened file's handle, else, the
FileHandle is NULL.
@param[in] FileName Points to the NULL-terminated UCS-2 encoded file name.
@param[out] FileHandle On return, points to the file handle.
@param[in] OpenMode File open mode. Either EFI_FILE_MODE_READ or
EFI_FILE_MODE_WRITE from section 12.4 of the UEFI
Specification.
@retval EFI_SUCCESS The file was opened. FileHandle has the opened file's handle.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. FileHandle is NULL.
@retval EFI_UNSUPPORTED Could not open the file path. FileHandle is NULL.
@retval EFI_NOT_FOUND The specified file could not be found on the device or the file
system could not be found on the device. FileHandle is NULL.
@retval EFI_NO_MEDIA The device has no medium. FileHandle is NULL.
@retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no
longer supported. FileHandle is NULL.
@retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according
the FileName. FileHandle is NULL.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. FileHandle is NULL.
@retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write
when the media is write-protected. FileHandle is NULL.
@retval EFI_ACCESS_DENIED The service denied access to the file. FileHandle is NULL.
@retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file. FileHandle
is NULL.
@retval EFI_VOLUME_FULL The volume is full. FileHandle is NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_OPEN_FILE_BY_NAME) (
IN CONST CHAR16 *FileName,
OUT SHELL_FILE_HANDLE *FileHandle,
IN UINT64 OpenMode
);
/**
Opens the files that match the path specified.
This function opens all of the files specified by Path. Wildcards are processed
according to the rules specified in UEFI Shell 2.0 spec section 3.7.1. Each
matching file has an EFI_SHELL_FILE_INFO structure created in a linked list.
@param[in] Path A pointer to the path string.
@param[in] OpenMode Specifies the mode used to open each file, EFI_FILE_MODE_READ or
EFI_FILE_MODE_WRITE.
@param[in, out] FileList Points to the start of a list of files opened.
@retval EFI_SUCCESS Create the file list successfully.
@return Can't create the file list.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_OPEN_FILE_LIST) (
IN CHAR16 *Path,
IN UINT64 OpenMode,
IN OUT EFI_SHELL_FILE_INFO **FileList
);
/**
Opens the root directory of a device.
This function opens the root directory of a device and returns a file handle to it.
@param[in] DevicePath Points to the device path corresponding to the device where the
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is installed.
@param[out] FileHandle On exit, points to the file handle corresponding to the root directory on the
device.
@retval EFI_SUCCESS Root opened successfully.
@retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory
could not be opened.
@retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted.
@retval EFI_DEVICE_ERROR The device had an error.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_OPEN_ROOT)(
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
OUT SHELL_FILE_HANDLE *FileHandle
);
/**
Opens the root directory of a device on a handle.
This function opens the root directory of a device and returns a file handle to it.
@param[in] DeviceHandle The handle of the device that contains the volume.
@param[out] FileHandle On exit, points to the file handle corresponding to the root directory on the
device.
@retval EFI_SUCCESS Root opened successfully.
@retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory
could not be opened.
@retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted.
@retval EFI_DEVICE_ERROR The device had an error.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_OPEN_ROOT_BY_HANDLE)(
IN EFI_HANDLE DeviceHandle,
OUT SHELL_FILE_HANDLE *FileHandle
);
/**
Reads data from the file.
If FileHandle is not a directory, the function reads the requested number of bytes
from the file at the file's current position and returns them in Buffer. If the read goes
beyond the end of the file, the read length is truncated to the end of the file. The file's
current position is increased by the number of bytes returned.
If FileHandle is a directory, then an error is returned.
@param[in] FileHandle The opened file handle for read.
@param[in] ReadSize On input, the size of Buffer, in bytes. On output, the amount of data read.
@param[in, out] Buffer The buffer in which data is read.
@retval EFI_SUCCESS Data was read.
@retval EFI_NO_MEDIA The device has no media.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required size.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_READ_FILE) (
IN SHELL_FILE_HANDLE FileHandle,
IN OUT UINTN *ReadSize,
IN OUT VOID *Buffer
);
/**
Register a GUID and a localized human readable name for it.
If Guid is not assigned a name, then assign GuidName to Guid. This list of GUID
names must be used whenever a shell command outputs GUID information.
This function is only available when the major and minor versions in the
EfiShellProtocol are greater than or equal to 2 and 1, respectively.
@param[in] Guid A pointer to the GUID being registered.
@param[in] GuidName A pointer to the localized name for the GUID being registered.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_INVALID_PARAMETER Guid was NULL.
@retval EFI_INVALID_PARAMETER GuidName was NULL.
@retval EFI_ACCESS_DENIED Guid already is assigned a name.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_REGISTER_GUID_NAME)(
IN CONST EFI_GUID *Guid,
IN CONST CHAR16 *GuidName
);
/**
Deletes the duplicate file names files in the given file list.
@param[in] FileList A pointer to the first entry in the file list.
@retval EFI_SUCCESS Always success.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_REMOVE_DUP_IN_FILE_LIST) (
IN EFI_SHELL_FILE_INFO **FileList
);
/**
Changes a shell command alias.
This function creates an alias for a shell command.
@param[in] Command Points to the NULL-terminated shell command or existing alias.
@param[in] Alias Points to the NULL-terminated alias for the shell command. If this is NULL, and
Command refers to an alias, that alias will be deleted.
@param[in] Replace If TRUE and the alias already exists, then the existing alias will be replaced. If
FALSE and the alias already exists, then the existing alias is unchanged and
EFI_ACCESS_DENIED is returned.
@param[in] Volatile if TRUE the Alias being set will be stored in a volatile fashion. if FALSE the
Alias being set will be stored in a non-volatile fashion.
@retval EFI_SUCCESS Alias created or deleted successfully.
@retval EFI_ACCESS_DENIED The alias is a built-in alias or already existed and Replace was set to
FALSE.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_SET_ALIAS)(
IN CONST CHAR16 *Command,
IN CONST CHAR16 *Alias,
IN BOOLEAN Replace,
IN BOOLEAN Volatile
);
/**
This function returns the command associated with a alias or a list of all
alias'.
@param[in] Alias Points to the NULL-terminated shell alias.
If this parameter is NULL, then all
aliases will be returned in ReturnedData.
@param[out] Volatile Upon return of a single command if TRUE indicates
this is stored in a volatile fashion. FALSE otherwise.
@return If Alias is not NULL, it will return a pointer to
the NULL-terminated command for that alias.
If Alias is NULL, ReturnedData points to a ';'
delimited list of alias (e.g.
ReturnedData = "dir;del;copy;mfp") that is NULL-terminated.
@retval NULL An error ocurred.
@retval NULL Alias was not a valid Alias.
**/
typedef
CONST CHAR16 *
(EFIAPI *EFI_SHELL_GET_ALIAS)(
IN CONST CHAR16 *Alias,
OUT BOOLEAN *Volatile OPTIONAL
);
/**
Changes the current directory on the specified device.
If the FileSystem is NULL, and the directory Dir does not contain a file system's
mapped name, this function changes the current working directory. If FileSystem is
NULL and the directory Dir contains a mapped name, then the current file system and
the current directory on that file system are changed.
If FileSystem is not NULL, and Dir is NULL, then this changes the current working file
system.
If FileSystem is not NULL and Dir is not NULL, then this function changes the current
directory on the specified file system.
If the current working directory or the current working file system is changed then the
%cwd% environment variable will be updated.
@param[in] FileSystem A pointer to the file system's mapped name. If NULL, then the current working
directory is changed.
@param[in] Dir Points to the NULL-terminated directory on the device specified by FileSystem.
@retval NULL Current directory does not exist.
@return The current directory.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_SET_CUR_DIR) (
IN CONST CHAR16 *FileSystem OPTIONAL,
IN CONST CHAR16 *Dir
);
/**
Sets the environment variable.
This function changes the current value of the specified environment variable. If the
environment variable exists and the Value is an empty string, then the environment
variable is deleted. If the environment variable exists and the Value is not an empty
string, then the value of the environment variable is changed. If the environment
variable does not exist and the Value is an empty string, there is no action. If the
environment variable does not exist and the Value is a non-empty string, then the
environment variable is created and assigned the specified value.
For a description of volatile and non-volatile environment variables, see UEFI Shell
2.0 specification section 3.6.1.
@param[in] Name Points to the NULL-terminated environment variable name.
@param[in] Value Points to the NULL-terminated environment variable value. If the value is an
empty string then the environment variable is deleted.
@param[in] Volatile Indicates whether the variable is non-volatile (FALSE) or volatile (TRUE).
@retval EFI_SUCCESS The environment variable was successfully updated.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_SET_ENV) (
IN CONST CHAR16 *Name,
IN CONST CHAR16 *Value,
IN BOOLEAN Volatile
);
/**
Sets the file information to an opened file handle.
This function changes file information. All file information in the EFI_FILE_INFO
struct will be updated to the passed in data.
@param[in] FileHandle A file handle.
@param[in] FileInfo Points to new file information.
@retval EFI_SUCCESS The information was set.
@retval EFI_NO_MEDIA The device has no medium.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@retval EFI_WRITE_PROTECTED The file or medium is write-protected.
@retval EFI_ACCESS_DENIED The file was opened read-only.
@retval EFI_VOLUME_FULL The volume is full.
@retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the size of EFI_FILE_INFO.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_SET_FILE_INFO)(
IN SHELL_FILE_HANDLE FileHandle,
IN CONST EFI_FILE_INFO *FileInfo
);
/**
Sets a file's current position.
This function sets the current file position for the handle to the position supplied. With
the exception of seeking to position 0xFFFFFFFFFFFFFFFF, only absolute positioning is
supported, and seeking past the end of the file is allowed (a subsequent write would
grow the file). Seeking to position 0xFFFFFFFFFFFFFFFF causes the current position
to be set to the end of the file.
@param[in] FileHandle The file handle on which requested position will be set.
@param[in] Position Byte position from the start of the file.
@retval EFI_SUCCESS Data was written.
@retval EFI_UNSUPPORTED The seek request for nonzero is not valid on open directories.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_SET_FILE_POSITION)(
IN SHELL_FILE_HANDLE FileHandle,
IN UINT64 Position
);
/**
This function creates a mapping for a device path.
@param[in] DevicePath Points to the device path. If this is NULL and Mapping points to a valid mapping,
then the mapping will be deleted.
@param[in] Mapping Points to the NULL-terminated mapping for the device path.
@retval EFI_SUCCESS Mapping created or deleted successfully.
@retval EFI_NO_MAPPING There is no handle that corresponds exactly to DevicePath. See the
boot service function LocateDevicePath().
@retval EFI_ACCESS_DENIED The mapping is a built-in alias.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_SET_MAP)(
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONST CHAR16 *Mapping
);
/**
Writes data to the file.
This function writes the specified number of bytes to the file at the current file position.
The current file position is advanced the actual number of bytes written, which is
returned in BufferSize. Partial writes only occur when there has been a data error
during the write attempt (such as "volume space full"). The file automatically grows to
hold the data, if required.
Direct writes to opened directories are not supported.
@param[in] FileHandle The opened file handle for writing.
@param[in, out] BufferSize On input, size of Buffer.
@param[in] Buffer The buffer in which data to write.
@retval EFI_SUCCESS Data was written.
@retval EFI_UNSUPPORTED Writes to open directory are not supported.
@retval EFI_NO_MEDIA The device has no media.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@retval EFI_WRITE_PROTECTED The device is write-protected.
@retval EFI_ACCESS_DENIED The file was open for read only.
@retval EFI_VOLUME_FULL The volume is full.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SHELL_WRITE_FILE)(
IN SHELL_FILE_HANDLE FileHandle,
IN OUT UINTN *BufferSize,
IN VOID *Buffer
);
//
// EFI_SHELL_PROTOCOL has been updated since UEFI Shell Spec 2.0
// Usage of this protocol will require version checking before attempting
// to use any new members. There is no need to check the version for
// members that existed in UEFI Shell Spec 2.0.
//
// Update below for any future UEFI Shell spec changes to this protocol.
//
// Check EFI_SHELL_PROTOCOL MajorVersion and MinorVersion:
// if ((2 == gEfiShellProtocol->MajorVersion) &&
// (0 == gEfiShellProtocol->MinorVersion)) {
// //
// // Cannot call:
// // RegisterGuidName - UEFI Shell 2.1
// // GetGuidName - UEFI Shell 2.1
// // GetGuidFromName - UEFI Shell 2.1
// // GetEnvEx - UEFI Shell 2.1
// //
// } else {
// //
// // Can use all members
// //
// }
//
typedef struct _EFI_SHELL_PROTOCOL {
EFI_SHELL_EXECUTE Execute;
EFI_SHELL_GET_ENV GetEnv;
EFI_SHELL_SET_ENV SetEnv;
EFI_SHELL_GET_ALIAS GetAlias;
EFI_SHELL_SET_ALIAS SetAlias;
EFI_SHELL_GET_HELP_TEXT GetHelpText;
EFI_SHELL_GET_DEVICE_PATH_FROM_MAP GetDevicePathFromMap;
EFI_SHELL_GET_MAP_FROM_DEVICE_PATH GetMapFromDevicePath;
EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH GetDevicePathFromFilePath;
EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH GetFilePathFromDevicePath;
EFI_SHELL_SET_MAP SetMap;
EFI_SHELL_GET_CUR_DIR GetCurDir;
EFI_SHELL_SET_CUR_DIR SetCurDir;
EFI_SHELL_OPEN_FILE_LIST OpenFileList;
EFI_SHELL_FREE_FILE_LIST FreeFileList;
EFI_SHELL_REMOVE_DUP_IN_FILE_LIST RemoveDupInFileList;
EFI_SHELL_BATCH_IS_ACTIVE BatchIsActive;
EFI_SHELL_IS_ROOT_SHELL IsRootShell;
EFI_SHELL_ENABLE_PAGE_BREAK EnablePageBreak;
EFI_SHELL_DISABLE_PAGE_BREAK DisablePageBreak;
EFI_SHELL_GET_PAGE_BREAK GetPageBreak;
EFI_SHELL_GET_DEVICE_NAME GetDeviceName;
EFI_SHELL_GET_FILE_INFO GetFileInfo;
EFI_SHELL_SET_FILE_INFO SetFileInfo;
EFI_SHELL_OPEN_FILE_BY_NAME OpenFileByName;
EFI_SHELL_CLOSE_FILE CloseFile;
EFI_SHELL_CREATE_FILE CreateFile;
EFI_SHELL_READ_FILE ReadFile;
EFI_SHELL_WRITE_FILE WriteFile;
EFI_SHELL_DELETE_FILE DeleteFile;
EFI_SHELL_DELETE_FILE_BY_NAME DeleteFileByName;
EFI_SHELL_GET_FILE_POSITION GetFilePosition;
EFI_SHELL_SET_FILE_POSITION SetFilePosition;
EFI_SHELL_FLUSH_FILE FlushFile;
EFI_SHELL_FIND_FILES FindFiles;
EFI_SHELL_FIND_FILES_IN_DIR FindFilesInDir;
EFI_SHELL_GET_FILE_SIZE GetFileSize;
EFI_SHELL_OPEN_ROOT OpenRoot;
EFI_SHELL_OPEN_ROOT_BY_HANDLE OpenRootByHandle;
EFI_EVENT ExecutionBreak;
UINT32 MajorVersion;
UINT32 MinorVersion;
// Added for Shell 2.1
EFI_SHELL_REGISTER_GUID_NAME RegisterGuidName;
EFI_SHELL_GET_GUID_NAME GetGuidName;
EFI_SHELL_GET_GUID_FROM_NAME GetGuidFromName;
EFI_SHELL_GET_ENV_EX GetEnvEx;
} EFI_SHELL_PROTOCOL;
extern EFI_GUID gEfiShellProtocolGuid;
enum ShellVersion {
SHELL_MAJOR_VERSION = 2,
SHELL_MINOR_VERSION = 2
};
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/ShellDynamicCommand.h
================================================
/** @file
EFI Shell Dynamic Command registration protocol
(C) Copyright 2012-2014 Hewlett-Packard Development Company, L.P.
Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_H__
#define __EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_H__
#include
#include
// {3C7200E9-005F-4EA4-87DE-A3DFAC8A27C3}
#define EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_GUID \
{ \
0x3c7200e9, 0x005f, 0x4ea4, { 0x87, 0xde, 0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3 } \
}
//
// Define for forward reference.
//
typedef struct _EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL;
/**
This is the shell command handler function pointer callback type. This
function handles the command when it is invoked in the shell.
@param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
@param[in] SystemTable The pointer to the system table.
@param[in] ShellParameters The parameters associated with the command.
@param[in] Shell The instance of the shell protocol used in the context
of processing this command.
@return EFI_SUCCESS the operation was sucessful
@return other the operation failed.
**/
typedef
SHELL_STATUS
(EFIAPI * SHELL_COMMAND_HANDLER)(
IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
IN EFI_SYSTEM_TABLE *SystemTable,
IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
IN EFI_SHELL_PROTOCOL *Shell
);
/**
This is the command help handler function pointer callback type. This
function is responsible for displaying help information for the associated
command.
@param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
@param[in] Language The pointer to the language string to use.
@return string Pool allocated help string, must be freed by caller
**/
typedef
CHAR16*
(EFIAPI * SHELL_COMMAND_GETHELP)(
IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
IN CONST CHAR8 *Language
);
/// EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL protocol structure.
struct _EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL {
CONST CHAR16 *CommandName;
SHELL_COMMAND_HANDLER Handler;
SHELL_COMMAND_GETHELP GetHelp;
};
extern EFI_GUID gEfiShellDynamicCommandProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/ShellParameters.h
================================================
/** @file
EFI Shell protocol as defined in the UEFI Shell 2.0 specification.
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
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 __EFI_SHELL_PARAMETERS_PROTOCOL_H__
#define __EFI_SHELL_PARAMETERS_PROTOCOL_H__
#include
#define EFI_SHELL_PARAMETERS_PROTOCOL_GUID \
{ \
0x752f3136, 0x4e16, 0x4fdc, { 0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca } \
}
typedef struct _EFI_SHELL_PARAMETERS_PROTOCOL {
///
/// Points to an Argc-element array of points to NULL-terminated strings containing
/// the command-line parameters. The first entry in the array is always the full file
/// path of the executable. Any quotation marks that were used to preserve
/// whitespace have been removed.
///
CHAR16 **Argv;
///
/// The number of elements in the Argv array.
///
UINTN Argc;
///
/// The file handle for the standard input for this executable. This may be different
/// from the ConInHandle in EFI_SYSTEM_TABLE.
///
SHELL_FILE_HANDLE StdIn;
///
/// The file handle for the standard output for this executable. This may be different
/// from the ConOutHandle in EFI_SYSTEM_TABLE.
///
SHELL_FILE_HANDLE StdOut;
///
/// The file handle for the standard error output for this executable. This may be
/// different from the StdErrHandle in EFI_SYSTEM_TABLE.
///
SHELL_FILE_HANDLE StdErr;
} EFI_SHELL_PARAMETERS_PROTOCOL;
extern EFI_GUID gEfiShellParametersProtocolGuid;
#endif
================================================
FILE: edk2/MdePkg/Include/Protocol/SimpleFileSystem.h
================================================
/** @file
SimpleFileSystem protocol as defined in the UEFI 2.0 specification.
The SimpleFileSystem protocol is the programmatic access to the FAT (12,16,32)
file system specified in UEFI 2.0. It can also be used to abstract a file
system other than FAT.
UEFI 2.0 can boot from any valid EFI image contained in a SimpleFileSystem.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.