gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
IdeDisk Class Reference

IDE Disk device model. More...

#include <ide_disk.hh>

Inheritance diagram for IdeDisk:
SimObject EventManager Serializable Drainable

Public Types

typedef IdeDiskParams Params
 
- Public Types inherited from 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 regStats () override
 Register Statistics. More...
 
void setController (IdeController *c)
 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 SimObject
const Paramsparams () const
 
 SimObject (const Params *_params)
 
virtual ~SimObject ()
 
virtual const std::string name () const
 
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 resetStats ()
 Reset statistics associated with this object. 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 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 EventManager
 EventManager (EventManager &em)
 
 EventManager (EventManager *em)
 
 EventManager (EventQueue *eq)
 
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)
 
void setCurTick (Tick newVal)
 
- Public Member Functions inherited from 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 Drainable
DrainState drainState () const
 Return the current drain state of an object. More...
 
virtual void notifyFork ()
 Notify a child process of a fork. More...
 

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 SimObject
const SimObjectParams * _params
 Cached copy of the object parameters. More...
 
- Protected Attributes inherited from 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...
 
uint32_t curPrdAddr
 PRD table base address. More...
 
PrdTableEntry curPrd
 PRD entry. More...
 
int devID
 Device ID (master=0/slave=1) More...
 
bool intrPending
 Interrupt pending. More...
 
bool dmaAborted
 DMA Aborted. More...
 
Stats::Scalar dmaReadFullPages
 
Stats::Scalar dmaReadBytes
 
Stats::Scalar dmaReadTxs
 
Stats::Scalar dmaWriteFullPages
 
Stats::Scalar dmaWriteBytes
 
Stats::Scalar dmaWriteTxs
 
EventWrapper< IdeDisk,&IdeDisk::doDmaTransferdmaTransferEvent
 
ChunkGeneratordmaReadCG
 
EventWrapper< IdeDisk,&IdeDisk::doDmaReaddmaReadWaitEvent
 
ChunkGeneratordmaWriteCG
 
EventWrapper< IdeDisk,&IdeDisk::doDmaWritedmaWriteWaitEvent
 
EventWrapper< IdeDisk,&IdeDisk::dmaPrdReadDonedmaPrdReadEvent
 
EventWrapper< IdeDisk,&IdeDisk::dmaReadDonedmaReadEvent
 
EventWrapper< IdeDisk,&IdeDisk::dmaWriteDonedmaWriteEvent
 

Friends

class EventWrapper< IdeDisk,&IdeDisk::doDmaTransfer >
 
class EventWrapper< IdeDisk,&IdeDisk::doDmaRead >
 
class EventWrapper< IdeDisk,&IdeDisk::doDmaWrite >
 
class EventWrapper< IdeDisk,&IdeDisk::dmaPrdReadDone >
 
class EventWrapper< IdeDisk,&IdeDisk::dmaReadDone >
 
class EventWrapper< IdeDisk,&IdeDisk::dmaWriteDone >
 

Additional Inherited Members

- Static Public Member Functions inherited from SimObject
static void serializeAll (CheckpointOut &cp)
 Serialize 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 Public Member Functions inherited from Serializable
static const std::string & currentSection ()
 Get the fully-qualified name of the active section. More...
 
static void serializeAll (const std::string &cpt_dir)
 
static void unserializeGlobals (CheckpointIn &cp)
 
- Static Public Attributes inherited from Serializable
static int ckptCount = 0
 
static int ckptMaxCount = 0
 
static int ckptPrevCount = -1
 
- Protected Member Functions inherited from 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 207 of file ide_disk.hh.

Member Typedef Documentation

typedef IdeDiskParams IdeDisk::Params

Definition at line 263 of file ide_disk.hh.

Constructor & Destructor Documentation

IdeDisk::IdeDisk ( const Params p)
IdeDisk::~IdeDisk ( )

Delete the data buffer.

Definition at line 138 of file ide_disk.cc.

References dataBuffer.

Member Function Documentation

void IdeDisk::abortDma ( )
void IdeDisk::dmaPrdReadDone ( )
private
void IdeDisk::dmaReadDone ( )
private
void IdeDisk::dmaWriteDone ( )
private
void IdeDisk::doDmaDataRead ( )
private
Todo:
we need to figure out what the delay actually will be

Definition at line 381 of file ide_disk.cc.

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

Referenced by dmaPrdReadDone().

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

Definition at line 488 of file ide_disk.cc.

References cmdBytesLeft, curPrd, curSector, curTick(), dataBuffer, diskDelay, dmaWriteWaitEvent, DPRINTF, PrdTableEntry::getByteCount(), MAX_DMA_SIZE, readDisk(), EventManager::schedule(), and SectorSize.

