mirror of https://github.com/acidanthera/audk.git
MdePkg: Fix EOL to be DOS format.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17429 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
87bfeb11f8
commit
21bd495843
File diff suppressed because it is too large
Load Diff
|
@ -1,286 +1,286 @@
|
|||
/** @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 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#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 funtion 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
|
||||
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 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#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 funtion 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 diff suppressed because it is too large
Load Diff
|
@ -1,326 +1,326 @@
|
|||
/** @file
|
||||
The UEFI Smart Card Reader Protocol provides an abstraction for device to provide
|
||||
smart card reader support. This protocol is very close to Part 5 of PC/SC workgroup
|
||||
specifications and provides an API to applications willing to communicate with a
|
||||
smart card or a smart card reader.
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __SMART_CARD_READER_H__
|
||||
#define __SMART_CARD_READER_H__
|
||||
|
||||
#define EFI_SMART_CARD_READER_PROTOCOL_GUID \
|
||||
{ \
|
||||
0x2a4d1adf, 0x21dc, 0x4b81, {0xa4, 0x2f, 0x8b, 0x8e, 0xe2, 0x38, 0x00, 0x60} \
|
||||
}
|
||||
|
||||
typedef struct _EFI_SMART_CARD_READER_PROTOCOL EFI_SMART_CARD_READER_PROTOCOL;
|
||||
|
||||
//
|
||||
// Codes for access mode
|
||||
//
|
||||
#define SCARD_AM_READER 0x0001 // Exclusive access to reader
|
||||
#define SCARD_AM_CARD 0x0002 // Exclusive access to card
|
||||
//
|
||||
// Codes for card action
|
||||
//
|
||||
#define SCARD_CA_NORESET 0x0000 // Don't reset card
|
||||
#define SCARD_CA_COLDRESET 0x0001 // Perform a cold reset
|
||||
#define SCARD_CA_WARMRESET 0x0002 // Perform a warm reset
|
||||
#define SCARD_CA_UNPOWER 0x0003 // Power off the card
|
||||
#define SCARD_CA_EJECT 0x0004 // Eject the card
|
||||
//
|
||||
// Protocol types
|
||||
//
|
||||
#define SCARD_PROTOCOL_UNDEFINED 0x0000
|
||||
#define SCARD_PROTOCOL_T0 0x0001
|
||||
#define SCARD_PROTOCOL_T1 0x0002
|
||||
#define SCARD_PROTOCOL_RAW 0x0004
|
||||
//
|
||||
// Codes for state type
|
||||
//
|
||||
#define SCARD_UNKNOWN 0x0000 /* state is unknown */
|
||||
#define SCARD_ABSENT 0x0001 /* Card is absent */
|
||||
#define SCARD_INACTIVE 0x0002 /* Card is present and not powered*/
|
||||
#define SCARD_ACTIVE 0x0003 /* Card is present and powered */
|
||||
//
|
||||
// Macro to generate a ControlCode & PC/SC part 10 control code
|
||||
//
|
||||
#define SCARD_CTL_CODE(code) (0x42000000 + (code))
|
||||
#define CM_IOCTL_GET_FEATURE_REQUEST SCARD_CTL_CODE(3400)
|
||||
|
||||
/**
|
||||
This function requests connection to the smart card or the reader, using the
|
||||
appropriate reset type and protocol.
|
||||
|
||||
The SCardConnectfunction requests access to the smart card or the reader. Upon
|
||||
success, it is then possible to call SCardTransmit.
|
||||
|
||||
If AccessMode is set to SCARD_AM_READER, PreferredProtocols must be set to
|
||||
SCARD_PROTOCOL_UNDEFINED and CardAction to SCARD_CA_NORESET else function
|
||||
fails with EFI_INVALID_PARAMETER.
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[in] AccessMode Codes of access mode.
|
||||
@param[in] CardAction SCARD_CA_NORESET, SCARD_CA_COLDRESET or
|
||||
SCARD_CA_WARMRESET.
|
||||
@param[in] PreferredProtocols Bitmask of acceptable protocols.
|
||||
@param[out] ActiveProtocol A flag that indicates the active protocol.
|
||||
|
||||
@retval EFI_SUCCESS The requested command completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL
|
||||
@retval EFI_INVALID_PARAMETER AccessMode is not valid.
|
||||
@retval EFI_INVALID_PARAMETER CardAction is not valid.
|
||||
@retval EFI_INVALID_PARAMETER Invalid combination of AccessMode/CardAction/
|
||||
PreferredProtocols.
|
||||
@retval EFI_NOT_READY A smart card is inserted but failed to return an ATR.
|
||||
@retval EFI_UNSUPPORTED PreferredProtocols does not contain an available
|
||||
protocol to use.
|
||||
@retval EFI_NO_MEDIA AccessMode is set to SCARD_AM_CARD but there is
|
||||
no smart card inserted.
|
||||
@retval EFI_ACCESS_DENIED Access is already locked by a previous SCardConnectcall.
|
||||
@retval EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SMART_CARD_READER_CONNECT) (
|
||||
IN EFI_SMART_CARD_READER_PROTOCOL *This,
|
||||
IN UINT32 AccessMode,
|
||||
IN UINT32 CardAction,
|
||||
IN UINT32 PreferredProtocols,
|
||||
OUT UINT32 *ActiveProtocol
|
||||
);
|
||||
|
||||
/**
|
||||
This function releases a connection previously taken by SCardConnect.
|
||||
|
||||
The SCardDisconnect function releases the lock previously taken by SCardConnect.
|
||||
In case the smart card has been removed before this call, thisfunction
|
||||
returns EFI_SUCCESS. If there is no previous call to SCardConnect, this
|
||||
function returns EFI_SUCCESS.
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[in] CardAction Codes for card action.
|
||||
|
||||
@retval EFI_SUCCESS The requested command completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL
|
||||
@retval EFI_INVALID_PARAMETER CardAction value is unknown.
|
||||
@retval EFI_UNSUPPORTED Reader does not support Eject card feature
|
||||
(disconnect was not performed).
|
||||
@retval EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SMART_CARD_READER_DISCONNECT) (
|
||||
IN EFI_SMART_CARD_READER_PROTOCOL *This,
|
||||
IN UINT32 CardAction
|
||||
);
|
||||
|
||||
/**
|
||||
This function retrieves some basic information about the smart card and reader.
|
||||
|
||||
The SCardStatusfunction retrieves basic reader and card information.
|
||||
|
||||
If ReaderName, State, CardProtocolor Atris NULL, the function does not fail but
|
||||
does not fill in such variables.
|
||||
|
||||
If EFI_SUCCESS is not returned, ReaderName and Atr contents shall not be considered
|
||||
as valid.
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[out] ReaderName A pointer to a NULL terminated string that will
|
||||
contain the reader name.
|
||||
@param[in, out] ReaderNameLength On input, a pointer to the variablethat holds the
|
||||
maximal size, in bytes,of ReaderName.
|
||||
On output, the required size, in bytes, for ReaderName.
|
||||
@param[out] State Current state of the smart card reader.
|
||||
@param[out] CardProtocol Current protocol used to communicate with the smart card.
|
||||
@param[out] Atr A pointer to retrieve the ATR of the smart card.
|
||||
@param[in, out] AtrLength On input, a pointer to hold the maximum size, in bytes,
|
||||
of Atr(usually 33).
|
||||
On output, the required size, inbytes, for the smart
|
||||
card ATR.
|
||||
|
||||
@retval EFI_SUCCESS The requested command completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL
|
||||
@retval EFI_INVALID_PARAMETER ReaderName is not NULL but ReaderNameLength is NULL
|
||||
@retval EFI_INVALID_PARAMETER Atr is not NULL but AtrLength is NULL
|
||||
@retval EFI_BUFFER_TOO_SMALL ReaderNameLength is not big enough to hold the reader name.
|
||||
ReaderNameLength has been updated to the required value.
|
||||
@retval EFI_BUFFER_TOO_SMALL AtrLength is not big enough to hold the ATR.
|
||||
AtrLength has been updated to the required value.
|
||||
@retval EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SMART_CARD_READER_STATUS) (
|
||||
IN EFI_SMART_CARD_READER_PROTOCOL *This,
|
||||
OUT CHAR16 *ReaderName OPTIONAL,
|
||||
IN OUT UINTN *ReaderNameLength OPTIONAL,
|
||||
OUT UINT32 *State OPTIONAL,
|
||||
OUT UINT32 *CardProtocol OPTIONAL,
|
||||
OUT UINT8 *Atr OPTIONAL,
|
||||
IN OUT UINTN *AtrLength OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
This function sends a command to the card or reader and returns its response.
|
||||
|
||||
The protocol to use to communicate with the smart card has been selected through
|
||||
SCardConnectcall.
|
||||
|
||||
In case RAPDULength indicates a buffer too small to holdthe response APDU, the
|
||||
function fails with EFI_BUFFER_TOO_SMALL.
|
||||
|
||||
@param[in] This A pointer to the EFI_USBFN_IO_PROTOCOLinstance.
|
||||
@param[in] CAPDU A pointer to a byte array thatcontains the Command
|
||||
APDU to send to the smart card or reader.
|
||||
@param[in] CAPDULength Command APDU size, in bytes.
|
||||
@param[out] RAPDU A pointer to a byte array that will contain the
|
||||
Response APDU.
|
||||
@param[in, out] RAPDULength On input, the maximum size, inbytes, of the Response
|
||||
APDU.
|
||||
On output, the size, in bytes, of the Response APDU.
|
||||
|
||||
@retval EFI_SUCCESS The requested command completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||
@retval EFI_INVALID_PARAMETER CAPDU is NULL or CAPDULength is 0.
|
||||
@retval EFI_BUFFER_TOO_SMALL RAPDULength is not big enough to hold the response APDU.
|
||||
RAPDULength has been updated to the required value.
|
||||
@retval EFI_NO_MEDIA There is no card in the reader.
|
||||
@retval EFI_NOT_READY Card is not powered.
|
||||
@retval EFI_PROTOCOL_ERROR A protocol error has occurred.
|
||||
@retval EFI_TIMEOUT The reader did not respond.
|
||||
@retval EFI_ACCESS_DENIED A communication with the reader/card is already pending.
|
||||
@retval EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SMART_CARD_READER_TRANSMIT) (
|
||||
IN EFI_SMART_CARD_READER_PROTOCOL *This,
|
||||
IN UINT8 *CAPDU,
|
||||
IN UINTN CAPDULength,
|
||||
OUT UINT8 *RAPDU,
|
||||
IN OUT UINTN *RAPDULength
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
This function provides direct access to the reader.
|
||||
|
||||
This function gives direct control to send commands to the driver or the reader.
|
||||
The ControlCode to use is vendor dependant; the only standard code defined is
|
||||
the one to get PC/SC part 10 features.
|
||||
|
||||
InBuffer and Outbuffer may be NULL when ControlCode operation does not require
|
||||
them.
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[in] ControlCode The control code for the operation to perform.
|
||||
@param[in] InBuffer A pointer to the input parameters.
|
||||
@param[in] InBufferLength Size, in bytes, of input parameters.
|
||||
@param[out] OutBuffer A pointer to the output parameters.
|
||||
@param[in, out] OutBufferLength On input, maximal size, in bytes, to store output
|
||||
parameters.
|
||||
On output, the size, in bytes, of output parameters.
|
||||
|
||||
@retval EFI_SUCCESS The requested command completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||
@retval EFI_INVALID_PARAMETER ControlCode requires input parameters but:
|
||||
InBuffer is NULL or InBufferLenth is NULL or
|
||||
InBuffer is not NULL but InBufferLenth is less than
|
||||
expected.
|
||||
@retval EFI_INVALID_PARAMETER OutBuffer is not NULL but OutBufferLength is NULL.
|
||||
@retval EFI_UNSUPPORTED ControlCode is not supported.
|
||||
@retval EFI_BUFFER_TOO_SMALL OutBufferLength is not big enough to hold the output
|
||||
parameters.
|
||||
OutBufferLength has been updated to the required value.
|
||||
@retval EFI_NO_MEDIA There is no card in the reader and the control code
|
||||
specified requires one.
|
||||
@retval EFI_NOT_READY ControlCode requires a powered card to operate.
|
||||
@retval EFI_PROTOCOL_ERROR A protocol error has occurred.
|
||||
@retval EFI_TIMEOUT The reader did not respond.
|
||||
@retval EFI_ACCESS_DENIED A communication with the reader/card is already pending.
|
||||
@retval EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SMART_CARD_READER_CONTROL) (
|
||||
IN EFI_SMART_CARD_READER_PROTOCOL *This,
|
||||
IN UINT32 ControlCode,
|
||||
IN UINT8 *InBuffer OPTIONAL,
|
||||
IN UINTN InBufferLength OPTIONAL,
|
||||
OUT UINT8 *OutBuffer OPTIONAL,
|
||||
IN OUT UINTN *OutBufferLength OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
This function retrieves a reader or smart card attribute.
|
||||
|
||||
Possibly supported attrib values are listed in "PC/SC specification, Part 3:
|
||||
Requirements for PC-Connected Interface Devices".
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[in] Attrib Identifier for the attribute to retrieve.
|
||||
@param[out] OutBuffer A pointer to a buffer that will contain
|
||||
attribute data.
|
||||
@param[in, out] OutBufferLength On input, maximal size, in bytes, to store
|
||||
attribute data.
|
||||
On output, the size, in bytes, of attribute
|
||||
data.
|
||||
|
||||
@retval EFI_SUCCESS The requested command completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||
@retval EFI_INVALID_PARAMETER OutBuffer is NULL or OutBufferLength is 0.
|
||||
@retval EFI_BUFFER_TOO_SMALL OutBufferLength is not big enough to hold the output
|
||||
parameters.
|
||||
OutBufferLength has been updated to the required value.
|
||||
@retval EFI_UNSUPPORTED Attribis not supported
|
||||
@retval EFI_NO_MEDIA There is no card in the reader and Attrib value
|
||||
requires one.
|
||||
@retval EFI_NOT_READY Attrib requires a powered card to operate.
|
||||
@retval EFI_PROTOCOL_ERROR A protocol error has occurred.
|
||||
@retval EFI_TIMEOUT The reader did not respond.
|
||||
@retval EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SMART_CARD_READER_GET_ATTRIB) (
|
||||
IN EFI_SMART_CARD_READER_PROTOCOL *This,
|
||||
IN UINT32 Attrib,
|
||||
OUT UINT8 *OutBuffer,
|
||||
IN OUT UINTN *OutBufferLength
|
||||
);
|
||||
|
||||
///
|
||||
/// Smart card aware application invokes this protocol to get access to an inserted
|
||||
/// smart card in the reader or to the reader itself.
|
||||
///
|
||||
struct _EFI_SMART_CARD_READER_PROTOCOL {
|
||||
EFI_SMART_CARD_READER_CONNECT SCardConnect;
|
||||
EFI_SMART_CARD_READER_DISCONNECT SCardDisconnect;
|
||||
EFI_SMART_CARD_READER_STATUS SCardStatus;
|
||||
EFI_SMART_CARD_READER_TRANSMIT SCardTransmit;
|
||||
EFI_SMART_CARD_READER_CONTROL SCardControl;
|
||||
EFI_SMART_CARD_READER_GET_ATTRIB SCardGetAttrib;
|
||||
};
|
||||
|
||||
extern EFI_GUID gEfiSmartCardReaderProtocolGuid;
|
||||
|
||||
#endif
|
||||
|
||||
/** @file
|
||||
The UEFI Smart Card Reader Protocol provides an abstraction for device to provide
|
||||
smart card reader support. This protocol is very close to Part 5 of PC/SC workgroup
|
||||
specifications and provides an API to applications willing to communicate with a
|
||||
smart card or a smart card reader.
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __SMART_CARD_READER_H__
|
||||
#define __SMART_CARD_READER_H__
|
||||
|
||||
#define EFI_SMART_CARD_READER_PROTOCOL_GUID \
|
||||
{ \
|
||||
0x2a4d1adf, 0x21dc, 0x4b81, {0xa4, 0x2f, 0x8b, 0x8e, 0xe2, 0x38, 0x00, 0x60} \
|
||||
}
|
||||
|
||||
typedef struct _EFI_SMART_CARD_READER_PROTOCOL EFI_SMART_CARD_READER_PROTOCOL;
|
||||
|
||||
//
|
||||
// Codes for access mode
|
||||
//
|
||||
#define SCARD_AM_READER 0x0001 // Exclusive access to reader
|
||||
#define SCARD_AM_CARD 0x0002 // Exclusive access to card
|
||||
//
|
||||
// Codes for card action
|
||||
//
|
||||
#define SCARD_CA_NORESET 0x0000 // Don't reset card
|
||||
#define SCARD_CA_COLDRESET 0x0001 // Perform a cold reset
|
||||
#define SCARD_CA_WARMRESET 0x0002 // Perform a warm reset
|
||||
#define SCARD_CA_UNPOWER 0x0003 // Power off the card
|
||||
#define SCARD_CA_EJECT 0x0004 // Eject the card
|
||||
//
|
||||
// Protocol types
|
||||
//
|
||||
#define SCARD_PROTOCOL_UNDEFINED 0x0000
|
||||
#define SCARD_PROTOCOL_T0 0x0001
|
||||
#define SCARD_PROTOCOL_T1 0x0002
|
||||
#define SCARD_PROTOCOL_RAW 0x0004
|
||||
//
|
||||
// Codes for state type
|
||||
//
|
||||
#define SCARD_UNKNOWN 0x0000 /* state is unknown */
|
||||
#define SCARD_ABSENT 0x0001 /* Card is absent */
|
||||
#define SCARD_INACTIVE 0x0002 /* Card is present and not powered*/
|
||||
#define SCARD_ACTIVE 0x0003 /* Card is present and powered */
|
||||
//
|
||||
// Macro to generate a ControlCode & PC/SC part 10 control code
|
||||
//
|
||||
#define SCARD_CTL_CODE(code) (0x42000000 + (code))
|
||||
#define CM_IOCTL_GET_FEATURE_REQUEST SCARD_CTL_CODE(3400)
|
||||
|
||||
/**
|
||||
This function requests connection to the smart card or the reader, using the
|
||||
appropriate reset type and protocol.
|
||||
|
||||
The SCardConnectfunction requests access to the smart card or the reader. Upon
|
||||
success, it is then possible to call SCardTransmit.
|
||||
|
||||
If AccessMode is set to SCARD_AM_READER, PreferredProtocols must be set to
|
||||
SCARD_PROTOCOL_UNDEFINED and CardAction to SCARD_CA_NORESET else function
|
||||
fails with EFI_INVALID_PARAMETER.
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[in] AccessMode Codes of access mode.
|
||||
@param[in] CardAction SCARD_CA_NORESET, SCARD_CA_COLDRESET or
|
||||
SCARD_CA_WARMRESET.
|
||||
@param[in] PreferredProtocols Bitmask of acceptable protocols.
|
||||
@param[out] ActiveProtocol A flag that indicates the active protocol.
|
||||
|
||||
@retval EFI_SUCCESS The requested command completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL
|
||||
@retval EFI_INVALID_PARAMETER AccessMode is not valid.
|
||||
@retval EFI_INVALID_PARAMETER CardAction is not valid.
|
||||
@retval EFI_INVALID_PARAMETER Invalid combination of AccessMode/CardAction/
|
||||
PreferredProtocols.
|
||||
@retval EFI_NOT_READY A smart card is inserted but failed to return an ATR.
|
||||
@retval EFI_UNSUPPORTED PreferredProtocols does not contain an available
|
||||
protocol to use.
|
||||
@retval EFI_NO_MEDIA AccessMode is set to SCARD_AM_CARD but there is
|
||||
no smart card inserted.
|
||||
@retval EFI_ACCESS_DENIED Access is already locked by a previous SCardConnectcall.
|
||||
@retval EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SMART_CARD_READER_CONNECT) (
|
||||
IN EFI_SMART_CARD_READER_PROTOCOL *This,
|
||||
IN UINT32 AccessMode,
|
||||
IN UINT32 CardAction,
|
||||
IN UINT32 PreferredProtocols,
|
||||
OUT UINT32 *ActiveProtocol
|
||||
);
|
||||
|
||||
/**
|
||||
This function releases a connection previously taken by SCardConnect.
|
||||
|
||||
The SCardDisconnect function releases the lock previously taken by SCardConnect.
|
||||
In case the smart card has been removed before this call, thisfunction
|
||||
returns EFI_SUCCESS. If there is no previous call to SCardConnect, this
|
||||
function returns EFI_SUCCESS.
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[in] CardAction Codes for card action.
|
||||
|
||||
@retval EFI_SUCCESS The requested command completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL
|
||||
@retval EFI_INVALID_PARAMETER CardAction value is unknown.
|
||||
@retval EFI_UNSUPPORTED Reader does not support Eject card feature
|
||||
(disconnect was not performed).
|
||||
@retval EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SMART_CARD_READER_DISCONNECT) (
|
||||
IN EFI_SMART_CARD_READER_PROTOCOL *This,
|
||||
IN UINT32 CardAction
|
||||
);
|
||||
|
||||
/**
|
||||
This function retrieves some basic information about the smart card and reader.
|
||||
|
||||
The SCardStatusfunction retrieves basic reader and card information.
|
||||
|
||||
If ReaderName, State, CardProtocolor Atris NULL, the function does not fail but
|
||||
does not fill in such variables.
|
||||
|
||||
If EFI_SUCCESS is not returned, ReaderName and Atr contents shall not be considered
|
||||
as valid.
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[out] ReaderName A pointer to a NULL terminated string that will
|
||||
contain the reader name.
|
||||
@param[in, out] ReaderNameLength On input, a pointer to the variablethat holds the
|
||||
maximal size, in bytes,of ReaderName.
|
||||
On output, the required size, in bytes, for ReaderName.
|
||||
@param[out] State Current state of the smart card reader.
|
||||
@param[out] CardProtocol Current protocol used to communicate with the smart card.
|
||||
@param[out] Atr A pointer to retrieve the ATR of the smart card.
|
||||
@param[in, out] AtrLength On input, a pointer to hold the maximum size, in bytes,
|
||||
of Atr(usually 33).
|
||||
On output, the required size, inbytes, for the smart
|
||||
card ATR.
|
||||
|
||||
@retval EFI_SUCCESS The requested command completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL
|
||||
@retval EFI_INVALID_PARAMETER ReaderName is not NULL but ReaderNameLength is NULL
|
||||
@retval EFI_INVALID_PARAMETER Atr is not NULL but AtrLength is NULL
|
||||
@retval EFI_BUFFER_TOO_SMALL ReaderNameLength is not big enough to hold the reader name.
|
||||
ReaderNameLength has been updated to the required value.
|
||||
@retval EFI_BUFFER_TOO_SMALL AtrLength is not big enough to hold the ATR.
|
||||
AtrLength has been updated to the required value.
|
||||
@retval EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SMART_CARD_READER_STATUS) (
|
||||
IN EFI_SMART_CARD_READER_PROTOCOL *This,
|
||||
OUT CHAR16 *ReaderName OPTIONAL,
|
||||
IN OUT UINTN *ReaderNameLength OPTIONAL,
|
||||
OUT UINT32 *State OPTIONAL,
|
||||
OUT UINT32 *CardProtocol OPTIONAL,
|
||||
OUT UINT8 *Atr OPTIONAL,
|
||||
IN OUT UINTN *AtrLength OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
This function sends a command to the card or reader and returns its response.
|
||||
|
||||
The protocol to use to communicate with the smart card has been selected through
|
||||
SCardConnectcall.
|
||||
|
||||
In case RAPDULength indicates a buffer too small to holdthe response APDU, the
|
||||
function fails with EFI_BUFFER_TOO_SMALL.
|
||||
|
||||
@param[in] This A pointer to the EFI_USBFN_IO_PROTOCOLinstance.
|
||||
@param[in] CAPDU A pointer to a byte array thatcontains the Command
|
||||
APDU to send to the smart card or reader.
|
||||
@param[in] CAPDULength Command APDU size, in bytes.
|
||||
@param[out] RAPDU A pointer to a byte array that will contain the
|
||||
Response APDU.
|
||||
@param[in, out] RAPDULength On input, the maximum size, inbytes, of the Response
|
||||
APDU.
|
||||
On output, the size, in bytes, of the Response APDU.
|
||||
|
||||
@retval EFI_SUCCESS The requested command completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||
@retval EFI_INVALID_PARAMETER CAPDU is NULL or CAPDULength is 0.
|
||||
@retval EFI_BUFFER_TOO_SMALL RAPDULength is not big enough to hold the response APDU.
|
||||
RAPDULength has been updated to the required value.
|
||||
@retval EFI_NO_MEDIA There is no card in the reader.
|
||||
@retval EFI_NOT_READY Card is not powered.
|
||||
@retval EFI_PROTOCOL_ERROR A protocol error has occurred.
|
||||
@retval EFI_TIMEOUT The reader did not respond.
|
||||
@retval EFI_ACCESS_DENIED A communication with the reader/card is already pending.
|
||||
@retval EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SMART_CARD_READER_TRANSMIT) (
|
||||
IN EFI_SMART_CARD_READER_PROTOCOL *This,
|
||||
IN UINT8 *CAPDU,
|
||||
IN UINTN CAPDULength,
|
||||
OUT UINT8 *RAPDU,
|
||||
IN OUT UINTN *RAPDULength
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
This function provides direct access to the reader.
|
||||
|
||||
This function gives direct control to send commands to the driver or the reader.
|
||||
The ControlCode to use is vendor dependant; the only standard code defined is
|
||||
the one to get PC/SC part 10 features.
|
||||
|
||||
InBuffer and Outbuffer may be NULL when ControlCode operation does not require
|
||||
them.
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[in] ControlCode The control code for the operation to perform.
|
||||
@param[in] InBuffer A pointer to the input parameters.
|
||||
@param[in] InBufferLength Size, in bytes, of input parameters.
|
||||
@param[out] OutBuffer A pointer to the output parameters.
|
||||
@param[in, out] OutBufferLength On input, maximal size, in bytes, to store output
|
||||
parameters.
|
||||
On output, the size, in bytes, of output parameters.
|
||||
|
||||
@retval EFI_SUCCESS The requested command completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||
@retval EFI_INVALID_PARAMETER ControlCode requires input parameters but:
|
||||
InBuffer is NULL or InBufferLenth is NULL or
|
||||
InBuffer is not NULL but InBufferLenth is less than
|
||||
expected.
|
||||
@retval EFI_INVALID_PARAMETER OutBuffer is not NULL but OutBufferLength is NULL.
|
||||
@retval EFI_UNSUPPORTED ControlCode is not supported.
|
||||
@retval EFI_BUFFER_TOO_SMALL OutBufferLength is not big enough to hold the output
|
||||
parameters.
|
||||
OutBufferLength has been updated to the required value.
|
||||
@retval EFI_NO_MEDIA There is no card in the reader and the control code
|
||||
specified requires one.
|
||||
@retval EFI_NOT_READY ControlCode requires a powered card to operate.
|
||||
@retval EFI_PROTOCOL_ERROR A protocol error has occurred.
|
||||
@retval EFI_TIMEOUT The reader did not respond.
|
||||
@retval EFI_ACCESS_DENIED A communication with the reader/card is already pending.
|
||||
@retval EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SMART_CARD_READER_CONTROL) (
|
||||
IN EFI_SMART_CARD_READER_PROTOCOL *This,
|
||||
IN UINT32 ControlCode,
|
||||
IN UINT8 *InBuffer OPTIONAL,
|
||||
IN UINTN InBufferLength OPTIONAL,
|
||||
OUT UINT8 *OutBuffer OPTIONAL,
|
||||
IN OUT UINTN *OutBufferLength OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
This function retrieves a reader or smart card attribute.
|
||||
|
||||
Possibly supported attrib values are listed in "PC/SC specification, Part 3:
|
||||
Requirements for PC-Connected Interface Devices".
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[in] Attrib Identifier for the attribute to retrieve.
|
||||
@param[out] OutBuffer A pointer to a buffer that will contain
|
||||
attribute data.
|
||||
@param[in, out] OutBufferLength On input, maximal size, in bytes, to store
|
||||
attribute data.
|
||||
On output, the size, in bytes, of attribute
|
||||
data.
|
||||
|
||||
@retval EFI_SUCCESS The requested command completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||
@retval EFI_INVALID_PARAMETER OutBuffer is NULL or OutBufferLength is 0.
|
||||
@retval EFI_BUFFER_TOO_SMALL OutBufferLength is not big enough to hold the output
|
||||
parameters.
|
||||
OutBufferLength has been updated to the required value.
|
||||
@retval EFI_UNSUPPORTED Attribis not supported
|
||||
@retval EFI_NO_MEDIA There is no card in the reader and Attrib value
|
||||
requires one.
|
||||
@retval EFI_NOT_READY Attrib requires a powered card to operate.
|
||||
@retval EFI_PROTOCOL_ERROR A protocol error has occurred.
|
||||
@retval EFI_TIMEOUT The reader did not respond.
|
||||
@retval EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *EFI_SMART_CARD_READER_GET_ATTRIB) (
|
||||
IN EFI_SMART_CARD_READER_PROTOCOL *This,
|
||||
IN UINT32 Attrib,
|
||||
OUT UINT8 *OutBuffer,
|
||||
IN OUT UINTN *OutBufferLength
|
||||
);
|
||||
|
||||
///
|
||||
/// Smart card aware application invokes this protocol to get access to an inserted
|
||||
/// smart card in the reader or to the reader itself.
|
||||
///
|
||||
struct _EFI_SMART_CARD_READER_PROTOCOL {
|
||||
EFI_SMART_CARD_READER_CONNECT SCardConnect;
|
||||
EFI_SMART_CARD_READER_DISCONNECT SCardDisconnect;
|
||||
EFI_SMART_CARD_READER_STATUS SCardStatus;
|
||||
EFI_SMART_CARD_READER_TRANSMIT SCardTransmit;
|
||||
EFI_SMART_CARD_READER_CONTROL SCardControl;
|
||||
EFI_SMART_CARD_READER_GET_ATTRIB SCardGetAttrib;
|
||||
};
|
||||
|
||||
extern EFI_GUID gEfiSmartCardReaderProtocolGuid;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue