142 #ifndef __DEV_ARM_UFS_DEVICE_HH__ 143 #define __DEV_ARM_UFS_DEVICE_HH__ 150 #include "debug/UFSHostDevice.hh" 158 #include "params/UFSHostDevice.hh" 272 uint32_t reserved[4];
274 uint8_t senseData[18];
290 uint32_t reserved[2];
315 uint8_t commandUPIU[128];
316 uint8_t responseUPIU[128];
375 memset(static_cast<void*>(
this), 0,
sizeof(*
this));
385 uint8_t senseCode[19];
550 struct SCSIReply SCSICMDHandle(uint32_t* SCSI_msg);
560 void readFlash(uint8_t* readaddr, uint64_t
offset, uint32_t size);
566 void writeFlash(uint8_t* writeaddr, uint64_t offset, uint32_t size);
601 void SSDReadStart(uint32_t total_read);
602 void SSDWriteStart();
609 void setTotalWrite(uint32_t total_write) {totalWrite = total_write;};
666 void statusCheck(uint8_t
status, uint8_t* sensecodelist);
738 static const unsigned int UPIUHeaderDataIndWord0 = 0x0000C022;
739 static const unsigned int UPIUHeaderDataIndWord1 = 0x00000000;
740 static const unsigned int UPIUHeaderDataIndWord2 = 0x40000000;
748 static const unsigned int controlPage[3];
749 static const unsigned int recoveryPage[3];
750 static const unsigned int cachingPage[5];
761 SCSIReadCapacity10 = 0x25,
762 SCSIReadCapacity16 = 0x9E,
763 SCSIReportLUNs = 0xA0,
764 SCSIStartStop = 0x1B,
765 SCSITestUnitReady = 0x00,
770 SCSIFormatUnit = 0x04,
771 SCSISendDiagnostic = 0x1D,
772 SCSISynchronizeCache = 0x35,
774 SCSIModeSelect10 = 0x55,
775 SCSIModeSense6 = 0x1A,
776 SCSIModeSense10 = 0x5A,
777 SCSIRequestSense = 0x03,
779 SCSIWriteBuffer = 0x3B,
780 SCSIReadBuffer = 0x3C,
782 SCSIMaintenanceIn = 0xA3
791 SCSICheckCondition = 0x02,
792 SCSIConditionGood = 0x04,
794 SCSIIntermediateGood = 0x10,
795 SCSIIntermediatCGood = 0x14,
796 SCSIReservationConflict = 0x18,
797 SCSICommandTerminated = 0x22,
798 SCSITaskSetFull = 0x28,
799 SCSIACAActive = 0x30,
800 SCSITaskAborted = 0x40
809 SCSIRecoverdError = 0x01,
811 SCSIMediumError = 0x03,
812 SCSIHardwareError = 0x04,
813 SCSIIllegalRequest = 0x05,
814 SCSIUnitAttention = 0x06,
815 SCSIDataProtect = 0x07,
816 SCSIBlankCheck = 0x08,
817 SCSIAbortedCommand = 0x0B,
818 SCSIVolumeOverflow = 0x0D,
819 SCSIMisCompare = 0x0E
875 uint32_t req_pos,
Addr finaladdress, uint32_t finalsize);
893 request_in,
int req_pos,
Addr finaladdress,
894 uint32_t finalsize, uint32_t done);
941 int size, uint8_t*
destination, uint64_t SCSIDiskOffset,
944 uint8_t* SCSIDestination,
bool no_cache,
945 Event* additional_action);
956 uint32_t sg_table_length,
1220 #endif //__DEV_ARM_UFS_DEVICE_HH__
Stats::Average averageWriteSSDQueue
Stats::Scalar currentSCSIQueue
Queue lengths.
std::deque< struct transferInfo > SSDReadPending
Information from the Disk, waiting to be pushed to the DMA.
void clearReadSignal()
Clear signal.
struct SCSIResumeInfo SCSIInfo
SCSI resume info information structure for SCSI resume.
void generateInterrupt()
set interrupt and sort out the doorbell register.
std::deque< EventFunctionWrapper > writeDoneEvent
Callback * transferDoneCallback
Callbacks for the logic units.
void setSignal()
set signal to indicate that the transaction has been completed.
std::deque< struct taskStart > taskInfo
When a task/transfer is started it needs information about the task/transfer it is about to perform...
AddrRangeList getAddrRanges() const override
Address range functions.
uint32_t totalRead
Total amount transactions that need to be made.
void unserialize(CheckpointIn &cp) override
Unserialize; needed to restore from checkpoints.
A stat that calculates the per tick average of a value.
void setValues()
Initialization function.
std::deque< struct transferStart > transferStartInfo
Tick transactionStart[32]
Helper for latency stats These variables keep track of the latency for every doorbell.
Stats::Scalar currentReadSSDQueue
uint32_t ORInterruptStatus
Operation and runtime registers.
std::vector< uint8_t > buffer
void finalUTP()
final UTP, sends the last acknowledge data structure to the system; prepares the clean up functions...
Stats::Scalar totalReadSSD
Amount of data read/written.
EventFunctionWrapper UTPEvent
Wait for the moment where we can send the last frame.
void transferStart()
Transfer Start function.
std::deque< EventFunctionWrapper > readGarbageEventQueue
Event after a read to clean up the UTP data structures.
std::deque< EventFunctionWrapper > transferEventQueue
struct UTPUPIURSP - Response UPIU structure header: UPIU header DW-0 to DW-2 residualTransferCount: R...
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...
bool transferCompleted
Signals to Host layer 1: signal for transaction completion 2: signal for read action completion...
struct UTPTransferReqDesc - UTRD structure header: UTRD header DW-0 to DW-3 commandDescBaseAddrLo: UC...
UFS command flow state machine digraph CommandFlow{ node [fontsize=10]; IDLE -> transferHandler [ lab...
Stats::Scalar totalReadUFSTransactions
UFSHostDevice(const UFSHostDeviceParams *p)
Constructor for the UFS Host device.
transferDoneInfo transferInfo
End of transfer information.
uint32_t ORInterruptEnable
Stats::Scalar totalReadDiskTransactions
void regStats() override
register statistics
Stats::Scalar totalWriteDiskTransactions
uint16_t responseUPIUOffset
struct UTPUPIUTaskReq - Task request UPIU structure header - UPIU header structure DW0 to DW-2 inputP...
Callback * memWriteCallback
Tick write(PacketPtr pkt) override
UFSHCD write function.
struct UFSHostDeviceStats stats
RequestHandler stats.
uint32_t amountOfReadTransfers
std::deque< EventFunctionWrapper > taskEventQueue
Multiple tasks transfers can be scheduled at once for the device, the only thing we know for sure abo...
std::deque< struct transferStart > transferEnd
To finish the transaction one needs information about the original message.
uint32_t ORHostControllerEnable
Tick read(PacketPtr pkt) override
register access functions
Declaration of Statistics objects.
This is a simple scalar statistic, like a counter.
DrainState
Object drain/handover states.
int readPendingNum
Track number of DMA transactions in progress.
const Addr pioAddr
Host controller information.
uint32_t commandDescBaseAddrLo
void readCallback()
Read callback Call back function for the logic units to indicate the completion of a read action...
std::deque< struct UTPTransferReqDesc * > garbage
garbage queue, ensure clearing of the allocated memory
bool finishedCommand() const
finished command.
void commandHandler()
Command handler function.
uint32_t HCCAP
Specify the host capabilities.
uint8_t activeDoorbells
Statistics helper variables Active doorbells indicates how many doorbells are in teh process of being...
Callback * memReadCallback
Callbacks between Device and Memory.
Stats::Average averageSCSIQueue
Average Queue lengths.
uint32_t ORHostControllerStatus
std::deque< struct SCSIResumeInfo > SCSIInfoQueue
Information message queues, as there can be multiple messages queued for handling in this system...
uint64_t Tick
Tick count type.
Stats::Average averageDoorbell
void clearInterrupt()
Interrupt control functions.
Stats::Scalar currentWriteSSDQueue
Callback * deviceReadCallback
transfer completion info.
bool finishedRead() const
Finished read.
std::vector< uint8_t > destination
void taskStart()
Task Start function.
void readDevice(bool lastTransfer, Addr SCSIStart, uint32_t SCSISize, uint8_t *SCSIDestination, bool no_cache, Event *additional_action)
Dma transaction function: read device.
void serialize(CheckpointOut &cp) const override
Serialize; needed to make checkpoints.
Stats::Scalar totalWriteUFSTransactions
std::deque< struct transferInfo > SSDWriteDoneInfo
SSDWriteDoneInfo: Structure from dma to disk, that contains data, and helper info to get it to the ri...
HCIMem UFSHCIMem
Host controller memory.
const uint32_t capacityUpper
Stats::Formula curDoorbell
Number of doorbells rung.
void LUNSignal()
LU callback function to indicate that the action has completed.
DrainState drain() override
Drain; needed to enable checkpoints.
std::deque< struct writeToDiskBurst > dmaWriteInfo
Information to get a DMA transaction.
Basic interface for accessing a disk image.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint32_t TMUTMRLBA
Task control registers.
Stats::Scalar totalWrittenSSD
void transferHandler(struct UTPTransferReqDesc *request_in, int req_pos, Addr finaladdress, uint32_t finalsize, uint32_t done)
Transfer handler function.
void SCSIStart()
Transfer SCSI function.
struct UTPTransferCMDDesc - UFS Commad Descriptor structure commandUPIU: Command UPIU Frame address r...
void readGarbage()
Read garbage A read from disk data structure can vary in size and is therefor allocated on creation...
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
uint32_t CMDUICCMDR
Command registers.
Callback * signalDone
Callbacks between Host and Device.
EventFunctionWrapper SCSIResumeEvent
The events that control the functionality.
static const unsigned int UTPTaskREQCOMPL
Stats::Average averageReadSSDQueue
std::deque< EventFunctionWrapper > readDoneEvent
Transfer flow events Basically these events form two queues, one from memory to UFS device (DMA) and ...
void manageReadTransfer(uint32_t size, uint32_t LUN, uint64_t offset, uint32_t sg_table_length, struct UFSHCDSGEntry *sglist)
Manage read transfer.
struct UTPTransferReqDesc * destination
void setReadSignal()
set signal to indicate that the read action has been completed
Logic unit information structure.
Stats::Scalar maxDoorbell
device layer: This is your Logic unit This layer implements the SCSI functionality of the UFS Device ...
struct UTPTransferReqDesc * RequestIn
uint32_t amountOfWriteTransfers
transaction progress tracking
Base class for ARM GIC implementations.
uint32_t residualTransferCount
void readDone()
Read done Started at the end of a transaction after the last read action.
Declaration of the Packet class.
uint32_t vendorSpecific
vendor specific register
std::ostream CheckpointOut
static const unsigned int UTPTransferREQCOMPL
Bits of interest within UFS data packages.
uint32_t commandDescBaseAddrHi
Stats::Formula averageReadSSDBW
Average bandwidth for reads and writes.
Host Controller Interface This is a set of registers that allow the driver to control the transaction...
void writeDone()
Write done After a DMA write with data intended for the disk, this function is called.
Different events, and scenarios require different types of information.
uint16_t responseUPIULength
uint32_t TRUTRLBA
Transfer control registers.
struct SCSIReply request_out_datain
SCSI reply structure, used for direct answering.
After a SCSI command has been identified, the SCSI resume function will handle it.
uint32_t taskCommandTrack
std::deque< struct transferInfo > SSDWriteinfo
Information from DMA transaction to disk.
void clearSignal()
Clear signal.
const uint32_t capacityLower
Stats::Histogram transactionLatency
Histogram of latencies.
const uint32_t blkSize
Logic unit dimensions.
Transfer start information.
This is an interface between the disk interface (which will handle the disk data transactions) and th...
struct UFSHCDSGEntry - UFSHCI PRD Entry baseAddr: Lower 32bit physical address DW-0 upperAddr: Upper ...
Callback * memReadCallback
void taskHandler(struct UTPUPIUTaskReq *request_in, uint32_t req_pos, Addr finaladdress, uint32_t finalsize)
Task handler function.
uint32_t transferTrack
Track the transfer This is allows the driver to "group" certain transfers together by using a tag in ...
std::vector< uint32_t > dataMsg
Disk transfer burst information.
AbstractNVM * flashDevice
std::vector< UFSSCSIDevice * > UFSDevice
logic units connected to the UFS Host device Note again that the "device" as such is represented by o...
Stats::Histogram idleTimes
uint32_t countInt
interrupt verification This keeps track of the number of interrupts generated.
void requestHandler()
Handler functions.
void checkDrain()
Checkdrain; needed to enable checkpoints.
void SCSIResume(uint32_t lun_id)
Starts the scsi handling function in the apropriate Logic unit, prepares the right data transfer sche...
Abstract superclass for simulation objects.
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.
static const unsigned int UICCommandCOMPL
static const unsigned int UICCommandReady
std::deque< struct transferInfo > SSDReadInfo
SSDReadInfo: Structure from disk to dma, that contains data, and helper info to get it to the right p...
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...
Stats::Formula averageWriteSSDBW