52 IN UINT8 SecurityProtocolId,
53 IN UINT16 SecurityProtocolSpecificData,
55 IN BOOLEAN IsTrustSend,
72 CommandPacket.NvmeCmd = &Command;
73 CommandPacket.NvmeCompletion = &Completion;
78 SpecificData = (((SecurityProtocolSpecificData << 8) & 0xFF00) | (SecurityProtocolSpecificData >> 8));
81 Command.Cdw0.Opcode = NVME_ADMIN_SECURITY_SEND_CMD;
82 CommandPacket.TransferBuffer = Buffer;
83 CommandPacket.TransferLength = (UINT32)TransferLength;
84 CommandPacket.NvmeCmd->Cdw10 = (UINT32)((SecurityProtocolId << 24) | (SpecificData << 8));
85 CommandPacket.NvmeCmd->Cdw11 = (UINT32)TransferLength;
87 Command.Cdw0.Opcode = NVME_ADMIN_SECURITY_RECEIVE_CMD;
88 CommandPacket.TransferBuffer = Buffer;
89 CommandPacket.TransferLength = (UINT32)TransferLength;
90 CommandPacket.NvmeCmd->Cdw10 = (UINT32)((SecurityProtocolId << 24) | (SpecificData << 8));
91 CommandPacket.NvmeCmd->Cdw11 = (UINT32)TransferLength;
94 CommandPacket.NvmeCmd->Flags = CDW10_VALID | CDW11_VALID;
95 CommandPacket.NvmeCmd->Nsid = NVME_CONTROLLER_NSID;
96 CommandPacket.CommandTimeout = Timeout;
97 CommandPacket.QueueType = NVME_ADMIN_QUEUE;
101 NVME_CONTROLLER_NSID,
106 if (EFI_ERROR (Status)) {
107 *TransferLengthOut = 0;
109 *TransferLengthOut = (
UINTN)TransferLength;
135 if ((This ==
NULL) || (NumberofDevices ==
NULL)) {
136 return EFI_INVALID_PARAMETER;
139 Private = GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY (This);
140 *NumberofDevices = Private->ActiveNamespaceNum;
181 if ((This ==
NULL) || (DevicePathLength ==
NULL) || (DevicePath ==
NULL)) {
182 return EFI_INVALID_PARAMETER;
185 Private = GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY (This);
186 if ((DeviceIndex == 0) || (DeviceIndex > Private->ActiveNamespaceNum)) {
187 return EFI_INVALID_PARAMETER;
192 Private->NamespaceInfo[DeviceIndex-1].NamespaceId,
193 Private->NamespaceInfo[DeviceIndex-1].NamespaceUuid,
291 IN UINT8 SecurityProtocolId,
292 IN UINT16 SecurityProtocolSpecificData,
294 OUT VOID *PayloadBuffer,
301 if ((PayloadBuffer ==
NULL) || (PayloadTransferSize ==
NULL) || (PayloadBufferSize == 0)) {
302 return EFI_INVALID_PARAMETER;
305 Private = GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY (This);
311 SecurityProtocolSpecificData,
391 IN UINT8 SecurityProtocolId,
392 IN UINT16 SecurityProtocolSpecificData,
394 IN VOID *PayloadBuffer
400 if ((PayloadBuffer ==
NULL) && (PayloadBufferSize != 0)) {
401 return EFI_INVALID_PARAMETER;
404 Private = GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY (This);
410 SecurityProtocolSpecificData,
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_STATUS NvmeBuildDevicePath(IN PEI_NVME_CONTROLLER_PRIVATE_DATA *Private, IN UINT32 NamespaceId, IN UINT64 NamespaceUuid, OUT UINTN *DevicePathLength, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
EFI_STATUS EFIAPI NvmePassThru(IN EDKII_PEI_NVM_EXPRESS_PASS_THRU_PPI *This, IN UINT32 NamespaceId, IN OUT EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET *Packet)
EFI_STATUS EFIAPI NvmeStorageSecurityGetDeviceNo(IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, OUT UINTN *NumberofDevices)
EFI_STATUS EFIAPI NvmeStorageSecurityGetDevicePath(IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, IN UINTN DeviceIndex, OUT UINTN *DevicePathLength, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
EFI_STATUS EFIAPI NvmeStorageSecuritySendData(IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, IN UINTN DeviceIndex, IN UINT64 Timeout, IN UINT8 SecurityProtocolId, IN UINT16 SecurityProtocolSpecificData, IN UINTN PayloadBufferSize, IN VOID *PayloadBuffer)
EFI_STATUS EFIAPI NvmeStorageSecurityReceiveData(IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, IN UINTN DeviceIndex, IN UINT64 Timeout, IN UINT8 SecurityProtocolId, IN UINT16 SecurityProtocolSpecificData, IN UINTN PayloadBufferSize, OUT VOID *PayloadBuffer, OUT UINTN *PayloadTransferSize)
EFI_STATUS TrustTransferNvmeDevice(IN PEI_NVME_CONTROLLER_PRIVATE_DATA *Private, IN OUT VOID *Buffer, IN UINT8 SecurityProtocolId, IN UINT16 SecurityProtocolSpecificData, IN UINTN TransferLength, IN BOOLEAN IsTrustSend, IN UINT64 Timeout, OUT UINTN *TransferLengthOut)