gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::UFSHostDevice Class Reference

Host controller layer: This is your Host controller This layer handles the UFS functionality. More...

#include <ufs_device.hh>

Inheritance diagram for gem5::UFSHostDevice:
gem5::DmaDevice gem5::PioDevice gem5::ClockedObject gem5::SimObject gem5::Clocked gem5::EventManager gem5::Serializable gem5::Drainable gem5::statistics::Group gem5::Named

Classes

struct  HCIMem
 Host Controller Interface This is a set of registers that allow the driver to control the transactions to the flash devices. More...
 
struct  LUNInfo
 Logic unit information structure. More...
 
struct  SCSIReply
 SCSI reply structure. More...
 
struct  SCSIResumeInfo
 After a SCSI command has been identified, the SCSI resume function will handle it. More...
 
struct  taskStart
 Task start information. More...
 
struct  transferDoneInfo
 transfer completion info. More...
 
struct  transferInfo
 Different events, and scenarios require different types of information. More...
 
struct  transferStart
 Transfer start information. More...
 
struct  UFSHCDSGEntry
 struct UFSHCDSGEntry - UFSHCI PRD Entry baseAddr: Lower 32bit physical address DW-0 upperAddr: Upper 32bit physical address DW-1 reserved: Reserved for future use DW-2 size: size of physical segment DW-3 More...
 
struct  UFSHostDeviceStats
 Statistics. More...
 
class  UFSSCSIDevice
 device layer: This is your Logic unit This layer implements the SCSI functionality of the UFS Device One logic unit controls one or more disk partitions More...
 
struct  UPIUMessage
 UPIU tranfer message. More...
 
struct  UTPTransferCMDDesc
 struct UTPTransferCMDDesc - UFS Commad Descriptor structure commandUPIU: Command UPIU Frame address responseUPIU: Response UPIU Frame address PRDTable: Physcial Region Descriptor All lengths as defined by JEDEC220 More...
 
struct  UTPTransferReqDesc
 struct UTPTransferReqDesc - UTRD structure header: UTRD header DW-0 to DW-3 commandDescBaseAddrLo: UCD base address low DW-4 commandDescBaseAddrHi: UCD base address high DW-5 responseUPIULength: response UPIU length DW-6 responseUPIUOffset: response UPIU offset DW-6 PRDTableLength: Physical region descriptor length DW-7 PRDTableOffset: Physical region descriptor offset DW-7 More...
 
struct  UTPUPIUHeader
 All the data structures are defined in the UFS standard This standard be found at the JEDEC website free of charge (login required): http://www.jedec.org/standards-documents/results/jesd220. More...
 
struct  UTPUPIURSP
 struct UTPUPIURSP - Response UPIU structure header: UPIU header DW-0 to DW-2 residualTransferCount: Residual transfer count DW-3 reserved: Reserved DW-4 to DW-7 senseDataLen: Sense data length DW-8 U16 senseData: Sense data field DW-8 to DW-12 More...
 
struct  UTPUPIUTaskReq
 struct UTPUPIUTaskReq - Task request UPIU structure header - UPIU header structure DW0 to DW-2 inputParam1: Input param 1 DW-3 inputParam2: Input param 2 DW-4 inputParam3: Input param 3 DW-5 reserved: Reserver DW-6 to DW-7 More...
 
struct  writeToDiskBurst
 Disk transfer burst information. More...
 

Public Member Functions

 UFSHostDevice (const UFSHostDeviceParams &p)
 Constructor for the UFS Host device.
 
DrainState drain () override
 Drain; needed to enable checkpoints.
 
void checkDrain ()
 Checkdrain; needed to enable checkpoints.
 
void serialize (CheckpointOut &cp) const override
 Serialize; needed to make checkpoints.
 
void unserialize (CheckpointIn &cp) override
 Unserialize; needed to restore from checkpoints.
 
- Public Member Functions inherited from gem5::DmaDevice
 DmaDevice (const Params &p)
 
virtual ~DmaDevice ()=default
 
void dmaWrite (Addr addr, int size, Event *event, uint8_t *data, uint32_t sid, uint32_t ssid, Tick delay=0)
 
void dmaWrite (Addr addr, int size, Event *event, uint8_t *data, Tick delay=0)
 
void dmaRead (Addr addr, int size, Event *event, uint8_t *data, uint32_t sid, uint32_t ssid, Tick delay=0)
 
void dmaRead (Addr addr, int size, Event *event, uint8_t *data, Tick delay=0)
 
bool dmaPending () const
 
void init () override
 init() is called after all C++ SimObjects have been created and all ports are connected.
 
Addr cacheBlockSize () const
 
PortgetPort (const std::string &if_name, PortID idx=InvalidPortID) override
 Get a port with a given name and index.
 
- Public Member Functions inherited from gem5::PioDevice
 PioDevice (const Params &p)
 
virtual ~PioDevice ()
 
void init () override
 init() is called after all C++ SimObjects have been created and all ports are connected.
 
PortgetPort (const std::string &if_name, PortID idx=InvalidPortID) override
 Get a port with a given name and index.
 
- Public Member Functions inherited from gem5::ClockedObject
 ClockedObject (const ClockedObjectParams &p)
 
- Public Member Functions inherited from gem5::SimObject
const Paramsparams () const
 
 SimObject (const Params &p)
 
virtual ~SimObject ()
 
virtual void loadState (CheckpointIn &cp)
 loadState() is called on each SimObject when restoring from a checkpoint.
 
virtual void initState ()
 initState() is called on each SimObject when not restoring from a checkpoint.
 
virtual void regProbePoints ()
 Register probe points for this object.
 
virtual void regProbeListeners ()
 Register probe listeners for this object.
 
ProbeManagergetProbeManager ()
 Get the probe manager for this object.
 
virtual void startup ()
 startup() is the final initialization call before simulation.
 
virtual void memWriteback ()
 Write back dirty buffers to memory using functional writes.
 
virtual void memInvalidate ()
 Invalidate the contents of memory buffers.
 
- Public Member Functions inherited from gem5::EventManager
EventQueueeventQueue () const
 
void schedule (Event &event, Tick when)
 
void deschedule (Event &event)
 
void reschedule (Event &event, Tick when, bool always=false)
 
void schedule (Event *event, Tick when)
 
void deschedule (Event *event)
 
void reschedule (Event *event, Tick when, bool always=false)
 
void wakeupEventQueue (Tick when=(Tick) -1)
 This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers.
 
void setCurTick (Tick newVal)
 
 EventManager (EventManager &em)
 Event manger manages events in the event queue.
 
 EventManager (EventManager *em)
 
 EventManager (EventQueue *eq)
 
- Public Member Functions inherited from gem5::Serializable
 Serializable ()
 
virtual ~Serializable ()
 
void serializeSection (CheckpointOut &cp, const char *name) const
 Serialize an object into a new section.
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object.
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 
- Public Member Functions inherited from gem5::Drainable
DrainState drainState () const
 Return the current drain state of an object.
 
virtual void notifyFork ()
 Notify a child process of a fork.
 
- Public Member Functions inherited from gem5::statistics::Group
 Group (Group *parent, const char *name=nullptr)
 Construct a new statistics group.
 
virtual ~Group ()
 
virtual void regStats ()
 Callback to set stat parameters.
 
virtual void resetStats ()
 Callback to reset stats.
 
virtual void preDumpStats ()
 Callback before stats are dumped.
 
void addStat (statistics::Info *info)
 Register a stat with this group.
 
const std::map< std::string, Group * > & getStatGroups () const
 Get all child groups associated with this object.
 
const std::vector< Info * > & getStats () const
 Get all stats associated with this object.
 
void addStatGroup (const char *name, Group *block)
 Add a stat block as a child of this block.
 
