-
Notifications
You must be signed in to change notification settings - Fork 2
/
data_buffer_ccmd.h
59 lines (43 loc) · 1.91 KB
/
data_buffer_ccmd.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef SRC_DATA_BUFFER_CCMD_H_
#define SRC_DATA_BUFFER_CCMD_H_
#include "ftl_config.h"
#define AVAILABLE_CCMD_DATA_BUFFER_ENTRY_COUNT (1 * USER_DIES)
#define CCMD_DATA_BUF_NONE 0xffff
#define CCMD_DATA_BUF_FAIL 0xffff
#define CCMD_DATA_BUF_DIRTY 1
#define CCMD_DATA_BUF_CLEAN 0
#define FindCcmdDataBufHashTableEntry(logicalSliceAddr) ((logicalSliceAddr) % AVAILABLE_CCMD_DATA_BUFFER_ENTRY_COUNT)
typedef struct _CCMD_DATA_BUF_ENTRY {
unsigned int logicalSliceAddr;
unsigned int prevEntry : 16;
unsigned int nextEntry : 16;
unsigned int blockingReqTail : 16;
unsigned int hashPrevEntry : 16;
unsigned int hashNextEntry : 16;
unsigned int dirty : 1;
unsigned int reserved0 : 15;
} CCMD_DATA_BUF_ENTRY, *P_CCMD_DATA_BUF_ENTRY;
typedef struct _CCMD_DATA_BUF_MAP{
CCMD_DATA_BUF_ENTRY dataBuf[AVAILABLE_DATA_BUFFER_ENTRY_COUNT];
} CCMD_DATA_BUF_MAP, *P_CCMD_DATA_BUF_MAP;
typedef struct _CCMD_DATA_BUF_LRU_LIST {
unsigned int headEntry : 16;
unsigned int tailEntry : 16;
} CCMD_DATA_BUF_LRU_LIST, *P_CCMD_DATA_BUF_LRU_LIST;
typedef struct _CCMD_DATA_BUF_HASH_ENTRY{
unsigned int headEntry : 16;
unsigned int tailEntry : 16;
} CCMD_DATA_BUF_HASH_ENTRY, *P_CCMD_DATA_BUF_HASH_ENTRY;
typedef struct _CCMD_DATA_BUF_HASH_TABLE{
CCMD_DATA_BUF_HASH_ENTRY dataBufHash[AVAILABLE_DATA_BUFFER_ENTRY_COUNT];
} CCMD_DATA_BUF_HASH_TABLE, *P_CCMD_DATA_BUF_HASH_TABLE;
void InitCcmdDataBuf();
unsigned int CheckCcmdDataBufHit(unsigned int reqSlotTag);
unsigned int AllocateCcmdDataBuf();
void UpdateCcmdDataBufEntryInfoBlockingReq(unsigned int bufEntry, unsigned int reqSlotTag);
void PutToCcmdDataBufHashList(unsigned int bufEntry);
void SelectiveGetFromCcmdDataBufHashList(unsigned int bufEntry);
extern P_CCMD_DATA_BUF_MAP ccmdDataBufMapPtr;
extern CCMD_DATA_BUF_LRU_LIST ccmdDataBufLruList;
extern P_CCMD_DATA_BUF_HASH_TABLE ccmdDataBufHashTable;
#endif /* SRC_DATA_BUFFER_CCMD_H_ */