142#ifndef __DEV_ARM_UFS_DEVICE_HH__
143#define __DEV_ARM_UFS_DEVICE_HH__
151#include "debug/UFSHostDevice.hh"
159#include "params/UFSHostDevice.hh"
389 memset(
static_cast<void*
>(
this), 0,
sizeof(*
this));
903 void taskHandler(
struct UTPUPIUTaskReq* request_in,
904 uint32_t req_pos,
Addr finaladdress, uint32_t finalsize);
922 request_in,
int req_pos,
Addr finaladdress,
923 uint32_t finalsize, uint32_t done);
947 struct UTPUPIURSP request_out, uint32_t size,
970 int size, uint8_t*
destination, uint64_t SCSIDiskOffset,
973 uint8_t* SCSIDestination,
bool no_cache,
974 Event* additional_action);
983 sg_table_length,
struct UFSHCDSGEntry* sglist);
985 uint32_t sg_table_length,
986 struct UFSHCDSGEntry* sglist);
Base class for ARM GIC implementations.
This is an interface between the disk interface (which will handle the disk data transactions) and th...
Basic interface for accessing a disk image.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Abstract superclass for simulation objects.
device layer: This is your Logic unit This layer implements the SCSI functionality of the UFS Device ...
static const unsigned int cachingPage[5]
void SSDWriteStart()
SSD write start.
Callback memWriteCallback
bool finishedRead() const
Finished read.
transferDoneInfo transferInfo
End of transfer information.
bool finishedCommand() const
finished command.
void SSDReadDone()
SSD Read done; Determines if the final callback of the transaction should be made at the end of a rea...
static const unsigned int controlPage[3]
These pages are SCSI specific.
std::function< void()> Callback
const uint32_t capacityLower
void setSignal()
set signal to indicate that the transaction has been completed.
UFSSCSIDevice(const UFSHostDeviceParams &p, uint32_t lun_id, const Callback &transfer_cb, const Callback &read_cb)
Constructor and destructor.
bool transferCompleted
Signals to Host layer 1: signal for transaction completion 2: signal for read action completion.
void writeFlash(uint8_t *writeaddr, uint64_t offset, uint32_t size)
Write flash.
static const unsigned int UPIUHeaderDataIndWord0
std::deque< struct transferInfo > SSDWriteDoneInfo
SSDWriteDoneInfo: Structure from dma to disk, that contains data, and helper info to get it to the ri...
void readFlash(uint8_t *readaddr, uint64_t offset, uint32_t size)
Disk access functions.
void statusCheck(uint8_t status, uint8_t *sensecodelist)
Status of SCSI.
Callback deviceReadCallback
const uint32_t blkSize
Logic unit dimensions.
void setReadSignal()
set signal to indicate that the read action has been completed
uint32_t amountOfReadTransfers
void clearSignal()
Clear signal.
Callback signalDone
Callbacks between Host and Device.
std::deque< struct transferInfo > SSDReadInfo
SSDReadInfo: Structure from disk to dma, that contains data, and helper info to get it to the right p...
std::deque< struct SCSIResumeInfo > SCSIInfoQueue
Information message queues, as there can be multiple messages queued for handling in this system.
Callback memReadCallback
Callbacks between Device and Memory.
@ SCSIReservationConflict
static const unsigned int recoveryPage[3]
void setTotalWrite(uint32_t total_write)
Sets total amount of write transactions that needs to be made.
DiskImage * flashDisk
The objects this model links to.
struct SCSIReply SCSICMDHandle(uint32_t *SCSI_msg)
SCSI command handle function; determines what the command is and returns a reply structure that allow...
AbstractNVM * flashDevice
struct LUNInfo lunInfo
Logic unit info; needed for SCSI Info messages and LU identification.
static const unsigned int UPIUHeaderDataIndWord2
void clearReadSignal()
Clear signal.
void readCallback()
Functions to indicate that the action to the SSD has completed.
static const unsigned int UPIUHeaderDataIndWord1
uint32_t totalRead
Total amount transactions that need to be made.
const uint32_t capacityUpper
void SSDReadStart(uint32_t total_read)
Start the transactions to (and from) the disk The host will queue all the transactions.
uint32_t amountOfWriteTransfers
transaction progress tracking
void SSDWriteDone()
SSD Write Done; This is the callback function for the memory model.
Host controller layer: This is your Host controller This layer handles the UFS functionality.
int readPendingNum
Track number of DMA transactions in progress.
void taskHandler(struct UTPUPIUTaskReq *request_in, uint32_t req_pos, Addr finaladdress, uint32_t finalsize)
Task handler function.
std::deque< EventFunctionWrapper > taskEventQueue
Multiple tasks transfers can be scheduled at once for the device, the only thing we know for sure abo...
@ regUICErrorCodePHYAdapterLayer
@ regUTPTransferREQListBaseH
@ regUTPTaskREQListRunStop
@ regControllerCapabilities
@ regUICErrorCodeDataLinkLayer
@ regUICErrorCodeNetworkLayer
@ regUTPTransferREQListBaseL
@ regUTPTransferREQListClear
@ regUICErrorCodeTransportLayer
@ regUTPTransferREQListRunStop
@ regUTPTransferREQINTAGGControl
@ regUTPTransferREQDoorbell
void generateInterrupt()
set interrupt and sort out the doorbell register.
void writeDone()
Write done After a DMA write with data intended for the disk, this function is called.
std::deque< struct taskStart > taskInfo
When a task/transfer is started it needs information about the task/transfer it is about to perform.
std::deque< struct transferInfo > SSDWriteinfo
Information from DMA transaction to disk.
static const unsigned int UICCommandReady
std::deque< EventFunctionWrapper > transferEventQueue
EventFunctionWrapper SCSIResumeEvent
The events that control the functionality.
void serialize(CheckpointOut &cp) const override
Serialize; needed to make checkpoints.
void transferHandler(struct UTPTransferReqDesc *request_in, int req_pos, Addr finaladdress, uint32_t finalsize, uint32_t done)
Transfer handler function.
Tick transactionStart[32]
Helper for latency stats These variables keep track of the latency for every doorbell.
const Addr pioAddr
Host controller information.
void commandHandler()
Command handler function.
HCIMem UFSHCIMem
Host controller memory.
struct SCSIReply request_out_datain
SCSI reply structure, used for direct answering.
static const unsigned int UTPTaskREQCOMPL
void clearInterrupt()
Interrupt control functions.
static const unsigned int UTPTransferREQCOMPL
Bits of interest within UFS data packages.
static const unsigned int UICCommandCOMPL
void writeDevice(Event *additional_action, bool toDisk, Addr start, int size, uint8_t *destination, uint64_t SCSIDiskOffset, uint32_t lun_id)
DMA transfer functions These allow the host to push/pull the data to the memory The provided event in...
void finalUTP()
final UTP, sends the last acknowledge data structure to the system; prepares the clean up functions.
std::deque< struct writeToDiskBurst > dmaWriteInfo
Information to get a DMA transaction.
uint32_t transferTrack
Track the transfer This is allows the driver to "group" certain transfers together by using a tag in ...
DrainState drain() override
Drain; needed to enable checkpoints.
void setValues()
Initialization function.
void requestHandler()
Handler functions.
void unserialize(CheckpointIn &cp) override
Unserialize; needed to restore from checkpoints.
void manageWriteTransfer(uint8_t LUN, uint64_t offset, uint32_t sg_table_length, struct UFSHCDSGEntry *sglist)
Disk transfer management functions these set up the queues, and initiated them, leading to the data t...
struct SCSIResumeInfo SCSIInfo
SCSI resume info information structure for SCSI resume.
Tick read(PacketPtr pkt) override
register access functions
struct UFSHostDeviceStats stats
RequestHandler stats.
void readGarbage()
Read garbage A read from disk data structure can vary in size and is therefor allocated on creation.
std::deque< struct transferStart > transferEnd
To finish the transaction one needs information about the original message.
std::deque< EventFunctionWrapper > readDoneEvent
Transfer flow events Basically these events form two queues, one from memory to UFS device (DMA) and ...
uint32_t countInt
interrupt verification This keeps track of the number of interrupts generated.
std::deque< struct UTPTransferReqDesc * > garbage
garbage queue, ensure clearing of the allocated memory
uint8_t activeDoorbells
Statistics helper variables Active doorbells indicates how many doorbells are in teh process of being...
void manageReadTransfer(uint32_t size, uint32_t LUN, uint64_t offset, uint32_t sg_table_length, struct UFSHCDSGEntry *sglist)
Manage read transfer.
std::vector< UFSSCSIDevice * > UFSDevice
logic units connected to the UFS Host device Note again that the "device" as such is represented by o...
std::deque< struct transferInfo > SSDReadPending
Information from the Disk, waiting to be pushed to the DMA.
void SCSIResume(uint32_t lun_id)
Starts the scsi handling function in the apropriate Logic unit, prepares the right data transfer sche...
std::deque< EventFunctionWrapper > writeDoneEvent
Tick write(PacketPtr pkt) override
UFSHCD write function.
std::deque< struct transferStart > transferStartInfo
AddrRangeList getAddrRanges() const override
Address range functions.
std::deque< EventFunctionWrapper > readGarbageEventQueue
Event after a read to clean up the UTP data structures.
EventFunctionWrapper UTPEvent
Wait for the moment where we can send the last frame.
void readCallback()
Read callback Call back function for the logic units to indicate the completion of a read action.
UFSHostDevice(const UFSHostDeviceParams &p)
Constructor for the UFS Host device.
void transferStart()
Transfer Start function.
void taskStart()
Task Start function.
void transferDone(Addr responseStartAddr, uint32_t req_pos, struct UTPUPIURSP request_out, uint32_t size, Addr address, uint8_t *destination, bool finished, uint32_t lun_id)
transfer done, the beginning of the final stage of the transfer.
void LUNSignal()
LU callback function to indicate that the action has completed.
void readDone()
Read done Started at the end of a transaction after the last read action.
void readDevice(bool lastTransfer, Addr SCSIStart, uint32_t SCSISize, uint8_t *SCSIDestination, bool no_cache, Event *additional_action)
Dma transaction function: read device.
void checkDrain()
Checkdrain; needed to enable checkpoints.
void SCSIStart()
Transfer SCSI function.
uint32_t taskCommandTrack
A stat that calculates the per tick average of a value.
This is a simple scalar statistic, like a counter.
DrainState
Object drain/handover states.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
Declaration of the Packet class.
Declaration of Statistics objects.
Host Controller Interface This is a set of registers that allow the driver to control the transaction...
uint32_t TMUTMRLBA
Task control registers.
uint32_t ORHostControllerStatus
uint32_t TRUTRLBA
Transfer control registers.
uint32_t ORHostControllerEnable
uint32_t ORInterruptStatus
Operation and runtime registers.
uint32_t CMDUICCMDR
Command registers.
uint32_t vendorSpecific
vendor specific register
uint32_t HCCAP
Specify the host capabilities.
uint32_t ORInterruptEnable
Logic unit information structure.
struct UPIUMessage message
After a SCSI command has been identified, the SCSI resume function will handle it.
struct UTPTransferReqDesc * RequestIn
std::vector< uint8_t > destination
struct UFSHCDSGEntry - UFSHCI PRD Entry baseAddr: Lower 32bit physical address DW-0 upperAddr: Upper ...
statistics::Scalar maxDoorbell
statistics::Formula averageWriteSSDBW
statistics::Average averageSCSIQueue
Average Queue lengths.
statistics::Scalar currentReadSSDQueue
statistics::Scalar totalWriteUFSTransactions
statistics::Formula averageReadSSDBW
Average bandwidth for reads and writes.
statistics::Average averageReadSSDQueue
statistics::Scalar totalReadDiskTransactions
statistics::Scalar totalWriteDiskTransactions
UFSHostDeviceStats(UFSHostDevice *parent)
Amount of data read/written.
statistics::Average averageDoorbell
statistics::Average averageWriteSSDQueue
statistics::Histogram transactionLatency
Histogram of latencies.
statistics::Scalar totalWrittenSSD
statistics::Scalar totalReadSSD
Amount of data read/written.
statistics::Formula curDoorbell
Number of doorbells rung.
statistics::Scalar currentSCSIQueue
Queue lengths.
statistics::Scalar totalReadUFSTransactions
statistics::Scalar currentWriteSSDQueue
statistics::Histogram idleTimes
std::vector< uint32_t > dataMsg
struct UTPUPIUHeader header
struct UTPTransferCMDDesc - UFS Commad Descriptor structure commandUPIU: Command UPIU Frame address r...
struct UFSHCDSGEntry PRDTable[128]
uint8_t responseUPIU[128]
struct UTPTransferReqDesc - UTRD structure header: UTRD header DW-0 to DW-3 commandDescBaseAddrLo: UC...
struct gem5::UFSHostDevice::UTPTransferReqDesc::RequestDescHeader header
uint32_t commandDescBaseAddrLo
uint32_t commandDescBaseAddrHi
uint16_t responseUPIULength
uint16_t responseUPIUOffset
struct UTPUPIURSP - Response UPIU structure header: UPIU header DW-0 to DW-2 residualTransferCount: R...
uint32_t residualTransferCount
struct UTPUPIUHeader header
struct UTPUPIUTaskReq - Task request UPIU structure header - UPIU header structure DW0 to DW-2 inputP...
struct UTPUPIUHeader header
struct UTPUPIUTaskReq destination
transfer completion info.
struct UTPUPIURSP requestOut
Different events, and scenarios require different types of information.
std::vector< uint8_t > buffer
Transfer start information.
struct UTPTransferReqDesc * destination
Disk transfer burst information.