gem5  v21.1.0.2
Classes | Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
gem5::IdeDisk Class Reference

IDE Disk device model. More...

#include <ide_disk.hh>

Inheritance diagram for gem5::IdeDisk:
gem5::SimObject gem5::EventManager gem5::Serializable gem5::Drainable gem5::statistics::Group gem5::Named

Classes

struct  IdeDiskStats
 

Public Types

typedef IdeDiskParams Params
 
- Public Types inherited from gem5::SimObject
typedef SimObjectParams Params
 

Public Member Functions

 IdeDisk (const Params &p)
 
 ~IdeDisk ()
 Delete the data buffer. More...
 
void reset (int id)
 Reset the device state. More...
 
void setController (IdeController *c, Addr chunk_bytes)
 Set the controller for this device. More...
 
void readCommand (const Addr offset, int size, uint8_t *data)
 
void readControl (const Addr offset, int size, uint8_t *data)
 
void writeCommand (const Addr offset, int size, const uint8_t *data)
 
void writeControl (const Addr offset, int size, const uint8_t *data)
 
void startDma (const uint32_t &prdTableBase)
 
void abortDma ()
 
- Public Member Functions inherited from gem5::SimObject
const Paramsparams () const
 
 SimObject (const Params &p)
 
virtual ~SimObject ()
 
virtual void init ()
 init() is called after all C++ SimObjects have been created and all ports are connected. More...
 
virtual void loadState (CheckpointIn &cp)
 loadState() is called on each SimObject when restoring from a checkpoint. More...
 
virtual void initState ()
 initState() is called on each SimObject when not restoring from a checkpoint. More...
 
virtual void regProbePoints ()
 Register probe points for this object. More...
 
virtual void regProbeListeners ()
 Register probe listeners for this object. More...
 
ProbeManagergetProbeManager ()
 Get the probe manager for this object. More...
 
virtual PortgetPort (const std::string &if_name, PortID idx=InvalidPortID)
 Get a port with a given name and index. More...
 
virtual void startup ()
 startup() is the final initialization call before simulation. More...
 
DrainState drain () override
 Provide a default implementation of the drain interface for objects that don't need draining. More...
 
virtual void memWriteback ()
 Write back dirty buffers to memory using functional writes. More...
 
virtual void memInvalidate ()
 Invalidate the contents of memory buffers. More...
 
void serialize (CheckpointOut &cp) const override
 Serialize an object. More...
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object. More...
 
- 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. More...
 
void setCurTick (Tick newVal)
 
 EventManager (EventManager &em)
 Event manger manages events in the event queue. More...
 
 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. More...
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object. More...
 
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. More...
 
virtual void notifyFork ()
 Notify a child process of a fork. More...
 
- Public Member Functions inherited from gem5::statistics::Group
 Group (Group *parent, const char *name=nullptr)
 Construct a new statistics group. More...
 
virtual ~Group ()
 
virtual void regStats ()
 Callback to set stat parameters. More...
 
virtual void resetStats ()
 Callback to reset stats. More...
 
virtual void preDumpStats ()
 Callback before stats are dumped. More...
 
void addStat (statistics::Info *info)
 Register a stat with this group. More...
 
const std::map< std::string, Group * > & getStatGroups () const
 Get all child groups associated with this object. More...
 
const std::vector< Info * > & getStats () const
 Get all stats associated with this object. More...
 
void addStatGroup (const char *name, Group *block)
 Add a stat block as a child of this block. More...
 
const InforesolveStat (std::string name) const
 Resolve a stat by its name within this group. More...
 
void mergeStatGroup (Group *block)
 Merge the contents (stats & children) of a block to this block. More...
 
 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
 

Protected Attributes

IdeControllerctrl
 The IDE controller for this disk. More...
 
DiskImageimage
 The image that contains the data of this disk. More...
 
int diskDelay
 The disk delay in microseconds. More...
 
- Protected Attributes inherited from gem5::SimObject
const SimObjectParams & _params
 Cached copy of the object parameters. More...
 
- Protected Attributes inherited from gem5::EventManager
EventQueueeventq
 A pointer to this object's event queue. More...
 

Private Member Functions

void startCommand ()
 
void intrPost ()
 
void intrClear ()
 
void doDmaTransfer ()
 
void doDmaDataRead ()
 
void doDmaRead ()
 
void doDmaDataWrite ()
 
void doDmaWrite ()
 
void dmaPrdReadDone ()
 
void dmaReadDone ()
 
void dmaWriteDone ()
 
void readDisk (uint32_t sector, uint8_t *data)
 
void writeDisk (uint32_t sector, uint8_t *data)
 
