#include "../nvme.h"

| 结构体 | |
| struct | Oc20ChunkState | 
| struct | Oc20RwCmd | 
| struct | Oc20DmCmd | 
| struct | Oc20AddrF | 
| struct | Oc20IdGeo | 
| struct | Oc20IdWrt | 
| struct | Oc20IdPerf | 
| struct | Oc20IdLBAF | 
| struct | Oc20Header | 
| struct | Oc20NamespaceGeometry | 
| struct | Oc20Ctrl | 
| struct | Oc20Namespace | 
| struct | Oc20AddrBucket | 
| 宏定义 | |
| #define | OC20_VID (0x1d1d) | 
| #define | OC20_DID (0x1f1f) | 
| #define | OC20_MAGIC ('L' << 24 | 'N' << 16 | 'V' << 8 | 'M') | 
| #define | OC20_CMD_MAX_LBAS (64) | 
| #define | OC20_NS_LOGPAGE_CHUNK_INFO_BLK_OFFSET(ns) ((ns)->blk.begin + sizeof(Oc20NamespaceGeometry)) | 
| #define | OC20_LBA_GET_SECTR(lbaf, lba) | 
| #define | OC20_LBA_GET_CHUNK(lbaf, lba) | 
| #define | OC20_LBA_GET_PUNIT(lbaf, lba) | 
| #define | OC20_LBA_GET_GROUP(lbaf, lba) (lba >> (lbaf)->grp_offset) | 
| #define | OC20_LBA(lbaf, group, punit, chunk, sectr) | 
| #define | OC20_GROUP_FROM_CHUNK_INDEX(lns, idx) (idx / (lns)->chks_per_grp) | 
| #define | OC20_PUNIT_FROM_CHUNK_INDEX(lns, idx) (idx % (lns)->chks_per_grp / (lns)->chks_per_lun) | 
| #define | OC20_CHUNK_FROM_CHUNK_INDEX(lns, idx) (idx % (lns)->chks_per_lun) | 
| #define | OC20_LBA_FROM_CHUNK_INDEX(lns, idx) | 
| #define | OC20_LBA_FORMAT_TEMPLATE "lba 0xffffffffffffffff pugrp 255 punit 255 chunk 65535 sectr 4294967295" | 
| #define | OC20_CHUNK_RESETABLE (OC20_CHUNK_FREE | OC20_CHUNK_CLOSED | OC20_CHUNK_OPEN) | 
| 类型定义 | |
| typedef struct Oc20ChunkState | Oc20CS | 
| typedef struct Oc20RwCmd | Oc20RwCmd | 
| typedef struct Oc20DmCmd | Oc20DmCmd | 
| typedef struct Oc20AddrF | Oc20AddrF | 
| typedef struct Oc20IdGeo | Oc20IdGeo | 
| typedef struct Oc20IdWrt | Oc20IdWrt | 
| typedef struct Oc20IdPerf | Oc20IdPerf | 
| typedef struct Oc20IdLBAF | Oc20IdLBAF | 
| typedef struct Oc20Header | Oc20Header | 
| typedef struct Oc20NamespaceGeometry | Oc20NamespaceGeometry | 
| typedef struct Oc20Ctrl | Oc20Ctrl | 
| typedef struct Oc20Namespace | Oc20Namespace | 
| typedef struct Oc20AddrBucket | Oc20AddrBucket | 
| typedef struct NvmeRequest | NvmeRequest | 
| typedef struct FemuCtrl | FemuCtrl | 
| 枚举 | |
| enum | Oc20IoCommands { OC20_CMD_VECT_ERASE = 0x90, OC20_CMD_VECT_WRITE = 0x91, OC20_CMD_VECT_READ = 0x92 } | 
| enum | Oc20MetaStates { OC20_SEC_UNKNOWN = 0x0, OC20_SEC_WRITTEN = 0xAC, OC20_SEC_ERASED = 0xDC } | 
| enum | Oc20ChunkStates { OC20_CHUNK_FREE = 1 << 0, OC20_CHUNK_CLOSED = 1 << 1, OC20_CHUNK_OPEN = 1 << 2, OC20_CHUNK_OFFLINE = 1 << 3 } | 
| enum | Oc20ChunkTypes { OC20_CHUNK_TYPE_SEQ = 1 << 0, OC20_CHUNK_TYPE_RAN = 1 << 1, OC20_CHUNK_TYPE_SRK = 1 << 4 } | 
| enum | Oc20StatusCodes { OC20_LBAL_SGL_LENGTH_INVALID = 0x01c1, OC20_WRITE_NEXT_UNIT = 0x02f0, OC20_CHUNK_EARLY_CLOSE = 0x02f1, OC20_OUT_OF_ORDER_WRITE = 0x02f2, OC20_OFFLINE_CHUNK = 0x02c0, OC20_INVALID_RESET = 0x02c1 } | 
| enum | Oc20ParamsMccap { OC20_PARAMS_MCCAP_MULTIPLE_RESETS = 0x1 << 1, OC20_PARAMS_MCCAP_EARLY_RESET = 0x1 << 2 } | 
| enum | Oc20LogPage { OC20_CHUNK_INFO = 0xCA } | 
| 函数 | |
| static void | _oc20_check_size (void) | 
| static int | nvme_rw_is_write (NvmeRequest *req) | 
| static int | oc20_rw_is_write (NvmeRequest *req) | 
| static uint64_t | nvme_lba_to_sector_index (FemuCtrl *n, NvmeNamespace *ns, uint64_t lba) | 
| static int | oc20_lba_valid (FemuCtrl *n, NvmeNamespace *ns, uint64_t lba) | 
| static uint64_t | oc20_lba_to_chunk_index (FemuCtrl *n, NvmeNamespace *ns, uint64_t lba) | 
| static uint64_t | oc20_lba_to_sector_index (FemuCtrl *n, NvmeNamespace *ns, uint64_t lba) | 
| #define OC20_CHUNK_FROM_CHUNK_INDEX | ( | lns, | |
| idx | |||
| ) | (idx % (lns)->chks_per_lun) | 
| #define OC20_CHUNK_RESETABLE (OC20_CHUNK_FREE | OC20_CHUNK_CLOSED | OC20_CHUNK_OPEN) | 
| #define OC20_CMD_MAX_LBAS (64) | 
| #define OC20_DID (0x1f1f) | 
| #define OC20_GROUP_FROM_CHUNK_INDEX | ( | lns, | |
| idx | |||
| ) | (idx / (lns)->chks_per_grp) | 
| #define OC20_LBA | ( | lbaf, | |
| group, | |||
| punit, | |||
| chunk, | |||
| sectr | |||
| ) | 
| #define OC20_LBA_FORMAT_TEMPLATE "lba 0xffffffffffffffff pugrp 255 punit 255 chunk 65535 sectr 4294967295" | 
| #define OC20_LBA_FROM_CHUNK_INDEX | ( | lns, | |
| idx | |||
| ) | 
| #define OC20_MAGIC ('L' << 24 | 'N' << 16 | 'V' << 8 | 'M') | 
| #define OC20_NS_LOGPAGE_CHUNK_INFO_BLK_OFFSET | ( | ns | ) | ((ns)->blk.begin + sizeof(Oc20NamespaceGeometry)) | 
| #define OC20_PUNIT_FROM_CHUNK_INDEX | ( | lns, | |
| idx | |||
| ) | (idx % (lns)->chks_per_grp / (lns)->chks_per_lun) | 
| #define OC20_VID (0x1d1d) | 
| typedef struct NvmeRequest NvmeRequest | 
| typedef struct Oc20AddrBucket Oc20AddrBucket | 
| typedef struct Oc20ChunkState Oc20CS | 
| typedef struct Oc20Header Oc20Header | 
| typedef struct Oc20IdLBAF Oc20IdLBAF | 
| typedef struct Oc20IdPerf Oc20IdPerf | 
| typedef struct Oc20Namespace Oc20Namespace | 
| typedef struct Oc20NamespaceGeometry Oc20NamespaceGeometry | 
| enum Oc20ChunkStates | 
| enum Oc20ChunkTypes | 
| enum Oc20IoCommands | 
| enum Oc20LogPage | 
| enum Oc20MetaStates | 
| enum Oc20ParamsMccap | 
| enum Oc20StatusCodes | 
| 
 | inlinestatic | 
| 
 | inlinestatic | 
| 
 | inlinestatic | 

| 
 | inlinestatic | 

| 
 | inlinestatic | 

| 
 | inlinestatic | 

| 
 | inlinestatic | 

