25#define NVME_CAP_OFFSET 0x0000
26#define NVME_VER_OFFSET 0x0008
27#define NVME_INTMS_OFFSET 0x000c
28#define NVME_INTMC_OFFSET 0x0010
29#define NVME_CC_OFFSET 0x0014
30#define NVME_CSTS_OFFSET 0x001c
31#define NVME_NSSR_OFFSET 0x0020
32#define NVME_AQA_OFFSET 0x0024
33#define NVME_ASQ_OFFSET 0x0028
34#define NVME_ACQ_OFFSET 0x0030
35#define NVME_CMBLOC_OFFSET 0x0038
36#define NVME_CMBSZ_OFFSET 0x003C
37#define NVME_BPINFO_OFFSET 0x0040
38#define NVME_BPRSEL_OFFSET 0x0044
39#define NVME_BPMBL_OFFSET 0x0048
40#define NVME_SQ0_OFFSET 0x1000
41#define NVME_CQ0_OFFSET 0x1004
47#define NVME_SQTDBL_OFFSET(QID, DSTRD) 0x1000 + ((2 * (QID)) * (4 << (DSTRD)))
48#define NVME_CQHDBL_OFFSET(QID, DSTRD) 0x1000 + (((2 * (QID)) + 1) * (4 << (DSTRD)))
95#define NVME_CC_SHN_NORMAL_SHUTDOWN 1
96#define NVME_CC_SHN_ABRUPT_SHUTDOWN 2
108#define NVME_CSTS_SHST_SHUTDOWN_OCCURRING 1
109#define NVME_CSTS_SHST_SHUTDOWN_COMPLETED 2
123#define NVME_ASQ UINT64
127#define NVME_ACQ UINT64
407 #define NAMESPACE_MANAGEMENT_SUPPORTED BIT3
408 #define FW_DOWNLOAD_ACTIVATE_SUPPORTED BIT2
409 #define FORMAT_NVM_SUPPORTED BIT1
410 #define SECURITY_SEND_RECEIVE_SUPPORTED BIT0
476 UINT8 VendorData[1024];
483 #define LBAF_RP_BEST 00b
484 #define LBAF_RP_BETTER 01b
485 #define LBAF_RP_GOOD 10b
486 #define LBAF_RP_DEGRADED 11b
516 UINT8 VendorData[3712];
529#define RPMB_FRAME_STUFF_BYTES 223
535 UINT8 Sbakamc[RPMB_FRAME_STUFF_BYTES];
562#define NVME_RPMB_AUTHKEY_PROGRAM 0x0001
563#define NVME_RPMB_COUNTER_READ 0x0002
564#define NVME_RPMB_AUTHDATA_WRITE 0x0003
565#define NVME_RPMB_AUTHDATA_READ 0x0004
566#define NVME_RPMB_RESULT_READ 0x0005
567#define NVME_RPMB_DCB_WRITE 0x0006
568#define NVME_RPMB_DCB_READ 0x0007
569#define NVME_RPMB_AUTHKEY_PROGRAM_RESPONSE 0x0100
570#define NVME_RPMB_COUNTER_READ_RESPONSE 0x0200
571#define NVME_RPMB_AUTHDATA_WRITE_RESPONSE 0x0300
572#define NVME_RPMB_AUTHDATA_READ_RESPONSE 0x0400
573#define NVME_RPMB_DCB_WRITE_RESPONSE 0x0600
574#define NVME_RPMB_DCB_READ_RESPONSE 0x0700
580#define NVME_RPMB_RESULT_SUCCESS 0x00
581#define NVME_RPMB_RESULT_GENERAL_FAILURE 0x01
582#define NVME_RPMB_RESULT_AHTHENTICATION_FAILURE 0x02
583#define NVME_RPMB_RESULT_COUNTER_FAILURE 0x03
584#define NVME_RPMB_RESULT_ADDRESS_FAILURE 0x04
585#define NVME_RPMB_RESULT_WRITE_FAILURE 0x05
586#define NVME_RPMB_RESULT_READ_FAILURE 0x06
587#define NVME_RPMB_RESULT_AUTHKEY_NOT_PROGRAMMED 0x07
588#define NVME_RPMB_RESULT_INVALID_DCB 0x08
731 #define LID_ERROR_INFO 0x1
732 #define LID_SMART_INFO 0x2
733 #define LID_FW_SLOT_INFO 0x3
734 #define LID_BP_INFO 0x15
735 #define LID_SANITIZE_STATUS_INFO 0x81
772#define SANITIZE_ACTION_NO_ACTION 0x0
773#define SANITIZE_ACTION_EXIT_FAILURE_MODE 0x1
774#define SANITIZE_ACTION_BLOCK_ERASE 0x2
775#define SANITIZE_ACTION_OVERWRITE 0x3
776#define SANITIZE_ACTION_CRYPTO_ERASE 0x4
793#define SES_NO_SECURE_ERASE 0x0
794#define SES_USER_DATA_ERASE 0x1
795#define SES_CRYPTO_ERASE 0x2
930#define NVME_ADMIN_DEIOSQ_CMD 0x00
931#define NVME_ADMIN_CRIOSQ_CMD 0x01
932#define NVME_ADMIN_GET_LOG_PAGE_CMD 0x02
933#define NVME_ADMIN_DEIOCQ_CMD 0x04
934#define NVME_ADMIN_CRIOCQ_CMD 0x05
935#define NVME_ADMIN_IDENTIFY_CMD 0x06
936#define NVME_ADMIN_ABORT_CMD 0x08
937#define NVME_ADMIN_SET_FEATURES_CMD 0x09
938#define NVME_ADMIN_GET_FEATURES_CMD 0x0A
939#define NVME_ADMIN_ASYNC_EVENT_REQUEST_CMD 0x0C
940#define NVME_ADMIN_NAMESACE_MANAGEMENT_CMD 0x0D
941#define NVME_ADMIN_FW_COMMIT_CMD 0x10
942#define NVME_ADMIN_FW_IAMGE_DOWNLOAD_CMD 0x11
943#define NVME_ADMIN_NAMESACE_ATTACHMENT_CMD 0x15
944#define NVME_ADMIN_FORMAT_NVM_CMD 0x80
945#define NVME_ADMIN_SECURITY_SEND_CMD 0x81
946#define NVME_ADMIN_SECURITY_RECEIVE_CMD 0x82
947#define NVME_ADMIN_SANITIZE_CMD 0x84
949#define NVME_IO_FLUSH_OPC 0
950#define NVME_IO_WRITE_OPC 1
951#define NVME_IO_READ_OPC 2
954 DeleteIOSubmissionQueueOpcode = NVME_ADMIN_DEIOSQ_CMD,
955 CreateIOSubmissionQueueOpcode = NVME_ADMIN_CRIOSQ_CMD,
956 GetLogPageOpcode = NVME_ADMIN_GET_LOG_PAGE_CMD,
957 DeleteIOCompletionQueueOpcode = NVME_ADMIN_DEIOCQ_CMD,
958 CreateIOCompletionQueueOpcode = NVME_ADMIN_CRIOCQ_CMD,
959 IdentifyOpcode = NVME_ADMIN_IDENTIFY_CMD,
960 AbortOpcode = NVME_ADMIN_ABORT_CMD,
961 SetFeaturesOpcode = NVME_ADMIN_SET_FEATURES_CMD,
962 GetFeaturesOpcode = NVME_ADMIN_GET_FEATURES_CMD,
963 AsyncEventRequestOpcode = NVME_ADMIN_ASYNC_EVENT_REQUEST_CMD,
964 NamespaceManagementOpcode = NVME_ADMIN_NAMESACE_MANAGEMENT_CMD,
965 FirmwareCommitOpcode = NVME_ADMIN_FW_COMMIT_CMD,
966 FirmwareImageDownloadOpcode = NVME_ADMIN_FW_IAMGE_DOWNLOAD_CMD,
967 NamespaceAttachmentOpcode = NVME_ADMIN_NAMESACE_ATTACHMENT_CMD,
968 FormatNvmOpcode = NVME_ADMIN_FORMAT_NVM_CMD,
969 SecuritySendOpcode = NVME_ADMIN_SECURITY_SEND_CMD,
970 SecurityReceiveOpcode = NVME_ADMIN_SECURITY_RECEIVE_CMD,
971 SanitizeOpcode = NVME_ADMIN_SANITIZE_CMD
972} NVME_ADMIN_COMMAND_OPCODE;
979 IdentifyNamespaceCns = 0x0,
980 IdentifyControllerCns = 0x1,
981 IdentifyActiveNsListCns = 0x2
982} NVME_ADMIN_IDENTIFY_CNS;
989 ActivateActionReplace = 0x0,
990 ActivateActionReplaceActivate = 0x1,
991 ActivateActionActivate = 0x2
992} NVME_FW_ACTIVATE_ACTION;
999 FirmwareSlotCtrlChooses = 0x0,
1000 FirmwareSlot1 = 0x1,
1001 FirmwareSlot2 = 0x2,
1002 FirmwareSlot3 = 0x3,
1003 FirmwareSlot4 = 0x4,
1004 FirmwareSlot5 = 0x5,
1005 FirmwareSlot6 = 0x6,
1007} NVME_FW_ACTIVATE_SLOT;
1014 ErrorInfoLogID = LID_ERROR_INFO,
1015 SmartHealthInfoLogID = LID_SMART_INFO,
1016 FirmwareSlotInfoLogID = LID_FW_SLOT_INFO,
1017 BootPartitionInfoLogID = LID_BP_INFO,
1018 SanitizeStatusInfoLogID = LID_SANITIZE_STATUS_INFO
1029 UINT8 ActivelyRunningFwSlot : 3;
1034 UINT8 NextActiveFwSlot : 3;
1051 CHAR8 FwRevisionSlot[7][8];
1052 UINT8 Reserved2[448];
1063 UINT8 CriticalWarningAvailableSpare : 1;
1064 UINT8 CriticalWarningTemperature : 1;
1065 UINT8 CriticalWarningReliability : 1;
1066 UINT8 CriticalWarningMediaReadOnly : 1;
1067 UINT8 CriticalWarningVolatileBackup : 1;
1068 UINT8 CriticalWarningReserved : 3;
1072 UINT16 CompositeTemp;
1076 UINT8 AvailableSpare;
1080 UINT8 AvailableSpareThreshold;
1084 UINT8 PercentageUsed;
1085 UINT8 Reserved1[26];
1089 UINT8 DataUnitsRead[16];
1093 UINT8 DataUnitsWritten[16];
1097 UINT8 HostReadCommands[16];
1101 UINT8 HostWriteCommands[16];
1105 UINT8 ControllerBusyTime[16];
1109 UINT8 PowerCycles[16];
1113 UINT8 PowerOnHours[16];
1117 UINT8 UnsafeShutdowns[16];
1121 UINT8 MediaAndDataIntegrityErrors[16];
1125 UINT8 NumberErrorInformationLogEntries[16];
1129 UINT32 WarningCompositeTemperatureTime;
1133 UINT32 CriticalCompositeTemperatureTime;
1137 UINT16 TemperatureSensor[8];
1138 UINT8 Reserved2[296];
1149 UINT16 SanitizeProgress;
1153 UINT16 SanitizeStatus : 3;
1154 UINT16 OverwriteSanitizeCompletedNumber : 5;
1155 UINT16 GlobalDataErased : 1;
1156 UINT16 SanitizeStatusRsvd : 7;
1160 UINT32 SanitizeCmdDw10Info;
1164 UINT32 OverwriteEstimatedTime;
1168 UINT32 BlockEraseEstimatedTime;
1172 UINT32 CryptoEraseEstimatedTime;
1178 UINT32 OverwriteEstimatedTimeWithNodmm;
1184 UINT32 BlockEraseEstimatedTimeWithNodmm;
1190 UINT32 CryptoEraseEstimatedTimeWithNodmm;
1191 UINT8 Reserved[480];
EFI_STATUS EFIAPI Activate(IN CONST EFI_SMM_CONTROL2_PROTOCOL *This, IN OUT UINT8 *CommandPort OPTIONAL, IN OUT UINT8 *DataPort OPTIONAL, IN BOOLEAN Periodic OPTIONAL, IN EFI_SMM_PERIOD ActivationInterval OPTIONAL)