void updateState (DevAction_t action)
 
bool isBSYSet ()
 
bool isIENSet ()
 
bool isDEVSelect ()
 
void setComplete ()
 
uint32_t getLBABase ()
 
Addr pciToDma (Addr pciAddr)
 
void serialize (CheckpointOut &cp) const override
 Serialize an object. More...
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object. More...
 

Private Attributes

struct ataparams driveID
 Drive identification structure for this disk. More...
 
uint8_t * dataBuffer
 Data buffer for transfers. More...
 
uint32_t cmdBytes
 Number of bytes in command data transfer. More...
 
uint32_t cmdBytesLeft
 Number of bytes left in command data transfer. More...
 
uint32_t drqBytesLeft
 Number of bytes left in DRQ block. More...
 
uint32_t curSector
 Current sector in access. More...
 
CommandReg_t cmdReg
 Command block registers. More...
 
uint8_t status
 Status register. More...
 
bool nIENBit
 Interrupt enable bit. More...
 
DevState_t devState
 Device state. More...
 
DmaState_t dmaState
 Dma state. More...
 
bool dmaRead
 Dma transaction is a read. More...
 
Addr chunkBytes
 Size of chunks to DMA. More...
 
uint32_t curPrdAddr
 PRD table base address. More...
 
PrdTableEntry curPrd
 PRD entry. More...
 
int devID
 Device ID (device0=0/device1=1) More...
 
bool intrPending
 Interrupt pending. More...
 
bool dmaAborted
 DMA Aborted. More...
 
gem5::IdeDisk::IdeDiskStats ideDiskStats
 
EventFunctionWrapper dmaTransferEvent
 
ChunkGeneratordmaReadCG
 
EventFunctionWrapper dmaReadWaitEvent
 
ChunkGeneratordmaWriteCG
 
EventFunctionWrapper dmaWriteWaitEvent
 
EventFunctionWrapper dmaPrdReadEvent
 
EventFunctionWrapper dmaReadEvent
 
EventFunctionWrapper dmaWriteEvent
 

Additional Inherited Members

- 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. More...
 
static SimObjectfind (const char *name)
 Find the SimObject with the given name and return a pointer to it. More...
 
static void setSimObjectResolver (SimObjectResolver *resolver)
 There is a single object name resolver, and it is only set when simulation is restoring from checkpoints. More...
 
static SimObjectResolvergetSimObjectResolver ()
 There is a single object name resolver, and it is only set when simulation is restoring from checkpoints. More...
 
- Static Public Member Functions inherited from gem5::Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section. More...
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it. More...
 
- Protected Member Functions inherited from gem5::Drainable
 Drainable ()
 
virtual ~Drainable ()
 
virtual void drainResume ()
 Resume execution after a successful drain. More...
 
void signalDrainDone () const
 Signal that an object is drained. More...
 

Detailed Description

IDE Disk device model.

Definition at line 216 of file ide_disk.hh.

Member Typedef Documentation

◆ Params

typedef IdeDiskParams gem5::IdeDisk::Params

Definition at line 279 of file ide_disk.hh.

Constructor & Destructor Documentation

◆ IdeDisk()

gem5::IdeDisk::IdeDisk ( const Params p)

Definition at line 65 of file ide_disk.cc.

References doDmaTransfer().

◆ ~IdeDisk()

gem5::IdeDisk::~IdeDisk ( )

Delete the data buffer.

Definition at line 140 of file ide_disk.cc.

References dataBuffer.

Member Function Documentation

◆ abortDma()

void gem5::IdeDisk::abortDma ( )

◆ dmaPrdReadDone()

void gem5::IdeDisk::dmaPrdReadDone ( )
private

◆ dmaReadDone()

void gem5::IdeDisk::dmaReadDone ( )
private

◆ dmaWriteDone()

void gem5::IdeDisk::dmaWriteDone ( )
private

◆ doDmaDataRead()

void gem5::IdeDisk::doDmaDataRead ( )
private
Todo:
we need to figure out what the delay actually will be

Definition at line 383 of file ide_disk.cc.

References curPrd, gem5::curTick(), diskDelay, dmaReadWaitEvent, DPRINTF, gem5::PrdTableEntry::getByteCount(), gem5::EventManager::schedule(), and SectorSize.

Referenced by dmaPrdReadDone().

◆ doDmaDataWrite()

void gem5::IdeDisk::doDmaDataWrite ( )
private

◆ doDmaRead()

void gem5::IdeDisk::doDmaRead ( )
private

◆ doDmaTransfer()

void gem5::IdeDisk::doDmaTransfer ( )
private

◆ doDmaWrite()