const InforesolveStat (std::string name) const
 Resolve a stat by its name within this group.
 
void mergeStatGroup (Group *block)
 Merge the contents (stats & children) of a block to this block.
 
 Group ()=delete
 
 Group (const Group &)=delete
 
Groupoperator= (const Group &)=delete
 
- Public Member Functions inherited from gem5::Named
 Named (const std::string &name_)
 
virtual ~Named ()=default
 
virtual std::string name () const
 
- Public Member Functions inherited from gem5::Clocked
void updateClockPeriod ()
 Update the tick to the current tick.
 
Tick clockEdge (Cycles cycles=Cycles(0)) const
 Determine the tick when a cycle begins, by default the current one, but the argument also enables the caller to determine a future cycle.
 
Cycles curCycle () const
 Determine the current cycle, corresponding to a tick aligned to a clock edge.
 
Tick nextCycle () const
 Based on the clock of the object, determine the start tick of the first cycle that is at least one cycle in the future.
 
uint64_t frequency () const
 
Tick clockPeriod () const
 
double voltage () const
 
Cycles ticksToCycles (Tick t) const
 
Tick cyclesToTicks (Cycles c) const
 

Private Types

enum  UFSHCIRegisters {
  regControllerCapabilities = 0x00 , regUFSVersion = 0x08 , regControllerDEVID = 0x10 , regControllerPRODID = 0x14 ,
  regInterruptStatus = 0x20 , regInterruptEnable = 0x24 , regControllerStatus = 0x30 , regControllerEnable = 0x34 ,
  regUICErrorCodePHYAdapterLayer = 0x38 , regUICErrorCodeDataLinkLayer = 0x3C , regUICErrorCodeNetworkLayer = 0x40 , regUICErrorCodeTransportLayer = 0x44 ,
  regUICErrorCodeDME = 0x48 , regUTPTransferREQINTAGGControl = 0x4C , regUTPTransferREQListBaseL = 0x50 , regUTPTransferREQListBaseH = 0x54 ,
  regUTPTransferREQDoorbell = 0x58 , regUTPTransferREQListClear = 0x5C , regUTPTransferREQListRunStop = 0x60 , regUTPTaskREQListBaseL = 0x70 ,
  regUTPTaskREQListBaseH = 0x74 , regUTPTaskREQDoorbell = 0x78 , regUTPTaskREQListClear = 0x7C , regUTPTaskREQListRunStop = 0x80 ,
  regUICCommand = 0x90 , regUICCommandArg1 = 0x94 , regUICCommandArg2 = 0x98 , regUICCommandArg3 = 0x9C
}
 

Private Member Functions

AddrRangeList getAddrRanges () const override
 Address range functions.
 
Tick read (PacketPtr pkt) override
 register access functions
 
Tick write (PacketPtr pkt) override
 UFSHCD write function.
 
void setValues ()
 Initialization function.
 
void requestHandler ()
 Handler functions.
 
void commandHandler ()
 Command handler function.
 
void taskStart ()
 Task Start function.
 
void taskHandler (struct UTPUPIUTaskReq *request_in, uint32_t req_pos, Addr finaladdress, uint32_t finalsize)
 Task handler function.
 
void transferStart ()
 Transfer Start function.
 
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.
 
void SCSIResume (uint32_t lun_id)
 Starts the scsi handling function in the apropriate Logic unit, prepares the right data transfer scheme and kicks it off.
 
void LUNSignal ()
 LU callback function to indicate that the action has completed.
 
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 finalUTP ()
 final UTP, sends the last acknowledge data structure to the system; prepares the clean up functions.
 
void clearInterrupt ()
 Interrupt control functions.
 
void generateInterrupt ()
 set interrupt and sort out the doorbell register.
 
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 indicates what the next phase it that will handle the obtained data, or what the follow up action is once the data has been pushed to the memory.
 
void readDevice (bool lastTransfer, Addr SCSIStart, uint32_t SCSISize, uint8_t *SCSIDestination, bool no_cache, Event *additional_action)
 Dma transaction function: read device.
 
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 transaction timing model based on the scatter gather list constructed in SCSIresume.
 
void manageReadTransfer (uint32_t size, uint32_t LUN, uint64_t offset, uint32_t sg_table_length, struct UFSHCDSGEntry *sglist)
 Manage read transfer.
 
void readDone ()
 Read done Started at the end of a transaction after the last read action.
 
void writeDone ()
 Write done After a DMA write with data intended for the disk, this function is called.
 
void readCallback ()
 Read callback Call back function for the logic units to indicate the completion of a read action.
 
void readGarbage ()
 Read garbage A read from disk data structure can vary in size and is therefor allocated on creation.
 

Private Attributes

const Addr pioAddr
 Host controller information.
 
const Addr pioSize
 
const Tick pioDelay
 
const int intNum
 
BaseGicgic
 
const uint32_t lunAvail
 
const uint8_t UFSSlots
 
HCIMem UFSHCIMem
 Host controller memory.
 
int readPendingNum
 Track number of DMA transactions in progress.
 
int writePendingNum
 
uint8_t activeDoorbells
 Statistics helper variables Active doorbells indicates how many doorbells are in teh process of being handled.
 
uint8_t pendingDoorbells
 
uint32_t countInt
 interrupt verification This keeps track of the number of interrupts generated.
 
uint32_t transferTrack
 Track the transfer This is allows the driver to "group" certain transfers together by using a tag in the UPIU.
 
uint32_t taskCommandTrack
 
Tick transactionStart [32]
 Helper for latency stats These variables keep track of the latency for every doorbell.
 
Tick idlePhaseStart
 
std::vector< UFSSCSIDevice * > UFSDevice
 logic units connected to the UFS Host device Note again that the "device" as such is represented by one or multiple logic units.
 
struct SCSIReply request_out_datain
 SCSI reply structure, used for direct answering.
 
struct SCSIResumeInfo SCSIInfo
 SCSI resume info information structure for SCSI resume.
 
std::deque< struct transferStarttransferEnd
 To finish the transaction one needs information about the original message.
 
std::deque< struct taskStarttaskInfo
 When a task/transfer is started it needs information about the task/transfer it is about to perform.
 
std::deque< struct transferStarttransferStartInfo
 
std::deque< struct writeToDiskBurstdmaWriteInfo
 Information to get a DMA transaction.
 
std::deque< struct transferInfoSSDWriteinfo
 Information from DMA transaction to disk.
 
std::deque< struct transferInfoSSDReadPending
 Information from the Disk, waiting to be pushed to the DMA.
 
std::deque< struct UTPTransferReqDesc * > garbage
 garbage queue, ensure clearing of the allocated memory
 
struct UFSHostDeviceStats stats
 RequestHandler stats.
 
std::deque< EventFunctionWrapperreadDoneEvent
 Transfer flow events Basically these events form two queues, one from memory to UFS device (DMA) and one from device to flash (SSD).
 
std::deque< EventFunctionWrapperwriteDoneEvent
 
EventFunctionWrapper SCSIResumeEvent
 The events that control the functionality.
 
EventFunctionWrapper UTPEvent
 Wait for the moment where we can send the last frame.
 
std::deque< EventFunctionWrapperreadGarbageEventQueue
 Event after a read to clean up the UTP data structures.
 
std::deque< EventFunctionWrappertaskEventQueue
 Multiple tasks transfers can be scheduled at once for the device, the only thing we know for sure about them is that they will happen in a first come first serve order; hence we need to queue.
 
std::deque< EventFunctionWrappertransferEventQueue
 

Static Private Attributes

static const unsigned int UTPTransferREQCOMPL = 0x01
 Bits of interest within UFS data packages.
 
static const unsigned int UTPTaskREQCOMPL = 0x200
 
static const unsigned int UICCommandCOMPL = 0x400
 
