OpenSSD Cosmos+ Platform Firmware  0.0.2
The firmware of Cosmos+ OpenSSD Platform for TOSHIBA nand flash module.
request_schedule.h
Go to the documentation of this file.
1
2// request_schedule.h for Cosmos+ OpenSSD
3// Copyright (c) 2017 Hanyang University ENC Lab.
4// Contributed by Yong Ho Song <yhsong@enc.hanyang.ac.kr>
5// Jaewook Kwak <jwkwak@enc.hanyang.ac.kr>
6// Sangjin Lee <sjlee@enc.hanyang.ac.kr>
7//
8// This file is part of Cosmos+ OpenSSD.
9//
10// Cosmos+ OpenSSD is free software; you can redistribute it and/or modify
11// it under the terms of the GNU General Public License as published by
12// the Free Software Foundation; either version 3, or (at your option)
13// any later version.
14//
15// Cosmos+ OpenSSD is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18// See the GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Cosmos+ OpenSSD; see the file COPYING.
22// If not, see <http://www.gnu.org/licenses/>.
24
26// Company: ENC Lab. <http://enc.hanyang.ac.kr>
27// Engineer: Jaewook Kwak <jwkwak@enc.hanyang.ac.kr>
28//
29// Project Name: Cosmos+ OpenSSD
30// Design Name: Cosmos+ Firmware
31// Module Name: Request Scheduler
32// File Name: request_schedule.h
33//
34// Version: v1.0.0
35//
36// Description:
37// - define parameters, data structure and functions of request scheduler
39
41// Revision History:
42//
43// * v1.0.0
44// - First draft
46
47#ifndef REQUEST_SCHEDULE_H_
48#define REQUEST_SCHEDULE_H_
49
50#include "ftl_config.h"
51
52#define WAY_NONE 0xF
53
54#define LUN_0_BASE_ADDR 0x00000000
55#define LUN_1_BASE_ADDR 0x00100000
56
57#define PSEUDO_BAD_BLOCK_MARK 0
58
66#define RETRY_LIMIT 5
67
68#define DIE_STATE_IDLE 0
69#define DIE_STATE_EXE 1
70
71#define REQ_STATUS_CHECK_OPT_NONE 0 // no need to check the request status
72#define REQ_STATUS_CHECK_OPT_CHECK 1 //
73#define REQ_STATUS_CHECK_OPT_REPORT 2 //
74#define REQ_STATUS_CHECK_OPT_COMPLETION_FLAG 3 // only for READ_TRANSFER
75
76/* -------------------------------------------------------------------------- */
77/* possible request states if dieState is DIE_STATE_EXE */
78/* -------------------------------------------------------------------------- */
79
80#define REQ_STATUS_RUNNING 0
81#define REQ_STATUS_DONE 1
82#define REQ_STATUS_FAIL 2
83#define REQ_STATUS_WARNING 3
84
85#define ERROR_INFO_FAIL 0
86#define ERROR_INFO_PASS 1
87#define ERROR_INFO_WARNING 2
88
90{
93
95{
98
99typedef struct _ERROR_INFO_TABLE
100{
103
104typedef struct _RETRY_LIMIT_TABLE
105{
108
122typedef struct _DIE_STATE_ENTRY
123{
124 unsigned int dieState : 8; // 0 for DIE_STATE_IDLE, 1 for DIE_STATE_EXE
125 unsigned int reqStatusCheckOpt : 4; // one of the four: NONE, CHECK, REPORT, COMPLETE
126 unsigned int prevWay : 4; // the die state entry index of prev way in the same list
127 unsigned int nextWay : 4; // the die state entry index of next way in the same list
128 unsigned int reserved : 12;
130
136typedef struct _DIE_STATE_TABLE
137{
140
160{
161 unsigned int idleHead : 4;
162 unsigned int idleTail : 4;
163 unsigned int statusReportHead : 4;
164 unsigned int statusReportTail : 4;
165 unsigned int readTriggerHead : 4;
166 unsigned int readTriggerTail : 4;
167 unsigned int writeHead : 4;
168 unsigned int writeTail : 4;
169 unsigned int readTransferHead : 4;
170 unsigned int readTransferTail : 4;
171 unsigned int eraseHead : 4;
172 unsigned int eraseTail : 4;
173 unsigned int statusCheckHead : 4;
174 unsigned int statusCheckTail : 4;
175 unsigned int reserved : 8;
177
182{
185
186void InitReqScheduler();
187
189void SyncAvailFreeReq();
190void SyncReleaseEraseReq(unsigned int chNo, unsigned int wayNo, unsigned int blockNo);
191void SchedulingNandReq();
192void SchedulingNandReqPerCh(unsigned int chNo);
193
194void PutToNandWayPriorityTable(unsigned int reqSlotTag, unsigned int chNo, unsigned int wayNo);
195void PutToNandIdleList(unsigned int chNo, unsigned int wayNo);
196void SelectivGetFromNandIdleList(unsigned int chNo, unsigned int wayNo);
197void PutToNandStatusReportList(unsigned int chNo, unsigned int wayNo);
198void SelectivGetFromNandStatusReportList(unsigned int chNo, unsigned int wayNo);
199void PutToNandReadTriggerList(unsigned int chNo, unsigned int wayNo);
200void SelectiveGetFromNandReadTriggerList(unsigned int chNo, unsigned int wayNo);
201void PutToNandWriteList(unsigned int chNo, unsigned int wayNo);
202void SelectiveGetFromNandWriteList(unsigned int chNo, unsigned int wayNo);
203void PutToNandReadTransferList(unsigned int chNo, unsigned int wayNo);
204void SelectiveGetFromNandReadTransferList(unsigned int chNo, unsigned int wayNo);
205void PutToNandEraseList(unsigned int chNo, unsigned int wayNo);
206void SelectiveGetFromNandEraseList(unsigned int chNo, unsigned int wayNo);
207void PutToNandStatusCheckList(unsigned int chNo, unsigned int wayNo);
208void SelectiveGetFromNandStatusCheckList(unsigned int chNo, unsigned int wayNo);
209
210void IssueNandReq(unsigned int chNo, unsigned int wayNo);
211unsigned int GenerateNandRowAddr(unsigned int reqSlotTag);
212unsigned int GenerateDataBufAddr(unsigned int reqSlotTag);
213unsigned int GenerateSpareDataBufAddr(unsigned int reqSlotTag);
214unsigned int CheckReqStatus(unsigned int chNo, unsigned int wayNo);
215unsigned int CheckEccErrorInfo(unsigned int chNo, unsigned int wayNo);
216
217void ExecuteNandReq(unsigned int chNo, unsigned int wayNo, unsigned int reqStatus);
218
225
226#endif /* REQUEST_SCHEDULE_H_ */
#define USER_CHANNELS
Definition: ftl_config.h:207
#define ERROR_INFO_WORD_COUNT
Definition: ftl_config.h:188
#define USER_WAYS
Definition: ftl_config.h:208
unsigned int GenerateDataBufAddr(unsigned int reqSlotTag)
Get the corresponding data buffer entry address of the given request.
struct _WAY_PRIORITY_ENTRY WAY_PRIORITY_ENTRY
The way priority table of this channel.
void SyncReleaseEraseReq(unsigned int chNo, unsigned int wayNo, unsigned int blockNo)
Issuing requests until the specified block can be erased.
void PutToNandEraseList(unsigned int chNo, unsigned int wayNo)
Append the specified die to the tail of the erase list of its channel.
struct _STATUS_REPORT_TABLE * P_STATUS_REPORT_TABLE
struct _ERROR_INFO_TABLE * P_ERROR_INFO_TABLE
struct _STATUS_REPORT_TABLE STATUS_REPORT_TABLE
void IssueNandReq(unsigned int chNo, unsigned int wayNo)
Issue a flash operations to the storage controller.
struct _RETRY_LIMIT_TABLE * P_RETRY_LIMIT_TABLE
P_RETRY_LIMIT_TABLE retryLimitTablePtr
P_DIE_STATE_TABLE dieStatusTablePtr
P_COMPLETE_FLAG_TABLE completeFlagTablePtr
void SelectiveGetFromNandReadTriggerList(unsigned int chNo, unsigned int wayNo)
Remove the specified die from the read trigger list of its channel.
void SelectivGetFromNandIdleList(unsigned int chNo, unsigned int wayNo)
Remove the specified die from the idle list of its channel.
void SyncAllLowLevelReqDone()
Do schedule until all the requests are done.
void InitReqScheduler()
Initialize scheduling related tables.
void SelectivGetFromNandStatusReportList(unsigned int chNo, unsigned int wayNo)
Remove the specified die from the status report list of its channel.
unsigned int GenerateSpareDataBufAddr(unsigned int reqSlotTag)
Get the corresponding sparse data buffer entry address of the given request.
void PutToNandReadTriggerList(unsigned int chNo, unsigned int wayNo)
Append the specified die to the tail of the read trigger list of its channel.
struct _COMPLETE_FLAG_TABLE * P_COMPLETE_FLAG_TABLE
void SyncAvailFreeReq()
Try release request entries by doing scheduling (both NVMe and NAND).
struct _WAY_PRIORITY_TABLE * P_WAY_PRIORITY_TABLE
struct _RETRY_LIMIT_TABLE RETRY_LIMIT_TABLE
unsigned int CheckEccErrorInfo(unsigned int chNo, unsigned int wayNo)
unsigned int CheckReqStatus(unsigned int chNo, unsigned int wayNo)
Update the die status and return the request status.
void SchedulingNandReqPerCh(unsigned int chNo)
The main function to schedule NAND requests on the specified channel.
P_WAY_PRIORITY_TABLE wayPriorityTablePtr
void PutToNandStatusReportList(unsigned int chNo, unsigned int wayNo)
Append the specified die to the tail of the status report list of its channel.
void SelectiveGetFromNandWriteList(unsigned int chNo, unsigned int wayNo)
Remove the specified die from the write list of its channel.
struct _DIE_STATE_TABLE * P_DIE_STATE_TABLE
void PutToNandWayPriorityTable(unsigned int reqSlotTag, unsigned int chNo, unsigned int wayNo)
Append the specified die to a NAND state list based on the request type of the given request.
struct _WAY_PRIORITY_TABLE WAY_PRIORITY_TABLE
The channel status table, each entry contains 7 lists.
void PutToNandStatusCheckList(unsigned int chNo, unsigned int wayNo)
Append the specified die to the tail of the status check list of its channel.
void SelectiveGetFromNandEraseList(unsigned int chNo, unsigned int wayNo)
Remove the specified die from the erase list of its channel.
void PutToNandWriteList(unsigned int chNo, unsigned int wayNo)
Append the specified die to the tail of the write list of its channel.
void ExecuteNandReq(unsigned int chNo, unsigned int wayNo, unsigned int reqStatus)
Update die state and issue new NAND requests if the die is in IDLE state.
P_ERROR_INFO_TABLE eccErrorInfoTablePtr
void SelectiveGetFromNandReadTransferList(unsigned int chNo, unsigned int wayNo)
Remove the specified die from the read transfer list of its channel.
struct _DIE_STATE_ENTRY * P_DIE_STATE_ENTRY
struct _WAY_PRIORITY_ENTRY * P_WAY_PRIORITY_ENTRY
void PutToNandIdleList(unsigned int chNo, unsigned int wayNo)
Append the specified die to the tail of the idle list of its channel.
struct _DIE_STATE_TABLE DIE_STATE_TABLE
The status table of each die on the flash memory.
P_STATUS_REPORT_TABLE statusReportTablePtr
struct _ERROR_INFO_TABLE ERROR_INFO_TABLE
unsigned int GenerateNandRowAddr(unsigned int reqSlotTag)
Get the nand row (block) address of the given request.
void PutToNandReadTransferList(unsigned int chNo, unsigned int wayNo)
Append the specified die to the tail of the read transfer list of its channel.
void SelectiveGetFromNandStatusCheckList(unsigned int chNo, unsigned int wayNo)
Remove the specified die from the status check list of its channel.
struct _COMPLETE_FLAG_TABLE COMPLETE_FLAG_TABLE
void SchedulingNandReq()
Iteratively do schedule on each channel by calling SchedulingNandReqPerCh.
struct _DIE_STATE_ENTRY DIE_STATE_ENTRY
unsigned int completeFlag[USER_CHANNELS][USER_WAYS]
unsigned int nextWay
unsigned int prevWay
unsigned int reserved
unsigned int dieState
unsigned int reqStatusCheckOpt
The status table of each die on the flash memory.
DIE_STATE_ENTRY dieState[USER_CHANNELS][USER_WAYS]
unsigned int errorInfo[USER_CHANNELS][USER_WAYS][ERROR_INFO_WORD_COUNT]
int retryLimit[USER_CHANNELS][USER_WAYS]
unsigned int statusReport[USER_CHANNELS][USER_WAYS]
The way priority table of this channel.
unsigned int readTransferHead
unsigned int readTriggerHead
unsigned int writeHead
unsigned int statusCheckTail
unsigned int eraseTail
unsigned int statusReportHead
unsigned int statusCheckHead
unsigned int idleTail
unsigned int readTransferTail
unsigned int statusReportTail
unsigned int idleHead
unsigned int reserved
unsigned int readTriggerTail
unsigned int eraseHead
unsigned int writeTail
The channel status table, each entry contains 7 lists.
WAY_PRIORITY_ENTRY wayPriority[USER_CHANNELS]