void gem5::IdeDisk::doDmaWrite ( )
private

◆ getLBABase()

uint32_t gem5::IdeDisk::getLBABase ( )
inlineprivate

◆ intrClear()

void gem5::IdeDisk::intrClear ( )
private

Definition at line 743 of file ide_disk.cc.

References ctrl, DPRINTF, gem5::PciDevice::intrClear(), intrPending, and panic.

Referenced by updateState().

◆ intrPost()

void gem5::IdeDisk::intrPost ( )
private

Definition at line 728 of file ide_disk.cc.

References ctrl, DPRINTF, intrPending, gem5::IdeController::intrPost(), and panic.

Referenced by updateState().

◆ isBSYSet()

bool gem5::IdeDisk::isBSYSet ( )
inlineprivate

Definition at line 354 of file ide_disk.hh.

References status, and STATUS_BSY_BIT.

◆ isDEVSelect()

bool gem5::IdeDisk::isDEVSelect ( )
private

Definition at line 191 of file ide_disk.cc.

References ctrl, and gem5::IdeController::isDiskSelected().

Referenced by updateState().

◆ isIENSet()

bool gem5::IdeDisk::isIENSet ( )
inlineprivate

Definition at line 355 of file ide_disk.hh.

References nIENBit.

Referenced by updateState().

◆ pciToDma()

Addr gem5::IdeDisk::pciToDma ( Addr  pciAddr)
inlineprivate

Definition at line 197 of file ide_disk.cc.

References ctrl, panic, and gem5::PciDevice::pciToDma().

Referenced by dmaPrdReadDone(), doDmaRead(), doDmaWrite(), and startDma().

◆ readCommand()

void gem5::IdeDisk::readCommand ( const Addr  offset,
int  size,
uint8_t *  data 
)

◆ readControl()

void gem5::IdeDisk::readControl ( const Addr  offset,
int  size,
uint8_t *  data 
)

Definition at line 256 of file ide_disk.cc.

References ALTSTAT_OFFSET, data, DPRINTF, gem5::ArmISA::offset, panic, and status.

◆ readDisk()

void gem5::IdeDisk::readDisk ( uint32_t  sector,
uint8_t *  data 
)
private

Definition at line 558 of file ide_disk.cc.

References data, image, gem5::Named::name(), panic, gem5::DiskImage::read(), and SectorSize.

Referenced by doDmaDataWrite(), and updateState().

◆ reset()

void gem5::IdeDisk::reset ( int  id)

◆ serialize()

void gem5::IdeDisk::serialize ( CheckpointOut cp) const
overrideprivatevirtual

◆ setComplete()

void gem5::IdeDisk::setComplete ( )
inlineprivate

Definition at line 358 of file ide_disk.hh.

References status, STATUS_DRDY_BIT, and STATUS_SEEK_BIT.

Referenced by updateState().

◆ setController()

void gem5::IdeDisk::setController ( IdeController c,
Addr  chunk_bytes 
)
inline

Set the controller for this device.

Parameters
cThe IDE controller

Definition at line 297 of file ide_disk.hh.

References gem5::ArmISA::c, chunkBytes, ctrl, and panic_if.

◆ startCommand()

void gem5::IdeDisk::startCommand ( )
private

◆ startDma()

void gem5::IdeDisk::startDma ( const uint32_t &  prdTableBase)

◆ unserialize()

void gem5::IdeDisk::unserialize ( CheckpointIn cp)
overrideprivatevirtual

◆ updateState()

void gem5::IdeDisk::updateState ( DevAction_t  action)
private
Todo:
change this to a scheduled event to simulate disk delay
Todo:
change this to a scheduled event to simulate disk delay

Definition at line 761 of file ide_disk.cc.