static const unsigned int UICCommandReady = 0x08
 

Additional Inherited Members

- Public Types inherited from gem5::DmaDevice
typedef DmaDeviceParams Params
 
- Public Types inherited from gem5::PioDevice
using Params = PioDeviceParams
 
- Public Types inherited from gem5::ClockedObject
using Params = ClockedObjectParams
 Parameters of ClockedObject.
 
- Public Types inherited from gem5::SimObject
typedef SimObjectParams Params
 
- Static Public Member Functions inherited from gem5::SimObject
static void serializeAll (const std::string &cpt_dir)
 Create a checkpoint by serializing all SimObjects in the system.
 
static SimObjectfind (const char *name)
 Find the SimObject with the given name and return a pointer to it.
 
static void setSimObjectResolver (SimObjectResolver *resolver)
 There is a single object name resolver, and it is only set when simulation is restoring from checkpoints.
 
static SimObjectResolvergetSimObjectResolver ()
 There is a single object name resolver, and it is only set when simulation is restoring from checkpoints.
 
- Static Public Member Functions inherited from gem5::Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section.
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it.
 
- Public Attributes inherited from gem5::ClockedObject
PowerStatepowerState
 
- Protected Member Functions inherited from gem5::Drainable
 Drainable ()
 
virtual ~Drainable ()
 
virtual void drainResume ()
 Resume execution after a successful drain.
 
void signalDrainDone () const
 Signal that an object is drained.
 
- Protected Member Functions inherited from gem5::Clocked
 Clocked (ClockDomain &clk_domain)
 Create a clocked object and set the clock domain based on the parameters.
 
 Clocked (Clocked &)=delete
 
Clockedoperator= (Clocked &)=delete
 
virtual ~Clocked ()
 Virtual destructor due to inheritance.
 
void resetClock () const
 Reset the object's clock using the current global tick value.
 
virtual void clockPeriodUpdated ()
 A hook subclasses can implement so they can do any extra work that's needed when the clock rate is changed.
 
- Protected Attributes inherited from gem5::DmaDevice
DmaPort dmaPort
 
- Protected Attributes inherited from gem5::PioDevice
Systemsys
 
PioPort< PioDevicepioPort
 The pioPort that handles the requests for us and provides us requests that it sees.
 
- Protected Attributes inherited from gem5::SimObject
const SimObjectParams & _params
 Cached copy of the object parameters.
 
- Protected Attributes inherited from gem5::EventManager
EventQueueeventq
 A pointer to this object's event queue.
 

Detailed Description

Host controller layer: This is your Host controller This layer handles the UFS functionality.

It tracks all the different transaction stages and uses the device layer and the flash layer to determine the transaction flow.

Definition at line 172 of file ufs_device.hh.

Member Enumeration Documentation

◆ UFSHCIRegisters

Enumerator
regControllerCapabilities 
regUFSVersion 
regControllerDEVID 
regControllerPRODID 
regInterruptStatus 
regInterruptEnable 
regControllerStatus 
regControllerEnable 
regUICErrorCodePHYAdapterLayer 
regUICErrorCodeDataLinkLayer 
regUICErrorCodeNetworkLayer 
regUICErrorCodeTransportLayer 
regUICErrorCodeDME 
regUTPTransferREQINTAGGControl 
regUTPTransferREQListBaseL 
regUTPTransferREQListBaseH 
regUTPTransferREQDoorbell 
regUTPTransferREQListClear 
regUTPTransferREQListRunStop 
regUTPTaskREQListBaseL 
regUTPTaskREQListBaseH 
regUTPTaskREQDoorbell 
regUTPTaskREQListClear 
regUTPTaskREQListRunStop 
regUICCommand 
regUICCommandArg1 
regUICCommandArg2 
regUICCommandArg3 

Definition at line 1206 of file ufs_device.hh.

Constructor & Destructor Documentation

◆ UFSHostDevice()

gem5::UFSHostDevice::UFSHostDevice ( const UFSHostDeviceParams & p)

Constructor for the UFS Host device.

Definition at line 718 of file ufs_device.cc.

References SCSIStart().

Member Function Documentation

◆ checkDrain()

void gem5::UFSHostDevice::checkDrain ( )

◆ clearInterrupt()

void gem5::UFSHostDevice::clearInterrupt ( )
private

Interrupt control functions.

Clear interrupt.

end of a transaction

Definition at line 1812 of file ufs_device.cc.

References checkDrain(), gem5::BaseGic::clearInt(), countInt, gem5::curTick(), DPRINTF, gic, idlePhaseStart, intNum, gem5::UFSHostDevice::HCIMem::TRUTRLDBR, and UFSHCIMem.

Referenced by read().

◆ commandHandler()

void gem5::UFSHostDevice::commandHandler ( )
private

Command handler function.

Handles the commands that are given.

Handles the command send to the Host controller

At this point in time, not many commands have been implemented in the driver.

Definition at line 1354 of file ufs_device.cc.

References gem5::UFSHostDevice::HCIMem::CMDUICCMDR, gem5::UFSHostDevice::HCIMem::ORHostControllerStatus, and UFSHCIMem.

Referenced by requestHandler().

◆ drain()

DrainState gem5::UFSHostDevice::drain ( )
overridevirtual

Drain; needed to enable checkpoints.

Reimplemented from gem5::SimObject.

Definition at line 2302 of file ufs_device.cc.

References DPRINTF, gem5::Drained, gem5::Draining, gem5::UFSHostDevice::HCIMem::TRUTRLDBR, and UFSHCIMem.

◆ finalUTP()

void gem5::UFSHostDevice::finalUTP ( )
private

final UTP, sends the last acknowledge data structure to the system; prepares the clean up functions.

finalUTP.

Second part of the transfer done event. this sends the final response: the UTP response. After this transaction the doorbell shall be cleared, and the interupt shall be set.

stats

Last message that will be transfered

clean and ensure that the tracker is updated

stats

This is the moment that the device is available again

Definition at line 1715 of file ufs_device.cc.

References activeDoorbells, gem5::UFSHostDevice::UFSHostDeviceStats::averageDoorbell, gem5::X86ISA::count, gem5::curTick(), DPRINTF, garbage, gem5::UFSHostDevice::UFSHostDeviceStats::maxDoorbell, pendingDoorbells, readDevice(), gem5::statistics::DistBase< Derived, Stor >::sample(), SCSIResume(), stats, gem5::UFSHostDevice::UFSHostDeviceStats::transactionLatency, transactionStart, transferEnd, transferEventQueue, transferTrack, gem5::UFSHostDevice::HCIMem::TRUTRLDBR, UFSDevice, UFSHCIMem, and gem5::statistics::ScalarBase< Derived, Stor >::value().

◆ generateInterrupt()

void gem5::UFSHostDevice::generateInterrupt ( )
private

set interrupt and sort out the doorbell register.

just to keep track of the transactions

step5 clear doorbell

step6 raise interrupt

Definition at line 1789 of file ufs_device.cc.

References checkDrain(), countInt, DPRINTF, gic, intNum, pendingDoorbells, gem5::BaseGic::sendInt(), transferTrack, gem5::UFSHostDevice::HCIMem::TRUTRLDBR, and UFSHCIMem.

Referenced by readDone(), and requestHandler().

◆ getAddrRanges()

AddrRangeList gem5::UFSHostDevice::getAddrRanges ( ) const
overrideprivatevirtual

Address range functions.

Determine address ranges.

Implements gem5::PioDevice.

Definition at line 903 of file ufs_device.cc.

References pioAddr, pioSize, and gem5::RangeSize().

◆ LUNSignal()

void gem5::UFSHostDevice::LUNSignal ( )
private

LU callback function to indicate that the action has completed.

Find finished transfer.