Referenced by dmaPrdReadDone().

void IdeDisk::doDmaRead ( )
private
void IdeDisk::doDmaTransfer ( )
private
void IdeDisk::doDmaWrite ( )
private
uint32_t IdeDisk::getLBABase ( )
inlineprivate

Definition at line 360 of file ide_disk.hh.

References cmdReg, CommandReg::cyl_high, CommandReg::cyl_low, CommandReg::head, and CommandReg::sec_num.

Referenced by startCommand().

void IdeDisk::intrClear ( )
private

Definition at line 755 of file ide_disk.cc.

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

Referenced by updateState().

void IdeDisk::intrPost ( )
private

Definition at line 740 of file ide_disk.cc.

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

Referenced by updateState().

bool IdeDisk::isBSYSet ( )
inlineprivate

Definition at line 346 of file ide_disk.hh.

References status, and STATUS_BSY_BIT.

bool IdeDisk::isDEVSelect ( )
private

Definition at line 189 of file ide_disk.cc.

References ctrl, and IdeController::isDiskSelected().

Referenced by updateState().

bool IdeDisk::isIENSet ( )
inlineprivate

Definition at line 347 of file ide_disk.hh.

References nIENBit.

Referenced by updateState().

Addr IdeDisk::pciToDma ( Addr  pciAddr)
inlineprivate

Definition at line 195 of file ide_disk.cc.

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

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

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

Definition at line 254 of file ide_disk.cc.

References ALTSTAT_OFFSET, DPRINTF, panic, and status.

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

Definition at line 571 of file ide_disk.cc.

References image, SimObject::name(), panic, DiskImage::read(), and SectorSize.

Referenced by doDmaDataWrite(), and updateState().

void IdeDisk::regStats ( )
overridevirtual
void IdeDisk::reset ( int  id)
void IdeDisk::serialize ( CheckpointOut cp) const
overrideprivatevirtual
void IdeDisk::setComplete ( )
inlineprivate

Definition at line 350 of file ide_disk.hh.

References status, STATUS_DRDY_BIT, and STATUS_SEEK_BIT.

Referenced by updateState().

void IdeDisk::setController ( IdeController c)
inline

Set the controller for this device.

Parameters
cThe IDE controller

Definition at line 285 of file ide_disk.hh.

References ArmISA::c, ctrl, and panic.

void IdeDisk::startCommand ( )
private
void IdeDisk::startDma ( const uint32_t &  prdTableBase)
void IdeDisk::unserialize ( CheckpointIn cp)
overrideprivatevirtual
void IdeDisk::updateState ( DevAction_t  action)
private
void IdeDisk::writeCommand ( const Addr  offset,
int  size,
const uint8_t *  data 
)
void IdeDisk::writeControl ( const Addr  offset,
int  size,
const uint8_t *  data 
)
void IdeDisk::writeDisk ( uint32_t  sector,
uint8_t *  data 
)
private

Definition at line 581 of file ide_disk.cc.

References image, SimObject::name(), panic, SectorSize, and DiskImage::write().

Referenced by dmaReadDone(), and updateState().

Friends And Related Function Documentation

friend class EventWrapper< IdeDisk,&IdeDisk::dmaPrdReadDone >
friend

Definition at line 327 of file ide_disk.hh.

friend class EventWrapper< IdeDisk,&IdeDisk::dmaReadDone >
friend

Definition at line 331 of file ide_disk.hh.

friend class EventWrapper< IdeDisk,&IdeDisk::dmaWriteDone >
friend

Definition at line 335 of file ide_disk.hh.

friend class EventWrapper< IdeDisk,&IdeDisk::doDmaRead >
friend

Definition at line 316 of file ide_disk.hh.

friend class EventWrapper< IdeDisk,&IdeDisk::doDmaTransfer >
friend

Definition at line 309 of file ide_disk.hh.

friend class EventWrapper< IdeDisk,&IdeDisk::doDmaWrite >
friend

Definition at line 323 of file ide_disk.hh.

Member Data Documentation

uint32_t IdeDisk::cmdBytes
private

Number of bytes in command data transfer.

Definition at line 225 of file ide_disk.hh.

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

uint32_t IdeDisk::cmdBytesLeft
private

Number of bytes left in command data transfer.

Definition at line 227 of file ide_disk.hh.

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

CommandReg_t IdeDisk::cmdReg
private

Command block registers.

Definition at line 233 of file ide_disk.hh.

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

IdeController* IdeDisk::ctrl
protected

