45#ifndef __DEV_STORAGE_IDE_DISK_HH__
46#define __DEV_STORAGE_IDE_DISK_HH__
54#include "params/IdeDisk.hh"
62#define DMA_BACKOFF_PERIOD 200
64#define MAX_DMA_SIZE 0x20000
65#define MAX_SINGLE_DMA_SIZE 0x10000
66#define MAX_MULTSECT (128)
68#define PRD_BASE_MASK 0xfffffffe
69#define PRD_COUNT_MASK 0xfffe
70#define PRD_EOT_MASK 0x8000
101#define DATA_OFFSET (0)
102#define ERROR_OFFSET (1)
103#define FEATURES_OFFSET (1)
104#define NSECTOR_OFFSET (2)
105#define SECTOR_OFFSET (3)
106#define LCYL_OFFSET (4)
107#define HCYL_OFFSET (5)
108#define SELECT_OFFSET (6)
109#define DRIVE_OFFSET (6)
110#define STATUS_OFFSET (7)
111#define COMMAND_OFFSET (7)
113#define CONTROL_OFFSET (2)
114#define ALTSTAT_OFFSET (2)
116#define SELECT_DEV_BIT 0x10
117#define CONTROL_RST_BIT 0x04
118#define CONTROL_IEN_BIT 0x02
119#define STATUS_BSY_BIT 0x80
120#define STATUS_DRDY_BIT 0x40
121#define STATUS_DRQ_BIT 0x08
122#define STATUS_SEEK_BIT 0x10
123#define STATUS_DF_BIT 0x20
124#define DRIVE_LBA_BIT 0x40
314 void startDma(
const uint32_t &prdTableBase);
This class takes an arbitrary memory region (address/length pair) and generates a series of appropria...
Basic interface for accessing a disk image.
IdeController * controller() const
Device model for an Intel PIIX4 IDE controller.
EventFunctionWrapper dmaReadEvent
uint32_t drqBytesLeft
Number of bytes left in DRQ block.
EventFunctionWrapper dmaPrdReadEvent
void setChannel(IdeController::Channel *_channel, Addr chunk_bytes)
Set the controller for this device.
void startDma(const uint32_t &prdTableBase)
void serialize(CheckpointOut &cp) const override
Serialize an object.
~IdeDisk()
Delete the data buffer.
void writeDisk(uint32_t sector, uint8_t *data)
bool nIENBit
Interrupt enable bit.
uint32_t cmdBytes
Number of bytes in command data transfer.
void readControl(const Addr offset, int size, uint8_t *data)
IdeController * ctrl
The IDE controller for this disk.
void writeCommand(const Addr offset, int size, const uint8_t *data)
uint32_t curPrdAddr
PRD table base address.
struct ataparams driveID
Drive identification structure for this disk.
uint8_t * dataBuffer
Data buffer for transfers.
ChunkGenerator * dmaWriteCG
PrdTableEntry curPrd
PRD entry.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
EventFunctionWrapper dmaWriteEvent
uint32_t curSector
Current sector in access.
bool dmaRead
Dma transaction is a read.
bool pendingInterrupt
Interrupt pending.
DiskImage * image
The image that contains the data of this disk.
EventFunctionWrapper dmaWriteWaitEvent
gem5::IdeDisk::IdeDiskStats ideDiskStats
ChunkGenerator * dmaReadCG
void readDisk(uint32_t sector, uint8_t *data)
DevState_t devState
Device state.
int diskDelay
The disk delay in microseconds.
EventFunctionWrapper dmaTransferEvent
void writeControl(const Addr offset, int size, const uint8_t *data)
bool dmaAborted
DMA Aborted.
uint8_t status
Status register.
Addr pciToDma(Addr pciAddr)
Addr chunkBytes
Size of chunks to DMA.
IdeController::Channel * channel
The channel this disk is connected to.
DmaState_t dmaState
Dma state.
void readCommand(const Addr offset, int size, uint8_t *data)
uint32_t cmdBytesLeft
Number of bytes left in command data transfer.
EventFunctionWrapper dmaReadWaitEvent
CommandReg_t cmdReg
Command block registers.
int devID
Device ID (device0=0/device1=1)
void updateState(DevAction_t action)
Abstract superclass for simulation objects.
This is a simple scalar statistic, like a counter.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
#define MAX_SINGLE_DMA_SIZE
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Declaration of Statistics objects.
Simple PCI IDE controller with bus mastering capability and UDMA modeled after controller in the Inte...
statistics::Scalar dmaWriteTxs
statistics::Scalar dmaWriteBytes
IdeDiskStats(statistics::Group *parent)
statistics::Scalar dmaWriteFullPages
statistics::Scalar dmaReadBytes
statistics::Scalar dmaReadFullPages
statistics::Scalar dmaReadTxs