Callback function. One of the LUNs is done with the disk transfer and reports back to the controller. This function finds out who it was, and calls transferDone.

Definition at line 1644 of file ufs_device.cc.

References gem5::curTick(), lunAvail, panic, gem5::UFSHostDevice::transferInfo::size, transferDone(), and UFSDevice.

◆ manageReadTransfer()

void gem5::UFSHostDevice::manageReadTransfer ( uint32_t size,
uint32_t LUN,
uint64_t offset,
uint32_t sg_table_length,
struct UFSHCDSGEntry * sglist )
private

Manage read transfer.

Manages correct transfer flow and makes sure that the queues are filled on time

Break-up the transactions into actions defined by the scatter gather list.

The disk image is read here; but the action is simultated later You can see this as the preparation stage, whereas later is the simulation phase.

stats

stats

Definition at line 2091 of file ufs_device.cc.

References gem5::UFSHostDevice::UFSHostDeviceStats::averageReadSSDQueue, gem5::X86ISA::count, gem5::UFSHostDevice::UFSHostDeviceStats::currentReadSSDQueue, DPRINTF, gem5::UFSHostDevice::transferInfo::filePointer, gem5::UFSHostDevice::transferInfo::lunID, gem5::ArmISA::offset, gem5::UFSHostDevice::transferInfo::offset, gem5::statistics::ScalarBase< Derived, Stor >::size(), gem5::UFSHostDevice::transferInfo::size, gem5::UFSHostDevice::UFSHCDSGEntry::size, stats, gem5::UFSHostDevice::UFSHostDeviceStats::totalReadSSD, gem5::UFSHostDevice::UFSHostDeviceStats::totalReadUFSTransactions, UFSDevice, and gem5::UFSHostDevice::UFSHCDSGEntry::upperAddr.

Referenced by SCSIResume().

◆ manageWriteTransfer()

void gem5::UFSHostDevice::manageWriteTransfer ( uint8_t LUN,
uint64_t offset,
uint32_t sg_table_length,
struct UFSHCDSGEntry * sglist )
private

Disk transfer management functions these set up the queues, and initiated them, leading to the data transaction timing model based on the scatter gather list constructed in SCSIresume.

Manage write transfer.

Manages correct transfer flow and makes sure that the queues are filled on time

Break-up the transactions into actions defined by the scatter gather list.

If the queue is empty, the transaction should be initiated

stats

stats

Definition at line 1902 of file ufs_device.cc.

References gem5::X86ISA::count, dmaWriteInfo, DPRINTF, gem5::UFSHostDevice::writeToDiskBurst::LUN, gem5::ArmISA::offset, gem5::UFSHostDevice::writeToDiskBurst::SCSIDiskOffset, gem5::UFSHostDevice::UFSHCDSGEntry::size, gem5::UFSHostDevice::writeToDiskBurst::size, gem5::UFSHostDevice::writeToDiskBurst::start, stats, gem5::UFSHostDevice::UFSHostDeviceStats::totalWriteUFSTransactions, gem5::UFSHostDevice::UFSHostDeviceStats::totalWrittenSSD, UFSDevice, gem5::UFSHostDevice::UFSHCDSGEntry::upperAddr, and writeDevice().

Referenced by SCSIResume().

◆ read()

Tick gem5::UFSHostDevice::read ( PacketPtr pkt)
overrideprivatevirtual

register access functions

UFSHCD read register.

This function allows the system to read the register entries

Implements gem5::PioDevice.

Definition at line 916 of file ufs_device.cc.

References clearInterrupt(), gem5::UFSHostDevice::HCIMem::CMDUCMDARG1, gem5::UFSHostDevice::HCIMem::CMDUCMDARG2, gem5::UFSHostDevice::HCIMem::CMDUCMDARG3, gem5::UFSHostDevice::HCIMem::CMDUICCMDR, data, gem5::Packet::getAddr(), gem5::UFSHostDevice::HCIMem::HCCAP, gem5::UFSHostDevice::HCIMem::HCHCDDID, gem5::UFSHostDevice::HCIMem::HCHCPMID, gem5::UFSHostDevice::HCIMem::HCversion, gem5::Packet::makeResponse(), gem5::UFSHostDevice::HCIMem::ORHostControllerEnable, gem5::UFSHostDevice::HCIMem::ORHostControllerStatus, gem5::UFSHostDevice::HCIMem::ORInterruptEnable, gem5::UFSHostDevice::HCIMem::ORInterruptStatus, gem5::UFSHostDevice::HCIMem::ORUECDL, gem5::UFSHostDevice::HCIMem::ORUECDME, gem5::UFSHostDevice::HCIMem::ORUECN, gem5::UFSHostDevice::HCIMem::ORUECPA, gem5::UFSHostDevice::HCIMem::ORUECT, gem5::UFSHostDevice::HCIMem::ORUTRIACR, pioDelay, regControllerCapabilities, regControllerDEVID, regControllerEnable, regControllerPRODID, regControllerStatus, regInterruptEnable, regInterruptStatus, regUFSVersion, regUICCommand, regUICCommandArg1, regUICCommandArg2, regUICCommandArg3, regUICErrorCodeDataLinkLayer, regUICErrorCodeDME, regUICErrorCodeNetworkLayer, regUICErrorCodePHYAdapterLayer, regUICErrorCodeTransportLayer, regUTPTaskREQDoorbell, regUTPTaskREQListBaseH, regUTPTaskREQListBaseL, regUTPTaskREQListClear, regUTPTaskREQListRunStop, regUTPTransferREQDoorbell, regUTPTransferREQINTAGGControl, regUTPTransferREQListBaseH, regUTPTransferREQListBaseL, regUTPTransferREQListClear, regUTPTransferREQListRunStop, gem5::Packet::setLE(), gem5::UFSHostDevice::HCIMem::TMUTMRLBA, gem5::UFSHostDevice::HCIMem::TMUTMRLBAU, gem5::UFSHostDevice::HCIMem::TMUTMRLCLR, gem5::UFSHostDevice::HCIMem::TMUTMRLDBR, gem5::UFSHostDevice::HCIMem::TMUTMRLRSR, gem5::UFSHostDevice::HCIMem::TRUTRLBA, gem5::UFSHostDevice::HCIMem::TRUTRLBAU, gem5::UFSHostDevice::HCIMem::TRUTRLCLR, gem5::UFSHostDevice::HCIMem::TRUTRLDBR, gem5::UFSHostDevice::HCIMem::TRUTRLRSR, and UFSHCIMem.

◆ readCallback()

void gem5::UFSHostDevice::readCallback ( )
private

Read callback Call back function for the logic units to indicate the completion of a read action.

Read callback, on the way from the disk to the DMA.

Note that this is needed because the read functionality needs to push data structures back to the memory.

Called by the UFSSCSI layer.

stats

Definition at line 2218 of file ufs_device.cc.

References gem5::curTick(), DPRINTF, lunAvail, name(), panic, readDevice(), readGarbage(), readGarbageEventQueue, SSDReadPending, stats, gem5::UFSHostDevice::UFSHostDeviceStats::totalReadDiskTransactions, and UFSDevice.

◆ readDevice()

void gem5::UFSHostDevice::readDevice ( bool lastTransfer,
Addr start,
uint32_t size,
uint8_t * destination,
bool no_cache,
Event * additional_action )
private

Dma transaction function: read device.

Notice that the dma action is from a device perspective, while this function is from an initiator perspective

check wether interrupt is needed

Definition at line 2056 of file ufs_device.cc.

References gem5::X86ISA::destination, gem5::DmaPort::dmaAction(), gem5::DmaDevice::dmaPort, DPRINTF, name(), readDone(), readDoneEvent, readPendingNum, gem5::Event::scheduled(), and gem5::MemCmd::WriteReq.