The IDE controller for this disk.

Definition at line 211 of file ide_disk.hh.

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

PrdTableEntry IdeDisk::curPrd
private
uint32_t IdeDisk::curPrdAddr
private

PRD table base address.

Definition at line 245 of file ide_disk.hh.

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

uint32_t IdeDisk::curSector
private

Current sector in access.

Definition at line 231 of file ide_disk.hh.

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

uint8_t* IdeDisk::dataBuffer
private

Data buffer for transfers.

Definition at line 223 of file ide_disk.hh.

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

int IdeDisk::devID
private

Device ID (master=0/slave=1)

Definition at line 249 of file ide_disk.hh.

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

DevState_t IdeDisk::devState
private

Device state.

Definition at line 239 of file ide_disk.hh.

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

int IdeDisk::diskDelay
protected

The disk delay in microseconds.

Definition at line 217 of file ide_disk.hh.

Referenced by doDmaDataRead(), and doDmaDataWrite().

bool IdeDisk::dmaAborted
private

DMA Aborted.

Definition at line 253 of file ide_disk.hh.

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

EventWrapper<IdeDisk, &IdeDisk::dmaPrdReadDone> IdeDisk::dmaPrdReadEvent
private

Definition at line 328 of file ide_disk.hh.

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

bool IdeDisk::dmaRead
private

Dma transaction is a read.

Definition at line 243 of file ide_disk.hh.

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

Stats::Scalar IdeDisk::dmaReadBytes
private

Definition at line 256 of file ide_disk.hh.

Referenced by doDmaRead(), and regStats().

ChunkGenerator* IdeDisk::dmaReadCG
private

Definition at line 315 of file ide_disk.hh.

Referenced by doDmaRead().

EventWrapper<IdeDisk, &IdeDisk::dmaReadDone> IdeDisk::dmaReadEvent
private

Definition at line 332 of file ide_disk.hh.

Referenced by serialize(), and unserialize().

Stats::Scalar IdeDisk::dmaReadFullPages
private

Definition at line 255 of file ide_disk.hh.

Referenced by doDmaRead(), and regStats().

Stats::Scalar IdeDisk::dmaReadTxs
private

Definition at line 257 of file ide_disk.hh.

Referenced by doDmaRead(), and regStats().

EventWrapper<IdeDisk, &IdeDisk::doDmaRead> IdeDisk::dmaReadWaitEvent
private

Definition at line 317 of file ide_disk.hh.

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

DmaState_t IdeDisk::dmaState
private
EventWrapper<IdeDisk, &IdeDisk::doDmaTransfer> IdeDisk::dmaTransferEvent
private

Definition at line 310 of file ide_disk.hh.

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

Stats::Scalar IdeDisk::dmaWriteBytes
private

Definition at line 259 of file ide_disk.hh.

Referenced by doDmaWrite(), and regStats().

ChunkGenerator* IdeDisk::dmaWriteCG
private

Definition at line 322 of file ide_disk.hh.

Referenced by doDmaWrite().

EventWrapper<IdeDisk, &IdeDisk::dmaWriteDone> IdeDisk::dmaWriteEvent
private

Definition at line 336 of file ide_disk.hh.

Referenced by serialize(), and unserialize().

Stats::Scalar IdeDisk::dmaWriteFullPages
private

Definition at line 258 of file ide_disk.hh.

Referenced by doDmaWrite(), and regStats().

Stats::Scalar IdeDisk::dmaWriteTxs
private

Definition at line 260 of file ide_disk.hh.

Referenced by doDmaWrite(), and regStats().

EventWrapper<IdeDisk, &IdeDisk::doDmaWrite> IdeDisk::dmaWriteWaitEvent
private

Definition at line 324 of file ide_disk.hh.

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

struct ataparams IdeDisk::driveID
private

Drive identification structure for this disk.

Definition at line 221 of file ide_disk.hh.

Referenced by IdeDisk(), and updateState().

uint32_t IdeDisk::drqBytesLeft
private

Number of bytes left in DRQ block.

Definition at line 229 of file ide_disk.hh.

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

DiskImage* IdeDisk::image
protected

The image that contains the data of this disk.

Definition at line 213 of file ide_disk.hh.

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

bool IdeDisk::intrPending
private

Interrupt pending.

Definition at line 251 of file ide_disk.hh.

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

bool IdeDisk::nIENBit
private

Interrupt enable bit.

Definition at line 237 of file ide_disk.hh.

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

uint8_t IdeDisk::status
private

Status register.

Definition at line 235 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 Fri Jun 9 2017 13:04:12 for gem5 by doxygen 1.8.6