45 #ifndef __DEV_STORAGE_IDE_DISK_HH__ 46 #define __DEV_STORAGE_IDE_DISK_HH__ 54 #include "params/IdeDisk.hh" 59 #define DMA_BACKOFF_PERIOD 200 61 #define MAX_DMA_SIZE 0x20000 // 128K 62 #define MAX_SINGLE_DMA_SIZE 0x10000 63 #define MAX_MULTSECT (128) 65 #define PRD_BASE_MASK 0xfffffffe 66 #define PRD_COUNT_MASK 0xfffe 67 #define PRD_EOT_MASK 0x8000 96 #define DATA_OFFSET (0) 97 #define ERROR_OFFSET (1) 98 #define FEATURES_OFFSET (1) 99 #define NSECTOR_OFFSET (2) 100 #define SECTOR_OFFSET (3) 101 #define LCYL_OFFSET (4) 102 #define HCYL_OFFSET (5) 103 #define SELECT_OFFSET (6) 104 #define DRIVE_OFFSET (6) 105 #define STATUS_OFFSET (7) 106 #define COMMAND_OFFSET (7) 108 #define CONTROL_OFFSET (2) 109 #define ALTSTAT_OFFSET (2) 111 #define SELECT_DEV_BIT 0x10 112 #define CONTROL_RST_BIT 0x04 113 #define CONTROL_IEN_BIT 0x02 114 #define STATUS_BSY_BIT 0x80 115 #define STATUS_DRDY_BIT 0x40 116 #define STATUS_DRQ_BIT 0x08 117 #define STATUS_SEEK_BIT 0x10 118 #define STATUS_DF_BIT 0x20 119 #define DRIVE_LBA_BIT 0x40 279 void regStats()
override;
288 panic_if(ctrl,
"Cannot change the controller once set!\n");
290 pageBytes = page_bytes;
295 void readControl(
const Addr offset,
int size, uint8_t *data);
296 void writeCommand(
const Addr offset,
int size,
const uint8_t *data);
297 void writeControl(
const Addr offset,
int size,
const uint8_t *data);
300 void startDma(
const uint32_t &prdTableBase);
311 void doDmaTransfer();
314 void doDmaDataRead();
320 void doDmaDataWrite();
326 void dmaPrdReadDone();
336 void readDisk(uint32_t sector, uint8_t *data);
337 void writeDisk(uint32_t sector, uint8_t *data);
370 #endif // __DEV_STORAGE_IDE_DISK_HH__
bool nIENBit
Interrupt enable bit.
DmaState_t dmaState
Dma state.
ChunkGenerator * dmaWriteCG
EventFunctionWrapper dmaReadEvent
struct PrdEntry PrdEntry_t
uint32_t curPrdAddr
PRD table base address.
Device model for an Intel PIIX4 IDE controller.
struct CommandReg CommandReg_t
#define MAX_SINGLE_DMA_SIZE
int devID
Device ID (master=0/slave=1)
DiskImage * image
The image that contains the data of this disk.
Simple PCI IDE controller with bus mastering capability and UDMA modeled after controller in the Inte...
bool dmaAborted
DMA Aborted.
uint32_t drqBytesLeft
Number of bytes left in DRQ block.
Stats::Scalar dmaWriteBytes
Declaration of Statistics objects.
This is a simple scalar statistic, like a counter.
uint32_t cmdBytesLeft
Number of bytes left in command data transfer.
Stats::Scalar dmaReadBytes
This class takes an arbitrary memory region (address/length pair) and generates a series of appropria...
void serialize(const ThreadContext &tc, CheckpointOut &cp)
Thread context serialization helpers.
EventFunctionWrapper dmaWriteEvent
Basic interface for accessing a disk image.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint32_t curSector
Current sector in access.
Addr pageBytes
Size of OS pages.
uint8_t status
Status register.
EventFunctionWrapper dmaPrdReadEvent
DevState_t devState
Device state.
EventFunctionWrapper dmaWriteWaitEvent
enum DevAction DevAction_t
ChunkGenerator * dmaReadCG
uint32_t cmdBytes
Number of bytes in command data transfer.
PrdTableEntry curPrd
PRD entry.
CommandReg_t cmdReg
Command block registers.
bool intrPending
Interrupt pending.
std::ostream CheckpointOut
EventFunctionWrapper dmaReadWaitEvent
bool dmaRead
Dma transaction is a read.
Stats::Scalar dmaReadFullPages
IdeController * ctrl
The IDE controller for this disk.
void unserialize(ThreadContext &tc, CheckpointIn &cp)
EventFunctionWrapper dmaTransferEvent
uint8_t * dataBuffer
Data buffer for transfers.
void setController(IdeController *c, Addr page_bytes)
Set the controller for this device.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Stats::Scalar dmaWriteFullPages
Abstract superclass for simulation objects.
int diskDelay
The disk delay in microseconds.
Stats::Scalar dmaWriteTxs