Referenced by finalUTP(), readCallback(), SCSIResume(), taskHandler(), and transferDone().

◆ readDone()

void gem5::UFSHostDevice::readDone ( )
private

Read done Started at the end of a transaction after the last read action.

Read done handling function, is only initiated at the end of a transaction.

Cleans up UTP descriptor and other remaining data structures. It also raises the interrupt.

Garbage collection; sort out the allocated UTP descriptor

done, generate interrupt if we havent got one already

Definition at line 1761 of file ufs_device.cc.

References DPRINTF, garbage, generateInterrupt(), gem5::UFSHostDevice::HCIMem::ORInterruptStatus, readDoneEvent, readPendingNum, UFSHCIMem, and UTPTransferREQCOMPL.

Referenced by readDevice().

◆ readGarbage()

void gem5::UFSHostDevice::readGarbage ( )
private

Read garbage A read from disk data structure can vary in size and is therefor allocated on creation.

After a disk read DMA transfer, the structure needs to be freed.

It can only be destroyed once that particular read action has completed. This function is called on completion of a read from disk action to handle this.

This is done in this function.

Definition at line 2256 of file ufs_device.cc.

References DPRINTF, readGarbageEventQueue, and SSDReadPending.

Referenced by readCallback().

◆ requestHandler()

void gem5::UFSHostDevice::requestHandler ( )
private

Handler functions.

Request handler.

Each function handles a different stage of the transfer. Note that the UFS protocol specifies three types of messages to the host (and devices): 1: Command (to Host specifically) 2: Task (to device; to control flow, not for data) 3: Transfer (to device; to transfer data) request handler. This function finds the cause of the request and triggers the right follow-up action (command handler, task handler, or transferhandler)

Determines where the request comes from and initiates the appropriate actions accordingly.

step1 determine what called us step2 determine where to get it Look for any request of which we where not yet aware

Command; general control of the Host controller. no DMA transfer needed

Task; flow control, meant for the device/Logic unit DMA transfer is needed, flash will not be approached

Find the position that is not handled yet

Transfer; Data transfer from or to the disk. There will be DMA transfers, and the flash might be approached. Further commands, are needed to specify the exact command.

Find the position that is not handled yet

stats

step3 start transfer step4 register information; allowing the host to respond in the end

Deleted in readDone, queued in finalUTP

Definition at line 1201 of file ufs_device.cc.

References activeDoorbells, gem5::UFSHostDevice::taskStart::address, gem5::UFSHostDevice::transferStart::address, gem5::UFSHostDevice::UFSHostDeviceStats::averageDoorbell, gem5::UFSHostDevice::HCIMem::CMDUICCMDR, commandHandler(), gem5::X86ISA::count, gem5::curTick(), gem5::UFSHostDevice::taskStart::done, gem5::UFSHostDevice::transferStart::done, DPRINTF, gem5::findLsbSet(), generateInterrupt(), inform, gem5::ArmISA::mask, gem5::UFSHostDevice::taskStart::mask, gem5::UFSHostDevice::transferStart::mask, gem5::UFSHostDevice::UFSHostDeviceStats::maxDoorbell, name(), gem5::UFSHostDevice::HCIMem::ORInterruptStatus, gem5::UFSHostDevice::taskStart::size, gem5::UFSHostDevice::transferStart::size, stats, taskCommandTrack, taskEventQueue, taskInfo, taskStart(), gem5::UFSHostDevice::HCIMem::TMUTMRLBA, gem5::UFSHostDevice::HCIMem::TMUTMRLBAU, gem5::UFSHostDevice::HCIMem::TMUTMRLDBR, transactionStart, transferEventQueue, transferStart(), transferStartInfo, transferTrack, gem5::UFSHostDevice::HCIMem::TRUTRLBA, gem5::UFSHostDevice::HCIMem::TRUTRLBAU, gem5::UFSHostDevice::HCIMem::TRUTRLDBR, UFSHCIMem, UICCommandCOMPL, gem5::statistics::ScalarBase< Derived, Stor >::value(), and writeDevice().

Referenced by write().

◆ SCSIResume()

void gem5::UFSHostDevice::SCSIResume ( uint32_t lun_id)
private

Starts the scsi handling function in the apropriate Logic unit, prepares the right data transfer scheme and kicks it off.

Handles the transfer requests that are given.

There can be three types of transfer. SCSI specific, Reads and writes apart from the data transfer, this also generates its own reply (UPIU response). Information for this reply is stored in transferInfo and will be used in transferDone

old info, lets form it such that we can understand it

call logic unit to handle SCSI command

build response stating that it was succesful command completion, Logic unit number, and Task tag

SCSI status reply

segment size + EHS length (see UFS standard ch7)

amount of data that will follow

transferdone information packet filling

In this part the data that needs to be transfered will be initiated and the chain of DMA (and potentially) disk transactions will be started.

write transfer

read transfer

not disk related transfer, SCSI maintanance

Transport the SCSI reponse data according to the SG list

safetynet; it has been shown that sg list may be optimistic in the amount of data allocated, which can potentially lead to some garbage data being send over. Hence this construction that finds the least amount of data that needs to be transfered.

Go to the next stage of the answering process

Definition at line 1492 of file ufs_device.cc.

References gem5::UFSHostDevice::UTPTransferReqDesc::commandDescBaseAddrHi, gem5::UFSHostDevice::UTPTransferReqDesc::commandDescBaseAddrLo, gem5::X86ISA::count, gem5::UFSHostDevice::UPIUMessage::dataMsg, DPRINTF, gem5::UFSHostDevice::UTPTransferReqDesc::RequestDescHeader::dWord0, gem5::UFSHostDevice::SCSIReply::expectMore, gem5::UFSHostDevice::UTPTransferReqDesc::header, gem5::UFSHostDevice::SCSIReply::LUN, manageReadTransfer(), manageWriteTransfer(), gem5::UFSHostDevice::SCSIReply::message, gem5::UFSHostDevice::SCSIReply::msgSize, gem5::UFSHostDevice::SCSIReply::offset, panic, gem5::UFSHostDevice::UTPTransferReqDesc::PRDTableLength, gem5::UFSHostDevice::UTPTransferReqDesc::PRDTableOffset, readDevice(), request_out_datain, gem5::UFSHostDevice::UTPTransferReqDesc::responseUPIULength, gem5::UFSHostDevice::SCSIReply::senseCode, gem5::UFSHostDevice::SCSIReply::senseSize, gem5::UFSHostDevice::UFSHCDSGEntry::size, gem5::UFSHostDevice::SCSIReply::status, transferDone(), gem5::UFSHostDevice::HCIMem::TRUTRLDBR, UFSDevice, UFSHCIMem, and gem5::UFSHostDevice::UFSHCDSGEntry::upperAddr.

Referenced by finalUTP(), and SCSIStart().

◆ SCSIStart()

void gem5::UFSHostDevice::SCSIStart ( )
private

Transfer SCSI function.

Obtain LUN and put it in the right LUN queue.

Determines which Logic unit to address and starts the SCSI resume function

Each LUN has its own queue of commands that need to be executed. This is the first instance where it can be determined which Logic unit should handle the transfer. Then check wether it should wait and queue or if it can continue.

There are 32 doorbells, so at max there can be 32 transactions

First transfer is done, fetch the next; At this point, the device is busy, not the HC

loading next data packet in case Another LUN is approached in the mean time

Definition at line 1447 of file ufs_device.cc.

References gem5::UFSHostDevice::SCSIResumeInfo::destination, DPRINTF, panic, SCSIInfo, SCSIResume(), transferEventQueue, transferStartInfo, UFSDevice, and writeDevice().

Referenced by UFSHostDevice().

◆ serialize()

