nvme/ds/controller/properties/
config.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use modular_bitfield::prelude::*;

#[derive(Copy, Clone)]
#[bitfield(bits = 32)]
#[repr(u32)]
pub struct ControllerConfig {
    pub enable: bool,
    #[skip]
    res: B3,
    pub io_command_set_selected: IOCommandSet,
    pub mem_page_size: B4,
    pub arbitration_mechanism: ArbitrationMechanism,
    pub shutdown_notification: ShutdownNotification,
    pub io_submission_queue_entry_size: B4,
    pub io_completion_queue_entry_size: B4,
    pub controller_ready_independent_of_media_enable: bool,
    #[skip]
    res1: B7,
}

#[derive(Copy, Clone, Debug, BitfieldSpecifier)]
#[bits = 3]
pub enum IOCommandSet {
    NVMCommandSet,
    AllSupported = 0b110,
    AdminOnly = 0b111,
}

#[derive(Copy, Clone, Debug, BitfieldSpecifier)]
#[bits = 3]
pub enum ArbitrationMechanism {
    RoundRobin,
    WeightedRoundRobinWithUrgent,
    VendorSpecific = 0b111,
}

#[derive(Copy, Clone, Debug, BitfieldSpecifier)]
#[bits = 2]
pub enum ShutdownNotification {
    NoNotification,
    NormalShutdown,
    AbruptShutdown,
}