@@ -61,7 +61,7 @@ impl From<AdminIoCqeStatus> for u32 {
6161 debug_assert_eq ! ( ( sct & !7 ) , 0 ) ;
6262 let sc: u32 = match value. status {
6363 AdminIoCqeStatusType :: GenericCommandStatus ( s) => s. id ( ) ,
64- AdminIoCqeStatusType :: CommandSpecificStatus ( s ) => s . id ( ) ,
64+ AdminIoCqeStatusType :: CommandSpecificStatus ( v ) => v ,
6565 AdminIoCqeStatusType :: MediaAndDataIntegrityErrors => todo ! ( ) ,
6666 AdminIoCqeStatusType :: PathRelatedStatus => todo ! ( ) ,
6767 AdminIoCqeStatusType :: VendorSpecific => todo ! ( ) ,
@@ -90,7 +90,7 @@ unsafe impl Discriminant<u8> for CommandRetryDelay {}
9090#[ repr( u8 ) ]
9191enum AdminIoCqeStatusType {
9292 GenericCommandStatus ( AdminIoCqeGenericCommandStatus ) = 0x00 ,
93- CommandSpecificStatus ( AdminIoCqeCommandSpecificStatus ) = 0x01 ,
93+ CommandSpecificStatus ( u8 ) = 0x01 ,
9494 #[ expect( dead_code) ]
9595 MediaAndDataIntegrityErrors = 0x02 ,
9696 #[ expect( dead_code) ]
@@ -109,13 +109,15 @@ enum AdminIoCqeGenericCommandStatus {
109109}
110110unsafe impl Discriminant < u8 > for AdminIoCqeGenericCommandStatus { }
111111
112- // Base v2.1, 4.2.3.2, Figure 103
113- #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
114- #[ repr( u8 ) ]
115- enum AdminIoCqeCommandSpecificStatus {
116- NamespaceIdentifierUnavailable = 0x16 ,
112+ // Base v2.1, 4.6.1, Figure 137
113+ // TODO: Unify with ControllerListResponse
114+ #[ derive( Debug , DekuRead , Eq , PartialEq ) ]
115+ #[ deku( ctx = "endian: Endian" , endian = "little" ) ]
116+ struct ControllerListRequest {
117+ numids : u16 ,
118+ #[ deku( count = "*numids" ) ]
119+ ids : WireVec < u16 , 2047 > ,
117120}
118- unsafe impl Discriminant < u8 > for AdminIoCqeCommandSpecificStatus { }
119121
120122// Base v2.1, 5.1.12, Figure 202
121123// MI v2.0, 6.3, Figure 141
@@ -298,6 +300,16 @@ enum ControllerType {
298300 AdministrativeController = 0x03 ,
299301}
300302
303+ impl From < crate :: ControllerType > for ControllerType {
304+ fn from ( value : crate :: ControllerType ) -> Self {
305+ match value {
306+ crate :: ControllerType :: Io => Self :: IoController ,
307+ crate :: ControllerType :: Discovery => Self :: DiscoveryController ,
308+ crate :: ControllerType :: Administrative => Self :: AdministrativeController ,
309+ }
310+ }
311+ }
312+
301313// Base v2.1, 5.1.13.2.1, Figure 312, LPA
302314flags ! {
303315 #[ repr( u8 ) ]
@@ -438,7 +450,7 @@ struct AdminIdentifyAllocatedNamespaceIdListResponse {
438450impl Encode < 4096 > for AdminIdentifyAllocatedNamespaceIdListResponse { }
439451
440452// Base v2.1, Section 5.1.13.2.12
441- #[ derive( Debug , DekuRead , DekuWrite ) ]
453+ #[ derive( Debug , DekuWrite ) ]
442454#[ deku( endian = "little" ) ]
443455struct ControllerListResponse {
444456 #[ deku( update = "self.ids.len()" ) ]
@@ -457,6 +469,15 @@ impl ControllerListResponse {
457469 }
458470}
459471
472+ // Base v2.1, 5.1.20.1, Figure 364, SEL
473+ #[ derive( Debug , DekuRead , Eq , PartialEq ) ]
474+ #[ deku( ctx = "endian: Endian, sel: u8" , endian = "endian" , id = "sel" ) ]
475+ #[ repr( u8 ) ]
476+ enum AdminNamespaceAttachmentSelect {
477+ #[ deku( id = 0x00 ) ]
478+ ControllerAttach ( ControllerListRequest ) ,
479+ }
480+
460481// Base v2.1, 5.1.21, Figure 376, SEL
461482#[ derive( Debug , DekuRead , DekuWrite , Eq , PartialEq ) ]
462483#[ deku( ctx = "endian: Endian, sel: u8" , endian = "endian" , id = "sel" ) ]
0 commit comments