void gem5::UFSHostDevice::serialize ( CheckpointOut & cp) const
overridevirtual

Serialize; needed to make checkpoints.

Reimplemented from gem5::ClockedObject.

Definition at line 2268 of file ufs_device.cc.

References lunAvail, gem5::ClockedObject::serialize(), SERIALIZE_ARRAY, SERIALIZE_SCALAR, and UFSHCIMem.

◆ setValues()

void gem5::UFSHostDevice::setValues ( )
private

◆ taskHandler()

void gem5::UFSHostDevice::taskHandler ( struct UTPUPIUTaskReq * request_in,
uint32_t req_pos,
Addr finaladdress,
uint32_t finalsize )
private

Task handler function.

Handles the tasks that are given.

Handles the tasks send to the devices because there are not many tasks implemented yet this is kept in the Host controller layer

At this point in time, not many tasks have been implemented in the driver.

For now, just unpack and acknowledge the task without doing anything. TODO Implement UFS tasks.

Definition at line 1368 of file ufs_device.cc.

References gem5::UFSHostDevice::UTPUPIUHeader::dWord0, gem5::UFSHostDevice::UTPUPIUHeader::dWord1, gem5::UFSHostDevice::UTPUPIUHeader::dWord2, gem5::UFSHostDevice::UTPUPIUTaskReq::header, inform, gem5::UFSHostDevice::HCIMem::ORInterruptStatus, readDevice(), taskCommandTrack, gem5::UFSHostDevice::HCIMem::TMUTMRLDBR, UFSHCIMem, and UTPTaskREQCOMPL.

Referenced by taskStart().

◆ taskStart()

void gem5::UFSHostDevice::taskStart ( )
private

Task Start function.

Task start event.

Starts the task handler once the task data structure has arrived

Definition at line 1320 of file ufs_device.cc.

References DPRINTF, taskEventQueue, taskHandler(), and taskInfo.

Referenced by requestHandler().

◆ transferDone()

void gem5::UFSHostDevice::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 )
private

transfer done, the beginning of the final stage of the transfer.

Transfer done.

Acknowledges UPIU frame and prepares the UTP response frame

When the data transfer is done, this function ensures that the application is notified.

Test whether SCSI queue hasn't popped prematurely

Definition at line 1676 of file ufs_device.cc.

References gem5::UFSHostDevice::transferStart::address, gem5::UFSHostDevice::transferStart::destination, gem5::X86ISA::destination, gem5::UFSHostDevice::transferStart::done, DPRINTF, gem5::UFSHostDevice::transferStart::lun_id, gem5::UFSHostDevice::transferStart::mask, panic, readDevice(), gem5::UFSHostDevice::transferStart::size, transferEnd, gem5::UFSHostDevice::HCIMem::TRUTRLDBR, UFSDevice, UFSHCIMem, and UTPEvent.

Referenced by LUNSignal(), and SCSIResume().

◆ transferHandler()

void gem5::UFSHostDevice::transferHandler ( struct UTPTransferReqDesc * request_in,
int req_pos,
Addr finaladdress,
uint32_t finalsize,
uint32_t done )
private

Transfer handler function.

Obtains the SCSI command (if any) Two possibilities: if it contains a SCSI command, then it is a usable message; if it doesnt contain a SCSI message, then it can't be handeld by this code.

Handles the transfers send to the devices Important to understand here is that a Logic unit is not a device (a device can contain multiple logic units). This function analyses the first data structure that has been transfered. Which will tell the host to expect SCSI frames for the rest of the transaction. Note that the host has no indication whatsoever which LU to address. That will follow in the next transaction.

This is the second stage of the transfer. We have the information about where the next command can be found and what the type of command is. The actions that are needed from the device its side are: get the information and store the information such that we can reply.

Get the UTP command that has the SCSI command

Definition at line 1404 of file ufs_device.cc.

References gem5::UFSHostDevice::UTPTransferReqDesc::commandDescBaseAddrHi, gem5::UFSHostDevice::UTPTransferReqDesc::commandDescBaseAddrLo, gem5::UFSHostDevice::SCSIResumeInfo::destination, gem5::UFSHostDevice::SCSIResumeInfo::done, DPRINTF, gem5::UFSHostDevice::UTPTransferReqDesc::RequestDescHeader::dWord2, gem5::UFSHostDevice::SCSIResumeInfo::finalAddress, gem5::UFSHostDevice::SCSIResumeInfo::finalSize, gem5::UFSHostDevice::UTPTransferReqDesc::header, gem5::UFSHostDevice::UTPTransferReqDesc::PRDTableLength, gem5::UFSHostDevice::UTPTransferReqDesc::PRDTableOffset, gem5::UFSHostDevice::SCSIResumeInfo::reqPos, gem5::UFSHostDevice::SCSIResumeInfo::RequestIn, gem5::Event::scheduled(), SCSIInfo, SCSIResumeEvent, transferEventQueue, and writeDevice().

Referenced by transferStart().

◆ transferStart()

void gem5::UFSHostDevice::transferStart ( )
private

Transfer Start function.

Transfer start event.

Starts the transfer handler once the transfer data structure has arrived

Definition at line 1334 of file ufs_device.cc.

References DPRINTF, transferEventQueue, transferHandler(), and transferStartInfo.

Referenced by requestHandler().

◆ unserialize()

void gem5::UFSHostDevice::unserialize ( CheckpointIn & cp)
overridevirtual

Unserialize; needed to restore from checkpoints.

Reimplemented from gem5::ClockedObject.

Definition at line 2285 of file ufs_device.cc.

References lunAvail, UFSHCIMem, gem5::ClockedObject::unserialize(), UNSERIALIZE_ARRAY, and UNSERIALIZE_SCALAR.

◆ write()

Tick gem5::UFSHostDevice::write ( PacketPtr pkt)
overrideprivatevirtual

UFSHCD write function.

This function allows access to the writeable registers. If any function attempts to write value to an unwriteable register entry, then the value will not be written.

Implements gem5::PioDevice.

Definition at line 1054 of file ufs_device.cc.

References gem5::UFSHostDevice::HCIMem::CMDUCMDARG1, gem5::UFSHostDevice::HCIMem::CMDUCMDARG2, gem5::UFSHostDevice::HCIMem::CMDUCMDARG3, gem5::UFSHostDevice::HCIMem::CMDUICCMDR, gem5::curTick(), data, gem5::Packet::getAddr(), gem5::Packet::getSize(), gem5::Packet::getUintX(), idlePhaseStart, gem5::UFSHostDevice::UFSHostDeviceStats::idleTimes, gem5::Packet::makeResponse(), gem5::UFSHostDevice::HCIMem::ORHostControllerEnable, gem5::UFSHostDevice::HCIMem::ORHostControllerStatus, gem5::UFSHostDevice::HCIMem::ORInterruptEnable, gem5::UFSHostDevice::HCIMem::ORUECDL, gem5::UFSHostDevice::HCIMem::ORUECDME, gem5::UFSHostDevice::HCIMem::ORUECN, gem5::UFSHostDevice::HCIMem::ORUECPA, gem5::UFSHostDevice::HCIMem::ORUECT, gem5::UFSHostDevice::HCIMem::ORUTRIACR, pioDelay, regControllerCapabilities, regControllerDEVID, regControllerEnable, regControllerPRODID, regControllerStatus, regInterruptEnable, regInterruptStatus, regUFSVersion, regUICCommand, regUICCommandArg1, regUICCommandArg2, regUICCommandArg3, regUICErrorCodeDataLinkLayer, regUICErrorCodeDME, regUICErrorCodeNetworkLayer, regUICErrorCodePHYAdapterLayer, regUICErrorCodeTransportLayer, regUTPTaskREQDoorbell, regUTPTaskREQListBaseH, regUTPTaskREQListBaseL, regUTPTaskREQListClear, regUTPTaskREQListRunStop, regUTPTransferREQDoorbell, regUTPTransferREQINTAGGControl, regUTPTransferREQListBaseH, regUTPTransferREQListBaseL, regUTPTransferREQListClear, regUTPTransferREQListRunStop, requestHandler(), gem5::statistics::DistBase< Derived, Stor >::sample(), stats, gem5::UFSHostDevice::HCIMem::TMUTMRLBA, gem5::UFSHostDevice::HCIMem::TMUTMRLBAU, gem5::UFSHostDevice::HCIMem::TMUTMRLCLR, gem5::UFSHostDevice::HCIMem::TMUTMRLDBR, gem5::UFSHostDevice::HCIMem::TMUTMRLRSR, gem5::UFSHostDevice::HCIMem::TRUTRLBA, gem5::UFSHostDevice::HCIMem::TRUTRLBAU, gem5::UFSHostDevice::HCIMem::TRUTRLCLR, gem5::UFSHostDevice::HCIMem::TRUTRLDBR, gem5::UFSHostDevice::HCIMem::TRUTRLRSR, UFSHCIMem, and UICCommandReady.