References gem5::ACT_CMD_COMPLETE, gem5::ACT_CMD_ERROR, gem5::ACT_CMD_WRITE, gem5::ACT_DATA_READ_BYTE, gem5::ACT_DATA_READ_SHORT, gem5::ACT_DATA_READY, gem5::ACT_DATA_WRITE_BYTE, gem5::ACT_DATA_WRITE_SHORT, gem5::ACT_DMA_DONE, gem5::ACT_DMA_READY, gem5::ACT_SELECT_WRITE, gem5::ACT_SRST_CLEAR, gem5::ACT_SRST_SET, gem5::ACT_STAT_READ, ATAPI_IDENTIFY_DEVICE, cmdBytes, cmdBytesLeft, cmdReg, gem5::CommandReg_t::command, gem5::Command_Execution, ctrl, curSector, gem5::CommandReg_t::data, gem5::Data_Ready_INTRQ_In, gem5::Data_Ready_INTRQ_Out, dataBuffer, gem5::Device_Dma_Abort, gem5::Device_Idle_NS, gem5::Device_Idle_S, gem5::Device_Idle_SI, gem5::Device_Srst, devID, devState, gem5::Dma_Idle, gem5::Dma_Start, dmaAborted, dmaState, DPRINTF, driveID, drqBytesLeft, intrClear(), intrPending, intrPost(), isDEVSelect(), isIENSet(), MAX_DMA_SIZE, panic, gem5::Prepare_Data_Dma, gem5::Prepare_Data_In, gem5::Prepare_Data_Out, readDisk(), reset(), SectorSize, setComplete(), gem5::IdeController::setDmaComplete(), startCommand(), status, STATUS_BSY_BIT, STATUS_DRQ_BIT, STATUS_SEEK_BIT, gem5::Transfer_Data_Dma, gem5::Transfer_Data_In, gem5::Transfer_Data_Out, WDCC_IDENTIFY, and writeDisk().

Referenced by abortDma(), dmaPrdReadDone(), dmaReadDone(), dmaWriteDone(), doDmaRead(), doDmaTransfer(), doDmaWrite(), readCommand(), startCommand(), writeCommand(), and writeControl().

◆ writeCommand()

void gem5::IdeDisk::writeCommand ( const Addr  offset,
int  size,
const uint8_t *  data 
)

◆ writeControl()

void gem5::IdeDisk::writeControl ( const Addr  offset,
int  size,
const uint8_t *  data 
)

◆ writeDisk()

void gem5::IdeDisk::writeDisk ( uint32_t  sector,
uint8_t *  data 
)
private

Definition at line 568 of file ide_disk.cc.

References data, image, gem5::Named::name(), panic, SectorSize, and gem5::DiskImage::write().

Referenced by dmaReadDone(), and updateState().

Member Data Documentation

◆ chunkBytes

Addr gem5::IdeDisk::chunkBytes
private

Size of chunks to DMA.

Definition at line 254 of file ide_disk.hh.

Referenced by doDmaRead(), doDmaWrite(), and setController().

◆ cmdBytes

uint32_t gem5::IdeDisk::cmdBytes
private

Number of bytes in command data transfer.

Definition at line 234 of file ide_disk.hh.

Referenced by reset(), serialize(), startCommand(), unserialize(), and updateState().

◆ cmdBytesLeft

uint32_t gem5::IdeDisk::cmdBytesLeft
private

Number of bytes left in command data transfer.

Definition at line 236 of file ide_disk.hh.

Referenced by dmaPrdReadDone(), dmaReadDone(), dmaWriteDone(), doDmaDataWrite(), reset(), serialize(), startCommand(), unserialize(), and updateState().

◆ cmdReg

CommandReg_t gem5::IdeDisk::cmdReg
private

Command block registers.

Definition at line 242 of file ide_disk.hh.

Referenced by getLBABase(), readCommand(), reset(), serialize(), startCommand(), unserialize(), updateState(), and writeCommand().

◆ ctrl

IdeController* gem5::IdeDisk::ctrl
protected

The IDE controller for this disk.

Definition at line 220 of file ide_disk.hh.

Referenced by doDmaRead(), doDmaTransfer(), doDmaWrite(), intrClear(), intrPost(), isDEVSelect(), pciToDma(), setController(), and updateState().

◆ curPrd

PrdTableEntry gem5::IdeDisk::curPrd
private

◆ curPrdAddr

uint32_t gem5::IdeDisk::curPrdAddr
private

PRD table base address.

Definition at line 256 of file ide_disk.hh.

Referenced by dmaPrdReadDone(), doDmaTransfer(), reset(), serialize(), startDma(), and unserialize().

◆ curSector

uint32_t gem5::IdeDisk::curSector
private

Current sector in access.

Definition at line 240 of file ide_disk.hh.

Referenced by dmaPrdReadDone(), dmaReadDone(), doDmaDataWrite(), reset(), serialize(), startCommand(), unserialize(), and updateState().

◆ dataBuffer

uint8_t* gem5::IdeDisk::dataBuffer
private

Data buffer for transfers.

Definition at line 232 of file ide_disk.hh.

Referenced by dmaReadDone(), doDmaDataWrite(), doDmaRead(), doDmaWrite(), reset(), serialize(), unserialize(), updateState(), and ~IdeDisk().

◆ devID

int gem5::IdeDisk::devID
private

Device ID (device0=0/device1=1)

Definition at line 260 of file ide_disk.hh.

Referenced by reset(), serialize(), unserialize(), and updateState().

◆ devState

