diff --git a/DiscImageChef.Devices/FreeBSD/Structs.cs b/DiscImageChef.Devices/FreeBSD/Structs.cs index bc1ece90f..98005f258 100644 --- a/DiscImageChef.Devices/FreeBSD/Structs.cs +++ b/DiscImageChef.Devices/FreeBSD/Structs.cs @@ -218,5 +218,162 @@ namespace DiscImageChef.Devices.FreeBSD /// initiator id of who selected public uint init_id; } + + struct nvme_command + { + private ushort opc_fuse_rsvd1; + /// + /// command identifier + /// + public ushort cid; + /// + /// namespace identifier + /// + public uint nsid; + /// + /// reserved + /// + public uint rsvd2; + /// + /// reserved + /// + public uint rsvd3; + /// + /// metadata pointer + /// + public ulong mptr; + /// + /// prp entry 1 + /// + public ulong prp1; + /// + /// prp entry 2 + /// + public ulong prp2; + /// + /// command-specific + /// + public uint cdw10; + /// + /// command-specific + /// + public uint cdw11; + /// + /// command-specific + /// + public uint cdw12; + /// + /// command-specific + /// + public uint cdw13; + /// + /// command-specific + /// + public uint cdw14; + /// + /// command-specific + /// + public uint cdw15; + + /// + /// opcode + /// + public byte opc => (byte)((opc_fuse_rsvd1 & 0xFF00) >> 8); + /// + /// fused operation + /// + public byte fuse => (byte)((opc_fuse_rsvd1 & 0xC0) >> 6); + /// + /// reserved + /// + public byte rsvd1 => (byte)(opc_fuse_rsvd1 & 0x3F); + } + + struct nvme_status + { + private ushort status; + + /// + /// phase tag + /// + public byte p => (byte)((status & 0x8000) >> 15); + + /// + /// status code + /// + public byte sc => (byte)((status & 0x7F80) >> 7); + + /// + /// status code type + /// + public byte sct => (byte)((status & 0x70) >> 4); + + /// + /// reserved + /// + public byte rsvd2 => (byte)((status & 0xC) >> 15); + + /// + /// more + /// + public byte m => (byte)((status & 0x2) >> 1); + + /// + /// do not retry + /// + public byte dnr => (byte)(status & 0x1); + } + + struct nvme_completion + { + /// + /// command-specific + /// + public uint cdw0; + + /// + /// reserved + /// + public uint rsvd1; + + /// + /// submission queue head pointer + /// + public ushort sqhd; + + /// + /// submission queue identifier + /// + public ushort sqid; + + /// + /// command identifier + /// + public ushort cid; + + public nvme_status status; + } + + /// + /// NVMe I/O Request CCB used for the XPT_NVME_IO and XPT_NVME_ADMIN function codes. + /// + struct ccb_nvmeio + { + public ccb_hdr ccb_h; + /// Ptr for next CCB for action + public IntPtr next_ccb; + /// NVME command, per NVME standard + public nvme_command cmd; + /// NVME completion, per NVME standard + public nvme_completion cpl; + /// Ptr to the data buf/SG list + public IntPtr data_ptr; + /// Data transfer length + public uint dxfer_len; + /// Number of SG list entries + public ushort sglist_cnt; + /// padding for removed uint32_t + public ushort unused; + } }