OpenSSD Cosmos+ Platform Firmware  0.0.2
The firmware of Cosmos+ OpenSSD Platform for TOSHIBA nand flash module.
request_allocation.h
Go to the documentation of this file.
1
2// request_allocation.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_allocation.h
32//
33// Version: v1.0.0
34//
35// Description:
36// - define parameters, data structure and functions of request allocator
38
40// Revision History:
41//
42// * v1.0.0
43// - First draft
45
46#ifndef REQUEST_ALLOCATION_H_
47#define REQUEST_ALLOCATION_H_
48
49#include "ftl_config.h"
50#include "request_format.h"
51#include "request_queue.h"
52
57#define AVAILABLE_OUNTSTANDING_REQ_COUNT ((USER_DIES)*128) // regardless of request type
58
59#define REQ_SLOT_TAG_NONE 0xffff // no request pool entry, used for checking tail entry
60#define REQ_SLOT_TAG_FAIL 0xffff // request pool entry not found, used for return error
61
72typedef struct _REQ_POOL
73{
76
77void InitReqPool();
78
79void PutToFreeReqQ(unsigned int reqSlotTag);
80unsigned int GetFromFreeReqQ();
81
82void PutToSliceReqQ(unsigned int reqSlotTag);
83unsigned int GetFromSliceReqQ();
84
85void PutToBlockedByBufDepReqQ(unsigned int reqSlotTag);
86void SelectiveGetFromBlockedByBufDepReqQ(unsigned int reqSlotTag);
87
88void PutToBlockedByRowAddrDepReqQ(unsigned int reqSlotTag, unsigned int chNo, unsigned int wayNo);
89void SelectiveGetFromBlockedByRowAddrDepReqQ(unsigned int reqSlotTag, unsigned int chNo, unsigned int wayNo);
90
91void PutToNvmeDmaReqQ(unsigned int reqSlotTag);
92void SelectiveGetFromNvmeDmaReqQ(unsigned int regSlotTag);
93
94void PutToNandReqQ(unsigned int reqSlotTag, unsigned chNo, unsigned wayNo);
95void GetFromNandReqQ(unsigned int chNo, unsigned int wayNo, unsigned int reqStatus, unsigned int reqCode);
96
104
105extern unsigned int notCompletedNandReqCnt;
106extern unsigned int blockedReqCnt;
107
108/* -------------------------------------------------------------------------- */
109/* util macros for request pool related ops */
110/* -------------------------------------------------------------------------- */
111
118#define REQ_ENTRY(iEntry) (&reqPoolPtr->reqPool[(iEntry)])
119#define REQ_BUF(iEntry) (REQ_ENTRY((iEntry))->dataBufInfo.entry)
120#define REQ_LSA(iEntry) (REQ_ENTRY((iEntry))->logicalSliceAddr)
121#define REQ_VSA(iEntry) (REQ_ENTRY((iEntry))->nandInfo.virtualSliceAddr)
122
130#define REQ_CODE_IS(idx, code) (REQ_ENTRY((idx))->reqCode == (code))
131
139#define REQ_TYPE_IS(idx, type) (REQ_ENTRY((idx))->reqType == (type))
140
148#define REQ_QUEUE_TYPE_IS(idx, qType) (REQ_ENTRY((idx))->reqQueueType == (qType))
149
150#endif /* REQUEST_ALLOCATION_H_ */
#define USER_CHANNELS
Definition: ftl_config.h:207
#define USER_WAYS
Definition: ftl_config.h:208
unsigned int GetFromFreeReqQ()
Get a free request from the free request queue.
#define AVAILABLE_OUNTSTANDING_REQ_COUNT
SLICE_REQUEST_QUEUE sliceReqQ
unsigned int blockedReqCnt
void SelectiveGetFromBlockedByRowAddrDepReqQ(unsigned int reqSlotTag, unsigned int chNo, unsigned int wayNo)
Remove the given request from the blockedByRowAddrDepReqQ.
void PutToFreeReqQ(unsigned int reqSlotTag)
Add the given request to the free request queue.
NVME_DMA_REQUEST_QUEUE nvmeDmaReqQ
struct _REQ_POOL REQ_POOL
The request entries pool for both NVMe and NAND requests.
unsigned int GetFromSliceReqQ()
Get a slice request from the slice request queue.
void PutToNandReqQ(unsigned int reqSlotTag, unsigned chNo, unsigned wayNo)
Add the given request to nandReqQ of the specified die.
void PutToBlockedByBufDepReqQ(unsigned int reqSlotTag)
Add the given request to blockedByBufDepReqQ.
void PutToNvmeDmaReqQ(unsigned int reqSlotTag)
Add the given request to the NVMe DMA request queue and update its status.
void GetFromNandReqQ(unsigned int chNo, unsigned int wayNo, unsigned int reqStatus, unsigned int reqCode)
Move the head request of the specified nandReqQ queue to freeReqQ.
void InitReqPool()
Initialize the request pool and the request queues.
unsigned int notCompletedNandReqCnt
void PutToBlockedByRowAddrDepReqQ(unsigned int reqSlotTag, unsigned int chNo, unsigned int wayNo)
Add the given request to blockedByRowAddrDepReqQ.
void SelectiveGetFromBlockedByBufDepReqQ(unsigned int reqSlotTag)
Remove the given request from the blockedByBufDepReqQ.
BLOCKED_BY_BUFFER_DEPENDENCY_REQUEST_QUEUE blockedByBufDepReqQ
void PutToSliceReqQ(unsigned int reqSlotTag)
Add the given request to the slice request queue.
P_REQ_POOL reqPoolPtr
NAND_REQUEST_QUEUE nandReqQ[USER_CHANNELS][USER_WAYS]
void SelectiveGetFromNvmeDmaReqQ(unsigned int regSlotTag)
Move the specified entry from the nvmeDmaReqQ to the freeReqQ.
struct _REQ_POOL * P_REQ_POOL
FREE_REQUEST_QUEUE freeReqQ
BLOCKED_BY_ROW_ADDR_DEPENDENCY_REQUEST_QUEUE blockedByRowAddrDepReqQ[USER_CHANNELS][USER_WAYS]
The request entries pool for both NVMe and NAND requests.
SSD_REQ_FORMAT reqPool[AVAILABLE_OUNTSTANDING_REQ_COUNT]
The structure of a slice command.