FEMU  原版 master 7e238cc
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
oc12.h
浏览该文件的文档.
1 #ifndef __FEMU_OC12_H
2 #define __FEMU_OC12_H
3 
4 #include "../nvme.h"
5 
11 };
12 
15  OC12_CMD_READ = 0x92,
17 };
18 
23 };
24 
25 typedef struct Oc12GetL2PTbl {
26  uint8_t opcode;
27  uint8_t flags;
28  uint16_t cid;
29  uint32_t nsid;
30  uint32_t rsvd1[4];
31  uint64_t prp1;
32  uint64_t prp2;
33  uint64_t slba;
34  uint32_t nlb;
35  uint16_t rsvd2[6];
37 
38 typedef struct Oc12BbtGet {
39  uint8_t opcode;
40  uint8_t flags;
41  uint16_t cid;
42  uint32_t nsid;
43  uint64_t rsvd1[2];
44  uint64_t prp1;
45  uint64_t prp2;
46  uint64_t spba;
47  uint32_t rsvd4[4]; // DW15, 14, 13, 12
48 } Oc12BbtGet;
49 
50 typedef struct Oc12BbtSet {
51  uint8_t opcode;
52  uint8_t flags;
53  uint16_t cid;
54  uint32_t nsid;
55  uint64_t rsvd1[2];
56  uint64_t prp1;
57  uint64_t prp2;
58  uint64_t spba;
59  uint16_t nlb;
60  uint8_t value;
61  uint8_t rsvd3;
62  uint32_t rsvd4[3];
63 } Oc12BbtSet;
64 
65 typedef struct Oc12RwCmd {
66  uint8_t opcode;
67  uint8_t flags;
68  uint16_t cid;
69  uint32_t nsid;
70  uint64_t rsvd2;
71  uint64_t metadata; /* OOB */
72  uint64_t prp1;
73  uint64_t prp2;
74  uint64_t spba; /* PPA list */
75  uint16_t nlb;
76  uint16_t control; /* For Suspend, SLC mode, Scramble, FUA, LR control */
77  uint32_t dsmgmt;
78  uint64_t slba; /* ! this is actually not used by OC12 */
79 } Oc12RwCmd;
80 
81 typedef struct Oc12DmCmd {
82  uint8_t opcode;
83  uint8_t flags;
84  uint16_t cid;
85  uint32_t nsid;
86  uint32_t rsvd1[8];
87  uint64_t spba;
88  uint32_t nlb;
89  uint32_t rsvd2[3];
90 } Oc12DmCmd;
91 
92 typedef struct Oc12IdAddrFormat {
93  uint8_t ch_offset;
94  uint8_t ch_len;
95  uint8_t lun_offset;
96  uint8_t lun_len;
97  uint8_t pln_offset;
98  uint8_t pln_len;
99  uint8_t blk_offset;
100  uint8_t blk_len;
101  uint8_t pg_offset;
102  uint8_t pg_len;
103  uint8_t sect_offset;
104  uint8_t sect_len;
105  uint8_t res[4];
106 } QEMU_PACKED Oc12IdAddrFormat;
107 
108 typedef struct Oc12AddrF {
109  uint64_t ch_mask;
110  uint64_t lun_mask;
111  uint64_t pln_mask;
112  uint64_t blk_mask;
113  uint64_t pg_mask;
114  uint64_t sec_mask;
115  uint8_t ch_offset;
116  uint8_t lun_offset;
117  uint8_t pln_offset;
118  uint8_t blk_offset;
119  uint8_t pg_offset;
120  uint8_t sec_offset;
121 } Oc12AddrF;
122 
123 typedef struct Oc12IdGroup {
124  uint8_t mtype;
125  uint8_t fmtype;
126  uint16_t res16;
127  uint8_t num_ch;
128  uint8_t num_lun;
129  uint8_t num_pln;
130  uint8_t rsvd1;
131  uint16_t num_blk;
132  uint16_t num_pg;
133  uint16_t fpg_sz;
134  uint16_t csecs;
135  uint16_t sos;
136  uint16_t rsvd2;
137  uint32_t trdt;
138  uint32_t trdm;
139  uint32_t tprt;
140  uint32_t tprm;
141  uint32_t tbet;
142  uint32_t tbem;
143  uint32_t mpos;
144  uint32_t mccap;
145  uint16_t cpar;
146  uint8_t res[906];
147 } QEMU_PACKED Oc12IdGroup;
148 
149 typedef struct Oc12IdCtrl {
150  uint8_t ver_id;
151  uint8_t vmnt;
152  uint8_t cgrps;
153  uint8_t res;
154  uint32_t cap;
155  uint32_t dom;
157  uint8_t resv[228];
159 } QEMU_PACKED Oc12IdCtrl;
160 
161 typedef struct Oc12Bbt {
162  uint8_t tblid[4];
163  uint16_t verid;
164  uint16_t revid;
165  uint32_t rsvd1;
166  uint32_t tblks;
167  uint32_t tfact;
168  uint32_t tgrown;
169  uint32_t tdresv;
170  uint32_t thresv;
171  uint32_t rsvd2[8];
172  uint8_t blk[0];
173 } QEMU_PACKED Oc12Bbt;
174 
175 /* Parameters passed on to QEMU to configure the characteristics of the drive */
176 typedef struct Oc12Params {
177  /* configurable device characteristics */
178  uint16_t pgs_per_blk;
179  uint16_t sec_size;
180  uint8_t sec_per_pg;
181  uint8_t max_sec_per_rq;
182  /* configurable parameters for Oc12IdGroup */
183  uint8_t mtype;
184  uint8_t fmtype;
185  uint8_t num_ch;
186  uint8_t num_pln;
187  uint8_t num_lun;
188  uint16_t sos;
189  /* calculated values */
190  uint32_t sec_per_pl;
191  uint32_t sec_per_blk;
192  uint32_t sec_per_lun;
193  uint32_t sec_per_ch;
194  uint32_t total_secs;
195  uint32_t blk_per_pl;
196  /* Calculated unit values for ordering */
197  uint32_t pl_units;
198  uint32_t pg_units;
199  uint32_t blk_units;
200  uint32_t lun_units;
201  uint32_t ch_units;
202  uint32_t total_units;
203 } QEMU_PACKED Oc12Params;
204 
205 enum Oc12Pmode {
209 };
210 
212  Oc12RSP_L2P = 1 << 0,
213  Oc12RSP_ECC = 1 << 1,
214 };
215 
216 typedef struct Oc12Ctrl {
220  uint8_t read_l2p_tbl;
221  uint8_t bbt_gen_freq;
222  uint8_t bbt_auto_gen;
223  uint8_t meta_auto_gen;
224  uint8_t debug;
225  uint8_t strict;
226  uint8_t *meta_buf;
228  int meta_len;
229  uint8_t int_meta_size; // # of bytes for "internal" metadata
230 } Oc12Ctrl;
231 
233  uint32_t state;
234  uint64_t rsv[2];
235 } __attribute__((__packed__));
236 
238  uint64_t lba;
239  uint64_t rsvd;
240 } __attribute__((__packed__));
241 
242 typedef struct AddrBucket {
243  int ch;
244  int lun;
245  int pg;
246  uint8_t page_type;
247  int cnt;
248 } AddrBucket;
249 
250 #define OC12_MAX_GRPS_PR_IDENT (20)
251 #define OC12_FEAT_EXT_START 64
252 #define OC12_FEAT_EXT_END 127
253 #define OC12_PBA_UNMAPPED UINT64_MAX
254 #define OC12_LBA_UNMAPPED UINT64_MAX
255 
256 static inline void oc12_check_size(void)
257 {
258  QEMU_BUILD_BUG_ON(sizeof(Oc12GetL2PTbl) != 64);
259  QEMU_BUILD_BUG_ON(sizeof(Oc12BbtGet) != 64);
260  QEMU_BUILD_BUG_ON(sizeof(Oc12BbtSet) != 64);
261  QEMU_BUILD_BUG_ON(sizeof(Oc12RwCmd) != 64);
262  QEMU_BUILD_BUG_ON(sizeof(Oc12DmCmd) != 64);
263  QEMU_BUILD_BUG_ON(sizeof(Oc12IdCtrl) != 4096);
264  QEMU_BUILD_BUG_ON(sizeof(Oc12IdAddrFormat) != 16);
265  QEMU_BUILD_BUG_ON(sizeof(Oc12IdGroup) != 960);
266 }
267 
268 #endif
dma_write_prp
uint16_t dma_write_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:112
Oc12IdGroup::mtype
uint8_t mtype
Definition: oc12.h:124
Oc12BbtGet::flags
uint8_t flags
Definition: oc12.h:40
Oc12BbtGet::nsid
uint32_t nsid
Definition: oc12.h:42
NvmeCmd
Definition: nvme.h:296
OcCtrlParams::num_ch
uint8_t num_ch
Definition: nvme.h:1158
Oc12Params::blk_per_pl
uint32_t blk_per_pl
Definition: oc12.h:195
Oc12IdGroup::cpar
uint16_t cpar
Definition: oc12.h:145
FemuCtrl::chnl_locks
pthread_spinlock_t chnl_locks[FEMU_MAX_NUM_CHNLS]
Definition: nvme.h:1305
Oc12Ctrl::meta_len
int meta_len
Definition: oc12.h:228
oc12_init_bbtbl
static int oc12_init_bbtbl(FemuCtrl *n, NvmeNamespace *ns)
Definition: oc12.c:794
oc12_init_params
static int oc12_init_params(FemuCtrl *n)
Definition: oc12.c:862
FemuCtrl::flash_type
uint8_t flash_type
Definition: nvme.h:1339
NVME_LBA_RANGE
@ NVME_LBA_RANGE
Definition: nvme.h:540
Oc12AddrF::pg_mask
uint64_t pg_mask
Definition: oc12.h:113
Oc12GetL2PTbl::rsvd2
uint16_t rsvd2[6]
Definition: oc12.h:35
Oc12IdCtrl::ver_id
uint8_t ver_id
Definition: oc12.h:150
Oc12IdGroup::num_ch
uint8_t num_ch
Definition: oc12.h:127
Oc12Params::pgs_per_blk
uint16_t pgs_per_blk
Definition: oc12.h:178
FemuCtrl
femu相关控制参数和数据成员
Definition: nvme.h:1184
PPA_SEC
#define PPA_SEC(ln, ppa)
Definition: nand.h:118
OC12_LBA_UNMAPPED
#define OC12_LBA_UNMAPPED
Definition: oc12.h:254
oc12_metadata_format::rsv
uint64_t rsv[2]
Definition: oc12.h:234
Oc12IdGroup::tbet
uint32_t tbet
Definition: oc12.h:141
FemuCtrl::ext_ops
FemuExtCtrlOps ext_ops
nvme到各模式ssd接口
Definition: nvme.h:1220
Oc12IdAddrFormat::sect_len
uint8_t sect_len
Definition: oc12.h:104
NvmeIdNs
Definition: nvme.h:863
Oc12Params::lun_units
uint32_t lun_units
Definition: oc12.h:200
PPA_BLK
#define PPA_BLK(ln, ppa)
Definition: nand.h:116
Oc12RwCmd::cid
uint16_t cid
Definition: oc12.h:68
oc12_check_size
static void oc12_check_size(void)
Definition: oc12.h:256
NvmeRequest::qsg
QEMUSGList qsg
dma用
Definition: nvme.h:984
Oc12IdAddrFormat::lun_offset
uint8_t lun_offset
Definition: oc12.h:95
Oc12IdCtrl::ppaf
struct Oc12IdAddrFormat ppaf
Definition: oc12.h:156
oc12_read_tbls
static int oc12_read_tbls(FemuCtrl *n)
Definition: oc12.c:701
Oc12Ctrl::id_ctrl
Oc12IdCtrl id_ctrl
Definition: oc12.h:218
Oc12IdGroup::csecs
uint16_t csecs
Definition: oc12.h:134
Oc12IdCtrl::vmnt
uint8_t vmnt
Definition: oc12.h:151
Oc12AddrF::lun_mask
uint64_t lun_mask
Definition: oc12.h:110
NvmeNamespace::uncorrectable
unsigned long * uncorrectable
Definition: nvme.h:1070
femu_log
#define femu_log(fmt,...)
Definition: nvme.h:1514
Oc12RwCmd::nsid
uint32_t nsid
Definition: oc12.h:69
Oc12Ctrl
Definition: oc12.h:216
Oc12Params::num_pln
uint8_t num_pln
Definition: oc12.h:186
Oc12BbtSet::rsvd4
uint32_t rsvd4[3]
Definition: oc12.h:62
Oc12Params::sec_per_pl
uint32_t sec_per_pl
Definition: oc12.h:190
FemuExtCtrlOps
struct FemuExtCtrlOps FemuExtCtrlOps
扩展操作接口,具体实现在各模式ssd中
Oc12BbtSet::opcode
uint8_t opcode
Definition: oc12.h:51
NvmeNamespace::tbl_entries
uint32_t tbl_entries
Definition: nvme.h:1077
Oc12IdAddrFormat::blk_len
uint8_t blk_len
Definition: oc12.h:100
Oc12IdCtrl::groups
Oc12IdGroup groups[4]
Definition: oc12.h:158
AddrBucket::ch
int ch
Definition: oc12.h:243
Oc12DmCmd::nsid
uint32_t nsid
Definition: oc12.h:85
Oc12AddrF
struct Oc12AddrF Oc12AddrF
Oc12AddrF::lun_offset
uint8_t lun_offset
Definition: oc12.h:116
OC12_ADM_CMD_SET_BB_TBL
@ OC12_ADM_CMD_SET_BB_TBL
Definition: oc12.h:10
Oc12DmCmd
struct Oc12DmCmd Oc12DmCmd
Oc12AddrF::blk_offset
uint8_t blk_offset
Definition: oc12.h:118
Oc12Params::total_units
uint32_t total_units
Definition: oc12.h:202
AddrBucket::lun
int lun
Definition: oc12.h:244
OcCtrlParams::max_sec_per_rq
uint8_t max_sec_per_rq
Definition: nvme.h:1157
ppa2secidx
static uint64_t ppa2secidx(Oc12Ctrl *ln, uint64_t ppa)
Definition: oc12.c:25
OC12_ADM_CMD_GET_L2P_TBL
@ OC12_ADM_CMD_GET_L2P_TBL
Definition: oc12.h:8
backend_rw
int backend_rw(SsdDramBackend *b, QEMUSGList *qsg, uint64_t *lbal, bool is_write)
Definition: dram.c:37
femu_debug
#define femu_debug(fmt,...)
Definition: nvme.h:1507
get_page_type
static uint8_t get_page_type(int flash_type, int pg)
Definition: nand.h:126
NVME_ID_NS_LBAF_MS
#define NVME_ID_NS_LBAF_MS(ns, lba_index)
Definition: nvme.h:37
Oc12RwCmd::opcode
uint8_t opcode
Definition: oc12.h:66
NvmeIdentity
Definition: nvme.h:406
NVME_SUCCESS
@ NVME_SUCCESS
Definition: nvme.h:526
NvmeNamespace::tbl
uint64_t * tbl
Definition: nvme.h:1078
Oc12IdGroup::trdm
uint32_t trdm
Definition: oc12.h:138
FemuCtrl::bar
NvmeBar bar
Definition: nvme.h:1188
advance_chip_timestamp
int64_t advance_chip_timestamp(FemuCtrl *n, int lunid, uint64_t now, int opcode, uint8_t page_type)
Definition: timing.c:72
Oc12BbtSet
Definition: oc12.h:50
oc12_set_ctrl_str
static void oc12_set_ctrl_str(FemuCtrl *n)
Definition: oc12.c:1061
Oc12RwCmd::flags
uint8_t flags
Definition: oc12.h:67
is_oc12_admin_cmd
static bool is_oc12_admin_cmd(uint8_t opcode)
Definition: oc12.c:8
Oc12BbtSet::rsvd3
uint8_t rsvd3
Definition: oc12.h:61
Oc12Responsibility
Oc12Responsibility
Definition: oc12.h:211
Oc12BbtSet::prp1
uint64_t prp1
Definition: oc12.h:56
Oc12RwCmd::slba
uint64_t slba
Definition: oc12.h:78
FemuCtrl::chip_next_avail_time
volatile int64_t chip_next_avail_time[FEMU_MAX_NUM_CHIPS]
Definition: nvme.h:1302
Oc12BbtGet::prp2
uint64_t prp2
Definition: oc12.h:45
Oc12IdGroup::rsvd2
uint16_t rsvd2
Definition: oc12.h:136
Oc12BbtGet
Definition: oc12.h:38
PPA_PLN
#define PPA_PLN(ln, ppa)
Definition: nand.h:115
oc12_write
static uint16_t oc12_write(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: oc12.c:493
Oc12BbtGet
struct Oc12BbtGet Oc12BbtGet
Oc12BbtGet::cid
uint16_t cid
Definition: oc12.h:41
Oc12RSP_ECC
@ Oc12RSP_ECC
Definition: oc12.h:213
Oc12IdAddrFormat::res
uint8_t res[4]
Definition: oc12.h:105
Oc12Params::sec_per_lun
uint32_t sec_per_lun
Definition: oc12.h:192
Oc12IdGroup::trdt
uint32_t trdt
Definition: oc12.h:137
dma_read_prp
uint16_t dma_read_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:137
NvmeNamespace
Definition: nvme.h:1065
OC12_ADM_CMD_GET_BB_TBL
@ OC12_ADM_CMD_GET_BB_TBL
Definition: oc12.h:9
NVME_CMD_WRITE
@ NVME_CMD_WRITE
Definition: nvme.h:340
NvmeNamespace::start_block
uint64_t start_block
Definition: nvme.h:1074
AddrBucket::cnt
int cnt
Definition: oc12.h:247
NVME_DNR
@ NVME_DNR
Definition: nvme.h:581
Oc12BbtGet::opcode
uint8_t opcode
Definition: oc12.h:39
Oc12GetL2PTbl::prp1
uint64_t prp1
Definition: oc12.h:31
Oc12Params::mtype
uint8_t mtype
Definition: oc12.h:183
Oc12Bbt
Definition: oc12.h:161
oc12_tgt_meta::lba
uint64_t lba
Definition: oc12.h:238
OcCtrlParams::pgs_per_blk
uint16_t pgs_per_blk
Definition: nvme.h:1156
Oc12GetL2PTbl::opcode
uint8_t opcode
Definition: oc12.h:26
Oc12Params
struct Oc12Params Oc12Params
Oc12MetaState
Oc12MetaState
Definition: oc12.h:19
Oc12Bbt::revid
uint16_t revid
Definition: oc12.h:164
Oc12Ctrl::ppaf
Oc12AddrF ppaf
Definition: oc12.h:219
oc12_nvme_rw
static uint16_t oc12_nvme_rw(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: oc12.c:1036
AddrBucket::page_type
uint8_t page_type
Definition: oc12.h:246
Oc12Ctrl::bbt_auto_gen
uint8_t bbt_auto_gen
Definition: oc12.h:222
Oc12Ctrl::meta_auto_gen
uint8_t meta_auto_gen
Definition: oc12.h:223
Oc12RwCmd::prp2
uint64_t prp2
Definition: oc12.h:73
oc12_metadata_format
Definition: oc12.h:232
NVME_UNRECOVERED_READ
@ NVME_UNRECOVERED_READ
Definition: nvme.h:573
Oc12AdminCommands
Oc12AdminCommands
Definition: oc12.h:6
NvmeRequest::iov
QEMUIOVector iov
Definition: nvme.h:985
Oc12IdGroup::fpg_sz
uint16_t fpg_sz
Definition: oc12.h:133
oc12_identity
static uint16_t oc12_identity(FemuCtrl *n, NvmeCmd *cmd)
Definition: oc12.c:576
OC12_PBA_UNMAPPED
#define OC12_PBA_UNMAPPED
Definition: oc12.h:253
Oc12IdAddrFormat::lun_len
uint8_t lun_len
Definition: oc12.h:96
oc12_read
static uint16_t oc12_read(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: oc12.c:419
PPA_LUN
#define PPA_LUN(ln, ppa)
Definition: nand.h:114
oc12_meta_state_set_written
static int oc12_meta_state_set_written(Oc12Ctrl *ln, uint64_t ppa)
Definition: oc12.c:215
Oc12Bbt::thresv
uint32_t thresv
Definition: oc12.h:170
NvmeRequest::stime
int64_t stime
io开始时间
Definition: nvme.h:987
OcCtrlParams::num_lun
uint8_t num_lun
Definition: nvme.h:1159
NvmeNamespace::id_ns
NvmeIdNs id_ns
Definition: nvme.h:1067
oc12_tgt_meta::rsvd
uint64_t rsvd
Definition: oc12.h:239
NvmeBar::cap
uint64_t cap
Definition: nvme.h:40
Oc12Params::fmtype
uint8_t fmtype
Definition: oc12.h:184
Oc12GetL2PTbl::flags
uint8_t flags
Definition: oc12.h:27
Oc12RwCmd::prp1
uint64_t prp1
Definition: oc12.h:72
Oc12Ctrl::meta_tbytes
int meta_tbytes
Definition: oc12.h:227
Oc12IdGroup::res
uint8_t res[906]
Definition: oc12.h:146
nvme_set_ctrl_name
void nvme_set_ctrl_name(FemuCtrl *n, const char *mn, const char *sn, int *dev_id)
Definition: nvme-util.c:294
NvmeIdNs::vs
uint8_t vs[3712]
Definition: nvme.h:895
Oc12AddrF::pln_mask
uint64_t pln_mask
Definition: oc12.h:111
Oc12Params::ch_units
uint32_t ch_units
Definition: oc12.h:201
Oc12Bbt::tblid
uint8_t tblid[4]
Definition: oc12.h:162
oc12_rw_check_req
static uint16_t oc12_rw_check_req(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req, uint64_t *psl, uint32_t nr_pages, uint32_t nlb, uint64_t data_size, uint64_t meta_size)
Definition: oc12.c:243
Oc12IdAddrFormat::blk_offset
uint8_t blk_offset
Definition: oc12.h:99
Oc12IdGroup::num_pln
uint8_t num_pln
Definition: oc12.h:129
Oc12Params::pg_units
uint32_t pg_units
Definition: oc12.h:198
Oc12DmCmd::rsvd1
uint32_t rsvd1[8]
Definition: oc12.h:86
Oc12IdAddrFormat
Definition: oc12.h:92
parse_ppa_list
static void parse_ppa_list(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req, AddrBucket *bucket, int *nr)
Definition: oc12.c:310
Oc12IdCtrl
struct Oc12IdCtrl Oc12IdCtrl
Oc12IdGroup::tprt
uint32_t tprt
Definition: oc12.h:139
Oc12IdGroup::num_blk
uint16_t num_blk
Definition: oc12.h:131
nvme_addr_read
void nvme_addr_read(FemuCtrl *n, hwaddr addr, void *buf, int size)
Definition: dma.c:3
oc12_admin_cmd
static uint16_t oc12_admin_cmd(FemuCtrl *n, NvmeCmd *cmd)
Definition: oc12.c:713
oc12_bbt_set
static uint16_t oc12_bbt_set(FemuCtrl *n, NvmeCmd *cmd)
Definition: oc12.c:655
Oc12Params::pl_units
uint32_t pl_units
Definition: oc12.h:197
Oc12AddrF::ch_offset
uint8_t ch_offset
Definition: oc12.h:115
oc12_tgt_meta
Definition: oc12.h:237
Oc12Bbt::rsvd1
uint32_t rsvd1
Definition: oc12.h:165
NvmeIdentity::prp1
uint64_t prp1
Definition: nvme.h:412
Oc12IdGroup::tprm
uint32_t tprm
Definition: oc12.h:140
Oc12DmCmd::flags
uint8_t flags
Definition: oc12.h:83
Oc12Ctrl::int_meta_size
uint8_t int_meta_size
Definition: oc12.h:229
AddrBucket
struct AddrBucket AddrBucket
Oc12PMODE_DUAL
@ Oc12PMODE_DUAL
Dual-plane (NVM_IO_DUAL_ACCESS)
Definition: oc12.h:207
Oc12GetL2PTbl::rsvd1
uint32_t rsvd1[4]
Definition: oc12.h:30
Oc12DmCmd::nlb
uint32_t nlb
Definition: oc12.h:88
OC12_CMD_READ
@ OC12_CMD_READ
Definition: oc12.h:15
Oc12BbtSet::flags
uint8_t flags
Definition: oc12.h:52
FemuCtrl::oc12_ctrl
Oc12Ctrl * oc12_ctrl
Definition: nvme.h:1301
OcCtrlParams::sos
uint16_t sos
Definition: nvme.h:1161
FemuCtrl::chip_locks
pthread_spinlock_t chip_locks[FEMU_MAX_NUM_CHIPS]
Definition: nvme.h:1303
Oc12Ctrl
struct Oc12Ctrl Oc12Ctrl
oc12_exit
static void oc12_exit(FemuCtrl *n)
Definition: oc12.c:1031
Oc12Params::sec_size
uint16_t sec_size
Definition: oc12.h:179
init_nand_flash
int init_nand_flash(void *opaque)
Definition: nand.c:148
Oc12Params::sec_per_ch
uint32_t sec_per_ch
Definition: oc12.h:193
NvmeIdCtrl::mdts
uint8_t mdts
Definition: nvme.h:701
NvmeRequest::is_write
uint16_t is_write
是否为写操作
Definition: nvme.h:973
Oc12DmCmd
Definition: oc12.h:81
__attribute__
struct oc12_metadata_format __attribute__((__packed__))
nvme_addr_write
void nvme_addr_write(FemuCtrl *n, hwaddr addr, void *buf, int size)
Definition: dma.c:13
Oc12IdAddrFormat
struct Oc12IdAddrFormat Oc12IdAddrFormat
Oc12Params::sec_per_pg
uint8_t sec_per_pg
Definition: oc12.h:180
OC12_SEC_UNKNOWN
@ OC12_SEC_UNKNOWN
Definition: oc12.h:20
Oc12BbtSet::nsid
uint32_t nsid
Definition: oc12.h:54
Oc12Params::total_secs
uint32_t total_secs
Definition: oc12.h:194
Oc12IdGroup::mccap
uint32_t mccap
Definition: oc12.h:144
NvmeIdentity::nsid
uint32_t nsid
Definition: nvme.h:410
Oc12IdGroup::sos
uint16_t sos
Definition: oc12.h:135
FemuCtrl::id_ctrl
NvmeIdCtrl id_ctrl
Definition: nvme.h:1285
Oc12BbtGet::prp1
uint64_t prp1
Definition: oc12.h:44
OC12_ADM_CMD_IDENTITY
@ OC12_ADM_CMD_IDENTITY
Definition: oc12.h:7
Oc12Ctrl::strict
uint8_t strict
Definition: oc12.h:225
FEMU_MAX_NUM_CHIPS
#define FEMU_MAX_NUM_CHIPS
Definition: nvme.h:1151
Oc12BbtGet::rsvd4
uint32_t rsvd4[4]
Definition: oc12.h:47
Oc12Bbt::verid
uint16_t verid
Definition: oc12.h:163
oc12.h
Oc12DmCmd::cid
uint16_t cid
Definition: oc12.h:84
Oc12IdGroup::rsvd1
uint8_t rsvd1
Definition: oc12.h:130
Oc12AddrF::sec_mask
uint64_t sec_mask
Definition: oc12.h:114
oc12_init_misc
static int oc12_init_misc(FemuCtrl *n)
Definition: oc12.c:836
oc12_init_meta
static int oc12_init_meta(Oc12Ctrl *ln)
Definition: oc12.c:775
Oc12GetL2PTbl::prp2
uint64_t prp2
Definition: oc12.h:32
state
uint32_t state
Definition: oc12.h:2
oc12_read_oob_meta
static int oc12_read_oob_meta(Oc12Ctrl *ln, uint64_t ppa, void *meta)
Definition: oc12.c:84
NVME_ID_NS_LBAF_DS
#define NVME_ID_NS_LBAF_DS(ns, lba_index)
Definition: nvme.h:36
Oc12AddrF
Definition: oc12.h:108
Oc12BbtSet::value
uint8_t value
Definition: oc12.h:60
oc12_init
static void oc12_init(FemuCtrl *n, Error **errp)
Definition: oc12.c:1070
NVME_INVALID_OPCODE
@ NVME_INVALID_OPCODE
Definition: nvme.h:527
Oc12RwCmd::nlb
uint16_t nlb
Definition: oc12.h:75
Oc12DmCmd::opcode
uint8_t opcode
Definition: oc12.h:82
Oc12AddrF::pln_offset
uint8_t pln_offset
Definition: oc12.h:117
NvmeIdNs::nsze
uint64_t nsze
Definition: nvme.h:864
Oc12RwCmd::control
uint16_t control
Definition: oc12.h:76
Oc12Bbt::rsvd2
uint32_t rsvd2[8]
Definition: oc12.h:171
Oc12Ctrl::debug
uint8_t debug
Definition: oc12.h:224
AddrBucket
Definition: oc12.h:242
Oc12IdGroup::num_lun
uint8_t num_lun
Definition: oc12.h:128
oc12_meta_blk_set_erased
static int oc12_meta_blk_set_erased(NvmeNamespace *ns, Oc12Ctrl *ln, uint64_t *psl, int nr_ppas)
Definition: oc12.c:113
Oc12IdCtrl
Definition: oc12.h:149
Oc12AddrF::blk_mask
uint64_t blk_mask
Definition: oc12.h:112
NvmeNamespace::bbtbl
Oc12Bbt ** bbtbl
Definition: nvme.h:1079
Oc12IdCtrl::res
uint8_t res
Definition: oc12.h:153
Oc12IdAddrFormat::pg_len
uint8_t pg_len
Definition: oc12.h:102
Oc12RwCmd
Definition: oc12.h:65
OcCtrlParams::secs_per_pg
uint8_t secs_per_pg
Definition: nvme.h:1155
Oc12Params::num_lun
uint8_t num_lun
Definition: oc12.h:187
Oc12Pmode
Oc12Pmode
Definition: oc12.h:205
Oc12Bbt::tfact
uint32_t tfact
Definition: oc12.h:167
Oc12RwCmd::spba
uint64_t spba
Definition: oc12.h:74
PPA_PG
#define PPA_PG(ln, ppa)
Definition: nand.h:117
set_latency
void set_latency(FemuCtrl *n)
Definition: timing.c:3
OcCtrlParams::sec_size
uint16_t sec_size
Definition: nvme.h:1154
Oc12GetL2PTbl::cid
uint16_t cid
Definition: oc12.h:28
oc12_advance_status
static int oc12_advance_status(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: oc12.c:345
Oc12IdGroup::mpos
uint32_t mpos
Definition: oc12.h:143
oc12_init_id_ctrl
static void oc12_init_id_ctrl(Oc12Ctrl *ln)
Definition: oc12.c:750
Oc12IdGroup
Definition: oc12.h:123
NvmeCmd::opcode
uint16_t opcode
Definition: nvme.h:297
nvme_register_ocssd12
int nvme_register_ocssd12(FemuCtrl *n)
Definition: oc12.c:1084
Oc12RwCmd::dsmgmt
uint32_t dsmgmt
Definition: oc12.h:77
oc12_meta_index
static void * oc12_meta_index(Oc12Ctrl *ln, void *meta, uint32_t index)
Definition: oc12.c:238
Oc12IdCtrl::cgrps
uint8_t cgrps
Definition: oc12.h:152
Oc12RwCmd::metadata
uint64_t metadata
Definition: oc12.h:71
Oc12Ctrl::params
Oc12Params params
Definition: oc12.h:217
Oc12IdCtrl::resv
uint8_t resv[228]
Definition: oc12.h:157
Oc12IdAddrFormat::ch_offset
uint8_t ch_offset
Definition: oc12.h:93
oc12_tbl_size
static uint32_t oc12_tbl_size(NvmeNamespace *ns)
Definition: oc12.c:571
Oc12Params::sec_per_blk
uint32_t sec_per_blk
Definition: oc12.h:191
nvme_map_prp
uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1, uint64_t prp2, uint32_t len, FemuCtrl *n)
Definition: dma.c:23
Oc12Bbt::tblks
uint32_t tblks
Definition: oc12.h:166
oc12_write_oob_meta
static int oc12_write_oob_meta(Oc12Ctrl *ln, uint64_t ppa, void *meta)
Definition: oc12.c:71
oc12_release_locks
static void oc12_release_locks(FemuCtrl *n)
Definition: oc12.c:821
Oc12PMODE_QUAD
@ Oc12PMODE_QUAD
Quad-plane (NVM_IO_QUAD_ACCESS)
Definition: oc12.h:208
oc12_read_ppa_list
static void oc12_read_ppa_list(FemuCtrl *n, Oc12RwCmd *cmd, uint64_t *ppa_list)
Definition: oc12.c:291
Oc12BbtSet::cid
uint16_t cid
Definition: oc12.h:53
Oc12IdCtrl::dom
uint32_t dom
Definition: oc12.h:155
Oc12GetL2PTbl::slba
uint64_t slba
Definition: oc12.h:33
Oc12GetL2PTbl
Definition: oc12.h:25
oc12_init_more
static int oc12_init_more(FemuCtrl *n)
Definition: oc12.c:882
oc12_tbl_initialize
static void oc12_tbl_initialize(NvmeNamespace *ns)
Definition: oc12.c:16
Oc12GetL2PTbl::nsid
uint32_t nsid
Definition: oc12.h:29
Oc12RwCmd
struct Oc12RwCmd Oc12RwCmd
Oc12RwCmd::rsvd2
uint64_t rsvd2
Definition: oc12.h:70
Oc12IdGroup::num_pg
uint16_t num_pg
Definition: oc12.h:132
NvmeIdNs::flbas
uint8_t flbas
Definition: nvme.h:869
Oc12Bbt::blk
uint8_t blk[0]
Definition: oc12.h:172
AddrBucket::pg
int pg
Definition: oc12.h:245
Oc12Bbt::tdresv
uint32_t tdresv
Definition: oc12.h:169
OcCtrlParams::num_pln
uint8_t num_pln
Definition: nvme.h:1160
Oc12RSP_L2P
@ Oc12RSP_L2P
Definition: oc12.h:212
advance_channel_timestamp
int64_t advance_channel_timestamp(FemuCtrl *n, int ch, uint64_t now, int opcode)
Definition: timing.c:38
NvmeRequest::expire_time
int64_t expire_time
io应该结束的时间
Definition: nvme.h:990
Oc12IdGroup::tbem
uint32_t tbem
Definition: oc12.h:142
OC12_CMD_WRITE
@ OC12_CMD_WRITE
Definition: oc12.h:14
Oc12GetL2PTbl::nlb
uint32_t nlb
Definition: oc12.h:34
Oc12AddrF::pg_offset
uint8_t pg_offset
Definition: oc12.h:119
oc12_get_l2p_tbl
static uint16_t oc12_get_l2p_tbl(FemuCtrl *n, NvmeCmd *cmd)
Definition: oc12.c:591
Oc12BbtSet::prp2
uint64_t prp2
Definition: oc12.h:57
FemuCtrl::chnl_next_avail_time
volatile int64_t chnl_next_avail_time[FEMU_MAX_NUM_CHNLS]
Definition: nvme.h:1304
OC12_SEC_ERASED
@ OC12_SEC_ERASED
Definition: oc12.h:22
Oc12DmCmd::spba
uint64_t spba
Definition: oc12.h:87
Oc12Params::num_ch
uint8_t num_ch
Definition: oc12.h:185
FemuCtrl::num_namespaces
uint32_t num_namespaces
Definition: nvme.h:1232
Oc12IdGroup::fmtype
uint8_t fmtype
Definition: oc12.h:125
Oc12Params::max_sec_per_rq
uint8_t max_sec_per_rq
Definition: oc12.h:181
FemuCtrl::mbe
SsdDramBackend * mbe
femu后端内存(实际数据)
Definition: nvme.h:1322
Oc12BbtGet::spba
uint64_t spba
Definition: oc12.h:46
Oc12IdGroup::res16
uint16_t res16
Definition: oc12.h:126
Oc12Params::sos
uint16_t sos
Definition: oc12.h:188
FemuExtCtrlOps::state
void * state
Definition: nvme.h:1170
ppa
describe a physical page addr
Definition: ftl.h:69
qemu_fls
static int qemu_fls(int i)
Definition: oc12.c:3
Oc12Bbt::tgrown
uint32_t tgrown
Definition: oc12.h:168
Oc12IdAddrFormat::pln_offset
uint8_t pln_offset
Definition: oc12.h:97
Oc12IdAddrFormat::pg_offset
uint8_t pg_offset
Definition: oc12.h:101
Oc12Ctrl::read_l2p_tbl
uint8_t read_l2p_tbl
Definition: oc12.h:220
NVME_CMD_READ
@ NVME_CMD_READ
Definition: nvme.h:341
Oc12IdAddrFormat::ch_len
uint8_t ch_len
Definition: oc12.h:94
NvmeRequest::slba
uint64_t slba
开始lba
Definition: nvme.h:972
oc12_bbt_get
static uint16_t oc12_bbt_get(FemuCtrl *n, NvmeCmd *cmd)
Definition: oc12.c:621
Oc12BbtSet::spba
uint64_t spba
Definition: oc12.h:58
Oc12Params::blk_units
uint32_t blk_units
Definition: oc12.h:199
NvmeIdentity::prp2
uint64_t prp2
Definition: nvme.h:413
NVME_CAP_SET_OC
#define NVME_CAP_SET_OC(cap, val)
Definition: nvme.h:117
NVME_INVALID_NSID
@ NVME_INVALID_NSID
Definition: nvme.h:537
OC12_SEC_WRITTEN
@ OC12_SEC_WRITTEN
Definition: oc12.h:21
FemuCtrl::namespaces
NvmeNamespace * namespaces
Definition: nvme.h:1279
Oc12Params
Definition: oc12.h:176
oc12_io_cmd
static uint16_t oc12_io_cmd(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: oc12.c:1043
Oc12BbtSet::nlb
uint16_t nlb
Definition: oc12.h:59
Oc12Bbt
struct Oc12Bbt Oc12Bbt
Oc12DmCommands
Oc12DmCommands
Definition: oc12.h:13
Oc12IdCtrl::cap
uint32_t cap
Definition: oc12.h:154
Oc12BbtGet::rsvd1
uint64_t rsvd1[2]
Definition: oc12.h:43
Oc12Ctrl::meta_buf
uint8_t * meta_buf
Definition: oc12.h:226
oc12_erase_async
static uint16_t oc12_erase_async(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: oc12.c:733
NvmeRequest
Definition: nvme.h:967
Oc12DmCmd::rsvd2
uint32_t rsvd2[3]
Definition: oc12.h:89
Oc12PMODE_SNGL
@ Oc12PMODE_SNGL
Single-plane
Definition: oc12.h:206
Oc12Ctrl::bbt_gen_freq
uint8_t bbt_gen_freq
Definition: oc12.h:221
FemuCtrl::oc_params
OcCtrlParams oc_params
Definition: nvme.h:1299
Oc12GetL2PTbl
struct Oc12GetL2PTbl Oc12GetL2PTbl
NvmeNamespace::ns_blks
uint64_t ns_blks
Definition: nvme.h:1073
Oc12AddrF::ch_mask
uint64_t ch_mask
Definition: oc12.h:109
FemuCtrl::page_size
uint16_t page_size
Definition: nvme.h:1224
Oc12IdAddrFormat::sect_offset
uint8_t sect_offset
Definition: oc12.h:103
Oc12AddrF::sec_offset
uint8_t sec_offset
Definition: oc12.h:120
NVME_INVALID_FIELD
@ NVME_INVALID_FIELD
Definition: nvme.h:528
FEMU_MAX_NUM_CHNLS
#define FEMU_MAX_NUM_CHNLS
Definition: nvme.h:1150
oc12_meta_state_get
static int oc12_meta_state_get(Oc12Ctrl *ln, uint64_t ppa, uint32_t *state)
Definition: oc12.c:96
NVME_ID_NS_FLBAS_INDEX
#define NVME_ID_NS_FLBAS_INDEX(flbas)
Definition: nvme.h:920
Oc12IdAddrFormat::pln_len
uint8_t pln_len
Definition: oc12.h:98
OC12_CMD_ERASE
@ OC12_CMD_ERASE
Definition: oc12.h:16
Oc12IdGroup
struct Oc12IdGroup Oc12IdGroup
PPA_CH
#define PPA_CH(ln, ppa)
Definition: nand.h:113
Oc12BbtSet
struct Oc12BbtSet Oc12BbtSet
Oc12BbtSet::rsvd1
uint64_t rsvd1[2]
Definition: oc12.h:55
oc12_metadata_format::state
uint32_t state
Definition: oc12.h:233
femu_err
#define femu_err(fmt,...)
Definition: nvme.h:1511