OpenSSD Cosmos+ Platform Firmware  0.0.2
The firmware of Cosmos+ OpenSSD Platform for TOSHIBA nand flash module.
request_format.h
Go to the documentation of this file.
1
2// request_format.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//
7// This file is part of Cosmos+ OpenSSD.
8//
9// Cosmos+ OpenSSD is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; either version 3, or (at your option)
12// any later version.
13//
14// Cosmos+ OpenSSD is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17// See the GNU General Public License for more details.
18//
19// You should have received a copy of the GNU General Public License
20// along with Cosmos+ OpenSSD; see the file COPYING.
21// If not, see <http://www.gnu.org/licenses/>.
23
25// Company: ENC Lab. <http://enc.hanyang.ac.kr>
26// Engineer: Jaewook Kwak <jwkwak@enc.hanyang.ac.kr>
27//
28// Project Name: Cosmos+ OpenSSD
29// Design Name: Cosmos+ Firmware
30// Module Name: Request Allocator
31// File Name: request_format.h
32//
33// Version: v1.0.0
34//
35// Description:
36// - define parameters, data structure of request
38
40// Revision History:
41//
42// * v1.0.0
43// - First draft
45
46#ifndef REQUEST_FORMAT_H_
47#define REQUEST_FORMAT_H_
48
49#include "nvme/nvme.h"
50
51#define REQ_TYPE_SLICE 0x0
52#define REQ_TYPE_NAND 0x1 // flash or flash DMA operation
53#define REQ_TYPE_NVME_DMA 0x2 // host DMA
54
60#define REQ_QUEUE_TYPE_NONE 0x0
61#define REQ_QUEUE_TYPE_FREE 0x1
62#define REQ_QUEUE_TYPE_SLICE 0x2
63#define REQ_QUEUE_TYPE_BLOCKED_BY_BUF_DEP 0x3
64#define REQ_QUEUE_TYPE_BLOCKED_BY_ROW_ADDR_DEP 0x4
65#define REQ_QUEUE_TYPE_NVME_DMA 0x5
66#define REQ_QUEUE_TYPE_NAND 0x6
67
72#define REQ_CODE_WRITE 0x00
73#define REQ_CODE_READ 0x08 // read trigger
74#define REQ_CODE_READ_TRANSFER 0x09 // read transfer
75#define REQ_CODE_ERASE 0x0C
76#define REQ_CODE_RESET 0x0D // currently only used in FTL initialization stage
77#define REQ_CODE_SET_FEATURE 0x0E // currently only used in FTL initialization stage
78#define REQ_CODE_FLUSH 0x0F
79#define REQ_CODE_RxDMA 0x10
80#define REQ_CODE_TxDMA 0x20
81
82#define REQ_CODE_OCSSD_PHY_TYPE_BASE 0xA0
83#define REQ_CODE_OCSSD_PHY_WRITE 0xA0
84#define REQ_CODE_OCSSD_PHY_READ 0xA8
85#define REQ_CODE_OCSSD_PHY_ERASE 0xAC
86
101#define REQ_OPT_DATA_BUF_ENTRY 0 // View `dataBufFormat` as buffer entry index, used by most requests.
102#define REQ_OPT_DATA_BUF_TEMP_ENTRY 1 // View `dataBufFormat` as buffer entry index, used by GC only.
103#define REQ_OPT_DATA_BUF_ADDR 2 // View `dataBufFormat` as DRAM address, currently used by BBT only.
104#define REQ_OPT_DATA_BUF_NONE 3 // for ERASE, RESET, SET_FEATURE (no buffer needed).
105
106#define REQ_OPT_NAND_ADDR_VSA 0 // the data stored in `nandInfo` is Virtual Slice Address.
107#define REQ_OPT_NAND_ADDR_PHY_ORG 1 // the data stored in `nandInfo` is Physical Flash Info.
108
109#define REQ_OPT_NAND_ECC_OFF 0
110#define REQ_OPT_NAND_ECC_ON 1
111
112#define REQ_OPT_NAND_ECC_WARNING_OFF 0
113#define REQ_OPT_NAND_ECC_WARNING_ON 1
114
115#define REQ_OPT_WRAPPING_NONE 0
116#define REQ_OPT_WRAPPING_REQ 1
117
118// no need to check dep for this request, may be used by information related operations.
119#define REQ_OPT_ROW_ADDR_DEPENDENCY_NONE 0
120// we should check dep for this request, basically was used by NAND I/O operations.
121#define REQ_OPT_ROW_ADDR_DEPENDENCY_CHECK 1
122
142#define REQ_OPT_BLOCK_SPACE_MAIN 0 // main blocks only
143#define REQ_OPT_BLOCK_SPACE_TOTAL 1 // main blocks and extended blocks
144
145#define LOGICAL_SLICE_ADDR_NONE 0xffffffff
146
155typedef struct _DATA_BUF_INFO
156{
157 union
158 {
159 unsigned int addr; // real buffer address (16384+256 bytes for data and spare region)
160 unsigned int entry; // data buffer entry index
161 };
163
179typedef struct _NVME_DMA_INFO
180{
181 unsigned int startIndex : 16; // which NVMe block should the slice request transfer from/to
182 unsigned int nvmeBlockOffset : 16; // which slice request offset should the first NVMe block aligned to
183 unsigned int numOfNvmeBlock : 16; // how many NVMe blocks should be transferred, 1 based
184 unsigned int reqTail : 8; // the tail index of the NVMe auto DMA queue
185 unsigned int reserved0 : 8; // reserved
186 unsigned int overFlowCnt; // TODO
188
189typedef struct _NAND_INFO
190{
191 union
192 {
193 unsigned int virtualSliceAddr; // location vector mention in paper
194 struct
195 {
196 unsigned int physicalCh : 4;
197 unsigned int physicalWay : 4;
198 unsigned int physicalBlock : 16;
199 unsigned int phyReserved0 : 8;
200 };
201 };
202 union
203 {
204 unsigned int programmedPageCnt;
205 struct
206 {
207 unsigned int physicalPage : 16;
208 unsigned int phyReserved1 : 16;
209 };
210 };
212
213typedef struct _REQ_OPTION
214{
220 unsigned int dataBufFormat : 2;
221
227 unsigned int nandAddr : 2;
228 unsigned int nandEcc : 1; // 0 for OFF, 1 for ON
229 unsigned int nandEccWarning : 1; // 0 for OFF, 1 for ON
230 unsigned int rowAddrDependencyCheck : 1; // whether this request needs to check dependency.
231 unsigned int blockSpace : 1; // 0 for MAIN, 1 for TOTAL
232 unsigned int reserved0 : 24;
233} REQ_OPTION, *P_REQ_OPTION; /* NOTE: 32 bits */
234
252typedef struct _SSD_REQ_FORMAT
253{
254 unsigned int reqType : 4; // the type of this request. Slice, NAND or NVMe command.
255 unsigned int reqQueueType : 4; // the type of request queue where this request is stored
256 unsigned int reqCode : 8; // READ/WRITE/RxDMA/TxDMA/etc. (check REQ_CODE_*)
257 unsigned int nvmeCmdSlotTag : 16; // TODO
258
259 unsigned int logicalSliceAddr;
260
261 REQ_OPTION reqOpt; // optional request configs
262 DATA_BUF_INFO dataBufInfo; // request data buffer entry info of this request
263 NVME_DMA_INFO nvmeDmaInfo; // NVMe requests related info
264 NAND_INFO nandInfo; // address info of this NAND request
265
266 unsigned int prevReq : 16; // the request pool index of prev request queue entry
267 unsigned int nextReq : 16; // the request pool index of next request queue entry
268 unsigned int prevBlockingReq : 16; // request entry index of the prev request in blocking request queue
269 unsigned int nextBlockingReq : 16; // request entry index of the next request in blocking request queue
270
271 // 4 4 8+4+12+8 8 Bytes
272
274
275#endif /* REQUEST_FORMAT_H_ */
struct _DATA_BUF_INFO DATA_BUF_INFO
The real address or entry index of the request.
struct _REQ_OPTION REQ_OPTION
struct _NVME_DMA_INFO NVME_DMA_INFO
The structure that manages the LBA and LSA info needed by NVMe DMA requests.
struct _NAND_INFO * P_NAND_INFO
struct _NVME_DMA_INFO * P_NVME_DMA_INFO
struct _DATA_BUF_INFO * P_DATA_BUF_INFO
struct _NAND_INFO NAND_INFO
struct _SSD_REQ_FORMAT * P_SSD_REQ_FORMAT
struct _SSD_REQ_FORMAT SSD_REQ_FORMAT
The structure of a slice command.
struct _REQ_OPTION * P_REQ_OPTION
The real address or entry index of the request.
unsigned int entry
unsigned int addr
unsigned int phyReserved1
unsigned int phyReserved0
unsigned int physicalBlock
unsigned int programmedPageCnt
unsigned int physicalWay
unsigned int physicalPage
unsigned int virtualSliceAddr
unsigned int physicalCh
The structure that manages the LBA and LSA info needed by NVMe DMA requests.
unsigned int reserved0
unsigned int numOfNvmeBlock
unsigned int startIndex
unsigned int nvmeBlockOffset
unsigned int reqTail
unsigned int overFlowCnt
unsigned int nandEccWarning
unsigned int reserved0
unsigned int dataBufFormat
Type of address stored in the SSD_REQ_FORMAT::dataBufInfo.
unsigned int nandAddr
Type of address stored in the SSD_REQ_FORMAT::nandInfo.
unsigned int blockSpace
unsigned int rowAddrDependencyCheck
unsigned int nandEcc
The structure of a slice command.
REQ_OPTION reqOpt
DATA_BUF_INFO dataBufInfo
unsigned int nextReq
unsigned int reqCode
NVME_DMA_INFO nvmeDmaInfo
unsigned int logicalSliceAddr
NAND_INFO nandInfo
unsigned int reqType
unsigned int nextBlockingReq
unsigned int prevBlockingReq
unsigned int reqQueueType
unsigned int prevReq
unsigned int nvmeCmdSlotTag