nvme_drv: provide get/set feature command

These admin commands are used to configure features of the NVMe device.

Issue #4715.
This commit is contained in:
Josef Söntgen 2022-11-13 20:11:16 +00:00 committed by Christian Helmuth
parent 00a6d1306c
commit 25d0dc19d5

View File

@ -66,6 +66,8 @@ namespace Nvme {
struct Sqe_create_cq;
struct Sqe_create_sq;
struct Sqe_identify;
struct Sqe_get_feature;
struct Sqe_set_feature;
struct Sqe_io;
struct Queue;
@ -133,6 +135,13 @@ namespace Nvme {
WRITE_ZEROS = 0x08,
};
enum Feature_sel {
CURRENT = 0b000,
DEFAULT = 0b001,
SAVED = 0b010,
SUPPORTED = 0b011,
};
struct Block_session_component;
struct Driver;
struct Main;
@ -332,6 +341,36 @@ struct Nvme::Sqe_identify : Nvme::Sqe
};
/*
* Get feature command
*/
struct Nvme::Sqe_get_feature : Nvme::Sqe
{
struct Cdw10 : Register<0x28, 32>
{
struct Fid : Bitfield< 0, 8> { }; /* feature identifier */
struct Sel : Bitfield< 8, 2> { }; /* select which value is returned */
};
Sqe_get_feature(addr_t const base) : Sqe(base) { }
};
/*
* Set feature command
*/
struct Nvme::Sqe_set_feature : Nvme::Sqe
{
struct Cdw10 : Register<0x28, 32>
{
struct Fid : Bitfield< 0, 8> { }; /* feature identifier */
struct Sv : Bitfield<31, 1> { }; /* save */
};
Sqe_set_feature(addr_t const base) : Sqe(base) { }
};
/*
* Create completion queue command
*/