FEMU  原版 master 7e238cc
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
oc20.h 文件参考
#include "../nvme.h"
oc20.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

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)
 

宏定义说明

◆ OC20_CHUNK_FROM_CHUNK_INDEX

#define OC20_CHUNK_FROM_CHUNK_INDEX (   lns,
  idx 
)    (idx % (lns)->chks_per_lun)

◆ OC20_CHUNK_RESETABLE

#define OC20_CHUNK_RESETABLE   (OC20_CHUNK_FREE | OC20_CHUNK_CLOSED | OC20_CHUNK_OPEN)

◆ OC20_CMD_MAX_LBAS

#define OC20_CMD_MAX_LBAS   (64)

◆ OC20_DID

#define OC20_DID   (0x1f1f)

◆ OC20_GROUP_FROM_CHUNK_INDEX

#define OC20_GROUP_FROM_CHUNK_INDEX (   lns,
  idx 
)    (idx / (lns)->chks_per_grp)

◆ OC20_LBA

#define OC20_LBA (   lbaf,
  group,
  punit,
  chunk,
  sectr 
)
值:
(sectr << (lbaf)->sec_offset \
| chunk << (lbaf)->chk_offset \
| punit << (lbaf)->lun_offset \
| group << (lbaf)->grp_offset)

◆ OC20_LBA_FORMAT_TEMPLATE

#define OC20_LBA_FORMAT_TEMPLATE   "lba 0xffffffffffffffff pugrp 255 punit 255 chunk 65535 sectr 4294967295"

◆ OC20_LBA_FROM_CHUNK_INDEX

#define OC20_LBA_FROM_CHUNK_INDEX (   lns,
  idx 
)
值:
<< (lns)->lbaf.grp_offset \
<< (lns)->lbaf.lun_offset \
<< (lns)->lbaf.chk_offset)

◆ OC20_LBA_GET_CHUNK

#define OC20_LBA_GET_CHUNK (   lbaf,
  lba 
)
值:
((lba & (lbaf)->chk_mask) \
>> (lbaf)->chk_offset)

◆ OC20_LBA_GET_GROUP

#define OC20_LBA_GET_GROUP (   lbaf,
  lba 
)    (lba >> (lbaf)->grp_offset)

◆ OC20_LBA_GET_PUNIT

#define OC20_LBA_GET_PUNIT (   lbaf,
  lba 
)
值:
((lba & (lbaf)->lun_mask) \
>> (lbaf)->lun_offset)

◆ OC20_LBA_GET_SECTR

#define OC20_LBA_GET_SECTR (   lbaf,
  lba 
)
值:
((lba & (lbaf)->sec_mask) \
>> (lbaf)->sec_offset)

◆ OC20_MAGIC

#define OC20_MAGIC   ('L' << 24 | 'N' << 16 | 'V' << 8 | 'M')

◆ OC20_NS_LOGPAGE_CHUNK_INFO_BLK_OFFSET

#define OC20_NS_LOGPAGE_CHUNK_INFO_BLK_OFFSET (   ns)    ((ns)->blk.begin + sizeof(Oc20NamespaceGeometry))

◆ OC20_PUNIT_FROM_CHUNK_INDEX

#define OC20_PUNIT_FROM_CHUNK_INDEX (   lns,
  idx 
)    (idx % (lns)->chks_per_grp / (lns)->chks_per_lun)

◆ OC20_VID

#define OC20_VID   (0x1d1d)

类型定义说明

◆ FemuCtrl

typedef struct FemuCtrl FemuCtrl

◆ NvmeRequest

typedef struct NvmeRequest NvmeRequest

◆ Oc20AddrBucket

◆ Oc20AddrF

typedef struct Oc20AddrF Oc20AddrF

◆ Oc20CS

typedef struct Oc20ChunkState Oc20CS

◆ Oc20Ctrl

typedef struct Oc20Ctrl Oc20Ctrl

◆ Oc20DmCmd

typedef struct Oc20DmCmd Oc20DmCmd