◆ writeDevice()

void gem5::UFSHostDevice::writeDevice ( Event * additional_action,
bool toDisk,
Addr start,
int size,
uint8_t * destination,
uint64_t SCSIDiskOffset,
uint32_t lun_id )
private

DMA transfer functions These allow the host to push/pull the data to the memory The provided event indicates what the next phase it that will handle the obtained data, or what the follow up action is once the data has been pushed to the memory.

Important to understand about the transfer flow: We have basically three stages, The "system memory" stage, the "device buffer" stage and the "disk" stage.

In this model we assume an infinite buffer, or a buffer that is big enough to store all the data in the biggest transaction. Between the three stages are two queues. Those queues store the messages to simulate their transaction from one stage to the next. The manage{Action} function fills up one of the queues and triggers the first event, which causes a chain reaction of events executed once they pass through their queues. For a write action the stages are ordered "system memory", "device buffer" and "disk", whereas the read transfers happen "disk", "device buffer" and "system memory". The dma action in the dma device is written from a bus perspective whereas this model is written from a device perspective. To avoid confusion, the translation between the two has been made in the writeDevice and readDevice funtions. Dma transaction function: write device. Note that the dma action is from a device perspective, while this function is from an initiator perspective

check whether transfer is all the way to the flash

destination is an offset here since we are writing to a disk

allocate appropriate buffer

transaction

Definition at line 1850 of file ufs_device.cc.

References gem5::curTick(), gem5::X86ISA::destination, gem5::DmaPort::dmaAction(), gem5::DmaDevice::dmaPort, DPRINTF, gem5::UFSHostDevice::transferInfo::filePointer, gem5::UFSHostDevice::transferInfo::lunID, name(), gem5::UFSHostDevice::transferInfo::offset, gem5::MemCmd::ReadReq, gem5::Event::scheduled(), gem5::UFSHostDevice::transferInfo::size, SSDWriteinfo, writeDone(), writeDoneEvent, and writePendingNum.

Referenced by manageWriteTransfer(), requestHandler(), SCSIStart(), transferHandler(), and writeDone().

◆ writeDone()

void gem5::UFSHostDevice::writeDone ( )
private

Write done After a DMA write with data intended for the disk, this function is called.

Write done handling function.

It ensures that the disk image is modified, and that the correct timing function is triggered.

Is only initiated when the flash is directly approached

DMA is done, information no longer needed

If there is nothing on the way, we need to start the events

Write the disk

Move to the second queue, enter the logic unit This is where the disk is approached and the flash transaction is handled SSDWriteDone will take care of the timing

so far, only the DMA part has been handled, lets do the disk delay

stats

initiate the next dma action (if any)

Definition at line 1961 of file ufs_device.cc.

References gem5::UFSHostDevice::UFSHostDeviceStats::averageWriteSSDQueue, gem5::UFSHostDevice::UFSHostDeviceStats::currentWriteSSDQueue, dmaWriteInfo, DPRINTF, gem5::statistics::ScalarBase< Derived, Stor >::size(), SSDWriteinfo, stats, gem5::UFSHostDevice::UFSHostDeviceStats::totalWriteDiskTransactions, UFSDevice, writeDevice(), and writePendingNum.

Referenced by writeDevice().

Member Data Documentation

◆ activeDoorbells

uint8_t gem5::UFSHostDevice::activeDoorbells
private

Statistics helper variables Active doorbells indicates how many doorbells are in teh process of being handled.

Pending doorbells have been handled and are waiting to be acknowledged by the host system. The doorbell register is 32 bits wide, so one byte is enough to keep track of the numbers

Definition at line 1052 of file ufs_device.hh.

Referenced by checkDrain(), finalUTP(), and requestHandler().

◆ countInt

uint32_t gem5::UFSHostDevice::countInt
private

interrupt verification This keeps track of the number of interrupts generated.

It is usefull for debug purposes. Make sure that the implemented driver prints the number of interrupts it has handled so far to fully benefit from this feature.

Definition at line 1062 of file ufs_device.hh.

Referenced by clearInterrupt(), and generateInterrupt().

◆ dmaWriteInfo

std::deque<struct writeToDiskBurst> gem5::UFSHostDevice::dmaWriteInfo
private

Information to get a DMA transaction.

Definition at line 1129 of file ufs_device.hh.

Referenced by manageWriteTransfer(), and writeDone().

◆ garbage

std::deque<struct UTPTransferReqDesc*> gem5::UFSHostDevice::garbage
private

garbage queue, ensure clearing of the allocated memory

Definition at line 1144 of file ufs_device.hh.

Referenced by finalUTP(), and readDone().

◆ gic

BaseGic* gem5::UFSHostDevice::gic
private

Definition at line 1028 of file ufs_device.hh.

Referenced by clearInterrupt(), and generateInterrupt().

◆ idlePhaseStart

Tick gem5::UFSHostDevice::idlePhaseStart
private

Definition at line 1081 of file ufs_device.hh.

Referenced by clearInterrupt(), and write().

◆ intNum

const int gem5::UFSHostDevice::intNum
private

Definition at line 1027 of file ufs_device.hh.

Referenced by clearInterrupt(), and generateInterrupt().

◆ lunAvail

const uint32_t gem5::UFSHostDevice::lunAvail
private

Definition at line 1029 of file ufs_device.hh.

Referenced by LUNSignal(), readCallback(), serialize(), and unserialize().

◆ pendingDoorbells

uint8_t gem5::UFSHostDevice::pendingDoorbells
private

Definition at line 1053 of file ufs_device.hh.

Referenced by finalUTP(), and generateInterrupt().

◆ pioAddr

const Addr gem5::UFSHostDevice::pioAddr
private

Host controller information.

Definition at line 1024 of file ufs_device.hh.

Referenced by getAddrRanges().

◆ pioDelay

const Tick gem5::UFSHostDevice::pioDelay
private

Definition at line 1026 of file ufs_device.hh.

Referenced by read(), and write().

◆ pioSize

const Addr gem5::UFSHostDevice::pioSize
private

Definition at line 1025 of file ufs_device.hh.

Referenced by getAddrRanges().

◆ readDoneEvent

std::deque<EventFunctionWrapper> gem5::UFSHostDevice::readDoneEvent
private

Transfer flow events Basically these events form two queues, one from memory to UFS device (DMA) and one from device to flash (SSD).

The SSD "queue" is maintained by the flash and the lun classes and does not form a queue of events as such, but rather a queue of information. This can be done because the flow of the events is completely in the control of these classes. (Whereas in the DMA case we rely on an external class)

