#include "base/chunk_generator.hh"
#include "base/cprintf.hh" // csprintf
#include "base/trace.hh"
-#include "config/the_isa.hh"
#include "debug/IdeDisk.hh"
#include "dev/storage/disk_image.hh"
#include "dev/storage/ide_ctrl.hh"
// clear out the data buffer
memset(dataBuffer, 0, MAX_DMA_SIZE);
dmaReadCG = new ChunkGenerator(curPrd.getBaseAddr(),
- curPrd.getByteCount(), TheISA::PageBytes);
+ curPrd.getByteCount(), pageBytes);
}
if (ctrl->dmaPending() || ctrl->drainState() != DrainState::Running) {
&dmaReadWaitEvent, dataBuffer + dmaReadCG->complete());
dmaReadBytes += dmaReadCG->size();
dmaReadTxs++;
- if (dmaReadCG->size() == TheISA::PageBytes)
+ if (dmaReadCG->size() == pageBytes)
dmaReadFullPages++;
dmaReadCG->next();
} else {
if (!dmaWriteCG) {
// clear out the data buffer
dmaWriteCG = new ChunkGenerator(curPrd.getBaseAddr(),
- curPrd.getByteCount(), TheISA::PageBytes);
+ curPrd.getByteCount(), pageBytes);
}
if (ctrl->dmaPending() || ctrl->drainState() != DrainState::Running) {
schedule(dmaWriteWaitEvent, curTick() + DMA_BACKOFF_PERIOD);
curPrd.getByteCount(), curPrd.getEOT());
dmaWriteBytes += dmaWriteCG->size();
dmaWriteTxs++;
- if (dmaWriteCG->size() == TheISA::PageBytes)
+ if (dmaWriteCG->size() == pageBytes)
dmaWriteFullPages++;
dmaWriteCG->next();
} else {
DmaState_t dmaState;
/** Dma transaction is a read */
bool dmaRead;
+ /** Size of OS pages. */
+ Addr pageBytes;
/** PRD table base address */
uint32_t curPrdAddr;
/** PRD entry */
* Set the controller for this device
* @param c The IDE controller
*/
- void setController(IdeController *c) {
- if (ctrl) panic("Cannot change the controller once set!\n");
+ void
+ setController(IdeController *c, Addr page_bytes)
+ {
+ panic_if(ctrl, "Cannot change the controller once set!\n");
ctrl = c;
+ pageBytes = page_bytes;
}
// Device register read/write