◆ Oc20Header

typedef struct Oc20Header Oc20Header

◆ Oc20IdGeo

typedef struct Oc20IdGeo Oc20IdGeo

◆ Oc20IdLBAF

typedef struct Oc20IdLBAF Oc20IdLBAF

◆ Oc20IdPerf

typedef struct Oc20IdPerf Oc20IdPerf

◆ Oc20IdWrt

typedef struct Oc20IdWrt Oc20IdWrt

◆ Oc20Namespace

typedef struct Oc20Namespace Oc20Namespace

◆ Oc20NamespaceGeometry

◆ Oc20RwCmd

typedef struct Oc20RwCmd Oc20RwCmd

枚举类型说明

◆ Oc20ChunkStates

枚举值
OC20_CHUNK_FREE 
OC20_CHUNK_CLOSED 
OC20_CHUNK_OPEN 
OC20_CHUNK_OFFLINE 

◆ Oc20ChunkTypes

枚举值
OC20_CHUNK_TYPE_SEQ 
OC20_CHUNK_TYPE_RAN 
OC20_CHUNK_TYPE_SRK 

◆ Oc20IoCommands

枚举值
OC20_CMD_VECT_ERASE 
OC20_CMD_VECT_WRITE 
OC20_CMD_VECT_READ 

◆ Oc20LogPage

枚举值
OC20_CHUNK_INFO 

◆ Oc20MetaStates

枚举值
OC20_SEC_UNKNOWN 
OC20_SEC_WRITTEN 
OC20_SEC_ERASED 

◆ Oc20ParamsMccap

枚举值
OC20_PARAMS_MCCAP_MULTIPLE_RESETS 
OC20_PARAMS_MCCAP_EARLY_RESET 

◆ Oc20StatusCodes

枚举值
OC20_LBAL_SGL_LENGTH_INVALID 
OC20_WRITE_NEXT_UNIT 
OC20_CHUNK_EARLY_CLOSE 
OC20_OUT_OF_ORDER_WRITE 
OC20_OFFLINE_CHUNK 
OC20_INVALID_RESET 

函数说明

◆ _oc20_check_size()

static void _oc20_check_size ( void  )
inlinestatic

◆ nvme_lba_to_sector_index()

static uint64_t nvme_lba_to_sector_index ( FemuCtrl n,
NvmeNamespace ns,
uint64_t  lba 
)
inlinestatic

◆ nvme_rw_is_write()

static int nvme_rw_is_write ( NvmeRequest req)
inlinestatic
这是这个函数的调用关系图:

◆ oc20_lba_to_chunk_index()

static uint64_t oc20_lba_to_chunk_index ( FemuCtrl n,
NvmeNamespace ns,
uint64_t  lba 
)
inlinestatic
这是这个函数的调用关系图:

◆ oc20_lba_to_sector_index()

static uint64_t oc20_lba_to_sector_index ( FemuCtrl n,
NvmeNamespace ns,
uint64_t  lba 
)
inlinestatic
这是这个函数的调用关系图:

◆ oc20_lba_valid()

static int oc20_lba_valid ( FemuCtrl n,
NvmeNamespace ns,
uint64_t  lba 
)
inlinestatic
这是这个函数的调用关系图:

◆ oc20_rw_is_write()

static int oc20_rw_is_write ( NvmeRequest req)
inlinestatic
函数调用图:
这是这个函数的调用关系图:
OC20_CHUNK_FROM_CHUNK_INDEX
#define OC20_CHUNK_FROM_CHUNK_INDEX(lns, idx)
Definition: oc20.h:41
lba
uint64_t lba
Definition: oc12.h:2
OC20_GROUP_FROM_CHUNK_INDEX
#define OC20_GROUP_FROM_CHUNK_INDEX(lns, idx)
Definition: oc20.h:35
OC20_PUNIT_FROM_CHUNK_INDEX
#define OC20_PUNIT_FROM_CHUNK_INDEX(lns, idx)
Definition: oc20.h:38