41 #include "debug/IdeDisk.hh" 50 image(p->image), curSector((off_t)-1), dirty(false)
88 accessAddr,
diskData[accessAddr % SectorSize]);
90 case sizeof(uint16_t):
91 memcpy(&d16,
diskData + (accessAddr % SectorSize), 2);
93 DPRINTF(
IdeDisk,
"reading word %#x value= %#x\n", accessAddr, d16);
95 case sizeof(uint32_t):
96 memcpy(&d32,
diskData + (accessAddr % SectorSize), 4);
98 DPRINTF(
IdeDisk,
"reading dword %#x value= %#x\n", accessAddr, d32);
100 case sizeof(uint64_t):
101 memcpy(&d64,
diskData + (accessAddr % SectorSize), 8);
103 DPRINTF(
IdeDisk,
"reading qword %#x value= %#x\n", accessAddr, d64);
106 panic(
"Invalid access size\n");
130 off_t bytes_written =
145 case sizeof(uint8_t):
150 case sizeof(uint16_t):
151 d16 = pkt->
getRaw<uint16_t>();
152 memcpy(
diskData + (accessAddr % SectorSize), &d16, 2);
153 DPRINTF(
IdeDisk,
"writing word %#x value= %#x\n", accessAddr, d16);
155 case sizeof(uint32_t):
156 d32 = pkt->
getRaw<uint32_t>();
157 memcpy(
diskData + (accessAddr % SectorSize), &d32, 4);
158 DPRINTF(
IdeDisk,
"writing dword %#x value= %#x\n", accessAddr, d32);
160 case sizeof(uint64_t):
161 d64 = pkt->
getRaw<uint64_t>();
162 memcpy(
diskData + (accessAddr % SectorSize), &d64, 8);
163 DPRINTF(
IdeDisk,
"writing qword %#x value= %#x\n", accessAddr, d64);
166 panic(
"Invalid access size\n");
189 MmDiskParams::create()
#define panic(...)
This implements a cprintf based panic() function.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
void serialize(CheckpointOut &cp) const override
Serialize an object.
void setRaw(T v)
Set the value in the data pointer to v without byte swapping.
This device acts as a disk similar to the memory mapped disk device in legion.
Addr pioSize
Size that the device's address range.
void makeAtomicResponse()
uint64_t Tick
Tick count type.
void serialize(CheckpointOut &cp) const override
Serialize an object.
virtual std::streampos write(const uint8_t *data, std::streampos offset)=0
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
uint8_t diskData[SectorSize]
std::ostream CheckpointOut
virtual std::streampos read(uint8_t *data, std::streampos offset) const =0
T getRaw() const
Get the data in the packet without byte swapping.
Tick pioDelay
Delay that the device experinces on an access.
Addr pioAddr
Address that the device listens to.
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.