DevState_t gem5::IdeDisk::devState
private

Device state.

Definition at line 248 of file ide_disk.hh.

Referenced by abortDma(), doDmaTransfer(), reset(), serialize(), startCommand(), startDma(), unserialize(), updateState(), and writeControl().

◆ diskDelay

int gem5::IdeDisk::diskDelay
protected

The disk delay in microseconds.

Definition at line 226 of file ide_disk.hh.

Referenced by doDmaDataRead(), and doDmaDataWrite().

◆ dmaAborted

bool gem5::IdeDisk::dmaAborted
private

DMA Aborted.

Definition at line 264 of file ide_disk.hh.

Referenced by dmaPrdReadDone(), doDmaRead(), doDmaTransfer(), doDmaWrite(), reset(), serialize(), unserialize(), and updateState().

◆ dmaPrdReadEvent

EventFunctionWrapper gem5::IdeDisk::dmaPrdReadEvent
private

Definition at line 338 of file ide_disk.hh.

Referenced by doDmaTransfer(), serialize(), and unserialize().

◆ dmaRead

bool gem5::IdeDisk::dmaRead
private

Dma transaction is a read.

Definition at line 252 of file ide_disk.hh.

Referenced by dmaPrdReadDone(), reset(), serialize(), startCommand(), and unserialize().

◆ dmaReadCG

ChunkGenerator* gem5::IdeDisk::dmaReadCG
private

Definition at line 328 of file ide_disk.hh.

Referenced by doDmaRead().

◆ dmaReadEvent

EventFunctionWrapper gem5::IdeDisk::dmaReadEvent
private

Definition at line 341 of file ide_disk.hh.

Referenced by serialize(), and unserialize().

◆ dmaReadWaitEvent

EventFunctionWrapper gem5::IdeDisk::dmaReadWaitEvent
private

Definition at line 329 of file ide_disk.hh.

Referenced by doDmaDataRead(), doDmaRead(), serialize(), and unserialize().

◆ dmaState

DmaState_t gem5::IdeDisk::dmaState
private

◆ dmaTransferEvent

EventFunctionWrapper gem5::IdeDisk::dmaTransferEvent
private

Definition at line 323 of file ide_disk.hh.

Referenced by doDmaTransfer(), serialize(), startDma(), and unserialize().

◆ dmaWriteCG

ChunkGenerator* gem5::IdeDisk::dmaWriteCG
private

Definition at line 334 of file ide_disk.hh.

Referenced by doDmaWrite().

◆ dmaWriteEvent

EventFunctionWrapper gem5::IdeDisk::dmaWriteEvent
private

Definition at line 344 of file ide_disk.hh.

Referenced by serialize(), and unserialize().

◆ dmaWriteWaitEvent

EventFunctionWrapper gem5::IdeDisk::dmaWriteWaitEvent
private

Definition at line 335 of file ide_disk.hh.

Referenced by doDmaDataWrite(), doDmaWrite(), serialize(), and unserialize().

◆ driveID

struct ataparams gem5::IdeDisk::driveID
private

Drive identification structure for this disk.

Definition at line 230 of file ide_disk.hh.

Referenced by updateState().

◆ drqBytesLeft

uint32_t gem5::IdeDisk::drqBytesLeft
private

Number of bytes left in DRQ block.

Definition at line 238 of file ide_disk.hh.

Referenced by reset(), serialize(), unserialize(), and updateState().

◆ ideDiskStats

gem5::IdeDisk::IdeDiskStats gem5::IdeDisk::ideDiskStats
private

Referenced by doDmaRead(), and doDmaWrite().

◆ image

DiskImage* gem5::IdeDisk::image
protected

The image that contains the data of this disk.

Definition at line 222 of file ide_disk.hh.

Referenced by readDisk(), startCommand(), and writeDisk().

◆ intrPending

bool gem5::IdeDisk::intrPending
private

Interrupt pending.

Definition at line 262 of file ide_disk.hh.

Referenced by intrClear(), intrPost(), reset(), serialize(), unserialize(), and updateState().

◆ nIENBit

bool gem5::IdeDisk::nIENBit
private

Interrupt enable bit.

Definition at line 246 of file ide_disk.hh.

Referenced by isIENSet(), serialize(), unserialize(), and writeControl().

◆ status

uint8_t gem5::IdeDisk::status
private

Status register.

Definition at line 244 of file ide_disk.hh.

Referenced by isBSYSet(), readCommand(), readControl(), reset(), serialize(), setComplete(), startCommand(), unserialize(), and updateState().


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

Generated on Tue Sep 21 2021 12:27:42 for gem5 by doxygen 1.8.17