Definition at line 1160 of file ufs_device.hh.

Referenced by readDevice(), and readDone().

◆ readGarbageEventQueue

std::deque<EventFunctionWrapper> gem5::UFSHostDevice::readGarbageEventQueue
private

Event after a read to clean up the UTP data structures.

Definition at line 1183 of file ufs_device.hh.

Referenced by readCallback(), and readGarbage().

◆ readPendingNum

int gem5::UFSHostDevice::readPendingNum
private

Track number of DMA transactions in progress.

Definition at line 1040 of file ufs_device.hh.

Referenced by readDevice(), and readDone().

◆ request_out_datain

struct SCSIReply gem5::UFSHostDevice::request_out_datain
private

SCSI reply structure, used for direct answering.

Might be refered to during the assembly of the reply (data, and response; e.g. if something goes wrong along the way, the reply will be different)

Definition at line 1095 of file ufs_device.hh.

Referenced by SCSIResume().

◆ SCSIInfo

struct SCSIResumeInfo gem5::UFSHostDevice::SCSIInfo
private

SCSI resume info information structure for SCSI resume.

it keeps track of all the information that is needed to successfully complete the transaction (response addresses, communicated information so far, etc.).

Definition at line 1103 of file ufs_device.hh.

Referenced by SCSIStart(), and transferHandler().

◆ SCSIResumeEvent

EventFunctionWrapper gem5::UFSHostDevice::SCSIResumeEvent
private

The events that control the functionality.

After a doorbell has been set, either a taskevent or a transfer event is scheduled. A transfer event might schedule a SCSI event, all events sequences end with an UTP event, which can be considered as the event which answers the doorbell. Wait for the SCSI specific data to arive

Definition at line 1173 of file ufs_device.hh.

Referenced by transferHandler().

◆ SSDReadPending

std::deque<struct transferInfo> gem5::UFSHostDevice::SSDReadPending
private

Information from the Disk, waiting to be pushed to the DMA.

Definition at line 1139 of file ufs_device.hh.

Referenced by readCallback(), and readGarbage().

◆ SSDWriteinfo

std::deque<struct transferInfo> gem5::UFSHostDevice::SSDWriteinfo
private

Information from DMA transaction to disk.

Definition at line 1134 of file ufs_device.hh.

Referenced by writeDevice(), and writeDone().

◆ stats

struct UFSHostDeviceStats gem5::UFSHostDevice::stats
private

RequestHandler stats.

Definition at line 1149 of file ufs_device.hh.

Referenced by finalUTP(), manageReadTransfer(), manageWriteTransfer(), readCallback(), requestHandler(), write(), and writeDone().

◆ taskCommandTrack

uint32_t gem5::UFSHostDevice::taskCommandTrack
private

Definition at line 1073 of file ufs_device.hh.

Referenced by requestHandler(), and taskHandler().

◆ taskEventQueue

std::deque<EventFunctionWrapper> gem5::UFSHostDevice::taskEventQueue
private

Multiple tasks transfers can be scheduled at once for the device, the only thing we know for sure about them is that they will happen in a first come first serve order; hence we need to queue.

Definition at line 1190 of file ufs_device.hh.

Referenced by requestHandler(), and taskStart().

◆ taskInfo

std::deque<struct taskStart> gem5::UFSHostDevice::taskInfo
private

When a task/transfer is started it needs information about the task/transfer it is about to perform.

This is defined in these structures. If multiple tasks/transfers are issued at the same time, they still need to be fetched one by one. They then need to be executed in the order specified by the UFS standard (least significant doorbell first). The tasks/transfers are placed in the queue in that specific order.

Definition at line 1123 of file ufs_device.hh.

Referenced by requestHandler(), and taskStart().

◆ transactionStart

Tick gem5::UFSHostDevice::transactionStart[32]
private

Helper for latency stats These variables keep track of the latency for every doorbell.

Eventually the latenmcies will be put in a histogram.

Definition at line 1080 of file ufs_device.hh.

Referenced by finalUTP(), and requestHandler().

◆ transferEnd

std::deque<struct transferStart> gem5::UFSHostDevice::transferEnd
private

To finish the transaction one needs information about the original message.

This is stored in this queue transferEnd uses the same structure as transferStartInfo, because all the information it needs is in there. It improves readability in the cc file.

Definition at line 1112 of file ufs_device.hh.

Referenced by finalUTP(), and transferDone().

◆ transferEventQueue

std::deque<EventFunctionWrapper> gem5::UFSHostDevice::transferEventQueue
private

Definition at line 1191 of file ufs_device.hh.

Referenced by finalUTP(), requestHandler(), SCSIStart(), transferHandler(), and transferStart().

◆ transferStartInfo

std::deque<struct transferStart> gem5::UFSHostDevice::transferStartInfo
private

Definition at line 1124 of file ufs_device.hh.

Referenced by requestHandler(), SCSIStart(), and transferStart().

◆ transferTrack

uint32_t gem5::UFSHostDevice::transferTrack
private

Track the transfer This is allows the driver to "group" certain transfers together by using a tag in the UPIU.

The messages with the same tag should be handled together, i.e. their doorbells should be cleared when they are all done. but we need to keep track of the ones we already handled, this integer shadows the doorbells to allow this behaviour.

Definition at line 1072 of file ufs_device.hh.

Referenced by finalUTP(), generateInterrupt(), and requestHandler().

◆ UFSDevice

std::vector<UFSSCSIDevice*> gem5::UFSHostDevice::UFSDevice
private

logic units connected to the UFS Host device Note again that the "device" as such is represented by one or multiple logic units.

Definition at line 1088 of file ufs_device.hh.

Referenced by finalUTP(), LUNSignal(), manageReadTransfer(), manageWriteTransfer(), readCallback(), SCSIResume(), SCSIStart(), transferDone(), and writeDone().

◆ UFSHCIMem

HCIMem gem5::UFSHostDevice::UFSHCIMem
private

◆ UFSSlots

const uint8_t gem5::UFSHostDevice::UFSSlots
private

Definition at line 1030 of file ufs_device.hh.

Referenced by setValues().

◆ UICCommandCOMPL

const unsigned int gem5::UFSHostDevice::UICCommandCOMPL = 0x400
staticprivate

Definition at line 1198 of file ufs_device.hh.

Referenced by requestHandler().

◆ UICCommandReady

const unsigned int gem5::UFSHostDevice::UICCommandReady = 0x08
staticprivate

Definition at line 1199 of file ufs_device.hh.

Referenced by write().

◆ UTPEvent

EventFunctionWrapper gem5::UFSHostDevice::UTPEvent
private

Wait for the moment where we can send the last frame.

Definition at line 1178 of file ufs_device.hh.

Referenced by transferDone().

◆ UTPTaskREQCOMPL

const unsigned int gem5::UFSHostDevice::UTPTaskREQCOMPL = 0x200
staticprivate

Definition at line 1197 of file ufs_device.hh.

Referenced by taskHandler().

◆ UTPTransferREQCOMPL

const unsigned int gem5::UFSHostDevice::UTPTransferREQCOMPL = 0x01
staticprivate

Bits of interest within UFS data packages.

Definition at line 1196 of file ufs_device.hh.

Referenced by readDone().

◆ writeDoneEvent

std::deque<EventFunctionWrapper> gem5::UFSHostDevice::writeDoneEvent
private

Definition at line 1161 of file ufs_device.hh.

Referenced by writeDevice().

◆ writePendingNum

int gem5::UFSHostDevice::writePendingNum
private

Definition at line 1041 of file ufs_device.hh.

Referenced by writeDevice(), and writeDone().


The documentation for this class was generated from the following files:

Generated on Tue Jun 18 2024 16:24:15 for gem5 by doxygen 1.11.0